/* ── Jessica MKT — Editorial Clean Design System ──────────────── */
/* Fonts: Fraunces (display), Newsreader (body), IBM Plex Mono (labels) */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..600&family=Newsreader:ital,opsz,wght@0,6..72,300..500;1,6..72,300..500&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Backgrounds */
  --bg:             #eef1f8;
  --surface:        #ffffff;
  --card:           #ffffff;

  /* Borders & Shadows */
  --border:         #dfe3ec;
  --border-active:  #c2510f;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:      0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg:      0 8px 24px rgba(0,0,0,0.09);

  /* Text */
  --text:           #23211c;
  --muted:          #6f6a5e;
  --light:          #9a958c;

  /* Accent — burnt orange */
  --accent:         #c2510f;
  --accent-hover:   #a8430c;
  --accent-bg:      rgba(194,81,15,0.07);
  --accent-ring:    rgba(194,81,15,0.18);

  /* Semantic */
  --ok:             #0f766e;
  --ok-bg:          #ecfdf5;
  --warn:           #b45309;
  --warn-bg:        #fffbeb;
  --danger:         #dc2626;
  --danger-bg:      #fef2f2;

  /* Radius */
  --radius-sm:      6px;
  --radius:         12px;
  --radius-lg:      16px;
  --radius-full:    9999px;

  /* Typography */
  --font-display:   'Fraunces', serif;
  --font-body:      'Newsreader', serif;
  --font-mono:      'IBM Plex Mono', monospace;

  /* Transitions */
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

::selection { background: var(--accent); color: #fff; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s var(--ease);
}
a:hover { color: var(--accent-hover); }

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 62px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  gap: 32px;
}

.topbar .brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar .brand span {
  color: var(--accent);
  font-weight: 600;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.topbar nav a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 450;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: var(--radius-full);
  transition: all .2s var(--ease);
  white-space: nowrap;
}

.topbar nav a:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text);
}

.topbar nav a.on {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

.topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar .logout {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  transition: all .2s var(--ease);
}

.topbar .logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── LAYOUT ────────────────────────────────────────────────── */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 40px;
}

/* ── HEADINGS ──────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 420;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

/* ── METRICS ───────────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric span {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}

.warn { color: var(--warn) !important; }

/* ── SECTIONS ──────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  font-size: 20px;
  font-weight: 420;
}

.muted { color: var(--muted); font-size: 13px; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px;
  font-weight: 450;
  font-style: italic;
}

/* ── ROWS (Triage list) ────────────────────────────────────── */
.row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 450;
  color: var(--text);
}

.row-sub {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row-actions.inline {
  flex-direction: row;
  display: inline-flex;
  margin-left: 12px;
  vertical-align: middle;
}

/* ── FORMS & CONTROLS ──────────────────────────────────────── */
input, select, button {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: all .2s var(--ease);
  font-weight: 450;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

button {
  cursor: pointer;
  background: #ffffff;
  border-radius: var(--radius-full);
  font-weight: 500;
  padding: 9px 20px;
}

button:hover {
  background: #f5f5f7;
  border-color: #c5c5c7;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

button.ghost:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text);
}

button.small {
  padding: 5px 14px;
  font-size: 12px;
}

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-right: 6px;
}

.badge.approved, .badge.done {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.rejected {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.negotiating, .badge.waiting {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.doing {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ── LISTS ─────────────────────────────────────────────────── */
ul.plain { list-style: none; }

ul.plain li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

ul.plain li:last-child { border-bottom: none; }

.amount {
  float: right;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.amount.strike {
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 400;
}

/* ── CLIENT / MISC ─────────────────────────────────────────── */
.client-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.inline-form input { flex: 1; }

.crumbs {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ── TABLES ────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: rgba(0,0,0,0.015);
}

.note { margin-top: 10px; }

/* ── LOGIN ─────────────────────────────────────────────────── */
body.center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, rgba(194,81,15,0.06) 0%, var(--bg) 60%);
}

.login {
  width: 370px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 420;
  letter-spacing: -0.02em;
}

.login h1 span { color: var(--accent); }

.login p {
  color: var(--muted);
  font-size: 14px;
}

.error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 8px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 2px;
    padding-bottom: 4px;
  }
  .topbar nav a {
    font-size: 13px;
    padding: 6px 12px;
  }
  main {
    padding: 20px 16px;
  }
  .row {
    flex-direction: column;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .metrics {
    grid-template-columns: 1fr;
  }
}

/* ── UTILITIES ─────────────────────────────────────────────── */
.scroll-x { overflow-x: auto; }

table.compact { font-size: 12px; }
table.compact th, table.compact td { padding: 6px 8px; white-space: nowrap; }

.ok-cell {
  background: var(--ok-bg);
  color: var(--ok);
  text-align: center;
  font-weight: 500;
}

.off-cell {
  color: var(--muted);
  text-align: center;
}
