:root {
  --ink: #17201d;
  --muted: #64716c;
  --line: #dfe5e1;
  --paper: #ffffff;
  --canvas: #f3f5f3;
  --brand: #2e5d4d;
  --brand-dark: #1f4539;
  --brand-soft: #e7f0eb;
  --danger: #a33b3b;
  --shadow: 0 12px 32px rgba(23, 32, 29, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.topbar {
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  color: white; background: var(--brand); font-weight: 800;
}
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { font-size: 14px; letter-spacing: .4px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-badge { color: var(--muted); font-size: 13px; }

.auth-layout {
  min-height: calc(100vh - 68px);
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 28px;
  align-items: center;
  padding: 42px 0;
}
.hero-card, .auth-card, .card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.hero-card { padding: clamp(32px, 6vw, 72px); min-height: 520px; display: flex; flex-direction: column; justify-content: center; }
.hero-card h1 { max-width: 740px; font-size: clamp(38px, 5vw, 68px); line-height: 1.03; margin: 10px 0 22px; letter-spacing: -2.6px; }
.eyebrow { margin: 0; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.lead { max-width: 650px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.hero-flow { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero-flow span { padding: 9px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; font-weight: 700; }
.hero-flow b { color: #99a39f; }
.auth-card { padding: 24px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--canvas); padding: 4px; border-radius: 13px; margin-bottom: 22px; }
.tab { border: 0; background: transparent; border-radius: 10px; padding: 10px; color: var(--muted); font-weight: 700; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(0,0,0,.06); }

.app-layout { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 238px 1fr; }
.sidebar {
  padding: 26px 18px; border-right: 1px solid var(--line); background: #fbfcfb;
  position: sticky; top: 68px; height: calc(100vh - 68px); display: flex; flex-direction: column;
}
.sidebar-title { margin: 0 10px 14px; font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: 1.3px; }
#navigation { display: grid; gap: 5px; }
.nav-item {
  border: 0; background: transparent; color: var(--muted); text-align: left;
  padding: 11px 12px; border-radius: 11px; font-weight: 650;
}
.nav-item:hover, .nav-item.active { color: var(--brand-dark); background: var(--brand-soft); }
.service-status { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; padding: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9c1bd; }
.status-dot.ok { background: #2f9365; box-shadow: 0 0 0 4px rgba(47,147,101,.12); }
.status-dot.error { background: #c24a4a; }
.workspace { padding: 32px; min-width: 0; }
.panel { display: none; }
.panel.active { display: block; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h2 { margin: 5px 0 0; font-size: 30px; letter-spacing: -.8px; }
.card { padding: 22px; margin-bottom: 20px; box-shadow: none; }
.card h3 { margin: 0 0 18px; font-size: 17px; }

.button { border: 1px solid transparent; border-radius: 11px; padding: 10px 14px; font-weight: 750; }
.button.primary { background: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { background: white; border-color: var(--line); color: var(--ink); }
.button.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.button.small { padding: 7px 10px; font-size: 12px; }

.form-stack, .form-grid { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #48534f; font-size: 12px; font-weight: 750; }
input, textarea, select {
  width: 100%; border: 1px solid #cfd7d2; border-radius: 10px; background: white;
  color: var(--ink); padding: 10px 11px; outline: none; font-weight: 500;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46,93,77,.1); }
textarea { resize: vertical; }
.hint { margin: -5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 18px; }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 28px; }
.step-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.step-card { border: 1px solid var(--line); border-radius: 15px; background: #fbfcfb; padding: 16px; text-align: left; min-height: 120px; }
.step-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.step-card b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: white; }
.step-card span { display: block; margin-top: 13px; font-size: 13px; font-weight: 700; line-height: 1.4; }

.item-list { display: grid; gap: 10px; }
.item-list.compact { margin-top: 16px; }
.item {
  border: 1px solid var(--line); border-radius: 13px; padding: 14px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
}
.item h4 { margin: 0 0 5px; font-size: 14px; }
.item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty-state { color: var(--muted); font-size: 13px; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.template-card { border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
.template-card strong { display: block; font-size: 13px; }
.template-card span { color: var(--muted); font-size: 11px; }
.match-result { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--canvas); }
.match-score { display: flex; align-items: baseline; gap: 8px; }
.match-score strong { font-size: 38px; color: var(--brand); }
.message { margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.message.success { background: #e7f4ec; color: #245e40; border: 1px solid #b9dec8; }
.message.error { background: #f9eaea; color: #873434; border: 1px solid #edc2c2; }

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; }
  .hero-card { min-height: auto; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .sidebar-title { display: none; }
  #navigation { display: flex; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .service-status { display: none; }
  .stat-grid, .step-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 680px) {
  .topbar { padding: 0 14px; }
  .auth-layout { width: min(100% - 20px, 1120px); padding: 18px 0; }
  .hero-card, .auth-card { border-radius: 16px; padding: 22px; }
  .hero-card h1 { font-size: 38px; letter-spacing: -1.5px; }
  .workspace { padding: 20px 12px; }
  .two-column, .form-grid, .stat-grid, .step-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .page-heading { align-items: flex-start; }
  .item { flex-direction: column; }
  .item-actions { justify-content: flex-start; }
}


/* v0.2: mobile-first authentication and better compact layout */
@media (max-width: 680px) {
  .auth-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .auth-card {
    order: -1;
    width: 100%;
  }
  .hero-card {
    min-height: auto;
    padding: 22px;
  }
  .hero-card h1 {
    font-size: 32px;
    line-height: 1.08;
    letter-spacing: -1.1px;
    margin: 8px 0 14px;
  }
  .hero-card .lead {
    font-size: 15px;
    line-height: 1.55;
  }
  .hero-flow {
    margin-top: 18px;
    gap: 7px;
  }
  .hero-flow span {
    padding: 7px 10px;
    font-size: 11px;
  }
  .auth-card {
    padding: 18px;
  }
  .tabs {
    margin-bottom: 16px;
  }
  input, textarea, select {
    font-size: 16px;
  }
}
