/* Zero Pest OS — design system (Piece 0) applied app-wide */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black: #030202; --panel: #121410; --panel-2: #1c1f19;
  --lime: #AFF95A; --lime-deep: #A8E10C; --lime-ink: #3f6a12; --lime-tint: #f4fbe6;
  --cream: #F2F2EE; --sand: #E8DFD0; --olive: #596E34;
  --ink: #171818; --ink-2: #5b625b; --ink-3: #98a096;
  --card: #ffffff; --line: #e4e8e1; --hover: #f7f9f5;
  --red: #b3261e; --red-tint: #fcefea;
  --amber: #a96b0b; --amber-tint: #fdf3e0;
  --green: #3f8f4f; --green-tint: #e9f5ec;
  --blue: #2b5ea7; --blue-tint: #e8f0fb;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(3,2,2,.06);
  --sh-2: 0 4px 14px rgba(3,2,2,.08);
  --sh-3: 0 18px 50px rgba(3,2,2,.28);
  /* legacy aliases used by earlier views */
  --dark: #030202; --dark-2: #1c1f19; --surface: #F2F2EE;
  --good: #3f8f4f; --good-bg: #e9f5ec; --warn: #a96b0b; --warn-bg: #fdf3e0;
  --late: #b3261e; --late-bg: #fcefea; --radius: 12px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--cream); font-size: 14.5px; line-height: 1.5;
}
.display, h1, .tile .num { font-family: 'Anton', sans-serif; font-weight: 400; }
.arcade { font-family: 'Press Start 2P', monospace; }

.shell { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--black); color: #c3c9bd;
  padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.logo { display: flex; gap: 10px; align-items: center; padding: 2px 8px 14px; }
.logo-mark {
  background: var(--lime); color: var(--black); font-weight: 800;
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.logo-img { width: 44px; height: auto; flex-shrink: 0; border-radius: 9px; }
.logo-name { font-weight: 700; color: #fff; font-size: 15px; }
.logo-tag { font-size: 8px; color: var(--ink-3); margin-top: 3px; font-family: 'Press Start 2P', monospace; }
.nav-grp { font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #565c53; padding: 14px 10px 4px; }
.sidebar a {
  color: #c3c9bd; text-decoration: none; padding: 8px 10px;
  border-radius: 8px; font-weight: 500; font-size: 13.5px;
  display: flex; align-items: center; gap: 8px; transition: all .12s;
}
.sidebar a:hover { background: var(--panel-2); color: #fff; }
.sidebar a.active { background: var(--panel-2); color: var(--lime); }
.soon { margin-left: auto; font-size: 9px; font-weight: 800; background: #33291a;
  color: #e0a94f; padding: 2px 6px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid #1f231d; }
.sidebar-foot .who { color: #fff; font-weight: 700; font-size: 13px; }
.sidebar-foot .role { color: var(--ink-3); font-size: 11px; text-transform: capitalize; }
.sidebar-foot .acts { display: flex; gap: 10px; margin-top: 6px; }
.sidebar-foot .acts span { color: var(--ink-3); font-size: 11.5px; cursor: pointer; }
.sidebar-foot .acts span:hover { color: var(--lime); }
.kbd-hint { color: #565c53; font-size: 10.5px; margin-top: 10px; padding: 0 8px; }
kbd { font: 600 10.5px 'Inter'; background: var(--panel-2); border: 1px solid #333830;
  border-bottom-width: 2px; color: var(--lime); padding: 2px 6px; border-radius: 5px; }

/* ---------- main ---------- */
main { flex: 1; padding: 26px 32px 70px; max-width: 1240px; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; letter-spacing: .01em; }
.page-sub { color: var(--ink-2); font-size: 13.5px; }
.spacer { flex: 1; }

/* ---------- buttons & forms ---------- */
button {
  font: 600 13px 'Inter'; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: 7px 14px;
  border-radius: 9px; transition: all .12s ease; box-shadow: var(--sh-1);
}
button:hover { border-color: #c6cdc2; transform: translateY(-1px); box-shadow: var(--sh-2); }
button:active { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--lime-deep); outline-offset: 2px; }
button.primary { background: var(--black); border-color: var(--black); color: var(--lime); }
button.primary:hover { background: #1a1d17; }
button.ghost { border: none; background: none; box-shadow: none; color: var(--ink-2); padding: 5px 8px; }
button.ghost:hover { color: var(--ink); background: var(--hover); transform: none; box-shadow: none; }
input, select, textarea {
  font: 14px 'Inter'; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); width: 100%;
  transition: all .12s;
}
input:hover, select:hover, textarea:hover { border-color: #c6cdc2; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--lime-deep);
  box-shadow: 0 0 0 3px rgba(168,225,12,.25);
}
label { font-size: 12px; font-weight: 700; color: var(--ink-2); display: block; margin-bottom: 4px; }

/* ---------- cards & tiles ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--sh-1);
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; box-shadow: var(--sh-1); transition: all .15s ease; }
.tile:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.tile .num { font-size: 32px; line-height: 1.1; }
.tile .lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.tile.alert .num { color: var(--red); }
.tile.ok .num { color: var(--green); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.section-title { font-size: 14.5px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px; }
.section-title .hint { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }

/* ---------- list rows ---------- */
.row { display: flex; align-items: center; gap: 10px; padding: 11px 4px;
  border-top: 1px solid var(--line); flex-wrap: wrap; transition: background .1s; }
.row:hover { background: var(--hover); }
.row:first-of-type { border-top: none; }
.row .who { font-weight: 700; }
.row .what { color: var(--ink-2); flex: 1; min-width: 180px; }
.row .meta { color: var(--ink-3); font-size: 12.5px; }
.tico { font-size: 16px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font: 700 11.5px 'Inter';
  padding: 3px 10px; border-radius: 99px; background: #edf0ea; color: var(--ink-2);
  white-space: nowrap; }
.chip.age-fresh { background: #edf0ea; color: var(--ink-2); }
.chip.age-warn { background: var(--amber-tint); color: var(--amber); }
.chip.age-late { background: var(--red-tint); color: var(--red); }
.chip.us { background: var(--red-tint); color: var(--red); }
.chip.customer { background: var(--blue-tint); color: var(--blue); }
.chip.owner { background: #edf0ea; color: var(--ink-2); }
.chip.done { background: var(--green-tint); color: var(--green); }

/* ---------- kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { background: #eaede7; border-radius: var(--r-md); padding: 10px;
  width: 232px; flex-shrink: 0; min-height: 120px; }
.col.dragover { outline: 2px dashed var(--lime-deep); outline-offset: -2px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; }
.col-head .name { font-size: 12.5px; font-weight: 700; }
.col-head .count { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--sh-1);
  transition: all .12s; }
.kcard:hover { box-shadow: var(--sh-2); border-color: #cdd4c9; }
.kcard:active { cursor: grabbing; }
.kcard.link { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.kcard.link:hover { border-color: var(--lime-deep); }
.kcard .t { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.kcard .d { color: var(--ink-2); font-size: 12.5px; margin-bottom: 6px; }
.kcard .foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pipe-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 800 11px 'Inter'; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tr { transition: background .1s; }
tbody tr:hover td, tr:hover td { background: var(--hover); }

/* ---------- forms in cards ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(3,2,2,.5);
  backdrop-filter: blur(2px); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--card); border-radius: 14px; padding: 22px;
  width: 100%; max-width: 460px; box-shadow: var(--sh-3); animation: pop .14s ease; }
@keyframes pop { from { transform: scale(.97); opacity: .6; } }
.modal h2 { font-size: 16.5px; margin-bottom: 14px; font-weight: 800; }
.modal .fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal .danger { color: var(--red); margin-right: auto; }

/* ---------- empty states ---------- */
.empty { color: var(--ink-3); padding: 18px 4px; font-size: 13.5px; }
.emptystate { text-align: center; padding: 44px 20px; background: #fff;
  border: 1px dashed #cdd4c9; border-radius: var(--r-md); }
.emptystate .big { font-size: 36px; margin-bottom: 8px; }
.emptystate b { display: block; margin-bottom: 4px; font-size: 15px; }
.emptystate p { color: var(--ink-2); font-size: 13.5px; max-width: 440px; margin: 0 auto 14px; }
.mini-stat { display: flex; gap: 8px; flex-wrap: wrap; }
.row.subtask { padding-left: 44px; background: #fafbf8; border-top: 1px dashed var(--line); }
.pending-cat { font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); padding: 12px 4px 2px; }
.vision { color: var(--ink-2); line-height: 1.55; }

/* ---------- scorecard ---------- */
table.sc { min-width: 640px; }
table.sc th { white-space: nowrap; }
table.sc th.sc-this { color: var(--lime-ink); }
.sc-name { font-weight: 600; min-width: 200px; }
.sc-goal { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.sc-cell { text-align: center; padding: 4px !important; min-width: 52px; }
.sc-cell input { width: 52px; text-align: center; border: 1px solid transparent;
  background: none; padding: 6px 2px; font-weight: 600; }
.sc-cell input:hover { border-color: var(--line); background: #fff; }
.sc-cell.auto { font-weight: 700; color: var(--ink-2); font-style: italic; }
.sc-cell.sc-green, .sc-cell.sc-green input { background: var(--green-tint); color: var(--green); }
.sc-cell.sc-amber, .sc-cell.sc-amber input { background: var(--amber-tint); color: var(--amber); }
.sc-cell.sc-red, .sc-cell.sc-red input { background: var(--red-tint); color: var(--red); }

/* ---------- markdown body (SOP reader) ---------- */
.md-body { max-width: 820px; padding: 26px 30px; line-height: 1.65; font-size: 14.5px; }
.md-body h2 { font-family: 'Anton', sans-serif; font-weight: 400; font-size: 24px; margin: 8px 0 12px; }
.md-body h3 { font-size: 17px; font-weight: 800; margin: 22px 0 8px; }
.md-body h4 { font-size: 14.5px; font-weight: 800; margin: 18px 0 6px; }
.md-body h5 { font-size: 12.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-2); margin: 16px 0 6px; }
.md-body p { margin: 8px 0; color: var(--ink); }
.md-body ul, .md-body ol { margin: 8px 0 8px 22px; }
.md-body li { margin: 4px 0; }
.md-body blockquote { border-left: 3px solid var(--lime-deep); background: var(--lime-tint);
  padding: 8px 14px; border-radius: 0 8px 8px 0; margin: 10px 0; color: var(--ink-2); }
.md-body code { background: #eef1ec; padding: 1px 6px; border-radius: 5px;
  font: 12.5px ui-monospace, Menlo, monospace; }
.md-body hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md-body table.mdt { margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; }
.md-body a { color: var(--blue); }

/* ---------- login ---------- */
.login-wrap { position: fixed; inset: 0; background: var(--black);
  display: flex; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .arcade { color: var(--lime); font-size: 9px; margin-bottom: 16px; }
.login-card h1 { color: #fff; font-size: 38px; margin-bottom: 4px; }
.login-card .sub { color: #7b8377; font-size: 13.5px; margin-bottom: 26px; }
.login-card label { color: #7b8377; }
.login-card input { background: var(--panel-2); border-color: #333830; color: #fff; margin-bottom: 12px; }
.login-card .err { color: #ff8a80; font-size: 13px; margin-bottom: 10px; min-height: 18px; }
.login-card button { width: 100%; padding: 11px; font-size: 14px;
  background: var(--lime); border-color: var(--lime); color: var(--black); }
.login-card button:hover { background: var(--lime-deep); border-color: var(--lime-deep); }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 90px);
  background: var(--black); color: #fff; border-radius: 12px; padding: 12px 18px;
  display: flex; gap: 16px; align-items: center; box-shadow: var(--sh-3);
  transition: transform .3s cubic-bezier(.2,.9,.3,1.2); z-index: 99; font-size: 13.5px; }
#toast.show { transform: translate(-50%, 0); }
#toast button { background: none; border: none; box-shadow: none; color: var(--lime);
  font-weight: 700; padding: 0; }

/* ---------- command palette ---------- */
#pal-back { position: fixed; inset: 0; background: rgba(3,2,2,.5); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding-top: 14vh;
  backdrop-filter: blur(2px); }
#pal-back.open { display: flex; }
#pal { width: min(560px, 92vw); background: #fff; border-radius: 14px;
  box-shadow: var(--sh-3); overflow: hidden; animation: pop .14s ease; }
#pal input { border: none; border-radius: 0; box-shadow: none; font-size: 15px;
  padding: 15px 18px; border-bottom: 1px solid var(--line); }
#pal input:focus { box-shadow: none; border-color: var(--line); }
#pal .res { max-height: 320px; overflow: auto; padding: 6px; }
#pal .item { display: flex; gap: 12px; align-items: center; padding: 10px 12px;
  border-radius: 9px; cursor: pointer; font-size: 14px; }
#pal .item .k { margin-left: auto; color: var(--ink-3); font-size: 11.5px; }
#pal .item.sel, #pal .item:hover { background: var(--lime-tint); }
#pal .cat { font: 800 10.5px 'Inter'; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); padding: 10px 12px 4px; }
