/* Kettle Creek Ops. Greys only: a status is a shape and a word, never a colour.
   Dense on purpose, like a real internal tool. Light and dark share every rule; only the tokens change. */

@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --font: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;

  --bg: #f4f4f5;
  --panel: #ffffff;
  --sunk: #fafafa;
  --side: #fafafa;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --hover: #f4f4f5;
  --selected: #e4e4e7;
  --primary: #18181b;
  --primary-text: #fafafa;
  --primary-hover: #3f3f46;
  --focus: #52525b;
  --notes-faint: #e7e7ea;
  --shadow: 0 1px 0 rgba(24, 24, 27, 0.04);

  --r: 6px;
  --r-sm: 4px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c0c0e;
  --panel: #151518;
  --sunk: #111114;
  --side: #111114;
  --line: #26262b;
  --line-strong: #34343a;
  --text: #ececef;
  --text-2: #c4c4ca;
  --muted: #8a8a93;
  --faint: #5c5c65;
  --hover: #1c1c20;
  --selected: #26262b;
  --primary: #ececef;
  --primary-text: #111114;
  --primary-hover: #c4c4ca;
  --focus: #a1a1aa;
  --notes-faint: #212125;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 13px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "tnum";
}
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.kc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kc-icon { width: 16px; height: 16px; flex: none; }
.kc-mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.01em; }
.kc-muted { color: var(--muted); }
.kc-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kc-nowrap { white-space: nowrap; }

/* Frame */
.kc-frame { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.kc-side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px 10px 12px;
  background: var(--side);
  border-right: 1px solid var(--line);
}
.kc-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 8px; text-decoration: none; font-size: 14px; letter-spacing: -0.01em; }
.kc-brand b { font-weight: 640; }
.kc-brand-sub { margin-left: 6px; color: var(--muted); font-weight: 450; }
.kc-brand-mark { width: 22px; height: 22px; padding: 3px; border-radius: 6px; background: var(--primary); color: var(--primary-text); stroke-width: 2.2; }
.kc-brand-lg { font-size: 16px; padding: 0 0 18px; }
.kc-brand-lg .kc-brand-mark { width: 26px; height: 26px; }

.kc-nav { display: flex; flex-direction: column; gap: 1px; }
.kc-nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-weight: 470;
}
.kc-nav-link .kc-icon { color: var(--muted); }
.kc-nav-link:hover { background: var(--hover); color: var(--text); }
.kc-nav-link[aria-current="page"] { background: var(--selected); color: var(--text); font-weight: 560; }
.kc-nav-link[aria-current="page"] .kc-icon { color: var(--text); }
.kc-nav-count { margin-left: auto; font: 500 11px var(--mono); color: var(--muted); }
.kc-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.kc-ribbon { padding: 10px 8px 0; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; color: var(--muted); }

.kc-main { min-width: 0; display: flex; flex-direction: column; }
.kc-top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  height: 48px; padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.kc-search { position: relative; flex: 1; max-width: 420px; }
.kc-search .kc-icon { position: absolute; left: 9px; top: 7px; color: var(--muted); }
.kc-search input {
  width: 100%; height: 30px; padding: 0 10px 0 32px;
  background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r);
}
.kc-search input::placeholder, .kc-filter-search input::placeholder { color: var(--faint); }
.kc-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.kc-release {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font: 500 11.5px var(--mono); color: var(--text-2); white-space: nowrap;
}
.kc-release-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); }
.kc-release-sep { color: var(--faint); }

.kc-theme {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  background: none; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; color: var(--text-2);
}
.kc-theme:hover { background: var(--hover); }

.kc-user { display: flex; align-items: center; gap: 8px; }
.kc-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--selected); font: 600 10.5px var(--font); color: var(--text-2); }
.kc-user-text { display: flex; flex-direction: column; line-height: 1.2; }
.kc-user-name { font-weight: 560; font-size: 12.5px; }
.kc-user-role { color: var(--muted); font-size: 11px; }

.kc-page { padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 14px; }

/* Page heading */
.kc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.kc-head h1 { font-size: 19px; font-weight: 620; letter-spacing: -0.015em; display: flex; align-items: baseline; gap: 10px; }
.kc-head-id { font-size: 13px; font-weight: 450; color: var(--muted); }
.kc-sub { margin-top: 4px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kc-head .kc-sub .kc-status, .kc-head .kc-sub .kc-priority { color: var(--text-2); }
.kc-actions { display: flex; gap: 8px; flex: none; }
.kc-dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.kc-crumbs { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; margin-bottom: -6px; }
.kc-crumbs a { text-decoration: none; }
.kc-crumbs a:hover { color: var(--text); }
.kc-crumbs .kc-icon { width: 12px; height: 12px; }
.kc-section-title { font-size: 14px; font-weight: 600; margin-top: 6px; }

/* Buttons and fields */
.kc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r);
  font-weight: 520; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow);
}
.kc-btn:hover { background: var(--hover); }
.kc-btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.kc-btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.kc-btn-quiet { border-color: transparent; background: none; box-shadow: none; color: var(--text-2); padding: 0 8px; }
.kc-btn-block { width: 100%; height: 34px; }

.kc-inline-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
select, .kc-filter-search input, .kc-field input {
  height: 28px; padding: 0 8px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
select { padding-right: 4px; }
.kc-filter-search { position: relative; }
.kc-filter-search .kc-icon { position: absolute; left: 8px; top: 6px; width: 14px; height: 14px; color: var(--muted); }
.kc-filter-search input { width: 200px; padding-left: 28px; }

/* Panels and tables */
.kc-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; box-shadow: var(--shadow); }
.kc-panel-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 40px; padding: 6px 14px;
  border-bottom: 1px solid var(--line);
}
.kc-panel-bar h2 { font-size: 13px; font-weight: 600; }
.kc-panel-bar a { font-size: 12px; color: var(--muted); }
.kc-table-wrap { overflow-x: auto; }
.kc-table { width: 100%; border-collapse: collapse; }
.kc-table th {
  text-align: left; font-weight: 520; font-size: 11.5px; color: var(--muted);
  padding: 7px 12px; background: var(--sunk); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.kc-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.kc-table td.kc-wrap { white-space: normal; }
.kc-table .kc-mono { white-space: nowrap; }
.kc-clip { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.kc-table[aria-label="Work orders"] th, .kc-table[aria-label="Work orders"] td { padding-left: 10px; padding-right: 10px; }
.kc-table tbody tr:last-child td { border-bottom: 0; }
.kc-table tbody tr:hover td { background: var(--hover); }
.kc-table td a { text-decoration: none; }
.kc-table td a:hover { text-decoration: underline; }
.kc-cell-title { font-weight: 540; }
.kc-table-mini td { padding: 6px 14px; }
.kc-row-total td { font-weight: 600; background: var(--sunk); }
.kc-empty { padding: 18px 14px; color: var(--muted); text-align: center; }

.kc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kc-toolbar-right { display: flex; align-items: center; gap: 12px; }
.kc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.kc-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 10px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px;
  font-weight: 500; cursor: pointer;
}
.kc-chip:hover { background: var(--hover); }
.kc-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.kc-chip-n { font: 500 11px var(--mono); opacity: 0.7; }
.kc-count { font-size: 13px; font-weight: 600; }

/* Status marks: shapes in greys */
.kc-status, .kc-priority { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.kc-mark { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--text-2); flex: none; }
.kc-mark-progress { background: linear-gradient(90deg, var(--text-2) 50%, transparent 50%); }
.kc-mark-awaiting { border-style: dashed; }
.kc-mark-approved { background: var(--text-2); box-shadow: inset 0 0 0 2px var(--panel); }
.kc-mark-hold { border-radius: 2px; }
.kc-mark-done { background: var(--text-2); }
.kc-mark-scheduled { border-color: var(--muted); }
.kc-bars { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 10px; }
.kc-bars i { width: 3px; background: var(--line-strong); border-radius: 1px; }
.kc-bars i:nth-child(1) { height: 4px; } .kc-bars i:nth-child(2) { height: 7px; } .kc-bars i:nth-child(3) { height: 10px; }
.kc-bars i.on { background: var(--text-2); }
.kc-overdue {
  display: inline-block; padding: 0 5px; margin-left: 2px;
  border: 1px solid var(--text-2); border-radius: 3px;
  font-size: 11px; font-weight: 600; line-height: 16px;
}
.kc-tag { padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 11px; color: var(--muted); }

/* Dashboard */
.kc-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kc-kpi { padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.kc-kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kc-kpi-n { font-size: 24px; font-weight: 620; letter-spacing: -0.02em; margin: 2px 0 0; }
.kc-kpi .kc-muted { font-size: 11.5px; }
.kc-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kc-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kc-bars-list { list-style: none; margin: 0; padding: 8px 14px 12px; display: grid; gap: 7px; }
.kc-bars-list li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 44px 20px; gap: 10px; align-items: center; }
.kc-bars-list li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-bar { height: 6px; background: var(--hover); border-radius: 3px; overflow: hidden; }
.kc-bar i { display: block; height: 100%; background: var(--text-2); border-radius: 3px; }

.kc-activity { list-style: none; margin: 0; padding: 10px 14px 12px; display: grid; gap: 10px; }
.kc-activity li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; }
.kc-activity li p:last-child { font-size: 11.5px; }
.kc-act-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; border: 1.5px solid var(--muted); }

/* Work order */
.kc-detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.kc-detail-main, .kc-detail-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.kc-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.kc-table-quote td:first-child { width: 55%; }
.kc-totals { margin: 0; padding: 8px 14px 12px; border-top: 1px solid var(--line); display: grid; gap: 4px; justify-content: end; }
.kc-totals div { display: grid; grid-template-columns: 220px 110px; gap: 10px; }
.kc-totals dt { color: var(--muted); text-align: right; }
.kc-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kc-totals { padding-bottom: 6px; }
.kc-total {
  display: grid; grid-template-columns: 220px 110px; gap: 10px; justify-content: end; align-items: baseline;
  margin: 0 14px; padding: 8px 0 12px; border-top: 1px solid var(--line);
  text-align: right; color: var(--text); font-weight: 650; font-size: 14px;
}
.kc-total-amount { font-variant-numeric: tabular-nums; }
.kc-notes { padding: 12px 14px 14px; color: var(--text-2); line-height: 1.55; }
.kc-notes-faint { color: var(--notes-faint); }
.kc-checklist { list-style: none; margin: 0; padding: 6px 14px 10px; display: grid; }
.kc-checklist li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.kc-checklist li:last-child { border-bottom: 0; }
.kc-box { width: 13px; height: 13px; border: 1.5px solid var(--line-strong); border-radius: 3px; }
.kc-facts { margin: 0; padding: 6px 14px 10px; display: grid; }
.kc-facts div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.kc-facts div:last-child { border-bottom: 0; }
.kc-facts dt { color: var(--muted); }
.kc-facts dd { margin: 0; }
.kc-files { list-style: none; margin: 0; padding: 8px 14px 12px; display: grid; gap: 6px; }
.kc-files li { display: flex; align-items: center; gap: 8px; }
.kc-files .kc-icon { color: var(--muted); width: 14px; height: 14px; }

/* Schedule */
.kc-schedule th[scope="row"] { display: flex; flex-direction: column; gap: 1px; background: var(--panel); font-size: 12.5px; color: var(--text); font-weight: 560; white-space: normal; min-width: 150px; border-bottom: 0; }
.kc-schedule th[scope="row"] .kc-muted { font-weight: 400; font-size: 11px; }
.kc-schedule td { vertical-align: top; min-width: 130px; border-left: 1px solid var(--line); }
.kc-schedule .is-today { background: var(--sunk); }
.kc-job { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; margin-bottom: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--panel); text-decoration: none; font-size: 12px; }
.kc-job:hover { border-color: var(--text-2); }
.kc-job .kc-muted { font-size: 11px; }
.kc-job.is-overdue { border-left: 3px solid var(--text-2); }

/* About */
.kc-prose { padding: 12px 14px 14px; display: grid; gap: 8px; color: var(--text-2); max-width: 70ch; }
.kc-prose h3 { font-size: 12px; font-weight: 600; color: var(--text); margin-top: 4px; }
.kc-prose ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* Sign in */
.kc-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; }
.kc-login-top { position: absolute; top: 14px; right: 16px; display: flex; gap: 10px; align-items: center; }
.kc-login-card { width: min(380px, 100%); padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.kc-login-card h1 { font-size: 19px; font-weight: 620; letter-spacing: -0.015em; }
.kc-form { display: grid; gap: 12px; margin-top: 18px; }
.kc-field { display: grid; gap: 5px; }
.kc-field label { font-weight: 520; font-size: 12.5px; }
.kc-field input { height: 34px; width: 100%; }
.kc-error { padding: 7px 10px; border: 1px solid var(--text-2); border-radius: var(--r-sm); font-size: 12.5px; }
.kc-login-note { margin-top: 16px; color: var(--muted); font-size: 12px; }

/* Narrow screens: the app still works on a phone, without trying to look like a phone app. */
@media (max-width: 960px) {
  .kc-frame { grid-template-columns: 1fr; }
  .kc-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .kc-nav { flex-direction: row; flex-wrap: wrap; }
  .kc-nav-link span:not(.kc-nav-count) { display: none; }
  .kc-side-foot { margin: 0 0 0 auto; flex-direction: row; }
  .kc-ribbon { display: none; }
  .kc-search { display: none; }
  .kc-user-text { display: none; }
  .kc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kc-grid-2, .kc-grid-3, .kc-detail, .kc-split { grid-template-columns: 1fr; }
  .kc-head { flex-direction: column; align-items: flex-start; }
  .kc-totals div { grid-template-columns: 1fr 100px; }
}
