/* CityScape Project Portal — themed per client via --brand / --accent / --bg (see _Theme.cshtml) */
:root {
    --brand: #1B3A1F;
    --accent: #93C01F;
    --bg: #EEEBE0;
    --panel: #ffffff;
    --ink: #1d1d1b;
    --muted: #6b6b66;
    --line: #d9d5c8;
    --red: #c8102e;
    --amber: #f0b45a;
    --green-ok: #93C01F;
    --radius: 10px;
    --sidebar: 256px;
    --font: "Open Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: inherit; }
img { max-width: 100%; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.mt { margin-top: 1.5rem; }
.ic { width: 1.25em; height: 1.25em; vertical-align: -.25em; flex: none; }
.ic.big { width: 48px; height: 48px; }

/* ---------- Layout ---------- */
.portal { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar); flex: none; background: var(--brand); color: #fff;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 20;
}
.brand { display: block; padding: 22px 40px 10px; text-align: center; }
.brand img { width: 100%; max-height: 110px; object-fit: contain; }
.brand-text { font-size: 1.6rem; letter-spacing: .2em; font-weight: 300; }
.welcome { padding: 48px 38px 28px; }
.welcome-title { font-size: 1.7rem; font-weight: 400; line-height: 1.1; }
.welcome-name { font-size: 1rem; }
.nav { display: flex; flex-direction: column; margin-right: 10px; }
.nav a {
    display: flex; align-items: center; gap: 22px; padding: 10px 28px; text-decoration: none; color: #fff;
    text-transform: uppercase; font-size: 1.05rem; letter-spacing: .02em; border-radius: 0 4px 4px 0;
}
.nav a .ic { width: 28px; height: 28px; stroke-width: 1.8; }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.active { background: var(--accent); }
.nav .pill { margin-left: auto; font-style: normal; background: var(--accent); color: var(--brand); border-radius: 10px; padding: 0 8px; font-size: .78rem; font-weight: 700; }
.nav a.active .pill { background: #fff; }
.create-btn {
    margin: auto 8px 18px; background: var(--bg); color: var(--ink); text-decoration: none; text-align: center;
    padding: 14px 10px; border-radius: 8px; font-size: 1rem; letter-spacing: .02em;
}
.create-btn:hover { filter: brightness(.96); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero {
    position: relative; min-height: 184px; padding: 24px 28px 24px 38px; display: flex; align-items: center; gap: 20px;
    background-color: var(--brand); background-size: cover; background-position: center;
    background-image: linear-gradient(120deg, color-mix(in srgb, var(--bg) 85%, #c9b89a) 0%, color-mix(in srgb, var(--bg) 70%, #a99472) 100%);
}
.hero-small { min-height: 120px; }
.hero-slot { flex: 1; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; min-width: 0; }
.hero-title { margin: 0; font-weight: 400; font-size: 1.6rem; letter-spacing: .04em; background: rgba(255,255,255,.85); padding: 6px 16px; border-radius: 8px; }
.hero-title a { text-decoration: none; }
.topbar { position: absolute; top: 22px; right: 28px; display: flex; gap: 12px; align-items: center; }
.round-btn {
    position: relative; width: 48px; height: 48px; border: 2px solid var(--ink); border-radius: 50%;
    display: grid; place-items: center; background: rgba(255,255,255,.55); cursor: pointer; list-style: none; text-decoration: none;
}
.round-btn::-webkit-details-marker { display: none; }
.round-btn .ic { width: 26px; height: 26px; }
.badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-style: normal; font-size: .72rem; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }
.client-switch select { height: 40px; border-radius: 8px; border: 1px solid var(--ink); background: rgba(255,255,255,.85); padding: 0 10px; font: inherit; }
.user-menu { position: relative; }
.user-menu .menu { right: 0; }
.menu { position: absolute; top: 56px; background: #fff; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); min-width: 240px; padding: 8px; z-index: 30; display: flex; flex-direction: column; gap: 4px; }
.menu-head { padding: 6px 10px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.menu a, .menu button { text-align: left; padding: 8px 10px; border-radius: 6px; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu-toggle { display: none; }
.content { padding: 18px 28px 40px 38px; flex: 1; }

/* ---------- Hero widgets (home) ---------- */
.hero-search { flex: 1 1 360px; max-width: 520px; display: flex; background: var(--bg); border-radius: 8px; padding: 0 10px 0 12px; height: 56px; align-items: center; margin-top: 30px; }
.hero-search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 1.05rem; outline: none; text-transform: uppercase; }
.hero-search button { border: 0; background: none; cursor: pointer; }
.hero-search .ic { width: 26px; height: 26px; }
.sort-box { margin-left: auto; margin-top: 30px; margin-right: 0; display: flex; align-items: center; gap: 8px; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
.sort-box > span, .filters > span { margin-right: 8px; font-size: 1.05rem; }
.chip {
    display: inline-block; border: 1.5px solid var(--brand); border-radius: 6px; padding: 5px 14px; text-decoration: none;
    font-size: 1rem; background: transparent; color: var(--ink); min-width: 80px; text-align: left;
}
.chip.on { background: var(--brand); color: #fff; }

.filter-bar { display: flex; align-items: center; gap: 16px; margin: 0 0 14px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.filters input[type=search], .filters select { height: 36px; border-radius: 6px; border: 1px solid var(--line); padding: 0 10px; font: inherit; }
.view-toggle { display: flex; gap: 6px; }
.view-toggle a { padding: 4px; border-radius: 4px; display: grid; place-items: center; text-decoration: none; }
.view-toggle a.on { background: rgba(0,0,0,.08); }
.section-title { margin: 0; font-weight: 400; letter-spacing: .04em; }
.region-pick select { height: 36px; border-radius: 6px; border: 1px solid var(--brand); padding: 0 8px; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.pcard { background: var(--panel); text-decoration: none; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.pcard-img { position: relative; aspect-ratio: 2 / 1; background: #ddd; overflow: hidden; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--accent))); color: rgba(255,255,255,.85); font-size: 3rem; letter-spacing: .1em; font-weight: 300; }
.pcard-body { padding: 14px 20px 14px 60px; font-size: 1.1rem; line-height: 1.3; }
.pcard-name { font-size: 1.15rem; }
.corner { position: absolute; top: 10px; right: 10px; }
.corner-l { position: absolute; top: 10px; left: 10px; }
.progress { height: 5px; background: #ebe8de; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); }
.progress.inline { display: inline-block; width: 80px; vertical-align: middle; margin: 0 6px 0 0; }

.tag { display: inline-block; font-size: .72rem; letter-spacing: .05em; padding: 2px 7px; border-radius: 4px; background: #e8e5da; color: var(--ink); font-weight: 600; }
.tag.red { background: var(--red); color: #fff; }
.tag.green { background: var(--accent); color: var(--brand); }
.status { display: inline-block; font-size: .75rem; padding: 3px 9px; border-radius: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #fff; }
.status.big { font-size: .85rem; padding: 6px 14px; }
.s-active { background: var(--accent); color: var(--brand); }
.s-planning { background: #e2e8f0; color: #334155; }
.s-onhold { background: var(--amber); color: #3b2a07; }
.s-complete { background: var(--brand); color: #fff; }
.s-cancelled { background: #ccc; color: #555; }

/* ---------- Generic UI ---------- */
.card { background: var(--panel); border-radius: 4px; padding: 20px 24px; margin-bottom: 20px; }
.card h2, .panel h2 { margin: 0 0 12px; font-weight: 400; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.card h3 { margin: 18px 0 8px; font-weight: 600; font-size: 1rem; }
.card.narrow { max-width: 560px; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; }
.cols-2 > .card { margin-bottom: 0; }
.cols-2 + .cols-2, .cols-2 + .card, .card + .cols-2 { margin-top: 20px; }
.btn {
    display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: #fff; border: 1.5px solid var(--brand);
    border-radius: 6px; padding: 8px 16px; text-decoration: none; font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.secondary:hover { background: var(--bg); filter: none; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 4px; color: var(--muted); display: inline-grid; place-items: center; text-decoration: none; }
.icon-btn:hover { color: var(--ink); }
button.link, .link { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.inline { display: inline; }
.flash { background: color-mix(in srgb, var(--accent) 30%, #fff); border-left: 4px solid var(--accent); padding: 10px 16px; margin-bottom: 16px; border-radius: 4px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 8px; border-left: 5px solid var(--accent); box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toast 6s forwards; }
@keyframes toast { 0%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(10px); visibility: hidden; } }
.flash.error { background: #fde8ea; border-color: var(--red); }
.empty { background: var(--panel); padding: 40px; text-align: center; color: var(--muted); border-radius: 4px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid #f0ede4; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: .92rem; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), .form select, .form textarea, .table input, .table select {
    font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: #fff; width: 100%;
}
.table input[type=date] { width: auto; }
.form input[type=color] { width: 64px; height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.form.inline { flex-direction: row; align-items: center; flex-wrap: wrap; }
.form.inline input:not([type=checkbox]):not([type=radio]), .form.inline select { width: auto; flex: 1 1 140px; }
.form.wrap { margin-top: 12px; }
.inline-label { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.inline-label select, .inline-label input { height: 36px; border-radius: 6px; border: 1px solid var(--line); padding: 0 8px; font: inherit; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.grid-form.tight { gap: 10px 14px; }
.grid-form .span-2 { grid-column: span 2; }
.grid-form.card { max-width: 900px; }
.err { color: var(--red); font-size: .8rem; }
.folder-checks { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.folder-checks label { flex-direction: row !important; gap: 6px !important; color: var(--ink) !important; font-size: .88rem !important; }
.codes { background: var(--bg); padding: 12px; border-radius: 6px; columns: 2; }
.qr svg { width: 200px; height: 200px; }
.steps { padding-left: 20px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.img-preview { max-height: 90px; border-radius: 4px; align-self: flex-start; }
.brand-preview { display: inline-block; padding: 8px 16px; border-radius: 4px; align-self: flex-start; }
.brand-preview img { height: 60px; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: .92rem; }
.table th { text-align: left; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); }
.table td { padding: 9px 12px; border-bottom: 1px solid #efece3; vertical-align: top; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table tr.attn td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table-scroll { overflow-x: auto; }
.count { font-style: normal; font-size: .72rem; background: #ece9df; border-radius: 9px; padding: 0 7px; margin-left: 4px; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 8px 16px; text-decoration: none; border-radius: 6px 6px 0 0; }
.tabs a.on { background: var(--brand); color: #fff; }
.pager { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); padding: 16px 18px; border-radius: 4px; border-top: 4px solid var(--accent); }
.stat b { display: block; font-size: 2rem; font-weight: 400; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.stat.warn { border-top-color: var(--red); }

.dialog { border: 0; border-radius: 10px; padding: 24px; width: min(520px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(0,0,0,.4); }
.dialog h2 { margin-top: 0; font-weight: 400; }
details > summary { cursor: pointer; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown .menu { right: 0; top: 40px; min-width: 260px; padding: 12px; }

/* ---------- Project page ---------- */
.project-hero { position: relative; margin: -24px 0 -24px -38px; align-self: stretch; display: flex; }
.project-cover { width: 360px; min-height: 184px; background: #ccc; overflow: hidden; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-address { position: absolute; top: 100%; left: 0; width: 360px; background: var(--panel); padding: 10px 24px 12px 60px; font-size: 1.1rem; line-height: 1.3; z-index: 2; }
.pa-name { font-size: 1.15rem; }
.pa-meta { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.project-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; min-height: 40px; }
.project-actions.project-top { padding-left: 340px; min-height: 92px; align-items: flex-start; }
.panels { display: grid; grid-template-columns: 1.15fr 1fr .8fr; gap: 20px; margin-bottom: 22px; }
.panel { background: var(--panel); padding: 20px 24px 46px; position: relative; min-height: 230px; }
.panel h2 { font-size: 1.6rem; text-transform: uppercase; }
.panel h2 .ic { width: 26px; height: 26px; }
.panel-list { list-style: none; margin: 0; padding: 0 0 0 30px; font-size: 1.05rem; line-height: 1.55; }
.panel-list a { text-decoration: none; }
.panel-list a:hover { text-decoration: underline; }
.panel-list.contacts summary { list-style: none; }
.panel-list.contacts summary::-webkit-details-marker { display: none; }
.person { padding: 4px 0 8px 14px; font-size: .9rem; border-left: 2px solid var(--accent); margin: 4px 0 6px; }
.panel-arrow { position: absolute; right: 18px; bottom: 12px; text-decoration: none; }
.panel-arrow .ic { width: 40px; height: 22px; stroke-width: 1.4; }

.goals { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; margin-bottom: 0; }
.goal-status { background: var(--accent); color: #fff; padding: 8px 60px; font-size: 1.1rem; display: grid; place-items: center; }
.goal-label { background: var(--brand); color: #fff; padding: 8px 16px; font-size: 1.1rem; display: grid; place-items: center; margin-left: 20px; }
.goal { display: flex; align-items: stretch; background: #fff; border: 1px solid #999; font-size: 1.1rem; }
.goal-code { padding: 6px 12px; display: grid; place-items: center; min-width: 64px; }
.goal-date { padding: 6px 4px; display: inline-grid; place-items: center; }
.goal-date.met { background: var(--accent); }
.goal-date.pending { background: var(--amber); }
.goal-date.risk { background: var(--red); color: #fff; }

.timeline-wrap { background: color-mix(in srgb, var(--bg) 60%, #fff); margin: 0 -28px 22px -38px; padding: 14px 20px 10px; overflow-x: auto; }
.timeline { list-style: none; display: grid; grid-template-columns: repeat(var(--steps, 25), minmax(40px, 1fr)); margin: 0; padding: 0; min-width: 1060px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 2%; right: 2%; top: 64px; height: 2px; background: #7d8a7f; }
.timeline li { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; padding: 0 2px; }
.ms-num { font-size: .85rem; color: var(--muted); height: 26px; }
.ms-dot {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 0; padding: 0; position: relative; z-index: 1;
    background: #a7b1a8; color: #fff; cursor: default; margin: 6px 0;
}
button.ms-dot { cursor: pointer; }
button.ms-dot:hover { outline: 3px solid var(--accent); }
.ms-dot .ic { width: 22px; height: 22px; }
.ms-name { font-size: .64rem; line-height: 1.15; min-height: 3.6em; color: #333; margin-top: 4px; }
.ms-date { font-size: .62rem; border: 1px solid #333; padding: 1px 4px; background: #fff; margin-top: 4px; white-space: nowrap; }
.ms-done .ms-dot { background: var(--brand); }
.ms-done .ms-date { background: var(--accent); color: #fff; border-color: var(--accent); }
.ms-current .ms-dot { background: var(--brand); box-shadow: 0 0 0 8px var(--accent); }
.ms-overdue .ms-dot { background: var(--red); }
.ms-overdue .ms-date { background: var(--red); color: #fff; border-color: var(--red); }
.ms-upcoming .ms-dot, .ms-unscheduled .ms-dot { background: #6d7f70; }
.legend { display: flex; gap: 18px; justify-content: flex-end; font-size: .75rem; margin-top: 10px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: #6d7f70; }
.legend .ms-done::before { background: var(--brand); }
.legend .ms-current::before { background: var(--accent); }
.legend .ms-overdue::before { background: var(--red); }

.task-list { list-style: none; padding: 0; margin: 0 0 8px; }
.task-list li { padding: 7px 0; border-bottom: 1px solid #f0ede4; }
.task-list li.done strong { text-decoration: line-through; color: var(--muted); }
.task-list li.overdue strong { color: var(--red); }
.activity { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.activity li { padding: 5px 0; border-bottom: 1px solid #f3f1ea; }
.checkbox { width: 24px; height: 24px; border: 2px solid var(--brand); border-radius: 5px; background: #fff; color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.checkbox.checked { background: var(--brand); color: #fff; }
.checkbox .ic { width: 16px; height: 16px; }
.goal-edit { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.goal-edit label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.goal-edit input { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.member { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.member summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- File manager ---------- */
.fm { display: grid; grid-template-columns: 300px 1fr; background: var(--panel); min-height: 560px; }
.fm-tree { background: #f4f2ec; padding: 10px 0; overflow: auto; max-height: 78vh; border-right: 1px solid var(--line); }
.fm-tree a { display: flex; align-items: center; gap: 8px; padding: 5px 14px; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.fm-tree a .ic { color: #444; }
.fm-tree a:hover { background: #ebe8de; }
.fm-tree a.on { background: color-mix(in srgb, var(--accent) 35%, #fff); }
.fm-root { font-weight: 600; }
.fm-main { padding: 14px 18px; min-width: 0; }
.fm-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { text-decoration: none; color: var(--brand); font-weight: 600; }
.dropzone { display: flex; align-items: center; gap: 12px; border: 2px dashed var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff); }
.dz-comment { flex: 1 1 200px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; }
.dz-status { flex-basis: 100%; }
.table.files td { vertical-align: middle; }
.versions ul { margin: 4px 0 0; padding-left: 18px; font-size: .82rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; font-size: .82rem; text-align: center; word-break: break-word; }
.tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; background: #eee; }
.tile.folder .ic, .tile .ic.big { color: var(--brand); margin: 20px 0; }

/* ---------- Directory ---------- */
.directory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.dir-col { min-height: 600px; padding: 30px 36px; margin: 0; }
.dir-col h2 { font-size: 1.6rem; margin-bottom: 4px; }
.dir-group > summary { font-size: 1.1rem; list-style: none; padding: 1px 0; }
.dir-group > summary::-webkit-details-marker, .dir-sub > summary::-webkit-details-marker { display: none; }
.dir-sub { padding-left: 26px; }
.dir-sub > summary { list-style: none; font-size: .9rem; }
.dir-person { padding: 2px 0 8px 54px; font-size: .85rem; line-height: 1.35; }
.dir-person a { text-decoration: none; }
.dir-name { display: block; }
.dir-name small { display: block; }
.dir-name .icon-btn { opacity: .5; }
.notifications { list-style: none; padding: 0; margin: 0; }
.notifications li a { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 14px 18px; background: var(--panel); margin-bottom: 6px; text-decoration: none; border-left: 4px solid transparent; }
.notifications li.unread a { border-left-color: var(--accent); }
.notifications .body { grid-column: 1 / -1; color: var(--muted); white-space: pre-line; font-size: .9rem; }
.client-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.client-tile { background: var(--panel); text-decoration: none; display: flex; flex-direction: column; }
.ct-logo { background: var(--brand); height: 110px; display: grid; place-items: center; color: #fff; padding: 10px; }
.ct-logo img { max-height: 90px; }
.ct-body { padding: 12px 16px; display: flex; flex-direction: column; border-bottom: 4px solid var(--accent); }

/* ---------- Login ---------- */
.auth { display: flex; min-height: 100vh; }
.auth-panel { width: 286px; flex: none; background: var(--brand); color: #fff; display: flex; flex-direction: column; position: relative; z-index: 2; }
.auth-brand { text-align: center; padding: 32px 40px 0; }
.auth-brand img { width: 100%; max-height: 110px; object-fit: contain; }
.auth-title { font-size: 1.2rem; letter-spacing: .03em; margin-top: 6px; }
.auth-body { margin-top: 170px; padding: 0 0 40px 28px; margin-right: -30px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-input { height: 46px; border-radius: 8px; border: 0; background: var(--bg); padding: 0 12px; font: inherit; font-size: 1.15rem; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.auth-input::placeholder { color: #1d1d1b; }
.auth-submit { height: 42px; border-radius: 8px; border: 1.5px solid #fff; background: var(--accent); color: #fff; font: inherit; font-size: 1.15rem; cursor: pointer; text-decoration: none; display: grid; place-items: center; }
.auth-submit:hover { filter: brightness(1.08); }
.auth-link { color: #fff; text-align: center; font-size: .85rem; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-remember { color: #fff; font-size: .82rem; display: flex; gap: 6px; align-items: center; }
.auth-error { background: #fde8ea; color: var(--red); border-radius: 6px; padding: 8px 12px; font-size: .9rem; }
.auth-note { background: color-mix(in srgb, var(--accent) 30%, #fff); color: var(--ink); border-radius: 6px; padding: 8px 12px; font-size: .9rem; }
.auth-help { color: #fff; font-size: .9rem; margin: 0; }
.auth-external { margin-top: 22px; }
.auth-ms { text-decoration: none; width: 100%; height: 42px; border-radius: 8px; border: 1px solid #fff; background: #fff; color: #1d1d1b; font: inherit; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
.auth-image { flex: 1; background-size: cover; background-position: center; background-color: var(--bg);
    background-image: linear-gradient(160deg, color-mix(in srgb, var(--bg) 92%, #fff), color-mix(in srgb, var(--bg) 70%, #9d8a68)); }
.error-page { display: grid; place-items: center; min-height: 100vh; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .panels { grid-template-columns: 1fr 1fr; }
    .directory { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
    body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .menu-toggle { display: grid; place-items: center; position: absolute; top: 22px; left: 16px; width: 44px; height: 44px; border-radius: 8px; border: 0; background: rgba(255,255,255,.85); cursor: pointer; z-index: 5; }
    .hero { padding: 80px 16px 18px; flex-wrap: wrap; }
    .topbar { right: 16px; }
    .content { padding: 16px; }
    .hero-search, .sort-box { margin-top: 0; }
    .sort-box { margin-left: 0; flex-wrap: wrap; }
    .panels, .directory, .fm { grid-template-columns: 1fr; }
    .fm-tree { max-height: 240px; }
    .project-hero { margin: 0; flex-direction: column; width: 100%; }
    .project-cover, .project-address { width: 100%; }
    .project-address { position: static; padding-left: 20px; }
    .project-actions.project-top { padding-left: 0; min-height: 0; }
    .timeline-wrap { margin: 0 -16px 20px; }
    .goal-status { padding: 8px 20px; }
    .goal-label { margin-left: 0; }
    .cols-2 { grid-template-columns: 1fr; }
    .grid-form { grid-template-columns: 1fr; }
    .grid-form .span-2 { grid-column: auto; }
    .auth { flex-direction: column; }
    .auth-panel { width: 100%; }
    .auth-body { margin: 40px 0 0; padding: 0 24px 40px; }
    .auth-image { min-height: 200px; }
    .table { display: block; overflow-x: auto; }
}
fieldset.proto { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
fieldset.proto legend { font-weight: 600; padding: 0 6px; }
.validation-summary-valid { display: none; }

/* ---------- Calendar ---------- */
:root { --k-milestone: var(--brand); --k-goal: #b7791f; --k-task: #2b6cb0; --k-meeting: #6b46c1; }
.cal-bar { justify-content: space-between; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav .section-title { min-width: 210px; text-align: center; }
.cal-filters { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.cal-filters select { height: 36px; border-radius: 6px; border: 1px solid var(--line); padding: 0 8px; font: inherit; }
.cal-filters label i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--k); }
.kind-milestone { --k: var(--k-milestone); } .kind-goal { --k: var(--k-goal); } .kind-task { --k: var(--k-task); } .kind-meeting { --k: var(--k-meeting); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); }
.cal-dow { background: var(--brand); color: #fff; padding: 6px 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.cal-day { background: var(--panel); min-height: 118px; padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: #f6f4ee; }
.cal-day.other .cal-num { color: #aaa; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { font-size: .8rem; color: var(--muted); align-self: flex-end; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; }
.cal-ev { display: block; font-size: .72rem; line-height: 1.25; padding: 2px 5px; border-radius: 3px; text-decoration: none; color: #fff; background: var(--k);
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev b { font-weight: 600; }
.cal-ev.done { opacity: .55; }
.cal-ev.overdue { background: var(--red); }
.cal-more { font-size: .72rem; color: var(--muted); }
.agenda { display: flex; flex-direction: column; gap: 12px; }
.agenda-day { background: var(--panel); padding: 12px 16px; border-radius: 4px; }
.agenda-day.today { box-shadow: inset 4px 0 0 var(--accent); }
.agenda-day h3 { margin: 0 0 8px; font-weight: 600; font-size: .95rem; }
.agenda-item { display: grid; grid-template-columns: 90px 90px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid #f0ede4; text-decoration: none; align-items: baseline; }
.agenda.compact .agenda-item { grid-template-columns: 130px 80px 1fr; }
.agenda-time { font-size: .85rem; color: var(--muted); }
.agenda-kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #fff; background: var(--k); border-radius: 3px; padding: 1px 6px; justify-self: start; }
.agenda-item.done { opacity: .6; }
.agenda-item.overdue .agenda-kind { background: var(--red); }
.card h2 .btn { font-size: .85rem; }
.feed-url { display: flex; gap: 8px; }
.feed-url input { flex: 1; font: inherit; font-size: .85rem; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: #f8f7f2; }
.attendee-checks { max-height: 220px; }
@media (max-width: 900px) {
    .cal-day { min-height: 70px; }
    .cal-ev b, .cal-ev { font-size: .62rem; }
    .agenda-item, .agenda.compact .agenda-item { grid-template-columns: 1fr; gap: 2px; }
}
fieldset.prefs { border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px 12px; display: flex; flex-direction: column; gap: 6px; margin: 0; }
fieldset.prefs legend { font-weight: 600; padding: 0 6px; }
fieldset.prefs p { margin: 0; }
.mt-s { margin-top: 6px; }
.btn.following { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, #fff); }

/* ---------- Prototype showcase ---------- */
.hero.hero-none { position: absolute; top: 0; right: 0; left: auto; min-height: 0; padding: 0; background: none !important; z-index: 15; }
.hero.hero-none .hero-slot { display: none; }
.hero.hero-none .round-btn { background: rgba(255,255,255,.75); border-color: rgba(255,255,255,.9); }
.main:has(.hero-none) { position: relative; }
.main:has(.hero-none) .content { padding-top: 0; }
.sc-hero { position: relative; margin: 0 -28px 0 -38px; height: min(78vh, 760px); min-height: 420px; overflow: hidden; background: var(--brand); color: #fff; }
.sc-hero-section { height: min(52vh, 520px); min-height: 320px; }
.sc-hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); animation: sc-zoom 18s ease-out forwards; }
@keyframes sc-zoom { to { transform: scale(1); } }
.sc-hero-empty { background: radial-gradient(120% 90% at 70% 20%, color-mix(in srgb, var(--accent) 35%, var(--brand)) 0%, var(--brand) 55%, #0c1a0e 100%); }
.sc-hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.15) 55%, rgba(0,0,0,.7) 100%); }
.sc-hero-text { position: absolute; left: 6%; right: 6%; bottom: 9%; }
.sc-hero-text h1 { margin: 0; font-weight: 200; font-size: clamp(2.6rem, 7vw, 6.4rem); line-height: .98; letter-spacing: .02em; text-shadow: 0 2px 30px rgba(0,0,0,.35);
                   opacity: 0; transform: translateY(24px); animation: sc-rise 1.1s .25s cubic-bezier(.2,.7,.2,1) forwards; }
.sc-hero-logo { height: 54px; margin-bottom: 18px; opacity: 0; animation: sc-rise 1s .05s ease forwards; }
.sc-hero-sub { font-size: 1.15rem; max-width: 46ch; margin: 14px 0 0; opacity: .9; }
.sc-back { color: #fff; text-decoration: none; font-size: .85rem; letter-spacing: .15em; text-transform: uppercase; opacity: .85; display: inline-block; margin-bottom: 14px; }
.sc-back:hover { opacity: 1; }
@keyframes sc-rise { to { opacity: 1; transform: none; } }
.sc-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding: 48px 0 34px; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.sc-intro h2 { margin: 0; font-weight: 300; font-size: clamp(1.5rem, 2.6vw, 2.3rem); color: var(--brand); letter-spacing: .01em; }
.sc-intro p { margin: 8px 0 0; color: var(--muted); }
.sc-intro-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.sc-tile { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; color: #fff; text-decoration: none; background: var(--brand); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.sc-tile-wide { grid-column: 1 / -1; aspect-ratio: 21 / 8; }
.sc-tile-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2,.7,.2,1), filter .6s; }
.sc-tile:hover .sc-tile-media, .sc-tile:focus-visible .sc-tile-media { transform: scale(1.06); }
.sc-tile-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.62) 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,.05) 100%); transition: background .6s; }
.sc-tile:hover .sc-tile-shade { background: linear-gradient(90deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.3) 60%, rgba(0,0,0,.1) 100%); }
.sc-tile-text { position: absolute; left: 7%; right: 7%; bottom: 12%; display: flex; flex-direction: column; gap: 6px; }
.sc-tile-title { font-size: clamp(1.5rem, 2.6vw, 2.5rem); font-weight: 300; line-height: 1.05; letter-spacing: .01em; }
.sc-tile-wide .sc-tile-title { font-size: clamp(2rem, 3.6vw, 3.4rem); }
.sc-tile-sub { font-size: .95rem; opacity: .9; max-width: 48ch; }
.sc-tile-count { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; opacity: .85; margin-top: 6px; }
.sc-arrow { display: inline-block; transition: transform .4s; margin-left: 6px; }
.sc-tile:hover .sc-arrow { transform: translateX(6px); }
.sc-placeholder { display: block; width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 70%, var(--accent)) 60%, color-mix(in srgb, var(--brand) 85%, #fff) 100%); }
.sc-placeholder::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255,255,255,.04) 0 2px, transparent 2px 22px); }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.sc-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin: 26px 0 20px; }
.sc-gallery { columns: 3 320px; column-gap: 16px; }
.sc-shot { position: relative; display: block; width: 100%; margin: 0 0 16px; padding: 0; border: 0; background: #ddd; border-radius: 4px; overflow: hidden; cursor: zoom-in; break-inside: avoid; }
.sc-shot img, .sc-shot video { display: block; width: 100%; height: auto; transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.sc-shot:hover img, .sc-shot:hover video { transform: scale(1.03); }
.sc-shot-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px; color: #fff; font-size: .82rem; text-align: left;
               background: linear-gradient(transparent, rgba(0,0,0,.65)); opacity: 0; transition: opacity .4s; }
.sc-shot:hover .sc-shot-cap, .sc-shot:focus-visible .sc-shot-cap { opacity: 1; }
.sc-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
           background: rgba(0,0,0,.45); color: #fff; font-size: 1.4rem; border: 1px solid rgba(255,255,255,.6); }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8,10,8,.94); display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: 90vw; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb-stage img, .lb-stage video { max-width: 90vw; max-height: 80vh; display: block; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox figcaption { color: #ddd; font-size: .9rem; letter-spacing: .03em; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 3rem; cursor: pointer; opacity: .75; padding: 10px 18px; }
.lightbox button:hover { opacity: 1; }
.lb-close { top: 10px; right: 16px; } .lb-prev { left: 10px; top: 50%; transform: translateY(-50%); } .lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.sc-edit-row { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; padding: 14px 0; border-top: 1px solid #efece3; }
.sc-edit-thumb { position: relative; aspect-ratio: 16/9; border-radius: 4px; overflow: hidden; background: #eee; }
.sc-edit-thumb img, .sc-edit-thumb video, .sc-edit-thumb .sc-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) {
    .sc-hero { margin: 0 -16px; height: 60vh; }
    .sc-tiles { grid-template-columns: 1fr; }
    .sc-tile-wide { aspect-ratio: 16 / 9; }
    .sc-edit-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .sc-hero-media, .sc-hero-text h1, .sc-hero-logo { animation: none; opacity: 1; transform: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .sc-tile-media, .sc-shot img, .sc-shot video, .sc-arrow { transition: none; }
}
.loc-search { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.loc-list { max-height: 300px; }
.loc-list label { padding: 4px 2px; border-bottom: 1px solid #f3f1ea; }
