/* ============================================================================
   michalkanas.com — app + admin stylesheet
   Precision-instrument / engineering-drawing aesthetic. Dark, deep steel with
   a single brass accent. IBM Plex Sans/Mono. Matches the static site tokens.
   Defines every component class the E (app-ui) and F (admin) agents rely on.
   ========================================================================== */

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  --ink:        #0A0D11;   /* deep steel bg            */
  --ink-2:      #0E1217;
  --panel:      #13181F;   /* panels                   */
  --panel-2:    #171D26;
  --edge:       #232B36;   /* edges / borders          */
  --line:       #1C232C;
  --line-soft:  #161C24;
  --paper:      #ECEAE3;   /* paper text               */
  --paper-dim:  #9AA0AA;
  --mute:       #7C828D;   /* muted                    */

  /* single accent — hue carried from the main site via localStorage.mk_accent */
  --sig-h: 35; --sig-s: 71%; --sig-l: 58%;
  --signal:     hsl(var(--sig-h) var(--sig-s) var(--sig-l));
  --signal-2:   hsl(var(--sig-h) calc(var(--sig-s) - 9%) calc(var(--sig-l) - 10%));
  --signal-soft: hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .10);
  --signal-hot: hsl(var(--sig-h) 80% 90%);
  --on-signal:  hsl(var(--sig-h) 55% 8%);   /* dark text on accent, legible at any hue */

  --ok:   #7BD0A0;
  --warn: #E0A04A;
  --err:  #E0655A;

  --radius: 2px;
  --font-display: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;

  --wrap: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 80% -8%, hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .05), transparent 55%),
    linear-gradient(180deg, var(--ink-2), var(--ink) 40%);
  background-attachment: fixed;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

/* faint engineering grid behind everything */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right,  rgba(236,234,227,.016) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(236,234,227,.016) 1px, transparent 1px);
  background-size: 84px 84px;
}

h1, h2, h3, h4, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a  { color: inherit; text-decoration: none; }
canvas { display: block; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); }
.muted { color: var(--mute); }

/* ── Layout wrapper ──────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
  position: relative;
  z-index: 1;
}

.app-main {
  flex: 1 0 auto;
  padding: clamp(1.75rem, 5vw, 3.25rem) 0 clamp(3rem, 7vw, 5rem);
  position: relative;
  z-index: 1;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 13, 17, .82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-admin { border-bottom-color: var(--signal-2); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 62px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--paper);
}
.brand .tick { color: var(--signal); }
.brand-sub { font-size: .68rem; color: var(--mute); letter-spacing: .12em; }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(.55rem, 2vw, 1.35rem);
  flex-wrap: wrap;
}
.nav-a {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--paper-dim);
  padding: .2em 0;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav-a:hover { color: var(--paper); }
.nav-a.is-active { color: var(--signal); border-bottom-color: var(--signal); }

/* ── Eyebrows / section markers ──────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mute);
  display: inline-flex;
  align-items: center;
  gap: .5em;
}
.eyebrow::before {
  content: "§";
  color: var(--signal);
  font-weight: 600;
}
.sig-mark {
  font-family: var(--font-mono);
  color: var(--signal);
  font-weight: 600;
  font-size: 1.05rem;
}

.page-head { margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.page-head h1 {
  font-size: clamp(1.5rem, 3.4vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -.01em;
  margin-top: .35rem;
}
.page-head p { color: var(--paper-dim); margin-top: .4rem; max-width: 60ch; }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  position: relative;
}
.panel > h2, .panel > h3 { font-size: 1.05rem; font-weight: 600; }
.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}

/* ── Grids ───────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: clamp(.9rem, 2vw, 1.35rem);
}
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.dash-grid {
  display: grid;
  gap: clamp(.9rem, 2vw, 1.35rem);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* ── Auth card ───────────────────────────────────────────────────────────── */
.auth-card {
  max-width: 420px;
  margin: clamp(1.5rem, 6vw, 4rem) auto 0;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  position: relative;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 34px; height: 2px;
  background: var(--signal);
}
.auth-card h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: .35rem; }
.auth-card .auth-sub { color: var(--mute); font-size: .85rem; margin-bottom: 1.4rem; }
.auth-alt {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: .82rem;
  color: var(--mute);
}
.auth-alt a { color: var(--signal); }
.auth-alt a:hover { text-decoration: underline; }

/* ── Forms / fields ──────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}
.field > label,
label.field-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--paper-dim);
}
.field .hint { font-size: .74rem; color: var(--mute); }
.field-row { display: flex; gap: .6rem; }
.field-row > * { flex: 1; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  font-family: var(--font-display);
  font-size: .92rem;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: .62em .75em;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--mute); }
input:focus,
select:focus,
textarea:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft);
  outline: none;
}
textarea { resize: vertical; min-height: 6.5em; line-height: 1.5; }
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--mute) 50%),
    linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(1em + 1px),
    calc(100% - 13px) calc(1em + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2em;
}
input[disabled], select[disabled], textarea[disabled] {
  opacity: .55;
  cursor: not-allowed;
}
.mono-input { font-family: var(--font-mono); letter-spacing: .12em; }

/* code / OTP inputs */
.otp-input {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  letter-spacing: .5em;
  text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  padding: .8em 1.15em;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--paper);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--mute); background: var(--panel); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: .55em .85em; font-size: .7rem; }
.btn-lg { padding: .95em 1.5rem; font-size: .82rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--on-signal);
  font-weight: 600;
}
.btn-primary:hover { background: var(--signal-hot); border-color: var(--signal-hot); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--paper-dim);
}
.btn-ghost:hover { color: var(--paper); background: rgba(255,255,255,.03); border-color: var(--line); }

.btn-danger { color: var(--err); border-color: rgba(224,101,90,.4); }
.btn-danger:hover { background: rgba(224,101,90,.08); border-color: var(--err); }

.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ── Flash / alerts ──────────────────────────────────────────────────────── */
.flash {
  border: 1px solid var(--edge);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .85rem;
  background: var(--panel-2);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .6em;
}
.flash::before { font-family: var(--font-mono); font-weight: 600; }
.flash-err { border-left-color: var(--err); color: #F2C6C1; }
.flash-err::before { content: "!"; color: var(--err); }
.flash-ok { border-left-color: var(--ok); color: #C4EAD3; }
.flash-ok::before { content: "\2713"; color: var(--ok); }
.flash[hidden] { display: none; }

/* ── Badges / status ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .28em .6em;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  color: var(--paper-dim);
  background: var(--ink-2);
}
.badge-ok   { color: var(--ok);   border-color: rgba(123,208,160,.4); background: rgba(123,208,160,.07); }
.badge-warn { color: var(--warn); border-color: rgba(224,160,74,.4);  background: rgba(224,160,74,.08); }
.badge-err  { color: var(--err);  border-color: rgba(224,101,90,.4);  background: rgba(224,101,90,.08); }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mute);
  box-shadow: 0 0 0 3px rgba(124,130,141,.15);
}
.status-dot.ok   { background: var(--ok);   box-shadow: 0 0 0 3px rgba(123,208,160,.15); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(224,160,74,.15); }
.status-dot.err  { background: var(--err);  box-shadow: 0 0 0 3px rgba(224,101,90,.15); }
.status-dot.off  { background: var(--mute); }

/* ── Project cards ───────────────────────────────────────────────────────── */
.project-card {
  display: block;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  transition: border-color .15s ease, transform .1s ease;
  position: relative;
  overflow: hidden;
}
.project-card:hover { border-color: var(--signal-2); transform: translateY(-2px); }
.project-card::after {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 0; height: 2px; background: var(--signal);
  transition: width .25s ease;
}
.project-card:hover::after { width: 100%; }
.project-card .pc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: .5rem;
}
.project-card .pc-name { font-weight: 600; font-size: 1.02rem; }
.project-card .pc-slug { font-family: var(--font-mono); font-size: .68rem; color: var(--mute); letter-spacing: .06em; }
.project-card .pc-desc { color: var(--paper-dim); font-size: .84rem; margin-top: .4rem; }
.project-card .pc-meta {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .68rem; color: var(--mute);
}

/* ── Commit rows ─────────────────────────────────────────────────────────── */
.commit-list { border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden; }
.commit-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: .9rem;
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
  background: var(--panel);
}
.commit-row:last-child { border-bottom: none; }
.commit-row:hover { background: var(--panel-2); }
.commit-row .c-hash {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--signal);
  letter-spacing: .04em;
}
.commit-row .c-msg {
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.commit-row .c-author { font-family: var(--font-mono); font-size: .72rem; color: var(--paper-dim); }
.commit-row .c-time   { font-family: var(--font-mono); font-size: .7rem;  color: var(--mute); white-space: nowrap; }
@media (max-width: 640px) {
  .commit-row { grid-template-columns: auto 1fr; }
  .commit-row .c-author, .commit-row .c-time { display: none; }
}

/* ── KPIs ────────────────────────────────────────────────────────────────── */
.kpi {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  position: relative;
}
.kpi .kpi-label {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute);
}
.kpi .kpi-value {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: .35rem;
  line-height: 1;
}
.kpi .kpi-value.accent { color: var(--signal); }
.kpi .kpi-sub { font-family: var(--font-mono); font-size: .7rem; color: var(--paper-dim); margin-top: .5rem; }

/* ── Plan cards ──────────────────────────────────────────────────────────── */
.plan-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 1.4rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  position: relative;
}
.plan-card.is-featured { border-color: var(--signal-2); }
.plan-card.is-featured::before {
  content: "RECOMMENDED";
  position: absolute; top: -1px; right: 12px;
  font-family: var(--font-mono); font-size: .58rem; letter-spacing: .12em;
  background: var(--signal); color: var(--on-signal);
  padding: .25em .6em; border-radius: 0 0 var(--radius) var(--radius);
}
.plan-card .plan-name { font-weight: 600; font-size: 1.1rem; }
.plan-card .plan-price { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.plan-card .plan-price .per { font-size: .8rem; font-weight: 400; color: var(--mute); font-family: var(--font-mono); }
.plan-card .plan-features { display: flex; flex-direction: column; gap: .45rem; font-size: .84rem; color: var(--paper-dim); }
.plan-card .plan-features li { display: flex; gap: .55em; align-items: flex-start; }
.plan-card .plan-features li::before { content: "§"; color: var(--signal); font-family: var(--font-mono); font-size: .8em; }
.plan-card .btn { margin-top: auto; }

/* ── Invoice rows ────────────────────────────────────────────────────────── */
.invoice-list { border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden; }
.invoice-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: .85rem;
}
.invoice-row:last-child { border-bottom: none; }
.invoice-row:hover { background: var(--panel-2); }
.invoice-row .inv-id { font-family: var(--font-mono); font-size: .72rem; color: var(--mute); }
.invoice-row .inv-desc { color: var(--paper); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-row .inv-amount { font-family: var(--font-mono); font-weight: 600; color: var(--paper); white-space: nowrap; }
.invoice-row .inv-date { font-family: var(--font-mono); font-size: .72rem; color: var(--mute); white-space: nowrap; }
@media (max-width: 680px) {
  .invoice-row { grid-template-columns: 1fr auto; row-gap: .4rem; }
  .invoice-row .inv-id, .invoice-row .inv-date { display: none; }
}

/* ── Admin tables ────────────────────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 500;
  padding: .7rem .85rem;
  background: var(--ink-2);
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  background: var(--panel);
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--panel-2); }
.admin-table .t-mono { font-family: var(--font-mono); font-size: .76rem; color: var(--paper-dim); }
.admin-table .t-num  { font-family: var(--font-mono); text-align: right; }
.admin-table .t-actions { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* ── Definition / meta lists ─────────────────────────────────────────────── */
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.25rem; font-size: .85rem; }
.meta-list dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); align-self: center; }
.meta-list dd { margin: 0; color: var(--paper); }

/* ── Misc utility ────────────────────────────────────────────────────────── */
.stack   { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.gap-sm { --gap: .6rem; }
.gap-lg { --gap: 1.6rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 2rem; }
.text-accent { color: var(--signal); }
.text-ok { color: var(--ok); }
.text-err { color: var(--err); }
.small { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 1.25rem 0; }
[hidden] { display: none !important; }

/* empty state */
.empty {
  text-align: center;
  padding: clamp(2rem, 6vw, 3.5rem) 1rem;
  color: var(--mute);
  border: 1px dashed var(--edge);
  border-radius: var(--radius);
}
.empty .sig-mark { display: block; font-size: 1.6rem; margin-bottom: .5rem; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  position: relative;
  z-index: 1;
}
.foot-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .72rem;
}
.foot-inner .mono { font-size: .68rem; letter-spacing: .08em; }
.foot-year { margin-left: auto; }
@media (max-width: 560px) { .foot-year { margin-left: 0; } }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress { display: flex; align-items: center; gap: .8em; }
.progress-track { flex: 1; height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; border: 1px solid var(--edge); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--signal-2), var(--signal)); border-radius: 6px; transition: width .5s cubic-bezier(.16,.9,.24,1); }
.progress-pct { font-family: var(--font-mono); font-size: .8rem; color: var(--signal); min-width: 3.2em; text-align: right; }

/* ── Timeline (project updates) ──────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px; background: var(--edge); }
.tl-item { position: relative; padding: 0 0 1.1rem 1.7rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 1px; top: .35em; width: 11px; height: 11px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.tl-item.kind-status .tl-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(123,208,160,.15); }
.tl-item.kind-milestone .tl-dot { background: var(--signal-hot); }
.tl-head { display: flex; align-items: baseline; gap: .6em; flex-wrap: wrap; }
.tl-title { font-weight: 600; }
.tl-kind { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--signal); border: 1px solid var(--edge); border-radius: var(--radius); padding: .1em .5em; }
.tl-time { font-family: var(--font-mono); font-size: .7rem; color: var(--mute); margin-left: auto; }
.tl-body { color: var(--paper-dim); margin-top: .3rem; white-space: pre-wrap; }

/* ── Message thread ──────────────────────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: .7rem; max-height: 460px; overflow-y: auto; padding: .3rem; }
.msg { max-width: 82%; padding: .6em .8em; border-radius: 10px; border: 1px solid var(--edge); background: var(--panel-2); }
.msg-mine { align-self: flex-end; border-color: hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .45); background: var(--signal-soft); }
.msg-them { align-self: flex-start; }
.msg-meta { font-family: var(--font-mono); font-size: .64rem; color: var(--mute); margin-bottom: .25em; display: flex; gap: .5em; }
.msg-role { color: var(--signal); }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-compose { display: flex; gap: .6em; margin-top: .9rem; align-items: flex-end; }
.msg-compose textarea { flex: 1; min-height: 2.6em; resize: vertical; }

/* ── Sessions / activity rows ────────────────────────────────────────────── */
.session-row, .act-row { display: flex; align-items: center; gap: .8em; padding: .6em 0; border-top: 1px solid var(--line); font-size: .86rem; }
.session-row:first-child, .act-row:first-child { border-top: none; }
.session-meta, .act-time { font-family: var(--font-mono); font-size: .7rem; color: var(--mute); }
.act-time { margin-left: auto; white-space: nowrap; }
.act-action { font-family: var(--font-mono); color: var(--signal); }
.session-cur { font-family: var(--font-mono); font-size: .62rem; color: var(--ok); border: 1px solid rgba(123,208,160,.4); border-radius: var(--radius); padding: .05em .5em; }

/* ── Segmented tabs + small helpers used by the panels ───────────────────── */
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden; }
.seg button { background: transparent; color: var(--paper-dim); border: 0; padding: .4em .8em; font-family: var(--font-mono); font-size: .72rem; cursor: pointer; }
.seg button.on { background: var(--signal-soft); color: var(--signal); }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4em; height: 1.4em; padding: 0 .35em; border-radius: 10px; background: var(--signal); color: var(--on-signal); font-family: var(--font-mono); font-size: .64rem; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1em; flex-wrap: wrap; }

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ============================================================================
   ELEVATION LAYER (v3) — premium depth, motion & finer detailing.
   Enhances the base above without changing the engineering identity: material
   depth, a single soft accent glow, entrance motion, refined interactions.
   ========================================================================== */

/* richer background field with a cool counter-glow */
body {
  background:
    radial-gradient(140% 92% at 84% -12%, hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .07), transparent 50%),
    radial-gradient(120% 80% at -5% 0%, hsl(212 45% 24% / .12), transparent 52%),
    linear-gradient(180deg, var(--ink-2), var(--ink) 42%);
}

/* on-brand thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--edge); border: 3px solid transparent; background-clip: padding-box; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--mute); background-clip: padding-box; }

/* topbar — depth + a hairline accent glow along the bottom edge */
.topbar {
  background: linear-gradient(180deg, rgba(14,18,23,.92), rgba(10,13,17,.8));
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 16px 34px -26px #000;
}
.topbar-inner { position: relative; }
.topbar-inner::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: calc(-1px - 0px); height: 1px;
  background: linear-gradient(90deg, transparent, hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .55), transparent);
  transform: translateY(1px);
}
.brand { transition: opacity .15s ease; }
.brand:hover { opacity: .85; }

/* softer, more premium big surfaces + real material depth */
.panel, .kpi, .project-card, .plan-card { border-radius: 6px; }
.auth-card { border-radius: 9px; }
.panel, .kpi, .project-card, .plan-card, .auth-card, .commit-list, .invoice-list, .admin-table {
  box-shadow:
    0 1px 0 rgba(255,255,255,.035) inset,
    0 24px 46px -30px rgba(0,0,0,.72),
    0 2px 6px -4px rgba(0,0,0,.5);
}

/* KPI — accent hairline, hover lift + glow, tabular figures */
.kpi { overflow: hidden; transition: border-color .18s ease, transform .18s ease, box-shadow .2s ease; }
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--signal), transparent 72%);
  opacity: .45; transition: opacity .2s ease;
}
.kpi:hover {
  transform: translateY(-3px); border-color: var(--signal-2);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 34px 60px -32px rgba(0,0,0,.85), 0 0 44px -24px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .5);
}
.kpi:hover::before { opacity: 1; }
.kpi .kpi-value { font-variant-numeric: tabular-nums; }
.kpi .kpi-value.accent { text-shadow: 0 0 26px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .35); }

/* project cards — soft accent glow on hover */
.project-card { transition: border-color .18s ease, transform .14s ease, box-shadow .2s ease; }
.project-card:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 34px 60px -32px rgba(0,0,0,.9), 0 0 48px -26px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .45);
}

/* buttons — refined; primary gets a subtle gradient + accent glow */
.btn { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease, box-shadow .18s ease; }
.btn-primary {
  background: linear-gradient(180deg, var(--signal-hot), var(--signal));
  box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 8px 22px -12px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .7);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.34) inset, 0 13px 30px -12px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .9); }
.btn-primary:active { transform: translateY(0); }

/* auth card — full-width branded top stripe */
.auth-card::before { width: 100%; height: 3px; background: linear-gradient(90deg, var(--signal), transparent 62%); }
.auth-card { padding-top: clamp(2rem, 4.5vw, 2.6rem); }

/* headings + timeline detailing */
.page-head h1 { text-wrap: balance; }
.tl-dot { box-shadow: 0 0 0 3px var(--signal-soft), 0 0 12px -1px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .5); }
.badge, .flash { border-radius: 4px; }

/* focus ring — softer, on-brand */
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--signal-soft), 0 0 0 1px var(--signal) inset; }

/* entrance motion — content rises in with a gentle stagger */
@media (prefers-reduced-motion: no-preference) {
  .app-main > .wrap > * { animation: mk-rise .5s cubic-bezier(.16,.9,.24,1) both; }
  .app-main > .wrap > *:nth-child(2) { animation-delay: .05s; }
  .app-main > .wrap > *:nth-child(3) { animation-delay: .1s; }
  .app-main > .wrap > *:nth-child(4) { animation-delay: .15s; }
  .app-main > .wrap > *:nth-child(5) { animation-delay: .2s; }
  .app-main > .wrap > *:nth-child(n+6) { animation-delay: .25s; }
  @keyframes mk-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

/* ============================================================================
   SIDEBAR SHELL (v4) — app-like left navigation + off-canvas mobile drawer.
   ========================================================================== */
.app-shell-body { display: block; }
.app-shell { position: relative; z-index: 1; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 252px; z-index: 40;
  display: flex; flex-direction: column;
  padding: 1.2rem 1rem 1.1rem;
  background: linear-gradient(180deg, rgba(15,19,25,.94), rgba(10,13,17,.85));
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: -1px; width: 1px;
  background: linear-gradient(180deg, transparent, hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .35), transparent);
  opacity: .5;
}
.side-top { display: flex; flex-direction: column; gap: .45rem; padding: .35rem .55rem 1.15rem; }
.side-top .brand { font-size: .95rem; }
.side-eyebrow { font-size: .56rem; letter-spacing: .22em; color: var(--mute); }

.side-nav { display: flex; flex-direction: column; gap: .18rem; }
.side-a {
  display: flex; align-items: center; gap: .72rem;
  padding: .62rem .72rem; border-radius: 6px;
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .01em;
  color: var(--paper-dim); position: relative;
  transition: background .14s ease, color .14s ease;
}
.side-a .ico { width: 17px; height: 17px; flex: none; opacity: .75; }
.side-a:hover { background: rgba(255,255,255,.035); color: var(--paper); }
.side-a:hover .ico { opacity: 1; }
.side-a.is-active { background: var(--signal-soft); color: var(--signal); box-shadow: inset 2px 0 0 var(--signal); }
.side-a.is-active .ico { opacity: 1; }

.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .65rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .15rem .35rem; min-width: 0; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--signal-hot), var(--signal)); color: var(--on-signal);
  font-family: var(--font-mono); font-weight: 600; font-size: .78rem;
  box-shadow: 0 4px 12px -6px hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .7);
}
.uc-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.uc-meta b { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-meta span { font-size: .62rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .btn { justify-content: flex-start; gap: .6rem; }
.side-foot .btn .ico { width: 15px; height: 15px; }

.app-col { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.app-col .app-main { flex: 1 0 auto; padding: 0; }
.wrap-app { width: 100%; max-width: 1120px; margin: 0 auto; padding: clamp(1.6rem,4vw,2.9rem) clamp(1.1rem,4vw,2.6rem) clamp(3rem,6vw,4.5rem); position: relative; z-index: 1; }

@media (prefers-reduced-motion: no-preference) {
  .wrap-app > * { animation: mk-rise .5s cubic-bezier(.16,.9,.24,1) both; }
  .wrap-app > *:nth-child(2){animation-delay:.05s}.wrap-app > *:nth-child(3){animation-delay:.1s}
  .wrap-app > *:nth-child(4){animation-delay:.15s}.wrap-app > *:nth-child(5){animation-delay:.2s}
  .wrap-app > *:nth-child(n+6){animation-delay:.25s}
}

.mobile-bar, .nav-scrim { display: none; }
.auth-shell-body .auth-top { padding: 1.4rem clamp(1rem,4vw,2rem); }
.auth-shell-body .auth-top .brand { font-size: .95rem; }

@media (max-width: 900px) {
  .sidebar {
    width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.16,.9,.24,1);
    z-index: 60; box-shadow: 24px 0 60px -20px #000;
  }
  .nav-toggle:checked ~ .app-shell .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4,6,10,.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .app-col { margin-left: 0; }
  .mobile-bar {
    display: flex; align-items: center; gap: .85rem;
    position: sticky; top: 0; z-index: 30;
    padding: .6rem clamp(1rem,4vw,1.4rem); min-height: 56px;
    background: rgba(10,13,17,.86); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-bar .brand { font-size: .9rem; }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; padding: .3rem; cursor: pointer; color: var(--paper-dim); border-radius: 5px; }
  .hamburger:hover { color: var(--paper); background: rgba(255,255,255,.04); }
  .hamburger .ico { width: 22px; height: 22px; }
  .wrap-app { padding-top: 1.5rem; }
}

/* KPI icons (v4) */
.kpi { padding-right: 2.9rem; }
.kpi-ico {
  position: absolute; top: 1rem; right: 1rem;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--paper-dim); background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
.kpi-ico .ico { width: 17px; height: 17px; }
.kpi-accent .kpi-ico { color: var(--signal); border-color: hsl(var(--sig-h) var(--sig-s) var(--sig-l) / .32); background: var(--signal-soft); }
