:root {
  --green: #416b3c;
  --green-600: #355830;
  --green-50: #eef4ec;
  --ink: #0d0f0e;
  --ink-2: #3b403d;
  --muted: #6f7672;
  --line: #e6e8e6;
  --bg: #ffffff;
  --bg-2: #f6f7f5;
  --dark: #121614;
  --dark-2: #1b201d;
  --dark-3: #262c28;
  --dark-line: #2f3631;
  --dark-text: #e7ebe8;
  --dark-muted: #9aa49e;
  --danger: #c4402f;
  --warn: #b7791f;
  --radius: 12px;
  --head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
h1, h2, h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: .01em; line-height: .95; margin: 0; }
.eyebrow { font: 600 11px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--green); }
.muted { color: var(--muted); }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font: 600 18px/1 var(--head); text-transform: uppercase; letter-spacing: .04em; }
.brand b { color: var(--green); font-weight: 800; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--green) url("favicon.svg") center/cover; display: inline-block; }

/* Buttons */
.btn { border: 1px solid transparent; border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-600); }
.btn.primary:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.ghost-dark { background: transparent; border-color: var(--dark-line); color: var(--dark-text); }
.btn.ghost-dark:hover { border-color: var(--dark-muted); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; background: var(--dark-3); color: var(--dark-text); font-size: 18px; }
.btn.wide { width: 100%; padding: 12px; }
.link { background: none; border: 0; color: var(--green); padding: 4px 0; font-weight: 600; }

/* Login */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; background: linear-gradient(160deg, rgba(13,15,14,.15), rgba(13,15,14,.85)), radial-gradient(120% 90% at 20% 10%, #5c8a55 0%, #2b4727 45%, #0d1a0c 100%); display: flex; align-items: flex-end; padding: 56px; color: #fff; overflow: hidden; }
.login-art::before { content: ""; position: absolute; inset: auto -10% 18% -10%; height: 220px; background: repeating-linear-gradient(170deg, rgba(255,255,255,.06) 0 2px, transparent 2px 22px); transform: skewY(-6deg); }
.login-art-copy { position: relative; }
.login-art .eyebrow { color: #cfe3c9; }
.login-art h1 { font-size: clamp(88px, 12vw, 180px); font-weight: 800; margin: 10px 0 12px; }
.login-art p { font-size: 18px; max-width: 34ch; color: #e1ebde; margin: 0; }
.login-card { align-self: center; justify-self: center; width: min(400px, calc(100% - 48px)); display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { font-size: 44px; margin-top: 28px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12px; color: var(--ink-2); }
.login-card input { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; outline: none; }
.login-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.form-error { color: var(--danger); min-height: 18px; font-size: 13px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { min-height: 220px; padding: 28px; } .login-art h1 { font-size: 72px; } }

/* Top bars */
.topbar { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 20px; }
.topbar.light { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.topbar.dark { background: var(--dark); color: var(--dark-text); border-bottom: 1px solid var(--dark-line); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.me { color: var(--muted); font-weight: 500; }

/* Projects */
.projects { min-height: 100%; background: var(--bg); }
.projects-main { max-width: 1240px; margin: 0 auto; padding: 36px 24px 64px; }
.projects-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.projects-head h1 { font-size: clamp(48px, 7vw, 84px); font-weight: 800; margin-top: 8px; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.pcard { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; cursor: pointer; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; text-align: left; padding: 0; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(13,15,14,.10); }
.pcard-img { aspect-ratio: 16/9; background: var(--bg-2) center/cover no-repeat; position: relative; }
.pcard-img .badge { position: absolute; top: 12px; left: 12px; }
.pcard-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.pcard h3 { font-size: 28px; font-weight: 700; }
.pcard .yacht { color: var(--muted); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.chip.green { background: var(--green-50); color: var(--green); }
.badge { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: #fff; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.badge.late { background: var(--danger); color: #fff; }
.badge.done { background: var(--green); color: #fff; }
.meta-row { display: flex; gap: 14px; color: var(--ink-2); font-size: 12px; }
.meta-row b { font-weight: 600; }
.bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar > div { height: 100%; background: var(--green); border-radius: 999px; }
.empty { text-align: center; padding: 80px 16px; color: var(--muted); }
.empty h3 { font-size: 34px; color: var(--ink); margin-bottom: 8px; }

/* Workspace */
.work { height: 100%; display: flex; flex-direction: column; background: var(--dark); }
.work-title { min-width: 0; }
.work-title .eyebrow { color: #8fbf86; }
.work-name { font: 700 22px/1.05 var(--head); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar.dark .chip { background: var(--dark-3); color: var(--dark-muted); }
.topbar.dark .chip.warn { background: #3a2f17; color: #f2c46d; }
.topbar.dark .chip.ok { background: #1f3320; color: #9fd496; }
.work-body { flex: 1; min-height: 0; display: flex; }
.panel { width: 340px; flex: none; background: var(--dark-2); color: var(--dark-text); border-right: 1px solid var(--dark-line); display: flex; flex-direction: column; min-height: 0; }
.panel.collapsed { display: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; border-bottom: 1px solid var(--dark-line); }
.tabs button { border: 0; background: transparent; color: var(--dark-muted); padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 12px; }
.tabs button.on { background: var(--dark-3); color: #fff; }
.tab-body { flex: 1; overflow: auto; padding: 14px; }
.tab-body h4 { margin: 4px 0 10px; font: 600 11px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--dark-muted); }
.tab-body .hint { color: var(--dark-muted); font-size: 12px; margin: 0 0 12px; }
.tab-body .hint a { color: #9fd496; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.btn.dk { background: var(--dark-3); color: var(--dark-text); border: 1px solid var(--dark-line); }
.btn.dk:hover { border-color: var(--dark-muted); }
.btn.gr { background: var(--green); color: #fff; }
.btn.gr:hover { background: var(--green-600); }
.btn.gr:disabled, .btn.dk:disabled { opacity: .5; cursor: default; }

.checklist { display: flex; flex-direction: column; gap: 6px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--dark-3); border: 1px solid transparent; cursor: pointer; user-select: none; }
.check-item:hover { border-color: var(--dark-line); }
.check-item .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--dark-muted); flex: none; display: grid; place-items: center; font-size: 12px; color: transparent; }
.check-item.done .box { background: var(--green); border-color: var(--green); color: #fff; }
.check-item.done .lbl { color: var(--dark-muted); text-decoration: line-through; }
.check-item.locked { cursor: default; opacity: .7; }
.check-item .tag { margin-left: auto; font-size: 10px; color: var(--dark-muted); text-transform: uppercase; letter-spacing: .08em; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12px; margin-bottom: 16px; }
.info-grid dt { color: var(--dark-muted); }
.info-grid dd { margin: 0; }
.notes { background: var(--dark-3); border-radius: 10px; padding: 10px 12px; font-size: 12px; white-space: pre-wrap; margin-bottom: 16px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; background: var(--dark-3) center/cover no-repeat; cursor: pointer; border: 2px solid transparent; }
.thumb.sel { border-color: #8fbf86; }
.thumb.sel::after { content: "✓"; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 12px; }
.thumb.sent { opacity: .55; }

.files { display: flex; flex-direction: column; gap: 4px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--dark-3); font-size: 12px; }
.file .ico { width: 28px; height: 28px; border-radius: 6px; background: var(--dark-line); display: grid; place-items: center; flex: none; font-size: 13px; }
.file .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .sub { color: var(--dark-muted); font-size: 11px; }
.file .acts { display: flex; gap: 4px; }
.file.folder { cursor: pointer; }
.file.folder:hover { background: var(--dark-line); }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; margin-bottom: 10px; color: var(--dark-muted); }
.crumbs button { background: none; border: 0; color: #9fd496; padding: 0; font-weight: 600; }
.panel select, .panel input[type=text] { background: var(--dark-3); color: var(--dark-text); border: 1px solid var(--dark-line); border-radius: 8px; padding: 7px 9px; }

.editor-wrap { flex: 1; min-width: 0; position: relative; background: #1b1c1f; }
#editor { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.editor-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--dark-text); background: rgba(18,22,20,.86); z-index: 2; text-align: center; padding: 20px; }
.editor-overlay.off { display: none; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--dark-line); border-top-color: #8fbf86; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dialog */
.dialog { border: 0; border-radius: 18px; padding: 26px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.dialog::backdrop { background: rgba(10,12,11,.55); }
.dialog h3 { font-size: 30px; margin: 8px 0 4px; overflow-wrap: anywhere; }
.dialog label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12px; color: var(--ink-2); margin-top: 14px; }
.dialog label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; }
.dialog select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 16px; }
.progress > div { height: 100%; width: 0; background: var(--green); transition: width .2s; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
a.btn { text-decoration: none; }
a.btn.dk { background: var(--dark-3); color: var(--dark-text); }
