:root {
  --bg: #0c0f17;
  --panel: #151a26;
  --panel-2: #1b2231;
  --line: #283146;
  --ink: #e7ecf5;
  --muted: #8a93a6;
  --accent: #4a7dff;
  --accent-2: #6c8cff;
  --good: #34c98a;
  --warn: #f0b541;
  --bad: #f06a6a;
  --dev: #6c8cff;
  --prod: #34c98a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #182236 0%, var(--bg) 55%) fixed;
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.hidden { display: none !important; }

/* ---- login ---- */
.login-wrap { position: fixed; inset: 0; display: grid; place-items: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 34px 32px; width: 340px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.brand span, .logo span { color: var(--accent-2); }
.tagline { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.login-card input, .login-card button { padding: 11px 13px; border-radius: 10px; font: inherit; }
.login-card input { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); }
.login-card button { background: var(--accent); color: #fff; border: 0; font-weight: 600; cursor: pointer; }
.login-err { color: var(--bad); font-size: 12.5px; min-height: 16px; }

/* ---- topbar ---- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 22px; padding: 14px 22px;
  border-bottom: 1px solid var(--line); background: rgba(13,17,26,.7); backdrop-filter: blur(8px);
}
.logo { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.stats { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; flex: 1; }
.stats b { color: var(--ink); font-size: 15px; margin-right: 4px; }
.stat { display: flex; align-items: baseline; gap: 5px; }
.topactions { display: flex; align-items: center; gap: 10px; }
.track-toggle { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.track-toggle button { background: transparent; border: 0; color: var(--muted); padding: 7px 14px; cursor: pointer; font: inherit; }
.track-toggle button.active { background: var(--accent); color: #fff; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: #5a2b2b; color: var(--bad); }

/* ---- board ---- */
.board { flex: 1; display: flex; gap: 14px; padding: 18px 22px; overflow-x: auto; align-items: flex-start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-width: 244px; width: 244px; flex-shrink: 0; max-height: 100%; display: flex; flex-direction: column; }
.col-head { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.col-head .name { font-weight: 700; font-size: 13px; letter-spacing: .2px; }
.col-head .count { color: var(--muted); font-size: 12px; background: var(--panel-2); border-radius: 999px; padding: 1px 9px; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.card {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--muted);
  border-radius: 10px; padding: 11px 12px; cursor: pointer; transition: transform .06s, border-color .12s;
}
.card:hover { transform: translateY(-1px); border-color: var(--accent); }
.card.ft { border-left-color: var(--prod); }
.card.full { border-left-color: var(--warn); }
.card.tbd { border-left-color: var(--muted); }
.card .c-name { font-weight: 600; font-size: 13.5px; margin-bottom: 7px; }
.card .c-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: #222b3d; color: #aeb8cd; font-weight: 600; }
.tag.domain { background: #1e2a4a; color: #9bb4ff; }
.tag.risk-Low { background: #143026; color: #5fd4a0; }
.tag.risk-Medium { background: #3a3215; color: #e9c45f; }
.tag.risk-High { background: #3a1c1c; color: #f08a8a; }
.tag.gate { background: #143026; color: #5fd4a0; }
.tag.tierpill { background: #2a2238; color: #c6a8f0; }
.card .c-code { color: var(--muted); font-size: 11px; margin-top: 7px; }

/* ---- drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 560px; max-width: 94vw; z-index: 50;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow-y: auto; padding: 20px 22px 28px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.drawer-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.d-title { background: transparent; border: 0; border-bottom: 1px solid transparent; color: var(--ink); font-size: 19px; font-weight: 700; width: 100%; padding: 2px 0; }
.d-title:focus { outline: none; border-bottom-color: var(--accent); }
.d-code { color: var(--muted); font-size: 12px; margin-top: 4px; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.d-grid label, .full { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.full { margin-top: 12px; }
.d-grid select, .d-grid input.d-input, .full textarea {
  font: inherit; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 9px; padding: 9px 10px; text-transform: none; letter-spacing: normal; font-weight: 400;
}
.d-grid input.d-input:focus { outline: none; border-color: var(--accent); }
.reco-box { margin-top: 12px; background: #0f1c2e; border: 1px solid #1d3350; border-radius: 10px; padding: 11px 14px; font-size: 13px; color: var(--ink); }
.reco-box b.ft { color: var(--prod); }
.reco-box b.full { color: var(--warn); }
.reco-why { color: var(--muted); }
.reco-apply { margin-left: 10px; font: inherit; font-size: 12px; background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 4px 10px; cursor: pointer; }
.full textarea { min-height: 62px; resize: vertical; line-height: 1.5; }
.d-grid select:focus, .full textarea:focus { outline: none; border-color: var(--accent); }
.d-section { margin: 22px 0 4px; font-size: 12px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: .6px; border-top: 1px solid var(--line); padding-top: 16px; }
.d-save-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 22px; position: sticky; bottom: 0; }
.saved-tag { color: var(--good); font-size: 12.5px; }
.d-sub { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: normal; font-size: 11px; }
.inline-link { color: var(--accent-2); text-decoration: none; font-weight: 400; text-transform: none; letter-spacing: normal; }
.inline-link:hover { text-decoration: underline; }

/* checklist */
.checklist { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.chk { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink); text-transform: none; letter-spacing: normal; font-weight: 400; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--good); }

/* view toggle */
.view-toggle { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.view-toggle button { background: transparent; border: 0; color: var(--muted); padding: 7px 14px; cursor: pointer; font: inherit; }
.view-toggle button.active { background: var(--panel-2); color: var(--ink); }

/* patterns */
.patterns { flex: 1; overflow-y: auto; padding: 20px 26px; }
.pat-head { display: flex; align-items: center; justify-content: space-between; }
.pat-head h2 { margin: 0; font-size: 19px; }
.pat-intro { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }
.pat-group { margin-bottom: 22px; }
.pat-group-h { font-size: 13px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.pat-group-h span { color: var(--muted); background: var(--panel); border-radius: 999px; padding: 1px 8px; font-size: 11px; margin-left: 4px; }
.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; position: relative; }
.pat-del { position: absolute; top: 8px; right: 9px; background: transparent; border: 0; color: var(--muted); font-size: 17px; cursor: pointer; line-height: 1; }
.pat-del:hover { color: var(--bad); }
.pat-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; padding-right: 16px; }
.pat-domain { display: inline-block; font-size: 10.5px; font-weight: 600; color: #9bb4ff; background: #1e2a4a; border-radius: 999px; padding: 2px 8px; margin-bottom: 8px; }
.pat-notes { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
