:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #60646c;
  --line: #d9dde5;
  --panel: #ffffff;
  --soft: #f4f6f8;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --brand-soft: #dff5f1;
  --accent: #c2410c;
  --accent-soft: #fff2e8;
  --good: #15803d;
  --bad: #b42318;
  --warn: #b45309;
  --shadow: 0 14px 34px rgba(17, 24, 39, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: #eef1f4; color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #f7f8fa, #e5eceb); }
.auth-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: 0; }
.auth-card p { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--brand); font-weight: 800; text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }

.field { display: grid; gap: 7px; margin: 14px 0; }
.field span { color: #333841; font-weight: 700; font-size: .88rem; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
}
.field textarea { min-height: 88px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--bad); }
.btn.icon { width: 40px; padding: 0; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: .86rem; }
.error { color: var(--bad); font-weight: 700; min-height: 22px; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { background: #18201f; color: #f8fafc; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { padding: 4px 10px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand b { display: block; font-size: 1.1rem; }
.brand span { color: #bac5c3; font-size: .86rem; }
.nav { display: grid; gap: 5px; }
.nav button {
  color: #d7e1df;
  border: 0;
  background: transparent;
  border-radius: 6px;
  min-height: 42px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 750;
}
.nav button.active, .nav button:hover { background: #263331; color: #fff; }
.sidebar-footer { margin-top: auto; color: #bac5c3; font-size: .82rem; padding: 8px 10px; display: grid; gap: 8px; }

.main { min-width: 0; }
.topbar { height: 70px; background: rgba(255,255,255,.85); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; position: sticky; top: 0; backdrop-filter: blur(10px); z-index: 2; }
.topbar h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0; }
.topbar p { margin: 2px 0 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 24px; display: grid; gap: 18px; }

.hero-panel {
  background: #10201d;
  color: #fff;
  border-radius: 8px;
  padding: 22px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
}
.hero-panel h2 { margin: 0 0 8px; font-size: clamp(1.55rem, 3vw, 2.4rem); letter-spacing: 0; }
.hero-panel p { margin: 0; color: #cbd9d6; line-height: 1.5; }
.hero-panel .eyebrow { color: #8ee1d3; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-actions .btn { min-height: 46px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.stat strong { display: block; margin-top: 8px; font-size: 1.55rem; letter-spacing: 0; }
.stat small { display: block; color: var(--muted); margin-top: 6px; line-height: 1.35; }

.board { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: start; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 18px; align-items: start; }
.dashboard-grid .wide { grid-column: 1 / -1; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.priority-section { border-color: #ffd6cc; }
.section-head { padding: 15px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 0; font-size: 1rem; letter-spacing: 0; }
.section-body { padding: 14px; display: grid; gap: 10px; }

.list { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 7px; padding: 12px; display: grid; gap: 8px; background: #fff; }
.item.is-urgent { border-color: #f6b6aa; background: #fffaf8; }
.item-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item h3 { margin: 0; font-size: .98rem; letter-spacing: 0; overflow-wrap: anywhere; }
.item p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; background: var(--soft); color: #3b4048; font-weight: 750; font-size: .78rem; }
.pill.good { color: var(--good); background: #e9f8ee; }
.pill.bad { color: var(--bad); background: #fff0ee; }
.pill.warn { color: var(--warn); background: #fff7ed; }
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }

.timeline { gap: 0; }
.timeline-item { display: grid; grid-template-columns: 82px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item span { font-weight: 850; color: var(--brand); font-size: .84rem; }
.timeline-item strong { display: block; overflow-wrap: anywhere; }
.timeline-item p { margin: 3px 0 0; color: var(--muted); }

.focus-card { display: grid; gap: 10px; }
.focus-card h3 { margin: 0; font-size: 1.08rem; }
.focus-card p { margin: 0; color: var(--muted); line-height: 1.5; }

.radar-list { display: grid; gap: 10px; }
.radar-list div { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; border: 1px solid var(--line); border-radius: 7px; padding: 10px; background: #fbfcfc; }
.radar-list svg { color: var(--brand); margin-top: 1px; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lane { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #f8fafb; min-height: 132px; }
.lane h3 { margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; font-size: .92rem; }
.lane h3 span { background: #e6eceb; color: #30413e; min-width: 26px; min-height: 24px; display: inline-grid; place-items: center; border-radius: 999px; font-size: .78rem; }
.lane button { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 9px; margin-bottom: 8px; text-align: left; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.lane p { margin: 12px 0 0; color: var(--muted); font-size: .88rem; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; background: #fff; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 10px; text-align: left; vertical-align: top; }
th { color: #4a5058; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; background: #f8fafb; }
td { font-size: .92rem; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; background: #fff; }
.tool-strip { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tool-strip div:first-child { display: grid; gap: 4px; }
.tool-strip strong { font-size: 1rem; }
.tool-strip span { color: var(--muted); line-height: 1.4; }
.tool-strip .filters input { width: min(360px, 100%); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal { width: min(860px, 100%); max-height: min(820px, 92vh); overflow: auto; background: #fff; border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-head p { margin: 4px 0 0; color: var(--muted); line-height: 1.4; }
.modal-body { padding: 18px; }
.modal-actions { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.form-sections { gap: 16px; }
.form-sections fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 0; background: #fbfcfd; }
.form-sections legend { padding: 0 6px; color: var(--brand); font-weight: 850; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.field.wide-field { grid-column: 1 / -1; }
.field input::placeholder, .field textarea::placeholder { color: #9aa1ab; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 3; padding: 10px; }
  .brand { display: none; }
  .nav { display: flex; overflow-x: auto; }
  .nav button { flex: 0 0 auto; }
  .sidebar-footer { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero-panel { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { height: auto; min-height: 68px; align-items: flex-start; flex-direction: column; padding: 14px; }
  .content { padding: 14px; }
  .stats { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .quick-actions { grid-template-columns: 1fr; }
  .tool-strip { align-items: stretch; flex-direction: column; }
  .tool-strip .filters input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; }
}
