/* ============================================
   SARISA WORKSPACE
   Same steel / arc-blue language as the website admin,
   mobile-first: big touch targets, bottom tab bar on phones.
   ============================================ */

:root {
    --bg: #0a0d11;
    --bg-2: #0e1217;
    --surface: #12171d;
    --surface-2: #171d24;
    --surface-3: #1d242c;
    --line: rgba(255, 255, 255, 0.075);
    --line-strong: rgba(255, 255, 255, 0.13);
    --text: #dfe5ea;
    --text-2: #aab4bd;
    --muted: #7f8a95;
    --blue: #2C7DA0;
    --blue-400: #3A9BC5;
    --arc: #7fd0f5;
    --ok: #5fd39a;
    --danger: #ff7b6b;
    --warn: #f4b400;
    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --display: 'Oswald', 'Arial Narrow', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
    --sidebar: 236px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    font: 400 15px/1.5 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--arc); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { overflow-wrap: anywhere; }
p, td, li { overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.86em; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.small { font-size: 0.84rem; }
.link { color: var(--arc); font-weight: 500; }
.link:hover { color: #fff; }
.muted a, p a:not(.btn), td a:not(.btn) { color: var(--arc); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 1.1rem 0; }
.pre { white-space: pre-wrap; }
.code { margin-top: 0.8rem; padding: 0.7rem 0.85rem; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); font: 500 0.78rem/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    min-height: 44px; padding: 0.6rem 1rem;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 600; font-size: 0.92rem; line-height: 1.1; text-align: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #44a9d4, #2C7DA0); color: #fff; box-shadow: 0 6px 18px -8px rgba(44, 125, 160, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:hover { background: linear-gradient(135deg, #52b6e0, #3189b0); }
.btn-ghost { border-color: var(--line-strong); color: var(--text-2); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover { border-color: rgba(127, 208, 245, 0.45); color: #fff; }
.btn-danger { background: rgba(255, 123, 107, 0.12); border-color: rgba(255, 123, 107, 0.35); color: #ffb0a6; }
.btn-danger:hover { background: rgba(255, 123, 107, 0.22); color: #fff; }
.btn-ok { background: rgba(95, 211, 154, 0.14); border-color: rgba(95, 211, 154, 0.4); color: #a8f0cb; }
.btn-ok:hover { background: rgba(95, 211, 154, 0.25); color: #fff; }
.btn-sm { min-height: 36px; padding: 0.4rem 0.75rem; font-size: 0.84rem; }
.btn-lg { min-height: 56px; font-size: 1.05rem; padding: 0.8rem 1.4rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: 0.6; pointer-events: none; }
.inline-form { display: inline-block; }
.icon-btn {
    width: 40px; height: 40px; flex-shrink: 0; display: inline-grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--line-strong); color: var(--text-2); background: rgba(255, 255, 255, 0.02);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: rgba(127, 208, 245, 0.45); color: #fff; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field > span { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.field .hint { color: var(--muted); font-size: 0.78rem; }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="url"], input[type="search"], input[type="time"], textarea, select {
    width: 100%; min-height: 46px; padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
    background: var(--bg-2); color: #fff; font-size: 16px; /* 16px: no zoom on iOS */
    transition: border-color 0.2s, box-shadow 0.2s;
}
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% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
input[type="date"] { color-scheme: dark; }
textarea { resize: vertical; line-height: 1.5; min-height: 90px; }
input::placeholder, textarea::placeholder { color: #5e6a75; opacity: 1; }
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(127, 208, 245, 0.65); box-shadow: 0 0 0 3px rgba(44, 125, 160, 0.25); }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue-400); flex-shrink: 0; }

.form-grid { display: grid; gap: 0.9rem; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
@media (min-width: 700px) {
    .form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 1rem; }
.filters .field { flex: 1 1 160px; max-width: 280px; }

.file-pick {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
    min-height: 56px; padding: 0.8rem 1rem; border-radius: var(--radius-sm);
    border: 1.5px dashed rgba(127, 208, 245, 0.4); color: var(--arc); font-weight: 600; cursor: pointer;
    background: rgba(44, 125, 160, 0.06);
}
.file-pick svg { width: 24px; height: 24px; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-pick .file-names { flex-basis: 100%; color: var(--text-2); font-weight: 400; font-size: 0.82rem; }
.file-pick:focus-within { outline: 2px solid var(--arc); }

/* ---------- Login ---------- */
.is-login { background: radial-gradient(80% 60% at 50% 0%, rgba(44, 125, 160, 0.25), transparent 60%), var(--bg); }
.is-login .main { padding: 1.2rem; margin: 0; max-width: none; }
.login { position: relative; min-height: calc(100vh - 2.4rem); display: grid; place-items: center; align-content: center; gap: 1rem; }
.login-grid { position: fixed; inset: 0; z-index: -1; background: linear-gradient(rgba(127, 208, 245, 0.05) 1px, transparent 1px) 50% 0 / 56px 56px, linear-gradient(90deg, rgba(127, 208, 245, 0.05) 1px, transparent 1px) 50% 0 / 56px 56px; -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 10%, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 10%, transparent 75%); }
.login-card { width: min(100%, 400px); display: grid; gap: 1rem; padding: 2rem 1.5rem 1.6rem; border-radius: 20px; border: 1px solid var(--line-strong); background: rgba(18, 23, 29, 0.92); box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9); }
.login-emblem { width: 68px; height: 68px; border-radius: 18px; border: 1px solid var(--line-strong); }
.login-card h1 { font: 600 1.8rem/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.login-card h1 span { color: var(--arc); }
.login-card .btn-primary { min-height: 50px; font-size: 1rem; }
.lang-switch { display: flex; gap: 0.4rem; }
.lang-switch button { padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); font-size: 0.85rem; }
.lang-switch button.is-active { color: #fff; border-color: rgba(127, 208, 245, 0.5); background: rgba(44, 125, 160, 0.2); }
.alert { padding: 0.75rem 0.9rem; border-radius: var(--radius-sm); font-size: 0.9rem; }
.alert-error { background: rgba(255, 123, 107, 0.1); border: 1px solid rgba(255, 123, 107, 0.35); color: #ffc2ba; }
.alert-warn { background: rgba(244, 180, 0, 0.1); border: 1px solid rgba(244, 180, 0, 0.4); color: #ffe5a1; margin-bottom: 1rem; }
.card-alert { border-color: rgba(244, 180, 0, 0.45); }

/* password fields: show/hide button + live length check */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 5.2rem; }
.pw-toggle {
    position: absolute; top: 50%; right: 0.4rem; transform: translateY(-50%);
    min-height: 32px; padding: 0.25rem 0.65rem; border-radius: 8px;
    border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04);
    color: var(--text-2); font-size: 0.78rem; font-weight: 600;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: #fff; border-color: rgba(127, 208, 245, 0.5); }
.pw-meter { min-height: 1.1em; font-size: 0.78rem; font-weight: 600; }
.pw-meter.is-ok { color: #5fd39a; }
.pw-meter.is-bad { color: #ffb38a; }

/* ---------- Shell ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar);
    display: none; flex-direction: column; gap: 1.2rem; padding: 1.2rem 0.85rem;
    border-right: 1px solid var(--line); overflow-y: auto;
    background: linear-gradient(180deg, rgba(44, 125, 160, 0.08), transparent 30%), var(--bg-2);
}
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.4rem; }
.brand img { border-radius: 10px; border: 1px solid var(--line-strong); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font: 600 1.12rem/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.05em; }
.brand small { font: 500 0.6rem var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--arc); margin-top: 0.2rem; }
.nav { display: grid; gap: 0.1rem; }
.nav-item {
    display: flex; align-items: center; gap: 0.7rem; width: 100%; min-height: 40px; padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 0.93rem; text-align: left;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item > span { display: flex; flex-direction: column; min-width: 0; }
.nav-item .badge { margin-left: auto; }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.nav-item.is-active { background: rgba(44, 125, 160, 0.18); color: #fff; box-shadow: inset 2px 0 0 var(--arc); }
.nav-item.is-active svg { color: var(--arc); }
.role-tag { font: 500 0.66rem var(--mono); color: var(--muted); letter-spacing: 0.05em; }
.sidebar-foot { margin-top: auto; display: grid; gap: 0.1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.badge {
    min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center;
    border-radius: 10px; background: #e5534b; font: 600 0.7rem/1 var(--font); font-style: normal; color: #fff;
}

.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.6rem;
    padding: 0.55rem 0.8rem; padding-top: max(0.55rem, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line); background: rgba(10, 13, 17, 0.92);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.topbar .brand { padding: 0; }
.topbar-title { flex: 1; min-width: 0; font: 600 1.02rem/1.2 var(--display); letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabbar {
    position: fixed; inset: auto 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 0.3rem 0.3rem max(0.3rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: rgba(10, 13, 17, 0.96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tabbar a { position: relative; display: grid; justify-items: center; gap: 0.12rem; padding: 0.4rem 0; min-height: 52px; border-radius: 10px; font-size: 0.68rem; font-weight: 500; color: var(--muted); text-align: center; }
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabbar svg { width: 23px; height: 23px; }
.tabbar a.is-active { color: #fff; }
.tabbar a.is-active svg { color: var(--arc); }
.tabbar .badge { position: absolute; top: 0.1rem; left: calc(50% + 5px); }

.main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.1rem 0.9rem calc(6.5rem + env(safe-area-inset-bottom)); }
.is-offline .main { padding-bottom: 2rem; }

@media (min-width: 960px) {
    .sidebar { display: flex; }
    .topbar, .tabbar { display: none; }
    .main { width: auto; max-width: none; margin-left: var(--sidebar); padding: 2rem clamp(1.5rem, 3vw, 2.8rem) 5rem; }
    .main > * { max-width: 1180px; }
    .main.is-wide > * { max-width: none; }
    .is-guest .main { margin-left: 0; }
}

/* ---------- Page head, cards ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.9rem 1.4rem; margin-bottom: 1.2rem; }
.page-head > div:first-child { min-width: 0; max-width: 720px; }
.eyebrow { font: 500 0.68rem/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--arc); margin-bottom: 0.5rem; }
.page-head h1 { font: 600 clamp(1.55rem, 5vw, 2.3rem)/1.08 var(--display); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 0.35rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.card { margin-bottom: 1rem; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); min-width: 0; }
@media (min-width: 700px) { .card { padding: 1.3rem 1.4rem; } }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.6rem 1rem; margin-bottom: 0.9rem; }
.card-head > div { min-width: 0; }
.card-head h2 { font-size: 1.05rem; font-weight: 600; }
.card-head p { font-size: 0.86rem; max-width: 72ch; }
.card.is-warn { border-color: rgba(244, 180, 0, 0.4); background: linear-gradient(160deg, rgba(244, 180, 0, 0.08), transparent 50%), var(--surface); }
.card.is-danger { border-color: rgba(255, 123, 107, 0.4); }
.empty { padding: 1.2rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); text-align: center; color: var(--muted); }
.empty-action { margin-top: 0.8rem; }
.empty-state { text-align: center; padding: 3rem 1rem; display: grid; gap: 0.8rem; justify-items: center; }
.empty-state h1 { font: 600 1.6rem/1.1 var(--display); text-transform: uppercase; }
.big-code { font: 600 3.2rem/1 var(--display); color: var(--arc); }
.big-code svg { width: 54px; height: 54px; }

.home-grid { display: grid; gap: 1rem; align-items: start; }
.home-grid > .card { margin: 0; }
@media (min-width: 1100px) { .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-grid > .span-2 { grid-column: 1 / -1; } }

.stat-grid { display: grid; gap: 0.75rem; margin-bottom: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1100px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { display: grid; gap: 0.15rem; align-content: start; padding: 0.9rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(160deg, rgba(44, 125, 160, 0.14), transparent 55%), var(--surface); min-width: 0; }
.stat strong { font: 600 clamp(1.4rem, 5vw, 2rem)/1.1 var(--display); color: #fff; overflow-wrap: anywhere; }
.stat span { color: var(--text-2); font-size: 0.84rem; }
.stat.is-warn { border-color: rgba(244, 180, 0, 0.45); }
.stat.is-danger { border-color: rgba(255, 123, 107, 0.5); }
.stat.is-danger strong { color: #ffb0a6; }
a.stat:hover { border-color: rgba(127, 208, 245, 0.35); }
.meter { height: 6px; margin-top: 0.5rem; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--arc)); border-radius: 4px; }
.meter.is-warn i { background: linear-gradient(90deg, #c98a00, var(--warn)); }
.meter.is-ok i { background: var(--ok); }

/* ---------- Status & badges ---------- */
.status { display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; white-space: nowrap; background: rgba(255, 255, 255, 0.07); color: var(--text-2); vertical-align: middle; }
.s-active, .s-open, .s-in_progress, .s-sent, .s-issued, .s-contacted, .s-site_visit, .s-offer_sent, .s-welded, .s-painted { background: rgba(44, 125, 160, 0.25); color: var(--arc); }
.s-planned, .s-draft, .s-new, .s-offer, .s-cut { background: rgba(255, 255, 255, 0.08); color: var(--text-2); }
.s-done, .s-fixed, .s-closed, .s-accepted, .s-won, .s-paid, .s-locked, .s-erected, .s-shipped, .s-verified { background: rgba(95, 211, 154, 0.16); color: var(--ok); }
.s-on_hold, .s-partial, .s-amended { background: rgba(244, 180, 0, 0.16); color: var(--warn); }
.s-cancelled, .s-lost, .s-rejected, .s-overdue, .s-expired { background: rgba(255, 123, 107, 0.15); color: var(--danger); }
.s-superseded { background: rgba(255, 255, 255, 0.05); color: var(--muted); text-decoration: line-through; }
.badge-soft { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 6px; font: 600 0.68rem/1.4 var(--mono); letter-spacing: 0.04em; background: rgba(255, 255, 255, 0.07); color: var(--text-2); vertical-align: middle; }
.badge-soft.warn { background: rgba(244, 180, 0, 0.16); color: var(--warn); }
.badge-soft.danger { background: rgba(255, 123, 107, 0.15); color: var(--danger); }
.badge-soft.ok { background: rgba(95, 211, 154, 0.15); color: var(--ok); }
.badge-soft.info { background: rgba(44, 125, 160, 0.22); color: var(--arc); }

.notice { display: flex; gap: 0.7rem; align-items: flex-start; margin-bottom: 1rem; padding: 0.8rem 0.95rem; border-radius: var(--radius-sm); border: 1px solid rgba(127, 208, 245, 0.25); background: rgba(44, 125, 160, 0.08); font-size: 0.86rem; color: var(--text-2); }
.notice svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--arc); margin-top: 0.1rem; }
.notice.warn { border-color: rgba(244, 180, 0, 0.35); background: rgba(244, 180, 0, 0.07); }
.notice.warn svg { color: var(--warn); }
.notice strong { color: var(--text); }

/* ---------- Tables (become cards on phones) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -0.2rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: left; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl.compact td { padding: 0.45rem 0.55rem; }
.tbl tr.is-off td { opacity: 0.55; }
.tbl tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.tbl a.row-link { color: var(--text); font-weight: 600; }
.tbl a.row-link:hover { color: var(--arc); }
@media (max-width: 699px) {
    .tbl.stack thead { display: none; }
    .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
    .tbl.stack tr { padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--line); }
    .tbl.stack td { border: 0; padding: 0.12rem 0.2rem; text-align: left; }
    .tbl.stack td[data-label]:not(:first-child)::before { content: attr(data-label) ': '; color: var(--muted); font-size: 0.78rem; }
    .tbl.stack td.right, .tbl.stack td.num { text-align: left; }
    .tbl.stack tfoot { display: block; }
}
.pager { display: flex; gap: 0.6rem; align-items: center; justify-content: center; margin-top: 0.9rem; }

/* ---------- Lists (cards that link) ---------- */
.list { display: grid; gap: 0.5rem; list-style: none; }
.list-item { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 0.85rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
a.list-item:hover { border-color: rgba(127, 208, 245, 0.35); background: var(--surface-3); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.list-item .sub { display: block; font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.list-item .side { text-align: right; flex-shrink: 0; font-size: 0.84rem; }
.list-item .dot, .project-title .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.list-item.is-late { border-color: rgba(255, 123, 107, 0.35); }
.list-item.is-done { opacity: 0.6; }

.more-list { display: grid; gap: 0.45rem; }
.more-item { display: flex; align-items: center; gap: 0.85rem; width: 100%; min-height: 54px; padding: 0.7rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 500; text-align: left; }
.more-item svg { width: 22px; height: 22px; color: var(--arc); }
.more-item .badge { margin-left: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 36px; padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.chip em { font: 500 0.72rem var(--mono); font-style: normal; color: var(--muted); }
.chip:hover { color: #fff; border-color: rgba(127, 208, 245, 0.4); }
.chip.is-active { background: rgba(44, 125, 160, 0.2); border-color: rgba(127, 208, 245, 0.5); color: #fff; }

/* ---------- Project header + sub tabs ---------- */
.project-head { margin-bottom: 1.1rem; }
.crumb { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.4rem; }
.crumb svg { width: 15px; height: 15px; }
.crumb:hover { color: #fff; }
.project-title { display: flex; gap: 0.7rem; align-items: flex-start; }
.project-title .dot { margin-top: 0.7rem; width: 12px; height: 12px; }
.project-title h1 { font: 600 clamp(1.4rem, 5vw, 2.1rem)/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.project-title p { font-size: 0.86rem; margin-top: 0.2rem; }
.subtabs { display: flex; gap: 0.3rem; margin-top: 0.9rem; overflow-x: auto; padding-bottom: 0.25rem; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex-shrink: 0; min-height: 38px; display: inline-flex; align-items: center; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.86rem; color: var(--text-2); white-space: nowrap; }
.subtabs a:hover { color: #fff; border-color: rgba(127, 208, 245, 0.45); }
.subtabs a.is-active { color: #fff; background: rgba(44, 125, 160, 0.22); border-color: rgba(127, 208, 245, 0.55); }
.page-tabs { margin: -0.4rem 0 1rem; }

.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 0.45rem 0.9rem; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 > .card { margin-bottom: 0; } }

/* ---------- Photos ---------- */
.photo-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.55rem; margin-top: 0.7rem; }
.photo-tile { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo-tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-tile.is-shared { border-color: rgba(95, 211, 154, 0.55); }
.photo-cap { display: block; padding: 0.3rem 0.45rem; font-size: 0.74rem; color: var(--text-2); }
.photo-tools { display: flex; justify-content: flex-end; gap: 0.3rem; padding: 0.3rem; }
.photo-tools .btn { min-height: 32px; padding: 0.3rem 0.5rem; font-size: 0.74rem; }
.photo-tools .btn span { display: none; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: max(0.8rem, env(safe-area-inset-top)); right: 0.8rem; left: 0.8rem; z-index: 100; display: grid; gap: 0.5rem; justify-items: end; pointer-events: none; }
.toast { width: min(420px, 100%); display: flex; gap: 0.6rem; padding: 0.8rem 0.95rem; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(22, 28, 35, 0.98); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8); font-size: 0.9rem; pointer-events: auto; animation: toast-in 0.35s var(--ease); }
.toast::before { content: ''; flex-shrink: 0; width: 8px; height: 8px; margin-top: 0.42rem; border-radius: 50%; background: var(--arc); }
.toast.ok::before { background: var(--ok); }
.toast.warn { border-color: rgba(244, 180, 0, 0.45); }
.toast.warn::before { background: var(--warn); }
.toast.error { border-color: rgba(255, 123, 107, 0.45); }
.toast.error::before { background: var(--danger); }
.toast.is-leaving { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- Gantt / timeline ---------- */
.gantt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-2); }
.gantt { position: relative; min-width: 760px; --label: 190px; font-size: 0.8rem; }
.gantt-row { position: relative; display: grid; grid-template-columns: var(--label) 1fr; min-height: 34px; border-bottom: 1px solid var(--line); }
.gantt-row:last-child { border-bottom: 0; }
.gantt-label { position: sticky; left: 0; z-index: 2; padding: 0.45rem 0.6rem; background: var(--bg-2); border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-row.is-project .gantt-label { font-weight: 600; color: #fff; background: var(--surface-2); }
.gantt-row.is-project { background: var(--surface-2); }
.gantt-label a:hover { color: var(--arc); }
.gantt-track { position: relative; }
.gantt-head .gantt-track { display: flex; }
.gantt-head .gantt-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.gantt-col { flex: 1 0 0; border-left: 1px solid var(--line); padding: 0.3rem 0.35rem; font-size: 0.68rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.gantt-col.is-now { color: var(--arc); }
.gantt-grid { position: absolute; inset: 0; display: flex; pointer-events: none; }
.gantt-grid i { flex: 1 0 0; border-left: 1px solid rgba(255, 255, 255, 0.035); }
.gantt-bar { position: absolute; top: 7px; height: 20px; min-width: 4px; border-radius: 5px; font-size: 0.68rem; line-height: 20px; padding: 0 0.35rem; color: #071017; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-bar.is-plan { background: repeating-linear-gradient(135deg, rgba(127, 208, 245, 0.18) 0 6px, rgba(127, 208, 245, 0.08) 6px 12px); border: 1px solid rgba(127, 208, 245, 0.55); color: var(--arc); top: 5px; height: 12px; line-height: 10px; font-size: 0; }
.gantt-bar.is-actual { top: 18px; height: 11px; line-height: 11px; font-size: 0; }
.gantt-bar.is-solo { top: 7px; height: 20px; font-size: 0.68rem; line-height: 20px; }
.gantt-row.is-project .gantt-bar { top: 9px; height: 16px; opacity: 0.9; font-size: 0; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 1; box-shadow: 0 0 8px rgba(255, 123, 107, 0.6); pointer-events: none; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.7rem 0 0; font-size: 0.78rem; color: var(--muted); }
.gantt-legend i { display: inline-block; width: 22px; height: 10px; border-radius: 3px; margin-right: 0.35rem; vertical-align: middle; }
.gantt-legend .lg-plan { background: rgba(127, 208, 245, 0.18); border: 1px solid rgba(127, 208, 245, 0.55); }
.gantt-legend .lg-actual { background: var(--arc); }
.gantt-legend .lg-today { width: 2px; background: var(--danger); }

/* ---------- Resource calendar ---------- */
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.cal { border-collapse: collapse; font-size: 0.74rem; min-width: 100%; }
.cal th, .cal td { border: 1px solid var(--line); padding: 0; height: 34px; min-width: 30px; text-align: center; }
.cal th { font-weight: 500; color: var(--muted); padding: 0.25rem 0.2rem; white-space: nowrap; }
.cal th.is-we, .cal td.is-we { background: rgba(255, 255, 255, 0.025); }
.cal th.is-today { color: var(--danger); }
.cal .res { position: sticky; left: 0; z-index: 2; background: var(--surface-2); text-align: left; padding: 0.3rem 0.55rem; min-width: 130px; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; color: var(--text); }
.cal .res small { display: block; color: var(--muted); font-size: 0.68rem; }
.cal td.is-booked { color: #071017; font-weight: 700; font-size: 0.66rem; }
.cal td.is-conflict { background: repeating-linear-gradient(135deg, rgba(255, 123, 107, 0.85) 0 4px, rgba(255, 123, 107, 0.45) 4px 8px) !important; color: #fff; }
.cal td a { display: block; height: 100%; line-height: 32px; overflow: hidden; }

/* ---------- Kanban (sales pipeline) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 0.8rem; overflow-x: auto; padding-bottom: 0.5rem; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
.kanban-col { scroll-snap-align: start; display: grid; gap: 0.5rem; align-content: start; padding: 0.7rem; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); min-height: 160px; }
.kanban-col h3 { display: flex; justify-content: space-between; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.kanban-card { display: grid; gap: 0.2rem; padding: 0.65rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 0.86rem; }
.kanban-card:hover { border-color: rgba(127, 208, 245, 0.35); }
.kanban-card .sub { color: var(--muted); font-size: 0.78rem; }

/* ---------- Line items editor (offers, invoices) ---------- */
.items { display: grid; gap: 0.6rem; }
.item-row { display: grid; gap: 0.5rem; grid-template-columns: 1fr 1fr; padding: 0.7rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.item-row .f-desc { grid-column: 1 / -1; }
.item-row .f-total { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; font-weight: 600; }
.item-row .field > span { font-size: 0.72rem; }
@media (min-width: 900px) {
    .item-row { grid-template-columns: minmax(0, 4fr) 1fr 0.8fr 1.3fr 0.9fr 1fr auto; align-items: end; }
    .item-row .f-desc, .item-row .f-total { grid-column: auto; }
    .item-row .f-total { display: grid; justify-items: end; min-width: 110px; }
}
.totals { margin-left: auto; width: min(100%, 380px); display: grid; gap: 0.35rem; font-size: 0.92rem; }
.totals div { display: flex; justify-content: space-between; gap: 1rem; }
.totals .grand { font-size: 1.1rem; font-weight: 700; color: #fff; border-top: 1px solid var(--line-strong); padding-top: 0.45rem; }

/* ---------- Workshop / QR item ---------- */
.steps { display: grid; gap: 0.5rem; list-style: none; counter-reset: step; }
.step { display: flex; align-items: center; gap: 0.8rem; padding: 0.65rem 0.8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.step i { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--line-strong); font-style: normal; font: 600 0.8rem var(--mono); color: var(--muted); }
.step.is-done i { background: var(--ok); border-color: var(--ok); color: #06140c; }
.step.is-done i svg { width: 16px; height: 16px; stroke-width: 3; }
.step.is-next { border-color: rgba(127, 208, 245, 0.5); }
.step .grow { flex: 1; min-width: 0; }
.step .sub { display: block; font-size: 0.78rem; color: var(--muted); }
.big-action { display: grid; gap: 0.5rem; margin: 1rem 0; }
.big-action .btn { min-height: 64px; font-size: 1.15rem; }
.progress-row { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.8rem; align-items: center; font-size: 0.86rem; }
.progress-row .meter { grid-column: 1 / -1; margin-top: 0; }
.stage-dots { display: flex; gap: 3px; }
.stage-dots i { width: 14px; height: 6px; border-radius: 2px; background: var(--surface-3); }
.stage-dots i.on { background: var(--ok); }

/* ---------- Misc ---------- */
.timeline { list-style: none; display: grid; gap: 0; border-left: 2px solid var(--line-strong); margin-left: 0.4rem; }
.timeline li { position: relative; padding: 0 0 0.9rem 1rem; font-size: 0.88rem; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 0.4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--arc); }
.timeline li.is-done::before { background: var(--ok); }
.timeline .sub { color: var(--muted); font-size: 0.8rem; }
.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--bg-2); }
.segmented button, .segmented a { min-height: 38px; padding: 0.45rem 0.85rem; border-radius: 8px; font-size: 0.86rem; font-weight: 500; color: var(--text-2); }
.segmented .is-active { background: var(--surface-3); color: #fff; }
.split { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
details.more { border-top: 1px solid var(--line); margin-top: 0.8rem; padding-top: 0.6rem; }
details.more > summary { cursor: pointer; color: var(--arc); font-weight: 500; min-height: 40px; display: flex; align-items: center; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '+ '; margin-right: 0.3rem; }
details.more[open] > summary::before { content: '− '; }
.audit-details code { font: 500 0.72rem/1.4 var(--mono); color: var(--text-2); word-break: break-all; }
.diff-old { color: var(--danger); text-decoration: line-through; }
.diff-new { color: var(--ok); }
.copy-box { display: flex; gap: 0.5rem; align-items: stretch; }
.copy-box input { font-family: var(--mono); font-size: 0.82rem; }
.qr-box { display: grid; place-items: center; padding: 0.8rem; background: #fff; border-radius: 10px; width: 170px; }
.result-big { font: 600 clamp(1.8rem, 7vw, 2.6rem)/1.1 var(--display); color: #fff; }
.cut-bar { position: relative; display: flex; height: 30px; border-radius: 5px; overflow: hidden; background: repeating-linear-gradient(135deg, rgba(255, 123, 107, 0.25) 0 5px, rgba(255, 123, 107, 0.1) 5px 10px); border: 1px solid var(--line-strong); margin: 0.3rem 0 0.2rem; }
.cut-bar span { display: grid; place-items: center; height: 100%; background: var(--blue); color: #fff; font: 600 0.68rem var(--mono); border-right: 2px solid var(--bg); overflow: hidden; white-space: nowrap; }
.cut-bar span:nth-child(even) { background: var(--blue-400); }
.cut-bar span.rem { background: rgba(95, 211, 154, 0.35); color: #dfffee; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.week-title { margin: 1.1rem 0 0.5rem; font-size: 0.95rem; font-weight: 600; }
.week-title:first-of-type { margin-top: 0.2rem; }
.conflict-list { margin: 0.4rem 0 0 1.1rem; }
.side.danger, .danger-text { color: var(--danger); }
.task-list { margin-top: 0.7rem; }
.task-list .list-item { padding: 0.5rem 0.6rem; }
.task-list .icon-btn { width: 34px; height: 34px; }
.task-list .icon-btn svg { color: var(--ok); stroke-width: 3; }
.cal td a { color: inherit; }
.list-item details.more { margin-top: 0.4rem; padding-top: 0.3rem; }
.list-item details.more > summary { min-height: 32px; font-size: 0.85rem; }
.list-item details.more form { margin-top: 0.6rem; }

/* ---------- Diary ---------- */
.diary-item { align-items: flex-start; }
.date-box { width: 50px; flex-shrink: 0; display: grid; justify-items: center; padding: 0.35rem 0; border-radius: 10px; background: var(--surface-3); line-height: 1.1; }
.date-box b { font: 600 1.35rem/1 var(--display); color: #fff; }
.date-box small { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }
.diary-head { margin-bottom: 1rem; align-items: flex-end; }
.diary-date { font: 600 clamp(1.3rem, 5vw, 1.8rem)/1.1 var(--display); text-transform: uppercase; margin-bottom: 0.4rem; }
.diary-form { display: grid; gap: 1rem; }
.diary-form .label, .field-photos .label, .weather-pick .label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.4rem; }
.weather-pick .chips { margin-bottom: 0; }
.radio-chip { position: relative; cursor: pointer; min-height: 42px; }
.radio-chip input { position: absolute; opacity: 0; pointer-events: none; }
.radio-chip:has(input:checked) { background: rgba(44, 125, 160, 0.3); border-color: var(--arc); color: #fff; }
.radio-chip:has(input:focus-visible) { outline: 2px solid var(--arc); }
.diary-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .diary-nums { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sticky-actions { position: sticky; bottom: calc(4.4rem + env(safe-area-inset-bottom)); z-index: 5; padding: 0.5rem 0 0; background: linear-gradient(transparent, var(--surface) 30%); }
@media (min-width: 960px) { .sticky-actions { bottom: 0; } }
.ro-title { margin: 0.9rem 0 0.25rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.signed-line { display: flex; align-items: center; gap: 0.4rem; margin: -0.4rem 0 1rem; }
.inline-ic { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; }
.kv.diff dd { font-size: 0.86rem; }

/* ---------- Snags ---------- */
.snag-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--surface-3); }
.snag-thumb.is-empty { display: grid; place-items: center; color: var(--muted); }
.snag-thumb.is-empty svg { width: 24px; height: 24px; }
.snag-title { font-size: 1.25rem; margin: 0.2rem 0 0.4rem; }
.status-buttons { display: grid; gap: 0.5rem; }
@media (min-width: 700px) { .status-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Documents ---------- */
.doc-ext { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; background: rgba(44, 125, 160, 0.18); color: var(--arc); font: 600 0.68rem var(--mono); }
.doc-item a strong { color: var(--text); }
.doc-item a:hover strong { color: var(--arc); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Share ---------- */
.pick-grid label { display: block; position: relative; cursor: pointer; }
.pick-grid input { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; accent-color: var(--ok); z-index: 1; }
.pick-grid .photo-tile:has(input:checked) { border-color: rgba(95, 211, 154, 0.7); box-shadow: 0 0 0 2px rgba(95, 211, 154, 0.35); }
.is-share .main { max-width: 980px; margin: 0 auto; padding-bottom: 3rem; }
.share-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.4rem; }
.share-head img { border-radius: 10px; border: 1px solid var(--line-strong); }
.share-head div { display: grid; flex: 1; min-width: 0; }
.share-head strong { font: 600 1.05rem/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.share-head span { font-size: 0.8rem; color: var(--muted); }
.share-head .lang-switch a { padding: 0.3rem 0.6rem; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.78rem; color: var(--text-2); }
.share-head .lang-switch a.is-active { color: #fff; border-color: rgba(127, 208, 245, 0.5); }
.share-photos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.share-foot { text-align: center; margin-top: 1.5rem; }
.list-item .side { max-width: 45%; }
.list-item .side .badge-soft { white-space: normal; text-align: center; }
.card > details.more:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.cover-pick { display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.45rem; font-size: 0.74rem; color: var(--text-2); cursor: pointer; }
@media (max-width: 600px) {
    .gantt { --label: 118px; font-size: 0.74rem; }
    .gantt-label { padding: 0.45rem 0.45rem; }
}
.list-item > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--arc); }
