/* HAC Beautify the Block portal — black + #FF7033 */
:root {
  --bg: #0A0A0A;
  --s1: #121212;
  --s2: #1A1A1A;
  --s3: #232323;
  --line: #2C2C2C;
  --line2: #3A3A3A;
  --text: #F4F2EF;
  --muted: #9C9893;
  --dim: #6B6864;
  --orange: #FF7033;
  --orange-d: #E85A1E;
  --orange-bg: rgba(255, 112, 51, .12);
  --red: #F25A4F;
  --red-bg: rgba(242, 90, 79, .12);
  --amber: #F2B53A;
  --amber-bg: rgba(242, 181, 58, .12);
  --green: #3ECF8E;
  --green-bg: rgba(62, 207, 142, .12);
  --blue: #6AA8FF;
  --r: 10px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --side: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.mono, .num { font-family: var(--mono); font-feature-settings: 'tnum'; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.upper { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 11.5px; }
.boot { display: grid; place-items: center; height: 100vh; font-weight: 900; letter-spacing: .2em; color: var(--orange); }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #000; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { padding: 4px 8px 18px; }
.brand .org { font-weight: 900; letter-spacing: .14em; font-size: 12px; line-height: 1.25; }
.brand .prog { color: var(--orange); font-weight: 800; font-size: 19px; margin-top: 6px; letter-spacing: -.01em; }
.brand .tag { color: var(--dim); font-size: 10.5px; letter-spacing: .14em; font-weight: 700; margin-top: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--s2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--orange-bg); color: var(--orange); }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.nav a .badge { margin-left: auto; }
.side .me { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.side .me .role { color: var(--orange); font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: .1em; }
.main { min-width: 0; padding: 28px 32px 80px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.6); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; background: #000; border-bottom: 1px solid var(--line); padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .t { font-weight: 800; color: var(--orange); }
  .main { padding: 18px 14px 90px; }
  h1 { font-size: 22px; }
}

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line2); background: var(--s2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #111; }
.btn.primary:hover { background: var(--orange-d); border-color: var(--orange-d); }
.btn.danger { color: var(--red); border-color: rgba(242,90,79,.4); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--s2); }
.btn.sm { padding: 5px 10px; font-size: 13px; min-height: 30px; }
.btn.icon { padding: 6px 9px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; background: var(--s1); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; min-height: 40px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-bg); }
input[type=date] { color-scheme: dark; }
textarea { min-height: 84px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--orange); vertical-align: middle; }
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
label.f .req { color: var(--orange); }
label.chk { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; min-height: 40px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

/* ---------- Surfaces ---------- */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.empty { color: var(--dim); text-align: center; padding: 26px 10px; font-size: 14px; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--s3); color: var(--muted); white-space: nowrap; letter-spacing: .02em; }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.blue { background: rgba(106,168,255,.12); color: var(--blue); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--s2); font-size: 14px; }
.alert + .alert { margin-top: 8px; }
.alert .bar { width: 3px; border-radius: 3px; flex: none; background: var(--muted); }
.alert.critical { background: var(--red-bg); border-color: rgba(242,90,79,.35); }
.alert.critical .bar { background: var(--red); }
.alert.warning { background: var(--amber-bg); border-color: rgba(242,181,58,.3); }
.alert.warning .bar { background: var(--amber); }
.alert.ok { background: var(--green-bg); border-color: rgba(62,207,142,.3); }
.alert.ok .bar { background: var(--green); }
.alert ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.kpi .v { font: 600 26px/1.15 var(--mono); margin-top: 6px; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi.bad { border-color: rgba(242,90,79,.5); }
.kpi.bad .v { color: var(--red); }
.meter { height: 8px; background: var(--s3); border-radius: 99px; overflow: hidden; margin-top: 10px; position: relative; }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--orange); border-radius: 99px; }
.meter.over i { background: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--s1); position: sticky; top: 0; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--text); }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--s2); }
.t .r { text-align: right; }
.t tfoot td { font-weight: 700; border-top: 1px solid var(--line2); }

/* ---------- Kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 272px; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.lane { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - 210px); scroll-snap-align: start; }
.lane-h { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.lane-h .n { margin-left: auto; font-family: var(--mono); color: var(--muted); font-size: 12px; }
.lane-b { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 70px; }
.lane.drop .lane-b { background: var(--orange-bg); }
.pcard { background: var(--s2); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; cursor: pointer; }
.pcard:hover { border-color: var(--line2); }
.pcard.dragging { opacity: .4; }
.pcard .a { font-weight: 700; font-size: 14px; }
.pcard .n { color: var(--muted); font-size: 13px; }
.pcard .m { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.pcard .cost { margin-left: auto; font: 500 12.5px var(--mono); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; font-size: 14px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--orange); border-bottom-color: var(--orange); }
.seg { display: inline-flex; background: var(--s2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { background: none; border: 0; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13.5px; }
.seg button.on { background: var(--s3); color: var(--text); }

/* ---------- Checklist ---------- */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; align-items: flex-start; }
.checks li:last-child { border-bottom: 0; }
.checks .ck { width: 20px; height: 20px; border-radius: 6px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 900; margin-top: 1px; }
.checks .done .ck { background: var(--green-bg); color: var(--green); }
.checks .missing .ck { background: var(--red-bg); color: var(--red); }
.checks .na { color: var(--dim); }
.checks .na .ck { background: var(--s3); color: var(--dim); }
.checks .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; padding-top: 12px; border: 0; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress .meter { flex: 1; margin: 0; }

/* scope items */
.scope-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(140px, 1.4fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cond { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.cond button { background: transparent; border: 0; padding: 8px 11px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); min-height: 38px; }
.cond button + button { border-left: 1px solid var(--line2); }
.cond button.on[data-v=repair] { background: var(--amber-bg); color: var(--amber); }
.cond button.on[data-v=replace] { background: var(--red-bg); color: var(--red); }
.cond button.on[data-v=no_damage] { background: var(--green-bg); color: var(--green); }
@media (max-width: 700px) { .scope-row { grid-template-columns: 1fr auto; } .scope-row .cond { grid-column: 1 / -1; } .scope-row .cond button { flex: 1; } .scope-row .cond { display: flex; } .scope-row .notes { grid-column: 1 / -1; } }

/* ---------- Docs / media ---------- */
.docs { list-style: none; padding: 0; margin: 0; }
.docs li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.docs li:last-child { border-bottom: 0; }
.docs .fi { width: 36px; height: 36px; border-radius: 8px; background: var(--s3); display: grid; place-items: center; font: 600 10px var(--mono); color: var(--muted); flex: none; text-transform: uppercase; }
.docs .meta { min-width: 0; flex: 1; }
.docs .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.media-grid a { display: block; aspect-ratio: 1; border-radius: 9px; overflow: hidden; background: var(--s3); position: relative; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid .cap { position: absolute; inset: auto 0 0 0; padding: 6px 8px; font-size: 11.5px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.drop-zone { border: 1.5px dashed var(--line2); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); }
.drop-zone.over { border-color: var(--orange); background: var(--orange-bg); }

/* ---------- Modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--s1); border: 1px solid var(--line2); border-radius: 14px; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(860px, 100%); }
.modal-h { padding: 18px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-b { padding: 16px 20px; overflow-y: auto; }
.modal-f { padding: 14px 20px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) { .modal-bg { place-items: end stretch; padding: 0; } .modal { border-radius: 16px 16px 0 0; max-height: 92vh; } }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--s3); border: 1px solid var(--line2); border-left: 3px solid var(--green); padding: 11px 14px; border-radius: 9px; font-size: 14px; max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: fade .2s; }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@media (max-width: 600px) { #toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; } }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: #000; border-right: 1px solid var(--line); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .art .big { font-weight: 900; font-size: clamp(40px, 6vw, 76px); line-height: .95; letter-spacing: -.03em; }
.auth .art .big em { font-style: normal; color: var(--orange); }
.auth .art .blocks { position: absolute; right: -40px; bottom: -40px; display: grid; grid-template-columns: repeat(5, 70px); gap: 10px; opacity: .9; }
.auth .art .blocks i { width: 70px; height: 70px; border-radius: 10px; background: var(--s2); }
.auth .art .blocks i.o { background: var(--orange); }
.auth .form { display: grid; place-items: center; padding: 32px 20px; }
.auth .form .box { width: min(380px, 100%); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth .art { padding: 28px 20px; min-height: 0; } .auth .art .blocks { display: none; } .auth .art .big { font-size: 40px; } }

/* misc */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }
.diff { font: 12.5px/1.5 var(--mono); }
.diff .k { color: var(--muted); }
.diff .o { color: var(--red); text-decoration: line-through; opacity: .8; }
.diff .n { color: var(--green); }
.flagbox { border: 1px solid rgba(242,181,58,.3); background: var(--amber-bg); border-radius: 9px; padding: 10px 14px; font-size: 13.5px; }
.flagbox ul { margin: 6px 0 0; padding-left: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; min-width: 160px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0 4px; display: flex; justify-content: flex-end; gap: 8px; }
.color-swatch { width: 38px; height: 38px; padding: 2px; border-radius: 8px; border: 1px solid var(--line2); background: var(--s1); }
.list-edit { display: grid; gap: 8px; }
.list-edit .it { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--s2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }

.kpi .badge { white-space: normal; text-align: left; }
.grid > .card + .card { margin-top: 0; }

.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
