:root {
  --navy: #071d3a;
  --navy-2: #0c2b52;
  --blue: #1769e0;
  --sky: #55b8f8;
  --ice: #eef7ff;
  --paper: #ffffff;
  --ink: #10243e;
  --muted: #63738a;
  --line: #dbe5ef;
  --success: #168665;
  --warning: #d7881e;
  --danger: #cc4653;
  --shadow: 0 14px 40px rgba(7, 29, 58, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 5%, rgba(85, 184, 248, 0.18), transparent 30rem),
    linear-gradient(180deg, #f4f9fd 0%, #edf4f8 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(20px, 4vw, 64px);
  color: #fff;
  background: linear-gradient(112deg, var(--navy), var(--navy-2));
  box-shadow: 0 8px 30px rgba(7, 29, 58, 0.2);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 14px; background: linear-gradient(135deg, var(--sky), #fff); color: var(--navy);
  font-size: 22px; transform: rotate(-7deg);
}
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #a9dafa; }
h1 { margin: 2px 0 0; font-size: clamp(20px, 2.4vw, 30px); font-weight: 720; }
.top-actions { display: flex; gap: 10px; align-items: end; }
.identity-control { display: grid; gap: 5px; font-size: 11px; color: #b9d8ed; }
.identity-control select { min-width: 130px; }

main { padding: 30px clamp(16px, 3vw, 48px) 56px; }
.hero {
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.15fr); gap: 34px;
  max-width: 1680px; margin: 0 auto 24px; align-items: end;
}
.hero h2 { margin: 10px 0 6px; font-size: clamp(25px, 3vw, 40px); letter-spacing: -.03em; }
.hero p { margin: 0; max-width: 720px; color: var(--muted); line-height: 1.55; }
.lock-badge { display: inline-flex; padding: 7px 10px; border-radius: 999px; background: #dff5ee; color: #0a6f52; font-weight: 700; font-size: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 10px; }
.summary-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.86); box-shadow: var(--shadow); }
.summary-card strong { display: block; font-size: 28px; }
.summary-card span { font-size: 12px; color: var(--muted); }

.workspace-shell { max-width: 1680px; margin: auto; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { display: flex; justify-content: space-between; gap: 18px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 9px 13px; border-radius: 10px; font-weight: 700; }
.tab.active { color: var(--navy); background: var(--ice); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
input, select, textarea { border: 1px solid #cbd8e4; border-radius: 10px; color: var(--ink); background: #fff; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23,105,224,.13); border-color: var(--blue); }
#searchInput { min-width: 220px; }
.button { border: 0; border-radius: 10px; padding: 9px 13px; font-weight: 750; }
.button.primary { background: var(--blue); color: #fff; }
.button.secondary { color: var(--navy); background: #fff; border: 1px solid var(--line); }
.topbar .button.secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.button.ghost { color: var(--muted); background: transparent; }
.view-root { min-height: 560px; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(276px, 310px); gap: 12px; overflow-x: auto; padding: 16px; align-items: start; }
.column { min-height: 490px; padding: 10px; border-radius: 16px; background: #f3f7fa; border: 1px solid #e3ebf2; }
.column-header { display: flex; justify-content: space-between; align-items: center; padding: 3px 3px 11px; font-size: 13px; font-weight: 800; }
.count { display: grid; place-items: center; min-width: 25px; height: 25px; border-radius: 999px; background: #fff; color: var(--muted); font-size: 12px; }
.card-stack { display: grid; gap: 9px; }
.task-card { text-align: left; width: 100%; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); padding: 13px; color: inherit; box-shadow: 0 5px 16px rgba(17,47,77,.055); transition: transform .15s ease, box-shadow .15s ease; }
.task-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(17,47,77,.11); }
.card-top, .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-id { color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.task-card h3 { margin: 9px 0 13px; font-size: 14px; line-height: 1.35; }
.owner-chip, .priority-chip, .gate-chip { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.owner-chip { color: #27506e; background: #eaf3f8; }
.gate-chip { color: #695622; background: #fff5cf; }
.priority-chip.Critical { color: #942d3b; background: #ffe7eb; }
.priority-chip.High { color: #9b5a0d; background: #fff0dc; }
.priority-chip.Medium { color: #315d9a; background: #e7f0ff; }
.priority-chip.Low { color: #526375; background: #edf1f4; }
.dependency-count { color: var(--muted); font-size: 10px; }
.empty-column { padding: 26px 8px; color: #94a0ae; font-size: 12px; text-align: center; }

.gates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 14px; padding: 18px; }
.gate-card { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 18px; }
.gate-title { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.gate-title h3 { margin: 4px 0 0; font-size: 18px; }
.gate-card p { color: var(--muted); line-height: 1.5; font-size: 13px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #eaf0f5; }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--sky)); }
.progress-copy { display: flex; justify-content: space-between; margin: 7px 0 14px; color: var(--muted); font-size: 11px; }
.criteria { margin: 0; padding-left: 19px; color: #394e65; font-size: 12px; line-height: 1.55; }

.tasks-table-wrap { overflow: auto; }
.tasks-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 12px; }
.tasks-table th { position: sticky; top: 0; background: #f6f9fb; color: var(--muted); text-align: left; padding: 11px; border-bottom: 1px solid var(--line); }
.tasks-table td { padding: 11px; border-bottom: 1px solid #edf1f4; vertical-align: top; }
.tasks-table tr[data-task-id] { cursor: pointer; }
.tasks-table tr[data-task-id]:hover { background: var(--ice); }
.status-text { font-weight: 750; }

dialog { width: min(780px, calc(100vw - 28px)); max-height: calc(100vh - 34px); overflow: auto; border: 0; border-radius: 20px; padding: 0; color: var(--ink); box-shadow: 0 30px 100px rgba(3,21,41,.35); }
dialog::backdrop { background: rgba(2,17,34,.62); backdrop-filter: blur(4px); }
#taskForm { padding: 22px; }
.dialog-header { display: flex; justify-content: space-between; gap: 18px; align-items: start; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.dialog-header h3 { margin: 6px 0 0; font-size: 23px; line-height: 1.25; }
.icon-button { border: 0; border-radius: 999px; width: 34px; height: 34px; background: #eef3f7; color: var(--ink); font-size: 24px; line-height: 1; }
.notice { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #fff4d9; color: #77510e; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0; }
.form-grid label, .wide-label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 750; }
.detail-block { padding: 11px 0; border-top: 1px solid #edf1f4; }
.detail-block span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.detail-block p { margin: 5px 0 0; line-height: 1.5; }
.dependency-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.dependency-list span { padding: 4px 7px; border-radius: 8px; background: var(--ice); color: var(--blue); font-size: 11px; letter-spacing: 0; text-transform: none; }
.wide-label { margin-top: 13px; }
textarea { resize: vertical; min-height: 72px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 18px; }

.empty-state { display: grid; place-items: center; padding: 70px 20px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filters { justify-content: flex-start; }
}

@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .identity-control { flex: 1; }
  .identity-control select { width: 100%; }
  main { padding: 20px 10px 34px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filters > * { flex: 1 1 140px; }
  #searchInput { min-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
}
