@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&display=swap');

/* ── Variables ──────────────────────────────────────────────────────── */
:root {
  --bg:      #E8E3D8;
  --surface: #F0EBE2;
  --surf2:   #E2DDD3;
  --border:  #CEC9BF;
  --accent:  #745744;
  --acc2:    #5C4336;
  --text:    #3A2A1E;
  --muted:   #9A8878;
  --rose:    #BA9898;
  --blue:    #7E99B0;
  --sage:    #7A9A7E;
  --success: #5A8A5A;
  --warning: #B07828;
  --danger:  #A84040;
  --info:    #7E99B0;
  --sidebar-w: 220px;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: 0.8rem; }
.muted { color: var(--muted); }
.fw6 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Typography ─────────────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 4px; }
h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
h3 { font-size: 0.92rem; font-weight: 600; }
.subtitle { color: var(--muted); font-size: 0.88rem; margin-bottom: 0; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h2 { margin: 0; }

/* ── Public top nav (login, apply, bug, portal, etc.) ───────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { font-weight: 700; font-size: 1rem; color: var(--accent); white-space: nowrap; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 2px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav-link { padding: 5px 12px; border-radius: 6px; color: var(--muted); font-size: 0.85rem; font-weight: 500; transition: all .15s; cursor: pointer; }
.nav-link:hover, .nav-link.active { background: var(--surf2); color: var(--text); text-decoration: none; }
.nav-link.danger { color: var(--danger); opacity: .7; }
.nav-link.danger:hover { opacity: 1; background: #f5e8e8; text-decoration: none; }

/* ── Admin shell layout ─────────────────────────────────────────────── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}
.sidebar-brand {
  padding: 20px 18px 16px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--accent);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-section { padding: 16px 10px 4px; }
.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 4px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all .12s;
  cursor: pointer;
  margin-bottom: 1px;
}
.sidebar-link:hover { background: var(--surf2); color: var(--text); text-decoration: none; }
.sidebar-link.active { background: var(--accent); color: #fff; }
.sidebar-link.active:hover { background: var(--acc2); text-decoration: none; }
.sidebar-icon { font-size: 0.9rem; width: 16px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px 10px;
}
.sidebar-search {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  margin-bottom: 6px;
  transition: border-color .15s;
}
.sidebar-search:focus { outline: none; border-color: var(--accent); }
.sidebar-search::placeholder { color: var(--muted); }

/* ── Main content area ──────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

/* ── Container ──────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 36px 32px; }
.center-wrap { max-width: 440px; margin: 0 auto; padding: 80px 24px; }
.pub-wrap { max-width: 640px; margin: 0 auto; padding: 40px 24px; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.pad-0 { padding: 0; overflow: hidden; }

/* ── Stats ──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-num { font-size: 1.9rem; font-weight: 700; color: var(--accent); line-height: 1; letter-spacing: -0.03em; }
.stat-label { color: var(--muted); font-size: 0.78rem; margin-top: 4px; font-weight: 500; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
input:not([type=checkbox]):not([type=radio]):focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(116, 87, 68, 0.12);
}
input[type=checkbox], input[type=radio] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}
textarea { min-height: 90px; resize: vertical; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--acc2); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--surf2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surf2); color: var(--text); text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge-pending     { background: #F5ECD9; color: #8A5C1A; border: 1px solid #E8D4A8; }
.badge-screening   { background: #DDE8F0; color: #3D6680; border: 1px solid #B8D0E0; }
.badge-interview   { background: #EDE0F0; color: #6A3E80; border: 1px solid #D4B8E0; }
.badge-hired       { background: #DDF0E0; color: #2E6640; border: 1px solid #B0D8B8; }
.badge-rejected    { background: #F0DDDD; color: #7A2E2E; border: 1px solid #D8B0B0; }
.badge-open        { background: #DDE8F0; color: #3D6680; border: 1px solid #B8D0E0; }
.badge-in_progress { background: #EDE0F0; color: #6A3E80; border: 1px solid #D4B8E0; }
.badge-resolved    { background: #DDF0E0; color: #2E6640; border: 1px solid #B0D8B8; }
.badge-closed      { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-published   { background: #DDF0E0; color: #2E6640; border: 1px solid #B0D8B8; }
.badge-draft       { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-planned     { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-review      { background: #F5ECD9; color: #8A5C1A; border: 1px solid #E8D4A8; }
.badge-shipped     { background: #DDF0E0; color: #2E6640; border: 1px solid #B0D8B8; }
.badge-active      { background: #DDF0E0; color: #2E6640; border: 1px solid #B0D8B8; }
.badge-inactive    { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-monitoring  { background: #F5ECD9; color: #8A5C1A; border: 1px solid #E8D4A8; }
.badge-superseded  { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-planned     { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-in_progress { background: #EDE0F0; color: #6A3E80; border: 1px solid #D4B8E0; }
.badge-ready       { background: #DDE8F0; color: #3D6680; border: 1px solid #B8D0E0; }
.badge-cancelled   { background: #F0DDDD; color: #7A2E2E; border: 1px solid #D8B0B0; }
.badge-raw         { background: #EBEBEB; color: #6A6A6A; border: 1px solid #D0D0D0; }
.badge-editing     { background: #EDE0F0; color: #6A3E80; border: 1px solid #D4B8E0; }
.badge-review      { background: #F5ECD9; color: #8A5C1A; border: 1px solid #E8D4A8; }
.badge-exported    { background: #DDE8F0; color: #3D6680; border: 1px solid #B8D0E0; }
.badge-uploaded    { background: #DDF0E8; color: #2E6655; border: 1px solid #B0D8C8; }
.badge-published   { background: #DDF0E0; color: #2E6640; border: 1px solid #B0D8B8; }

/* ── Severity ─────────────────────────────────────────────────────────── */
.sev-critical { color: var(--danger);  font-weight: 700; font-size: 0.78rem; }
.sev-high     { color: var(--warning); font-weight: 600; font-size: 0.78rem; }
.sev-medium   { color: var(--blue);    font-weight: 500; font-size: 0.78rem; }
.sev-low      { color: var(--muted);   font-weight: 400; font-size: 0.78rem; }

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 0.85rem; }
.alert-success { background: #DDF0E0; border: 1px solid #B0D8B8; color: #2E6640; }
.alert-error   { background: #F0DDDD; border: 1px solid #D8B0B0; color: #7A2E2E; }

/* ── Table ───────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .6px;
  background: var(--surf2);
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(116, 87, 68, 0.04); }

/* ── Layout helpers ──────────────────────────────────────────────────── */
.two-col    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col-lg { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* ── Pipeline / Kanban ───────────────────────────────────────────────── */
.pipeline-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.pipeline-col { min-width: 0; }
.pipeline-col-head {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 2px solid;
}
.pipeline-count { font-size: 0.7rem; opacity: .6; margin-left: 4px; }
.pipeline-empty { color: var(--muted); font-size: 0.82rem; padding: 12px 0; }
.pipeline-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  transition: box-shadow .15s, transform .1s;
}
.pipeline-card:hover { box-shadow: 0 2px 8px rgba(116,87,68,.12); transform: translateY(-1px); text-decoration: none; }
.pipeline-name { font-weight: 600; font-size: 0.86rem; color: var(--text); }
.pipeline-role { font-size: 0.74rem; color: var(--muted); margin-top: 3px; }
.pipeline-meta { font-size: 0.7rem; color: var(--muted); margin-top: 6px; }

/* ── Detail view ─────────────────────────────────────────────────────── */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dl { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.dl-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 0.86rem; }
.dl-label { color: var(--muted); font-size: 0.78rem; padding-top: 1px; }
.text-block {
  background: var(--surf2);
  border-radius: 8px;
  padding: 13px 15px;
  font-size: 0.86rem;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ── Onboarding ──────────────────────────────────────────────────────── */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.86rem;
}
.check-row:last-child { border-bottom: none; }
.phase-card { background: var(--surf2); border-radius: 8px; padding: 14px; border-left: 3px solid var(--accent); }
.phase-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.phase-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); }
.phase-title { font-weight: 600; font-size: 0.88rem; }
.phase-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surf2);
  border-radius: 8px;
  color: var(--text);
  border: 1px solid var(--border);
  transition: all .15s;
}
.resource-link:hover { border-color: var(--accent); background: var(--surface); text-decoration: none; }
.resource-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.resource-arrow { margin-left: auto; color: var(--muted); }

/* ── Misc ────────────────────────────────────────────────────────────── */
.quick-links { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-icon { font-size: 2rem; margin-bottom: 10px; }

/* ── Activity log ────────────────────────────────────────────────────── */
.activity-log { border-left: 2px solid var(--border); padding-left: 16px; margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.activity-entry { position: relative; font-size: 0.84rem; }
.activity-dot { position: absolute; left: -21px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); display: block; }

/* ── Changelog / Releases ───────────────────────────────────────────── */
.version-tag {
  display: inline-block;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Mono', monospace;
}
.changelog-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.changelog-list li { font-size: 0.86rem; padding-left: 14px; position: relative; }
.changelog-list li::before { content: '·'; position: absolute; left: 0; color: var(--muted); }

/* ── Accounts / Tokens ──────────────────────────────────────────────── */
.token-display {
  display: block;
  flex: 1;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 0.76rem;
  color: var(--muted);
  word-break: break-all;
}
.token-highlight { border-color: var(--accent); color: var(--text); background: var(--surface); }

/* ── Loading ─────────────────────────────────────────────────────────── */
.loading { text-align: center; padding: 64px 24px; color: var(--muted); }
.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-logo { font-size: 2.4rem; margin-bottom: 10px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 36px; text-align: left; }
.foot-links { margin-top: 18px; font-size: 0.82rem; color: var(--muted); text-align: center; }

/* ── Public form pages ───────────────────────────────────────────────── */
.pub-header { text-align: center; margin-bottom: 28px; }
.pub-header .login-logo { display: block; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-main { margin-left: 0; }
  .sidebar-brand { border-bottom: none; padding: 14px 18px; }
  .sidebar-section { padding: 8px 8px 4px; }
  .sidebar-footer { border-top: none; padding: 8px 10px; }
  .pipeline-board { grid-template-columns: repeat(2, 1fr); }
  .two-col, .two-col-lg { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 24px 16px; }
}
@media (max-width: 480px) {
  .pipeline-board { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
