:root {
  /* Palette aligned with the M.E. Contracting CRM: bluish ground, navy ink,
     brick red for brand/destructive, deep green for money/success. */
  --brand: #0B6BC4;
  --brand-deep: #0A4C86;
  --brand-soft: #E8F2FD;
  --brand-line: #9EC6EC;
  --red: #C0392B;
  --red-soft: #FBE9E7;
  --green: #1F7A4C;
  --green-soft: #E3F3EA;
  --gold: #9C6206;
  --gold-soft: #FBF1DD;
  --ink: #0F2236;
  --ink-2: #3C4F66;
  --ink-3: #5A6B80;
  --bg: #EEF3F9;
  --surface: #FFFFFF;
  --line: #D3DDE8;
  --line-strong: #B3C2D4;
  /* Zone tints (match mec) */
  --zone-blue:  #EAF2FB;
  --zone-green: #EAF4EE;
  --zone-gold:  #FAF4E8;
  --zone-plum:  #F1EEFA;
  --zone-slate: #F0F4F9;
  --zone-red:   #FBEFEE;
  --shadow-card: 0 1px 2px rgba(15,23,42,.05);
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-input: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
.x-btn svg { width: 17px; height: 17px; }
::selection { background: rgba(192,57,43,.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.3); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
@keyframes mitFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mitSheet { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.grotesk { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--ink-3); }
.pre { white-space: pre-wrap; }
.section-label { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- toasts ---------- */
.toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 92vw; }
.toast { padding: 11px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(15,23,42,.16); transition: opacity .4s; animation: mitFade .2s ease; }
.toast-error { background: #FCE8E9; color: #9b1c1c; border: 1px solid #f3b9bb; }
.toast-success { background: #E4F5EB; color: #15803d; border: 1px solid #a7e3bd; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; border-radius: var(--radius-btn); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(.98); }
.btn svg { width: 17px; height: 17px; }
.btn-sm { padding: 7px 12px; font-size: 13px; gap: 6px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 1px 2px rgba(192,57,43,.25); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 1px 2px rgba(21,146,74,.25); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #C0392B33; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; box-shadow: var(--shadow-card); }
.card.pad0 { padding: 0; }
a.card, .card.clickable { display: block; transition: box-shadow .18s, transform .18s; }
a.card:hover, .card.clickable:hover { box-shadow: 0 6px 22px rgba(15,23,42,.09); transform: translateY(-1px); }
.card.alert { border-color: var(--red); }
.divider { height: 1px; background: var(--line); }

/* ---------- pills / tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1; white-space: nowrap; }
.pill.sm { padding: 3px 9px; font-size: 11.5px; }
.pill .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.prio .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.eta-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: var(--bg); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.eta-chip svg { width: 13px; height: 13px; }
.eta-chip.big { padding: 6px 11px; font-size: 13px; }
.eta-chip.big svg { width: 15px; height: 15px; }
.eta-chip.over { background: #FCE8E9; color: var(--red); }
.eta-chip.soon { background: #FBF0DD; color: #C2700A; }

/* ---------- avatar ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-family: 'Space Grotesk', sans-serif; flex-shrink: 0; border-radius: 9px; }

/* ---------- fields ---------- */
.field { display: block; }
.field > .label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field > .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.input, .select, .textarea, input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-input); border: 1px solid var(--line);
  background: var(--surface); font-family: inherit; font-size: 14.5px; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.search-wrap input { padding-left: 38px; }

/* ---------- layout: client portal ---------- */
.portal { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.client-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.client-header .inner { max-width: 980px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 14px; }
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 28px 24px 48px; }
.icon-btn { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.dot-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

/* brand logo lockup */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo img { display: block; width: auto; }
.logo .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.logo .word .sep { color: var(--red); }

/* ---------- layout: admin ---------- */
.admin { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.sidebar { width: 232px; flex-shrink: 0; background: var(--ink); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 16px 14px 12px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.sidebar .brand .brand-logo { display: block; width: 100%; height: auto; max-height: 60px; object-fit: contain; }
.sidebar .brand .brand-who { display: flex; flex-direction: column; line-height: 1.25; padding: 0 2px; }
.sidebar .brand .brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; }
.sidebar .brand .brand-pos { font-size: 12px; opacity: .7; }
.sidebar .brand .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; }
.sidebar nav { padding: 6px 12px; display: grid; gap: 4px; }
.side-btn { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; width: 100%; text-align: left; white-space: nowrap; background: transparent; color: rgba(255,255,255,.62); }
.side-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-btn.active { background: rgba(255,255,255,.13); color: #fff; }
.side-btn svg { width: 19px; height: 19px; }
.side-btn .grow { flex: 1; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.sidebar .foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.side-alert { background: rgba(192,57,43,.16); border: 1px solid rgba(192,57,43,.4); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 6px; }
.admin-main { flex: 1; min-width: 0; padding: 26px 30px 40px; max-width: 1180px; margin: 0 auto; width: 100%; }
.page-title { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--ink-2); font-size: 14px; margin: 4px 0 0; }

.row-between { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.back-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 0; margin-bottom: 16px; }
.back-btn svg { width: 18px; height: 18px; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); background: var(--bg); border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); vertical-align: middle; }
.table tr.clickable:hover td { background: var(--bg); }
.table .ttl { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.table .right { text-align: right; }

/* ---------- filter tabs (client) ---------- */
.filter-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.filter-tabs a { padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.filter-tabs a.active { color: var(--red); border-bottom-color: var(--red); }
.filter-tabs .n { opacity: .6; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* ---------- timeline ---------- */
.timeline { position: relative; }
.tl-item { display: flex; gap: 13px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.tl-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; z-index: 1; }
.tl-ico svg { width: 16px; height: 16px; }
.tl-text { font-size: 14px; color: var(--ink); line-height: 1.45; }
.tl-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- meta rows / cost ---------- */
.meta-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.meta-row svg { width: 17px; height: 17px; color: var(--ink-3); flex-shrink: 0; }
.meta-row .k { font-size: 13px; color: var(--ink-3); width: 88px; flex-shrink: 0; }
.meta-row .v { font-size: 13.5px; color: var(--ink); font-weight: 500; text-align: right; margin-left: auto; }
.cost-row { display: flex; justify-content: space-between; align-items: baseline; }
.cost-row .k { font-size: 13.5px; color: var(--ink-2); }
.cost-row .v { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 500; }
.cost-row.strong .v { font-size: 17px; font-weight: 700; color: var(--red); }

/* ---------- attachments ---------- */
.att { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-input); background: var(--bg); }
.att .ico { width: 32px; height: 32px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }
.att .ico svg { width: 17px; height: 17px; }
.att .nm { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { font-size: 11.5px; color: var(--ink-3); }
.dropzone { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3); font-size: 13.5px; flex-wrap: wrap; }
.dropzone input[type=file] { font-size: 13px; border: none; padding: 0; width: auto; }

/* ---------- estimate banner ---------- */
.est-banner { border: 1.5px solid var(--red); border-radius: var(--radius-card); overflow: hidden; box-shadow: 0 4px 20px rgba(192,57,43,.10); }
.est-banner .hd { background: var(--red); color: #fff; padding: 11px 18px; display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; }
.est-banner .bd { padding: 18px; background: var(--surface); }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1 1 120px; min-width: 110px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; }
.stat.accent { background: var(--red); border-color: var(--red); }
.stat .k { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 3px; }
.stat.accent .k { color: rgba(255,255,255,.8); }
.stat .v { font-family: 'IBM Plex Mono', monospace; font-size: 18px; font-weight: 600; color: var(--ink); }
.stat.accent .v { color: #fff; }
.note-box { font-size: 14px; color: var(--ink); line-height: 1.55; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.est-result { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-radius: var(--radius-card); font-size: 13.5px; font-weight: 600; }
.est-result.ok { border: 1px solid #15924A33; background: #15924A0F; }
.est-result.no { border: 1px solid #C0392B33; background: #C0392B0F; }
.est-result svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- sheets (dialog) ---------- */
dialog.sheet { padding: 0; border: none; border-radius: 18px; width: 100%; max-width: 480px; max-height: 92vh; box-shadow: 0 24px 60px rgba(15,23,42,.28); overflow: hidden; animation: mitSheet .22s cubic-bezier(.2,.8,.2,1); }
dialog.sheet.wide { max-width: 620px; }
/* Let long sheets scroll: header/footer stay pinned, body scrolls. */
dialog.sheet form { display: flex; flex-direction: column; max-height: 92vh; min-height: 0; }
.sheet .sh-bd { flex: 1 1 auto; min-height: 0; }
dialog.sheet::backdrop { background: rgba(15,23,42,.42); backdrop-filter: blur(2px); }
.sheet .sh-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet .sh-hd .t { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; }
.sheet .sh-bd { padding: 20px; overflow-y: auto; }
.sheet .sh-ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg); }
.x-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.total-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--ink); border-radius: 12px; }
.total-bar .k { color: rgba(255,255,255,.8); font-size: 13.5px; font-weight: 600; }
.total-bar .v { font-family: 'IBM Plex Mono', monospace; color: #fff; font-size: 24px; font-weight: 700; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.detail-grid.client { grid-template-columns: 1fr 300px; }
.rail { display: grid; gap: 16px; position: sticky; top: 26px; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink-2); }
.empty .t { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; background: var(--surface); }
.brand-panel { position: relative; overflow: hidden; background: var(--ink); color: #fff; flex: 1 1 0; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between; }
.brand-panel .matrix { position: absolute; inset: 0; opacity: .16; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(43,212,74,.5) 22px 23px); -webkit-mask-image: linear-gradient(120deg,transparent,#000 60%); mask-image: linear-gradient(120deg,transparent,#000 60%); }
.brand-panel .top { position: relative; display: flex; align-items: center; gap: 12px; }
.brand-panel .top .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 27px; letter-spacing: -0.02em; }
.brand-panel h2 { position: relative; font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
.brand-panel p { position: relative; font-size: 15px; color: rgba(255,255,255,.7); line-height: 1.6; max-width: 360px; margin: 0; }
.brand-panel .addr { position: relative; font-size: 12.5px; color: rgba(255,255,255,.5); font-family: 'IBM Plex Mono', monospace; }
.signin-pane { flex: 1 1 0; display: flex; align-items: center; justify-content: center; padding: 48px 44px; background: var(--bg); }
.signin { width: 100%; max-width: 380px; }
.signin-logo { max-width: 240px; height: auto; display: block; margin: 0 0 22px; }
.signin h1 { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
.signin .sub { font-size: 14px; color: var(--ink-2); margin: 0 0 22px; }
.notice { margin-top: 20px; padding: 11px 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.notice strong { color: var(--ink-2); }

/* mobile FAB */
.fab { position: fixed; right: 18px; bottom: 24px; z-index: 60; width: 56px; height: 56px; border-radius: 18px; background: var(--red); color: #fff; border: none; box-shadow: 0 8px 24px rgba(192,57,43,.4); display: grid; place-items: center; cursor: pointer; }
.fab svg { width: 26px; height: 26px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .sidebar { display: none; }
  .admin-main { padding: 16px 16px 88px; }
  .container { padding: 18px 16px 90px; }
  .client-header .inner { padding: 12px 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .detail-grid, .detail-grid.client { grid-template-columns: 1fr; }
  .rail { position: static; }
  .login { flex-direction: column; }
  .brand-panel { padding: 30px 24px 26px; }
  .brand-panel h2, .brand-panel p { display: none; }
  .signin-pane { padding: 28px 20px 40px; }
  .hide-mobile { display: none !important; }
  dialog.sheet { max-width: 100%; margin: auto auto 0; border-radius: 20px 20px 0 0; }
}
.admin-topbar { display: none; }
.admin-bottomnav { display: none; }
@media (max-width: 760px) {
  .admin-topbar { display: flex; position: sticky; top: 0; z-index: 50; background: var(--ink); color: #fff; padding: 12px 16px; align-items: center; gap: 10px; }
  .admin-topbar .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; }
  .admin-topbar .so { margin-left: auto; background: rgba(255,255,255,.1); border: none; border-radius: 9px; width: 36px; height: 36px; display: grid; place-items: center; color: #fff; cursor: pointer; }
  .admin-bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px 10px; }
  .admin-bottomnav a { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--ink-3); font-size: 11px; font-weight: 600; position: relative; }
  .admin-bottomnav a.active { color: var(--red); }
}
@media (min-width: 761px) { .only-mobile { display: none !important; } }

/* full-logo lockups */
.logo-badge { background: #fff; border-radius: 10px; padding: 7px 11px; display: inline-flex; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.logo-badge img { display: block; width: auto; }
.logo-img { display: block; width: auto; }

/* sidebar child links (settings / invoices subdirectories) */
.side-children { display: grid; gap: 2px; padding: 2px 0 8px; }
.side-children a { display: block; padding: 7px 12px 7px 44px; border-radius: 8px; font-size: 13px; color: rgba(255,255,255,.6); }
.side-children a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-children a.active { color: #fff; background: rgba(255,255,255,.13); }

/* Subtask-template editor: let Type/Hours controls fill their columns. */
.tpl-table th, .tpl-table td { padding-left: 12px; padding-right: 12px; }
.tpl-table td input, .tpl-table td select { width: 100%; box-sizing: border-box; }
.tpl-table td .select-wrap { width: 100%; }

/* ===================================================================
   Light-blue admin theme + larger fonts — ADMIN ONLY (scoped to .admin).
   Light UI restored; blue chrome/accents; bigger type. Client pages untouched.
   =================================================================== */
.admin{ --blue:#2F80ED; --blue-dark:#0B6BC4; --blue-deep:#173F7D; --blue-soft:#EAF2FE; font-size:16px; }
.admin, .admin input, .admin textarea, .admin select, .admin button, .admin .btn{ font-size:15.5px; }
.admin .page-title{ font-size:30px; }
.admin .page-sub, .admin .hint, .admin .muted{ font-size:14.5px; }
.admin .section-label{ font-size:12.5px; }
.admin table, .admin .aiv-table, .admin table td, .admin table th, .admin .aiv-table td, .admin .aiv-table th{ font-size:15px; }
.admin .card, .admin .aiv-card{ font-size:15.5px; }

/* Blue chrome: sidebar / topbar */
.admin .sidebar{ background:linear-gradient(180deg,#0B6BC4,#173F7D); color:#fff; }
.admin .sidebar .brand .word{ color:#fff; }
.admin .side-btn{ color:rgba(255,255,255,.78); }
.admin .side-btn:hover{ background:rgba(255,255,255,.12); color:#fff; }
.admin .side-btn.active{ background:rgba(255,255,255,.2); color:#fff; }
.admin .side-children a{ color:rgba(255,255,255,.72); }
.admin .side-children a.active, .admin .side-children a:hover{ color:#fff; }
.admin .admin-topbar{ background:#0B6BC4; color:#fff; }

/* Blue accents on the light UI */
.admin a{ color:var(--blue); }
.admin .btn-primary{ background:var(--blue); border-color:var(--blue); color:#fff; box-shadow:0 1px 2px rgba(47,128,237,.3); }
.admin .btn-primary:hover{ background:var(--blue-dark); border-color:var(--blue-dark); }
.admin input:focus, .admin textarea:focus, .admin select:focus, .admin .aiv-input:focus{ border-color:var(--blue); box-shadow:0 0 0 3px rgba(47,128,237,.15); }
.admin .chip.active{ background:var(--blue); border-color:var(--blue); color:#fff; }
.admin .re-tab.is-active{ background:var(--blue); border-color:var(--blue); color:#fff; }
.admin .nav-badge{ background:var(--blue-soft); color:var(--blue-dark); }
.admin .aiv-badge.green{ background:var(--blue-soft); color:var(--blue-dark); }

/* Footer: light blue */
.app-footer{ display:none; }
body:has(.admin) .app-footer{ display:block; background:#173F7D; color:#CFE0FB; }
.app-footer-in{ max-width:1180px; margin:0 auto; padding:16px 30px; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; font-size:15px; }
.app-footer .af-brand{ font-weight:700; color:#fff; letter-spacing:.02em; }
.app-footer .af-sep{ color:#8FBAF5; }
.app-footer .af-links a{ color:#CFE0FB; text-decoration:none; margin-right:16px; }
.app-footer .af-links a:hover{ color:#fff; }
.app-footer .af-status{ color:#7EE0A0; }

/* Sidebar brand: stack the name under the logo */
.admin .sidebar .brand{ flex-direction:column; align-items:flex-start; gap:8px; }

/* ============================================================
   monday.com-style board (admin cases)
   ============================================================ */
.board-head { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.board-tools { display:flex; align-items:center; gap:6px; flex-wrap:wrap; background:#fff; border:1px solid var(--line); border-radius:10px; padding:6px; margin-bottom:16px; }
.tb-btn { display:inline-flex; align-items:center; gap:7px; padding:7px 11px; border:1px solid transparent; border-radius:7px; background:transparent; font-size:13.5px; color:var(--ink-2); cursor:pointer; text-decoration:none; white-space:nowrap; }
.tb-btn:hover { background:var(--bg); }
.tb-btn.on { background:var(--bg); color:var(--ink); }
.tb-btn svg { width:16px; height:16px; }
.tb-sep { width:1px; align-self:stretch; background:var(--line); margin:2px 4px; }
.tb-new { background:#0073ea; color:#fff !important; font-weight:600; border-radius:7px; }
.tb-new:hover { background:#0060c0; }
.tb-gear { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:9px; border:1px solid var(--line); background:#fff; color:var(--ink-2); }
.tb-gear:hover { background:var(--bg); color:var(--ink); }

.mgroup { margin-bottom:24px; }
.mgroup > summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px; font-size:15.5px; font-weight:700; margin-bottom:9px; user-select:none; }
.mgroup > summary::-webkit-details-marker { display:none; }
.mgroup > summary .chev { transition:transform .15s; display:inline-flex; }
.mgroup:not([open]) > summary .chev { transform:rotate(-90deg); }
.mgroup > summary .gcount { font-weight:500; color:var(--ink-3); font-size:13px; }

.mscroll { overflow-x:auto; border-radius:10px; }
.mtbl { width:100%; border-collapse:separate; border-spacing:0; background:#fff; border:1px solid var(--line); border-left:none; border-radius:0 10px 10px 0; min-width:940px; }
.mtbl thead th { font-size:12px; font-weight:600; color:var(--ink-3); text-align:left; padding:9px 12px; background:var(--bg); border-bottom:1px solid var(--line); white-space:nowrap; }
.mtbl tbody td { border-bottom:1px solid var(--line); border-right:1px solid var(--line); font-size:13px; color:var(--ink-2); background:#fff; }
.mtbl tbody tr:last-child td { border-bottom:none; }
.mtbl tbody tr:hover td { background:#f8fafc; }
.mtbl .cellpad { padding:10px 12px; }
.mtbl .gbar-td { width:6px; padding:0; border-right:none; }
.mtbl .chk { width:34px; text-align:center; color:var(--ink-3); }
.mtbl .chk { text-align:center; }
.mtbl .chk input { cursor:pointer; width:16px; height:16px; }
.m-ref { font:600 11px/1 var(--mono,monospace); color:var(--ink-3); }
.m-title { font-size:14px; font-weight:600; color:var(--ink); margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:280px; }
.fillcell { display:block; width:100%; height:100%; min-height:42px; color:#fff; font-weight:600; text-align:center; font-size:12.5px; padding:12px 8px; box-sizing:border-box; }
.fillcell.sm { font-size:12px; padding:11px 8px; }
.owner-dot { display:inline-flex; align-items:center; gap:7px; }


/* ============================================================
   Top navigation bar (replaces the left sidebar)
   ============================================================ */
.topnav { display: block; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.tn-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 9px 24px; }
.tn-brand img { height: 34px; display: block; }
.tn-links { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; min-width: 0; }
.tn-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tn-link:hover { background: var(--bg); color: var(--ink); }
.tn-link.active { background: var(--blue-soft, #EAF2FE); color: var(--blue-dark, #0B6BC4); }
.tn-link svg { width: 18px; height: 18px; }
.tn-badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 6px; }
.tn-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tn-who { display: flex; flex-direction: column; line-height: 1.15; text-align: right; margin-right: 4px; }
.tn-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.tn-pos { font-size: 11px; color: var(--ink-3); }
.tn-alert { display: inline-flex; align-items: center; gap: 4px; background: #FDECEC; color: var(--red); font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 8px; }
.tn-alert svg { width: 15px; height: 15px; }
.tn-icon { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); background: #fff; cursor: pointer; }
.tn-icon:hover { background: var(--bg); color: var(--ink); }
.tn-icon.active { background: var(--blue-soft, #EAF2FE); color: var(--blue-dark, #0B6BC4); border-color: transparent; }
.tn-icon svg { width: 18px; height: 18px; }
.tn-subwrap { border-top: 1px solid var(--line); background: var(--bg); }
.tn-sub { max-width: 1400px; margin: 0 auto; display: flex; gap: 4px; padding: 8px 24px; flex-wrap: wrap; }
.tn-sub a { padding: 6px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tn-sub a:hover { background: #fff; }
.tn-sub a.active { background: var(--blue, #2F80ED); color: #fff; }
@media (max-width: 760px) { .topnav { display: none; } }

/* Invoices page two-column layout — rail stacks under the table on narrow screens. */
@media (max-width: 1100px) { .inv-layout { flex-direction: column !important; } .inv-rail { width: 100% !important; } }

/* ============================================================
   Tabs (customer + reusable) + dashboard charts
   ============================================================ */
.ctabs { display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:22px; overflow-x:auto; }
.ctab { display:inline-flex; align-items:center; gap:8px; padding:11px 16px; border:none; background:transparent; font-size:14px; font-weight:600; color:var(--ink-3); cursor:pointer; border-bottom:2.5px solid transparent; margin-bottom:-1px; white-space:nowrap; transition:color .15s, border-color .15s; }
.ctab:hover { color:var(--ink); }
.ctab.active { color:var(--blue,#2F80ED); border-bottom-color:var(--blue,#2F80ED); }
.ctab svg { width:16px; height:16px; }
.ctab .ct-n { background:var(--bg); color:var(--ink-3); font-size:11.5px; font-weight:700; border-radius:999px; padding:1px 8px; }
.ctab.active .ct-n { background:var(--blue-soft,#EAF2FE); color:var(--blue-dark,#0B6BC4); }

.chart-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-card); padding:16px 18px; box-shadow:var(--shadow-card); }
.chart-card .chart-title { font-size:12.5px; font-weight:700; letter-spacing:.03em; color:var(--ink-2); margin-bottom:14px; display:flex; align-items:center; justify-content:space-between; }
.chart-grid { display:grid; grid-template-columns:2fr 2fr 1.4fr; gap:14px; }
@media (max-width:960px){ .chart-grid { grid-template-columns:1fr; } }

.bars { display:flex; align-items:flex-end; gap:6px; height:150px; padding-top:6px; }
.bar-col { flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; }
.bar-track { flex:1; width:100%; max-width:34px; display:flex; align-items:flex-end; background:linear-gradient(var(--bg),transparent); border-radius:7px 7px 0 0; }
.bar-fill { width:100%; border-radius:7px 7px 3px 3px; min-height:0; transition:height .3s ease; cursor:default; }
.bar-col:hover .bar-fill { filter:brightness(1.08); }
.bar-lbl { font-size:11px; color:var(--ink-3); font-weight:600; }

.donut-wrap { display:flex; align-items:center; gap:16px; }
.donut { width:118px; height:118px; border-radius:50%; flex:none; position:relative; display:grid; place-items:center; }
.donut-hole { width:74px; height:74px; border-radius:50%; background:var(--surface); display:grid; place-items:center; text-align:center; }
.donut-legend { display:grid; gap:7px; min-width:0; }
.dl-row { display:flex; align-items:center; gap:8px; font-size:13px; }
.dl-dot { width:10px; height:10px; border-radius:3px; flex:none; }
.dl-lbl { color:var(--ink-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dl-val { margin-left:auto; font-weight:700; font-family:'IBM Plex Mono',monospace; }

/* Wide data tables: scroll horizontally on small screens instead of crushing columns. */
.tblcard { overflow: hidden; }
@media (max-width: 640px) {
  .tblcard { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tblcard > .table { min-width: 560px; }
  .admin-main { padding: 16px 14px 88px; }
  .page-title { font-size: 24px !important; }
  .chart-grid { grid-template-columns: 1fr !important; }
  .ctab { padding: 10px 12px; font-size: 13.5px; }
}

/* Cases view switch (Board / Classic) */
.viewseg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.viewseg a { padding:7px 13px; font-size:13px; font-weight:600; color:var(--ink-2); background:#fff; text-decoration:none; }
.viewseg a.on { background:var(--blue,#2F80ED); color:#fff; }

/* Top-nav dropdown menus */
.tn-menu-wrap { position: relative; }
.tn-menu-btn { cursor: pointer; background: transparent; border: none; font: inherit; margin: 0; -webkit-appearance: none; appearance: none; }
.tn-menu-btn:hover { background: var(--bg); color: var(--ink); }
.tn-menu-wrap.open .tn-menu-btn { background: var(--bg); color: var(--ink); }
.tn-menu-btn svg:last-child { width: 14px; height: 14px; opacity: .7; }
.tn-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(29,44,66,.16); padding: 6px; display: none; z-index: 60; }
.tn-menu-wrap.open .tn-menu { display: block; animation: mitFade .12s ease; }
.tn-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tn-menu a:hover { background: var(--bg); color: var(--ink); }
.tn-menu a svg { width: 17px; height: 17px; color: var(--ink-3); }

/* Outlook-style "New board" toggle */
.ob-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; padding: 4px 6px; margin-right: 4px; font: inherit; }
.ob-toggle-lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ob-toggle-sw { width: 38px; height: 20px; border-radius: 999px; background: #C3CDD9; position: relative; transition: background .18s; flex: none; }
.ob-toggle-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .18s; }
.ob-toggle.on .ob-toggle-sw { background: var(--blue,#2F80ED); }
.ob-toggle.on .ob-toggle-knob { left: 20px; }
@media (max-width: 900px) { .ob-toggle-lbl { display: none; } }

/* ===== Collapsible card sections (app-wide, CR3) ===== */
.collapse-hd { cursor: pointer; user-select: none; }
.collapse-cx { display: inline-block; font-size: 10px; line-height: 1; margin-right: 6px; color: var(--ink-3); transition: transform .15s ease; vertical-align: middle; }
.is-collapsed > .collapse-hd .collapse-cx,
.collapse-hd.is-collapsed .collapse-cx { transform: rotate(-90deg); }
.card.is-collapsed, .chart-card.is-collapsed { padding-bottom: 12px; }
.ob-group .ob-ghead { cursor: pointer; user-select: none; }
.ob-group .ob-ghead > span:first-child { transition: transform .15s ease; }
.ob-group.is-collapsed .ob-ghead > span:first-child { transform: rotate(-90deg); }

/* ===== Grid column customizer ===== */
.gc-btn { display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; font:inherit; font-size:13px; font-weight:600; color:var(--ink-2); cursor:pointer; }
.gc-btn:hover { background:var(--bg); }
.gc-pop { position:absolute; z-index:1000; width:260px; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 34px rgba(20,26,33,.18); padding:8px; font-size:13.5px; }
.gc-pop-hd { font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-3); padding:4px 6px 8px; }
.gc-pop-list { display:flex; flex-direction:column; gap:2px; max-height:320px; overflow:auto; }
.gc-row { display:flex; align-items:center; gap:6px; padding:5px 6px; border-radius:8px; background:#fff; }
.gc-row:hover { background:var(--bg); }
.gc-row.gc-dragging { opacity:.5; }
.gc-drag { cursor:grab; color:var(--ink-3); font-size:14px; line-height:1; }
.gc-lbl { flex:1; display:flex; align-items:center; gap:7px; cursor:pointer; }
.gc-lbl input { width:auto; }
.gc-up, .gc-down { cursor:pointer; color:var(--ink-3); font-size:10px; padding:2px 3px; border-radius:4px; }
.gc-up:hover, .gc-down:hover { background:var(--line); color:var(--ink); }
.gc-pop-ft { display:flex; justify-content:space-between; gap:8px; padding:8px 6px 2px; margin-top:6px; border-top:1px solid var(--line); }
.gc-reset { background:none; border:none; color:var(--ink-3); font:inherit; font-size:12.5px; cursor:pointer; text-decoration:underline; }
.gc-done { background:var(--ink); color:#fff; border:none; border-radius:7px; padding:5px 14px; font:inherit; font-size:13px; font-weight:600; cursor:pointer; }
/* resize handle sits at the right edge of a header cell */
th[data-col], .ob-hcell[data-col] { position:relative; }
.gc-resize { position:absolute; top:0; right:0; width:8px; height:100%; cursor:col-resize; user-select:none; }
.gc-resize:hover { background:linear-gradient(90deg, transparent, rgba(44,123,229,.25)); }

/* ================= Whole-app mobile overhaul ================= */
@media (max-width: 760px) {
  /* comfortable page padding + room for the bottom nav */
  .admin-main { padding: 14px 13px 92px !important; }
  .page-title { font-size: 22px !important; }
  .board-head, .row-between { flex-wrap: wrap; gap: 10px; }
  /* toolbars / filter bars wrap instead of overflowing */
  .board-tools, .ob-toolbar, .inv-layout { flex-wrap: wrap !important; }
  .board-tools > *, .ob-toolbar > * { flex: 0 1 auto; }
  /* any data table becomes horizontally scrollable inside its card */
  .tblcard { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tblcard > table { min-width: 620px; }
  /* forms & inputs go full width and are easy to tap */
  input, select, textarea, .select-wrap { max-width: 100%; }
  .grid2, .grid3 { grid-template-columns: 1fr !important; }
  .btn, .tb-btn, .ob-tbtn, .gc-btn { min-height: 40px; }
  /* filter forms stack their controls */
  form.board-tools, .admin-main form[method="get"] { gap: 8px; }
  /* the "Show invoices/reimb" + status chips wrap neatly */
  .chip { padding: 7px 12px; }
  /* cards a touch tighter */
  .card { padding: 14px; }
  /* column customizer buttons aren't useful on a phone (cards/scroll instead) */
  [data-grid-columns] { display: none !important; }
  /* customizer popover fits the viewport if ever opened */
  .gc-pop { width: calc(100vw - 24px) !important; max-width: 320px; }
  /* dialogs already become bottom sheets; make their bodies scroll */
  dialog.sheet { max-height: 92vh; overflow-y: auto; }
  /* mobile card list for the classic cases view */
  .cases-mcards { display: grid; gap: 9px; }
  .cases-mcard { background: var(--surface); border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px; padding: 12px 13px; display: block; color: inherit; text-decoration: none; position: relative; }
  .cases-mcard .cm-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .cases-mcard .cm-title { font-size: 14.5px; font-weight: 600; margin-top: 5px; color: var(--ink); }
  .cases-mcard .cm-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
  .cases-mcard .cm-pill { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: #fff; }
}
@media (min-width: 761px) { .cases-mcards { display: none; } }
@media (max-width: 420px) {
  .admin-bottomnav a span { font-size: 10px; }
  .page-title { font-size: 20px !important; }
}

/* Direct header drag/resize affordances for the grid customizer */
.gc-head { cursor: grab; }
.gc-head:active { cursor: grabbing; }
.gc-dragcol { opacity: .5; }
.gc-drophint { box-shadow: inset 3px 0 0 var(--ob-accent, #2C7BE5); }
.gc-resize { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; user-select: none; z-index: 3; }
.gc-head:hover .gc-resize { background: linear-gradient(90deg, transparent, rgba(44,123,229,.35)); }
body.gc-resizing { cursor: col-resize !important; user-select: none; }
.opsboard .ob-hcell.gc-head { position: relative; }

/* Invoices: compact reminders rail + never clip the table */
.inv-rem-link { font-size: 11.5px; font-weight: 600; color: var(--brand); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.inv-rem-link svg { width: 13px; height: 13px; }
.inv-rem-link:hover { text-decoration: underline; }
.inv-rem-link.overdue { color: var(--red); }
.inv-layout .tblcard { overflow-x: auto; }

/* ===== Editable clients grid ===== */
.clg { display: grid; min-width: 1040px; }
.clg-head, .clg-row { display: grid; grid-template-columns: 1.5fr 1fr 1.4fr .9fr 118px 92px 70px 82px 66px 78px 40px; align-items: center; gap: 8px; padding: 7px 12px; }
.clg-head { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.clg-head .r { text-align: right; } .clg-head .c { text-align: center; }
.clg-row { border-bottom: 1px solid var(--line); }
.clg-row:last-child { border-bottom: none; }
.clg-row:hover { background: var(--bg); }
.clg .c { justify-self: center; }
.clg-row input, .clg-row select { width: 100%; padding: 6px 8px; font-size: 13px; border: 1px solid transparent; background: transparent; border-radius: 7px; color: var(--ink); font-family: inherit; }
.clg-row input:hover, .clg-row select:hover { border-color: var(--line); }
.clg-row input:focus, .clg-row select:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 2px rgba(11,107,196,.12); outline: none; }
.clg-row input.r { text-align: right; }
.clg-row input[type=checkbox] { width: auto; }
.clg-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.clg-name input { font-weight: 600; }
.clg-cases { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.clg-stat { display: flex; align-items: center; justify-content: center; }
.clg-open { color: var(--ink-3); display: inline-flex; }
.clg-row.saved { animation: clgflash 1.1s ease; }
@keyframes clgflash { 0% { background: var(--green-soft); } 100% { background: transparent; } }

/* Editable clients table cells */
.cl-table td, .cl-table th { vertical-align: middle; }
.cl-table input, .cl-table select { width: 100%; padding: 6px 8px; font-size: 13px; border: 1px solid transparent; background: transparent; border-radius: 7px; color: var(--ink); font-family: inherit; }
.cl-table input:hover, .cl-table select:hover { border-color: var(--line); }
.cl-table input:focus, .cl-table select:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 2px rgba(11,107,196,.12); outline: none; }
.cl-table input.right { text-align: right; }
.cl-table input[type=checkbox] { width: auto; }
.cl-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cl-name input { font-weight: 600; }
.cl-edit { color: var(--ink); font-weight: 600; text-decoration: none; padding: 4px 6px; margin: -4px -6px; border-radius: 7px; }
.cl-edit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-edit:hover { background: var(--brand-soft, #EAF2FE); color: var(--brand-deep, #0B4F96); }
.cl-edit:hover span { text-decoration: underline; }
#client-edit.flash { box-shadow: 0 0 0 3px var(--brand, #2F80ED); transition: box-shadow .4s; }
.cl-cases { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.cl-open { color: var(--ink-3); display: inline-flex; }
.cl-row.saved { animation: clgflash 1.1s ease; }

/* Full-width pages (e.g. case detail) */
.admin-main.full { max-width: none; padding-left: 28px; padding-right: 28px; }
.admin-main.full .detail-grid { grid-template-columns: minmax(0, 1fr) 340px; }
.admin-main.full .subtask-row { flex-wrap: nowrap; }
@media (max-width: 1100px) { .admin-main.full .subtask-row { flex-wrap: wrap; } }
