/* =========================================================
   DOC TRACKER — Isprava luxury theme
   Deep forest green · ivory · brass, serif display type
   ========================================================= */

:root {
  --green-950: #0e1b14;
  --green-900: #142720;
  --green-800: #1b352a;
  --green-700: #29513e;
  --green-600: #34664e;
  --brass: #a9853a;
  --brass-deep: #8a6a2a;
  --brass-soft: #efe7d3;
  --accent: var(--green-700);
  --accent-soft: #e4ebe2;
  --bg: #f2eee4;
  --panel: #fbf9f3;
  --panel-2: #f6f2e7;
  --line: #d5cbb4;
  --line-soft: #e7e0cd;
  --txt: #232b24;
  --txt-dim: #757a6a;
  --ok: #3f7a52;
  --ok-soft: #e1ecdf;
  --warn: #97701e;
  --warn-soft: #f4ecd4;
  --bad: #a84f38;
  --bad-soft: #f5e2da;
  --row-bld: #e6ddc4;
  --row-disc: #f0ead8;
  --gantt-bar-border: #a9853a;
  --gantt-bar-bg: #ece0c4;
  --gantt-fill: #29513e;
  --gantt-late: #a84f38;
  --radius: 3px;
  --radius-lg: 8px;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --font: "Jost", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --fs: 13px;
  --shadow: 0 1px 3px rgba(30, 42, 32, 0.12);
  --shadow-lg: 0 18px 50px rgba(14, 27, 20, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs);
  color: var(--txt); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: var(--txt); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; }
h2 { font-size: 24px; margin: 0; color: var(--green-900); }
h3 { font-size: 17px; margin: 0; color: var(--green-900); }
.muted { color: var(--txt-dim); }
.spacer { flex: 1; }
.late-txt { color: var(--bad); font-weight: 600; }

/* ================= LOGIN ================= */

#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 480px at 85% -5%, rgba(169, 133, 58, 0.28), transparent 60%),
    radial-gradient(700px 500px at -5% 108%, rgba(52, 102, 78, 0.30), transparent 55%),
    linear-gradient(160deg, var(--green-950) 0%, var(--green-900) 50%, var(--green-800) 100%);
  padding: 24px;
}
.login-card {
  width: 430px; max-width: 100%; background: var(--panel);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  border: 1px solid rgba(169, 133, 58, 0.35);
}
.login-brand {
  background: linear-gradient(150deg, var(--green-950), var(--green-800));
  color: #f4efe2; padding: 30px 30px 24px; text-align: center;
}
.login-brand .lb-org {
  font-size: 11px; letter-spacing: 0.34em; color: #cfb87a; font-weight: 500;
}
.login-brand h1 { margin: 12px 0 0; font-size: 30px; font-weight: 600; color: #f7f2e4; }
.lb-rule {
  width: 64px; height: 1px; margin: 14px auto;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
}
.login-brand p { margin: 0; font-size: 12px; opacity: 0.75; letter-spacing: 0.02em; }
.login-body { padding: 24px 30px 28px; }
.login-body .fld { margin-bottom: 13px; }
.login-error {
  background: var(--bad-soft); color: var(--bad); border: 1px solid #dcb4a6;
  padding: 8px 11px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 500;
}
.btn-login {
  width: 100%; padding: 11px; border: 1px solid var(--green-700); border-radius: var(--radius);
  background: var(--green-700); color: #f4efe2; font-weight: 500; font-size: 14px;
  letter-spacing: 0.14em; text-transform: uppercase; transition: all 0.2s;
}
.btn-login:hover { background: var(--green-800); border-color: var(--brass); }
.demo-block { margin-top: 20px; border-top: 1px solid var(--line-soft); padding-top: 15px; }
.demo-block > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--brass-deep); }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.demo-acct {
  border: 1px solid var(--line-soft); background: var(--panel-2); border-radius: var(--radius);
  padding: 7px 10px; text-align: left; line-height: 1.35; transition: all 0.15s;
}
.demo-acct b { display: block; font-size: 12.5px; color: var(--green-800); }
.demo-acct span { font-size: 11px; color: var(--txt-dim); }
.demo-acct:hover { border-color: var(--brass); background: var(--brass-soft); }

/* ================= APP SHELL ================= */

#app { display: flex; flex-direction: column; height: 100vh; }

#topbar {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(120deg, var(--green-950) 0%, var(--green-800) 100%);
  color: #f4efe2; padding: 0 18px; height: 56px; flex: none;
  border-bottom: 1px solid rgba(169, 133, 58, 0.45); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-name {
  font-family: var(--serif); font-size: 21px; font-weight: 600;
  letter-spacing: 0.30em; color: #f0e6cd; padding-left: 4px;
}
.brand-rule { width: 1px; height: 22px; background: rgba(169, 133, 58, 0.6); }
.brand-sub { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(244, 239, 226, 0.65); }
#user-chip { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.chip-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brass-soft); color: var(--green-800);
  border: 1px solid var(--brass);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11.5px;
  flex: none;
}
.chip-lg { width: 40px; height: 40px; font-size: 13px; }
.chip-meta { display: flex; flex-direction: column; line-height: 1.3; }
.chip-meta b { font-size: 13px; font-weight: 500; }
.chip-meta span { font-size: 10.5px; opacity: 0.68; letter-spacing: 0.04em; }
#btn-logout {
  border: 1px solid rgba(244, 239, 226, 0.35); background: transparent; color: #f4efe2;
  border-radius: var(--radius); padding: 6px 14px; font-size: 11.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
}
#btn-logout:hover { border-color: var(--brass); color: #f0e6cd; }

/* ------- Notification bell ------- */

.bell-wrap { position: relative; }
#btn-bell {
  position: relative; border: 1px solid rgba(244, 239, 226, 0.25); background: transparent;
  border-radius: 50%; width: 36px; height: 36px; font-size: 15px; line-height: 1;
}
#btn-bell:hover { border-color: var(--brass); }
#bell-count {
  position: absolute; top: -5px; right: -6px; min-width: 17px; height: 17px;
  background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 1px solid var(--green-900);
}
#bell-panel {
  position: absolute; right: 0; top: 46px; width: 380px; max-height: 62vh; overflow-y: auto;
  background: var(--panel); color: var(--txt); border: 1px solid var(--line);
  border-top: 2px solid var(--brass); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 90; padding-bottom: 6px;
}
.bell-head {
  font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--green-900);
  padding: 12px 16px 8px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 8px;
}
.bell-item {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 16px; font-size: 12.5px; line-height: 1.4;
  border-bottom: 1px dashed var(--line-soft); color: var(--txt);
}
.bell-item:hover { background: var(--panel-2); }
.bell-item span { flex: none; }
.bell-item.ntf-bad { box-shadow: inset 3px 0 0 var(--bad); }
.bell-item.ntf-warn { box-shadow: inset 3px 0 0 var(--warn); }
.bell-empty { padding: 20px 16px; color: var(--ok); font-weight: 500; }

#layout { display: flex; flex: 1; min-height: 0; }

/* ------- Sidebar ------- */

#sidebar {
  width: 250px; flex: none; background: var(--panel-2); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 10px 9px 20px;
}
.nav-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--brass-deep); padding: 14px 10px 6px; font-weight: 500;
}
.nav-item {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  border: 0; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: var(--radius); color: var(--txt);
  border-left: 2px solid transparent; margin-bottom: 1px; transition: background 0.12s;
}
.nav-item:hover { background: #ece6d4; }
.nav-item.active { background: var(--accent-soft); border-left-color: var(--brass); font-weight: 500; color: var(--green-800); }
.nav-ico { width: 16px; text-align: center; color: var(--brass-deep); flex: none; }
.nav-proj-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.nav-proj-name { font-size: 12.5px; line-height: 1.3; }
.nav-proj-sub { font-size: 10.5px; color: var(--txt-dim); letter-spacing: 0.03em; }
.nav-proj-bar { height: 3px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.nav-proj-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-600), var(--brass)); }
.nav-empty { padding: 8px 12px; color: var(--txt-dim); font-size: 12px; }
.nav-section-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-add {
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  color: var(--green-700); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  padding: 2px 9px; text-transform: uppercase;
}
.nav-add:hover { border-color: var(--brass); background: var(--brass-soft); color: var(--brass-deep); }

/* ------- Main ------- */

#main { flex: 1; min-width: 0; overflow: auto; padding: 18px 20px 34px; }
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.sect-title {
  margin: 22px 0 10px; font-family: var(--serif); font-size: 17px; font-weight: 600;
  letter-spacing: 0.02em; color: var(--green-800);
  display: flex; align-items: center; gap: 8px;
}
.sect-title.grp-late { color: var(--bad); }
.sect-title.grp-done { color: var(--ok); }
.count-pill {
  background: var(--brass-soft); border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 1px 9px; font-size: 11px; font-family: var(--font);
  color: var(--brass-deep); letter-spacing: 0;
}

/* ================= PROJECT HEADER ================= */

.proj-head {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  border-top: 2px solid var(--brass);
  padding: 16px 18px 0; margin-bottom: 12px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 20px;
}
.proj-sub { color: var(--txt-dim); margin-top: 4px; font-size: 12.5px; }
.proj-edit {
  font-family: var(--font); font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 10px;
  vertical-align: 6px; margin-left: 10px; color: var(--green-700); background: var(--panel);
}
.proj-edit:hover { border-color: var(--brass); background: var(--brass-soft); color: var(--brass-deep); }
.proj-kpis { display: flex; gap: 10px; align-items: center; }
.kpi {
  min-width: 78px; text-align: center; padding: 7px 10px;
  border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel-2);
}
.kpi b { display: block; font-family: var(--serif); font-size: 20px; color: var(--green-800); }
.kpi span { font-size: 9.5px; color: var(--txt-dim); text-transform: uppercase; letter-spacing: 0.14em; }
.kpi-bad { background: var(--bad-soft); border-color: #dcb4a6; }
.kpi-bad b { color: var(--bad); }
.kpi-pct { min-width: 100px; }
.proj-tabs { grid-column: 1 / -1; display: flex; gap: 3px; margin-top: 12px; }
.ptab {
  border: 1px solid var(--line); border-bottom: 0; background: var(--panel-2);
  padding: 8px 20px; border-radius: 6px 6px 0 0; color: var(--txt-dim);
  font-weight: 500; letter-spacing: 0.04em;
}
.ptab.active {
  background: var(--panel); color: var(--green-800); font-weight: 600;
  border-bottom: 2px solid var(--panel); margin-bottom: -1px;
  box-shadow: inset 0 2px 0 var(--brass);
}

/* ================= TOOLBAR ================= */

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 9px 11px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.tb-title { color: var(--txt-dim); padding-left: 4px; }
.tb-input, .tb-select {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 9px;
  background: #fffef9; min-width: 132px;
}
.tb-input:focus, .tb-select:focus { outline: 2px solid var(--brass-soft); border-color: var(--brass); }
.btn {
  border: 1px solid var(--line); background: #fffef9; border-radius: var(--radius);
  padding: 6px 14px; font-weight: 500; color: var(--green-800);
  letter-spacing: 0.03em; transition: all 0.15s;
}
.btn:hover { border-color: var(--brass); color: var(--brass-deep); background: var(--brass-soft); }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #f4efe2; }
.btn-primary:hover { background: var(--green-800); border-color: var(--brass); color: #f4efe2; }
.btn-danger { background: #fffef9; border-color: #d3ac9e; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-sm { padding: 3px 11px; font-size: 11.5px; }

/* ================= REGISTER GRID + GANTT ================= */

.register-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: auto; max-height: calc(100vh - 295px); box-shadow: var(--shadow);
}
.register { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.register th, .register td {
  border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft);
  padding: 5px 9px; text-align: left; white-space: nowrap; vertical-align: middle;
  background: var(--panel); height: 34px;
}
.register thead th {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--panel-2), #ece5d1);
  border-bottom: 2px solid var(--brass);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--green-800); font-weight: 600;
}
.c-sn { width: 36px; min-width: 36px; text-align: center !important; color: var(--txt-dim); }
.sticky-num { position: sticky; left: 36px; z-index: 3; min-width: 152px; box-shadow: inset -1px 0 0 var(--line-soft); }
td.c-sn, th.c-sn { position: sticky; left: 0; z-index: 3; }
.sticky-name { position: sticky; left: 188px; z-index: 3; min-width: 240px; max-width: 300px;
  overflow: hidden; text-overflow: ellipsis; box-shadow: inset -2px 0 0 var(--line); }
.register thead .c-sn, .register thead .sticky-num, .register thead .sticky-name { z-index: 7; }
.c-rev { width: 44px; }
.c-date { width: 84px; font-variant-numeric: tabular-nums; }
.c-slip { width: 52px; text-align: center !important; font-variant-numeric: tabular-nums; }
.slip-late { color: var(--bad); font-weight: 600; }
.slip-early { color: var(--ok); font-weight: 500; }
.slip-ontime { color: var(--txt-dim); }
.c-code { min-width: 118px; }
.c-prog { min-width: 108px; }
.c-status { min-width: 96px; }
.c-prio { min-width: 72px; }
.c-remark { max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: var(--txt-dim); }
.c-assign { min-width: 140px; }
.c-groupmeta { color: var(--txt-dim); font-size: 11.5px; }

.row-bld td { background: var(--row-bld); font-weight: 600; cursor: pointer; border-bottom-color: var(--line); }
.row-bld td.sticky-num { font-family: var(--serif); font-size: 15px; color: var(--green-900); }
.row-disc td { background: var(--row-disc); cursor: pointer; }
.row-disc td.sticky-name, .row-disc td.sticky-num { font-weight: 600; color: var(--green-700); letter-spacing: 0.04em; }
.row-doc { cursor: pointer; }
.row-doc:hover td { background: #f3efdf; }
.row-late td { background: #f8efe8; }
.row-late:hover td { background: #f5e7dc; }
.row-mine td.sticky-name { box-shadow: inset -2px 0 0 var(--line), inset 3px 0 0 var(--brass); }
.bld-type {
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em;
  background: rgba(169, 133, 58, 0.16); border-radius: 3px; padding: 2px 7px; color: var(--brass-deep);
}
.empty-row { padding: 28px !important; text-align: center; color: var(--txt-dim); background: var(--panel); border: 0; }
.row-btn {
  border: 0; background: transparent; color: var(--txt-dim); border-radius: 3px;
  padding: 1px 5px; font-size: 12px; vertical-align: middle;
}
.row-btn:hover { background: rgba(169, 133, 58, 0.18); color: var(--brass-deep); }
.dlv-tag { color: var(--brass); font-size: 11px; margin-left: 4px; cursor: help; }
.doc-link {
  display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 3px;
  color: var(--green-700); background: var(--accent-soft); border: 1px solid #cfd9cc;
  font-weight: 600; font-size: 11.5px; text-decoration: none; line-height: 1.5;
}
.doc-link:hover { background: var(--brass-soft); border-color: var(--brass); color: var(--brass-deep); }

/* ------- Gantt cells ------- */

.c-gantt {
  width: var(--gantt-w); min-width: var(--gantt-w); max-width: var(--gantt-w);
  position: relative; padding: 0 !important; overflow: hidden;
}
.th-gantt { height: 34px; }
.g-month {
  position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line);
  padding: 9px 0 0 6px; font-size: 10px; color: var(--green-800); overflow: hidden;
  letter-spacing: 0.08em;
}
.g-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; opacity: 0.8; }
.g-today i {
  position: absolute; top: 1px; left: 3px; font-style: normal; font-size: 8.5px;
  color: var(--bad); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.g-bar {
  position: absolute; top: 50%; transform: translateY(-50%); height: 14px;
  background: var(--gantt-bar-bg); border: 1px solid var(--gantt-bar-border);
  border-radius: 3px; overflow: hidden; z-index: 1;
}
.g-bar i { display: block; height: 100%; background: var(--gantt-fill); }
.g-late { border-color: var(--gantt-late); background: #f0d9cf; }
.g-late i { background: var(--gantt-late); }
.g-summary {
  position: absolute; top: 50%; transform: translateY(-50%); height: 7px;
  background: var(--green-800); border-radius: 2px; z-index: 1;
}
.g-summary::before, .g-summary::after {
  content: ''; position: absolute; bottom: -4px; border: 5px solid transparent; border-top-color: var(--green-800);
}
.g-summary::before { left: -1px; }
.g-summary::after { right: -1px; }
.g-actual { position: absolute; top: 50%; transform: translate(-50%, -50%); color: var(--ok); font-size: 12px; z-index: 2; }

.legend {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 9px 4px 0; color: var(--txt-dim); font-size: 11.5px;
}
.legend .lg { display: inline-block; width: 22px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
.lg-bar { background: var(--gantt-bar-bg); border: 1px solid var(--gantt-bar-border); }
.lg-fill { background: var(--gantt-fill); }
.lg-late { background: #f0d9cf; border: 1px solid var(--gantt-late); }
.lg-diamond { color: var(--ok); }
.lg-today-s { color: var(--bad); font-weight: 600; }
.lg-planned { background: transparent; border-bottom: 2px dashed var(--brass); height: 2px !important; border-radius: 0; }
.lg-actual { background: var(--green-700); height: 3px !important; border-radius: 0; }

/* ================= BADGES & CELLS ================= */

.badge {
  display: inline-block; font-size: 10px; font-weight: 600; border-radius: 3px;
  padding: 2px 8px; letter-spacing: 0.08em; white-space: nowrap; text-transform: uppercase;
}
.code-0 { background: var(--ok-soft); color: var(--ok); }
.code-1 { background: var(--accent-soft); color: var(--green-700); }
.code-2 { background: var(--warn-soft); color: var(--warn); }
.code-3 { background: var(--bad-soft); color: var(--bad); }
.code-4 { background: #ebe6f0; color: #6a5a8c; }
.st-ns   { background: #ece9df; color: var(--txt-dim); }
.st-wip  { background: var(--accent-soft); color: var(--green-700); }
.st-rev  { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-hold { background: #ebe6f0; color: #6a5a8c; }
.st-overdue { background: var(--bad); color: #fdf6ef; }
.pr-high { background: var(--bad-soft); color: var(--bad); }
.pr-med  { background: var(--warn-soft); color: var(--warn); }
.pr-low  { background: #ece9df; color: var(--txt-dim); }
.rl-super { background: var(--green-900); color: #ecdfb9; }
.rl-mgr   { background: var(--brass-soft); color: var(--brass-deep); }
.rl-jr    { background: #ece9df; color: var(--txt-dim); }

.pcell { display: flex; align-items: center; gap: 7px; min-width: 92px; }
.pcell span { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--txt-dim); width: 32px; }
.pbar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; min-width: 46px; }
.pbar i { display: block; height: 100%; border-radius: 4px; background: var(--green-600); transition: width 0.3s; }
.pbar-lg { height: 10px; margin: 9px 0 5px; }
.pbar .p-100 { background: var(--ok); }
.pbar .p-80 { background: var(--green-600); }
.pbar .p-50 { background: linear-gradient(90deg, var(--green-600), var(--brass)); }
.pbar .p-20 { background: var(--brass); }
.pbar .p-0 { background: transparent; }
.pbar .p-late { background: var(--gantt-late); }

.assignee { display: inline-flex; align-items: center; gap: 6px; }
.mini-avatar {
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--brass-soft); color: var(--brass-deep); border: 1px solid rgba(169, 133, 58, 0.4);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8.5px; font-weight: 600; font-style: normal; flex: none;
}
.unassigned { color: var(--warn); font-style: italic; }

/* ================= PLAIN TABLES ================= */

.table-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: auto; box-shadow: var(--shadow);
}
.plain-table { border-collapse: collapse; width: 100%; }
.plain-table th, .plain-table td {
  border-bottom: 1px solid var(--line-soft); padding: 6px 11px; text-align: left; white-space: nowrap;
}
.plain-table th {
  background: linear-gradient(var(--panel-2), #ece5d1);
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--green-800); border-bottom: 2px solid var(--brass);
  position: sticky; top: 0; font-weight: 600;
}
.plain-table .c-name { white-space: normal; min-width: 220px; }
.plain-table tr:last-child td { border-bottom: 0; }

/* ================= DASHBOARD ================= */

.dash-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dcard {
  flex: 1; min-width: 122px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 13px 15px; box-shadow: var(--shadow);
  border-top: 2px solid var(--brass);
}
.dcard-n { font-family: var(--serif); font-size: 27px; font-weight: 600; display: block; color: var(--green-900); }
.dcard-l { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--txt-dim); }
.dcard-ok { border-top-color: var(--ok); }
.dcard-ok .dcard-n { color: var(--ok); }
.dcard-bad { border-top-color: var(--bad); background: #faf3ec; }
.dcard-bad .dcard-n { color: var(--bad); }
.dcard-warn { border-top-color: var(--warn); }
.dcard-warn .dcard-n { color: var(--warn); }

.dash-duo { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; margin-bottom: 6px; }
.panel-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; box-shadow: var(--shadow); min-width: 0;
}
.panel-card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }

.s-curve { width: 100%; height: auto; display: block; }
.sc-grid { stroke: var(--line-soft); stroke-width: 1; }
.sc-lbl { fill: var(--txt-dim); font-size: 9.5px; font-family: var(--font); }
.sc-today { stroke: var(--bad); stroke-width: 1.5; opacity: 0.75; }
.sc-planned { fill: none; stroke: var(--brass); stroke-width: 2; stroke-dasharray: 5 4; }
.sc-actual { fill: none; stroke: var(--green-700); stroke-width: 2.5; }

.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px;
  border-bottom: 1px dashed var(--line-soft); font-size: 12.5px;
}
.feed-item:last-child { border-bottom: 0; }
.feed-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.feed-note { color: var(--txt-dim); font-style: italic; }
.feed-when { color: var(--txt-dim); font-size: 11px; flex: none; }

.proj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 12px; }
.proj-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow); transition: all 0.18s;
  border-top: 2px solid var(--brass);
}
.proj-card:hover { border-color: var(--brass); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(30, 42, 32, 0.18); }
.proj-card h3 { font-size: 18px; }
.proj-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.proj-card-pct { font-family: var(--serif); font-size: 25px; font-weight: 600; color: var(--green-800); }
.proj-card-discs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.disc-pill {
  font-size: 10.5px; background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 2px 9px; color: var(--txt-dim); letter-spacing: 0.04em;
}
.disc-pill b { color: var(--green-700); }
.proj-card-alert { margin-top: 9px; color: var(--bad); font-weight: 500; font-size: 12px; }
.all-clear {
  background: var(--ok-soft); border: 1px solid #bcd4bb; color: var(--ok);
  padding: 15px; border-radius: var(--radius-lg); font-weight: 500;
}

/* ================= TEAM ================= */

.team-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 15px 17px; margin-bottom: 14px; box-shadow: var(--shadow);
  border-left: 2px solid var(--brass);
}
.team-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.team-meta { display: flex; flex-direction: column; line-height: 1.35; }
.team-meta b { font-family: var(--serif); font-size: 17px; color: var(--green-900); }
.team-stats { display: flex; gap: 8px; margin-left: auto; }
.tstat {
  min-width: 66px; text-align: center; border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 5px 8px; background: var(--panel-2);
}
.tstat b { display: block; font-family: var(--serif); font-size: 17px; color: var(--green-800); }
.tstat span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--txt-dim); }
.tstat-bad { background: var(--bad-soft); border-color: #dcb4a6; }
.tstat-bad b { color: var(--bad); }
.team-card .pbar { margin: 11px 0; }
.team-card .table-wrap { border: 1px solid var(--line-soft); box-shadow: none; max-height: 260px; border-radius: var(--radius); }

/* ================= DELIVERABLES ================= */

.dlv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 12px; }
.dlv-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; box-shadow: var(--shadow); border-top: 2px solid var(--brass);
}
.dlv-late { border-left: 3px solid var(--bad); }
.dlv-head { display: flex; justify-content: space-between; gap: 10px; }
.dlv-pct { font-family: var(--serif); font-size: 23px; font-weight: 600; color: var(--green-800); display: flex; gap: 6px; align-items: baseline; }
.dlv-docs { margin-top: 6px; }
.dlv-doc {
  display: flex; align-items: center; gap: 9px; padding: 5px 2px;
  border-bottom: 1px dashed var(--line-soft); font-size: 12px;
}
.dlv-doc:last-child { border-bottom: 0; }
.dlv-doc-num { font-variant-numeric: tabular-nums; color: var(--txt-dim); flex: none; }
.dlv-doc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlv-doc-pct { font-weight: 600; width: 38px; text-align: right; color: var(--green-800); }

/* ================= ADMIN / DATA ================= */

.data-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.data-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 17px; box-shadow: var(--shadow); border-top: 2px solid var(--brass);
}
.data-card p { margin: 8px 0 14px; }

/* ================= MODALS ================= */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(14, 27, 20, 0.55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px;
  animation: fadein 0.15s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel); border-radius: var(--radius-lg); width: 480px; max-width: 100%;
  max-height: 86vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(169, 133, 58, 0.4);
  animation: pop 0.16s ease-out;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-wide { width: 680px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(var(--panel), var(--panel-2));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: inset 0 2px 0 var(--brass);
}
.modal-head h3 { color: var(--green-900); font-size: 19px; }
.modal-x { border: 0; background: transparent; font-size: 14px; color: var(--txt-dim); padding: 4px 8px; border-radius: 3px; }
.modal-x:hover { background: var(--line-soft); }
.modal-body { padding: 17px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--line-soft); align-items: center;
}
.confirm-msg { margin: 4px 0 12px; line-height: 1.55; }
.doc-summary {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 10px 13px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 2px;
  border-left: 2px solid var(--brass);
}
.auto-hint {
  margin-top: 14px; padding: 8px 12px; border-radius: var(--radius);
  background: var(--brass-soft); border: 1px dashed var(--brass);
  color: var(--brass-deep); font-size: 11.5px; line-height: 1.5;
}

.form-sect {
  font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--green-800);
  margin: 16px 0 9px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft);
}
.form-sect:first-child { margin-top: 0; }
.adv-opts {
  margin-top: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--panel-2); padding: 0 13px 0;
}
.adv-opts[open] { padding-bottom: 13px; }
.adv-opts summary {
  cursor: pointer; padding: 10px 0; font-weight: 500; color: var(--green-700);
  letter-spacing: 0.03em; user-select: none;
}
.adv-opts summary:hover { color: var(--brass-deep); }
.adv-opts .form-grid { margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 15px; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld-full { grid-column: 1 / -1; }
.fld > span { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--brass-deep); }
.fld input, .fld select, .fld textarea {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; background: #fffef9; width: 100%;
}
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid var(--brass-soft); border-color: var(--brass); }
.fld textarea { resize: vertical; }
.check-list {
  display: flex; flex-wrap: wrap; gap: 7px 16px; border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 10px 12px; background: var(--panel-2); margin-top: 4px;
}
.check-item { display: flex; align-items: center; gap: 6px; }
.check-item input { accent-color: var(--green-700); }

.mini-table { border-collapse: collapse; width: 100%; }
.mini-table th, .mini-table td { border-bottom: 1px solid var(--line-soft); padding: 6px 9px; text-align: left; font-size: 12px; }
.mini-table th { color: var(--brass-deep); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; }

/* ================= EMPTY / TOASTS ================= */

.empty-state { text-align: center; padding: 70px 20px; color: var(--txt-dim); }
.empty-state h2 { color: var(--green-800); margin-bottom: 8px; }

#toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--green-900); color: #f4efe2; border-radius: var(--radius);
  border-left: 2px solid var(--brass);
  padding: 10px 17px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: all 0.25s; font-weight: 500; letter-spacing: 0.02em;
}
.toast.show { opacity: 1; transform: none; }

/* ================= TOPBAR EXTRAS ================= */

#btn-menu {
  display: none; border: 1px solid rgba(244, 239, 226, 0.3); background: transparent;
  color: #f4efe2; border-radius: var(--radius); width: 36px; height: 36px; font-size: 16px;
  flex: none; align-items: center; justify-content: center;
}
#cloud-dot {
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em; color: #7fd39a;
  border: 1px solid rgba(127, 211, 154, 0.45); border-radius: 10px; padding: 3px 10px;
  white-space: nowrap;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1000px) {
  .dash-duo { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .proj-head { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ------- Phone layout: sidebar becomes a slide-over drawer ------- */
@media (max-width: 768px) {
  #btn-menu { display: flex; }
  .brand-sub, .brand-rule { display: none; }
  .brand-name { font-size: 17px; letter-spacing: 0.2em; }
  .chip-meta { display: none; }
  #topbar { gap: 10px; padding: 0 12px; }
  #cloud-dot { padding: 3px 7px; }

  #sidebar {
    position: fixed; top: 56px; bottom: 0; left: 0; width: min(290px, 84vw);
    transform: translateX(-105%); transition: transform 0.22s ease-out;
    z-index: 70; box-shadow: 8px 0 30px rgba(14, 27, 20, 0.35);
  }
  body.nav-open #sidebar { transform: none; }
  body.nav-open #main::after {
    content: ''; position: fixed; inset: 56px 0 0 0;
    background: rgba(14, 27, 20, 0.35); z-index: 60;
  }
  #main { padding: 12px 12px 28px; }

  .proj-kpis { flex-wrap: wrap; }
  .kpi { min-width: 66px; padding: 5px 8px; }
  .dcard { min-width: 100px; padding: 10px 12px; }
  .dcard-n { font-size: 21px; }
  .proj-cards, .dlv-grid, .data-cards { grid-template-columns: 1fr; }
  .team-stats { margin-left: 0; width: 100%; }

  .sticky-name { min-width: 170px; max-width: 200px; left: 150px; }
  .sticky-num { min-width: 114px; }
  .register-wrap { max-height: none; }

  #bell-panel { position: fixed; top: 54px; right: 8px; left: 8px; width: auto; }

  .modal, .modal-wide { width: 100%; max-height: 92vh; }
  .modal-backdrop { padding: 3vh 8px; }
  .modal-body { padding: 14px; }
  .modal-foot { flex-wrap: wrap; }
  .toolbar { padding: 8px; }
  .tb-input, .tb-select { min-width: 0; flex: 1 1 44%; }
}

/* ------- Touch devices: bigger hit areas ------- */
@media (pointer: coarse) {
  .row-btn { padding: 6px 9px; font-size: 13px; }
  .btn { padding: 9px 15px; }
  .nav-item { padding: 11px 10px; }
  .bell-item { padding: 12px 16px; }
  .register th, .register td { height: 40px; }
}
