/* Verdant — Issue Resolution Tracker */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Atkinson+Hyperlegible:wght@400;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #FAFAF5;
  --surface: #FFFFFF;
  --surface-2: #F3F1E8;
  --ink: #1A2417;
  --ink-2: #3A463A;
  --ink-3: #6B7668;
  --ink-4: #9AA299;
  --line: #E5E3D6;
  --line-2: #EEECE0;

  --green: #3E6B3A;
  --green-deep: #2B4A28;
  --green-soft: #5E8C50;
  --sage: #C9D8A8;
  --sage-soft: #DDE6C0;
  --moss: #8FA77A;
  --cream: #F5F1DF;

  --red: #B03A2E;
  --amber: #B8832A;
  --blue: #3A5F8A;
  --purple: #6B4A7A;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(26, 36, 23, 0.04);
  --shadow-md: 0 2px 8px rgba(26, 36, 23, 0.05), 0 1px 2px rgba(26, 36, 23, 0.04);
  --shadow-lg: 0 12px 32px rgba(26, 36, 23, 0.08), 0 2px 6px rgba(26, 36, 23, 0.05);

  --serif: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }

/* App shell */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 22px 20px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line-2);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--green);
  display: grid; place-items: center;
  color: #F5F1DF; font-family: var(--serif); font-size: 20px;
  font-style: italic; line-height: 1;
}
.brand-name {
  font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-name em { font-style: italic; color: var(--green); font-weight: 400; }

.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-section { margin: 16px 10px 6px; font-size: 10px; font-weight: 600; color: var(--ink-4); letter-spacing: 0.09em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; transition: background 0.12s;
  font-weight: 500;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--cream); color: var(--green-deep); }
.nav-item .count {
  margin-left: auto;
  font-size: 11px; color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--green); }

.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--sage); color: var(--green-deep);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 245, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.crumbs { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.crumbs b { color: var(--ink); font-weight: 500; }
.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
  min-width: 260px;
  font-size: 13px; color: var(--ink-3);
}
.search input { border: none; outline: none; background: none; flex: 1; font-size: 13px; color: var(--ink); }
.kbd {
  font-family: var(--mono); font-size: 10px; color: var(--ink-4);
  padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px;
}

.content { padding: 28px 32px 80px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 24px; }
.page-title {
  font-family: var(--serif);
  font-size: 44px; line-height: 1.05;
  font-weight: 400; letter-spacing: -0.01em;
  color: var(--ink);
}
.page-title em { font-style: italic; color: var(--green); }
.page-sub { margin-top: 6px; color: var(--ink-3); font-size: 14px; max-width: 520px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  transition: all 0.12s;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-4); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--ink-3); }

/* Grid helpers */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* Stat card */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat-value {
  font-family: var(--serif); font-size: 48px; line-height: 1;
  color: var(--ink); margin-top: 10px; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 20px; color: var(--ink-3); margin-left: 4px; font-style: italic; }
.stat-delta { font-size: 12px; margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-delta .muted { color: var(--ink-4); }
.stat.feature {
  background: linear-gradient(135deg, #2B4A28 0%, #3E6B3A 100%);
  color: #F5F1DF; border-color: transparent;
}
.stat.feature .stat-label { color: rgba(245, 241, 223, 0.7); }
.stat.feature .stat-value { color: #F5F1DF; }
.stat.feature .stat-value .unit { color: rgba(245, 241, 223, 0.6); }
.stat.feature .stat-delta { color: var(--sage); }
.stat.feature .stat-delta .muted { color: rgba(245, 241, 223, 0.5); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500; line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.st-reported   { background: #F0EEDF; color: #6B5A1E; }
.st-pending    { background: #F5E9D4; color: #8B6420; }
.st-assigned   { background: #E6EEF5; color: #2E4E6E; }
.st-progress   { background: #DBE9CF; color: #3E6B2A; }
.st-cx         { background: #E8DFE9; color: #6B3A7A; }
.st-resolved   { background: #D4E8D0; color: #2B5A28; }
.st-closed     { background: #E8E6DC; color: #5A5A50; }
.st-reopened   { background: #F2DADA; color: #8B2A2A; }

.pr-low      { background: #E8ECE4; color: #5A6B50; }
.pr-medium   { background: #E6EEF5; color: #2E4E6E; }
.pr-high     { background: #F5E9D4; color: #8B6420; }
.pr-critical { background: #F2DADA; color: #8B2A2A; }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.table th:first-child { border-top-left-radius: 10px; }
.table th:last-child { border-top-right-radius: 10px; }
.table td {
  padding: 14px; font-size: 13px; color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FBFAF3; cursor: pointer; }
.table .mono { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.table .issue-title { color: var(--ink); font-weight: 500; }
.table a { text-decoration: none; color: inherit; }
.table a:hover .issue-title { color: var(--green); }

/* Filter bar */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l) var(--r-l) 0 0;
  border-bottom: none;
  flex-wrap: wrap;
}
.filter-bar select {
  display: inline-flex; align-items: center;
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; color: var(--ink-2);
  border: 1px dashed var(--line);
  background: var(--surface);
  cursor: pointer;
}
.filter-bar select:hover { border-color: var(--ink-4); }
.filter-bar .divider { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

/* Progress bar */
.progress-bar {
  height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden;
}
.progress-bar > div { height: 100%; border-radius: 999px; }

/* Quote banner */
.quote {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(90deg, #F5F1DF 0%, #DDE6C0 100%);
  border: 1px solid var(--sage-soft);
  border-radius: var(--r-l);
  margin-bottom: 20px;
}
.quote-mark {
  font-family: var(--serif); font-size: 40px; line-height: 0.5;
  color: var(--green); font-style: italic;
  align-self: flex-start; margin-top: 10px;
}
.quote-text {
  font-family: var(--serif); font-style: italic;
  font-size: 18px; color: var(--green-deep); line-height: 1.35;
  flex: 1;
}
.quote-author { font-size: 11px; color: var(--ink-3); font-family: var(--sans); font-style: normal; margin-top: 4px; }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.login-art {
  background: linear-gradient(165deg, #2B4A28 0%, #3E6B3A 55%, #5E8C50 100%);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px; color: #F5F1DF;
}
.login-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 20% 80%, rgba(245,241,223,0.12) 0%, transparent 40%),
                    radial-gradient(circle at 80% 20%, rgba(201,216,168,0.15) 0%, transparent 45%);
  pointer-events: none;
}
.login-brand { display: flex; align-items: center; gap: 10px; z-index: 1; }
.login-brand .brand-mark { background: rgba(245,241,223,0.15); color: #F5F1DF; }
.login-brand .brand-name { color: #F5F1DF; }
.login-brand .brand-name em { color: var(--sage); }
.login-blurb { z-index: 1; max-width: 420px; }
.login-blurb h1 {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: 44px; line-height: 1.15; margin: 0 0 24px;
  letter-spacing: -0.01em;
}
.login-blurb p { font-size: 15px; line-height: 1.65; opacity: 0.85; margin: 0; }
.login-stats { display: flex; gap: 40px; z-index: 1; }
.login-stat-v { font-family: var(--serif); font-size: 36px; line-height: 1; }
.login-stat-l { font-size: 12px; opacity: 0.7; margin-top: 4px; }

.login-form-wrap { display: flex; flex-direction: column; justify-content: center; padding: 48px 72px; }
.login-form { max-width: 400px; width: 100%; margin: 0 auto; }
.login-form h2 { font-family: var(--serif); font-size: 40px; font-weight: 400; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-form h2 em { font-style: italic; color: var(--green); }
.login-form .sub { color: var(--ink-3); font-size: 14px; margin-bottom: 32px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 14px;
  outline: none; transition: border 0.12s, box-shadow 0.12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px rgba(62, 107, 58, 0.1);
}
.field .hint { font-size: 11px; color: var(--ink-4); margin-top: 4px; }
.field .with-icon { position: relative; }
.field .with-icon .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); font-size: 15px;
}
.field .with-icon input { padding-left: 38px; }

.form-row { display: flex; gap: 12px; }
.form-row .field { flex: 1; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--green); }

.login-hint {
  margin-top: 20px; padding: 12px 14px;
  background: var(--cream); border: 1px solid var(--sage-soft);
  border-radius: 8px; font-size: 12px; color: var(--ink-2);
  line-height: 1.5;
}
.login-hint b { color: var(--green-deep); }

.error-msg {
  padding: 10px 14px; margin-bottom: 16px;
  background: #F2DADA; border: 1px solid #E5C5C5;
  border-radius: 8px; font-size: 13px; color: #8B2A2A;
}

/* Issue detail */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 1.5px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -24px; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--green);
}
.tl-dot.done { background: var(--green); }
.tl-dot.comment { border-color: var(--blue); }
.tl-dot.status { border-color: var(--amber); }
.tl-dot.created { border-color: var(--ink-4); }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; }
.tl-who { font-weight: 500; color: var(--ink); }
.tl-what { color: var(--ink-3); margin-left: 4px; }
.tl-when { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }
.tl-body { margin-top: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.tl-body.highlight {
  background: var(--cream); padding: 12px; border-radius: 8px; margin-top: 6px;
}

.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--ink-3); }
.info-row .v { color: var(--ink); font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* Leaderboard */
.leaderboard-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-2);
}
.leaderboard-row:last-child { border-bottom: none; }
.rank { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ink-4); width: 28px; }
.rank.top { color: var(--green); }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; gap: 2px;
}
.segmented button, .segmented a {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; color: var(--ink-3);
  font-weight: 500; text-decoration: none;
}
.segmented button.active, .segmented a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Kanban */
.kanban-col {
  background: var(--surface-2); border-radius: 12px; padding: 12px;
}
.kanban-col-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px; margin-bottom: 12px;
}
.kanban-col-title {
  font-size: 12px; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.kanban-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin-bottom: 8px;
  display: block; text-decoration: none; color: inherit;
  transition: box-shadow 0.12s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }

/* CX Queue */
.cx-item {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--line-2);
  align-items: center; text-decoration: none; color: inherit;
}
.cx-item:hover { background: #FBFAF3; }

/* Legend */
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--ink-3); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Divider */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.divider-v { width: 1px; background: var(--line); align-self: stretch; }

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; }
.text-muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.italic { font-style: italic; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* Tag row */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--surface-2); color: var(--ink-3); }

/* Timer strip */
.timer-strip {
  padding: 16px; background: #FBFAF3;
  border: 1px solid var(--line); border-radius: var(--r-l);
}
.timer-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--green); display: grid; place-items: center;
  color: #F5F1DF; font-size: 18px;
}

/* Similar issues card */
.similar-card {
  background: linear-gradient(135deg, #F5F1DF 0%, #DDE6C0 100%);
  border: 1px solid var(--sage-soft);
}

/* Django form styling */
.django-form input, .django-form select, .django-form textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 14px;
  outline: none; transition: border 0.12s, box-shadow 0.12s;
}
.django-form input:focus, .django-form select:focus, .django-form textarea:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px rgba(62, 107, 58, 0.1);
}
.django-form label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.django-form .helptext { font-size: 11px; color: var(--ink-4); margin-top: 4px; }
.django-form .errorlist { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12px; color: var(--red); }

/* Priority selector buttons */
.priority-selector { display: flex; gap: 8px; }
.priority-btn {
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.priority-btn:hover { border-color: var(--ink-4); }
.priority-btn.active { background: var(--cream); border-color: var(--sage); color: var(--green-deep); }

/* Bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; padding-top: 20px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar-value { font-size: 11px; font-family: var(--mono); color: var(--ink-3); }
.bar-fill { width: 100%; border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.3s; }
.bar-label { font-size: 11px; color: var(--ink-3); }

/* Responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .sidebar { display: none; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 32px; }
  .filter-bar { flex-wrap: wrap; }
}
