/* =====================================================================
   Ecocoast Operations Portal — theme
   Brand tokens live here. Adjust these to fine-tune colours.
   ===================================================================== */
:root {
  --deep: #0b2b4c;        /* Deep Sea — navigation, headings */
  --deep-2: #12385f;
  --ocean: #0077b6;       /* Ocean — primary actions, links */
  --ocean-600: #00639a;
  --ocean-50: #e6f2f9;
  --lagoon: #00a19a;      /* Lagoon teal — in progress */
  --lagoon-50: #e0f5f3;
  --kelp: #5fae32;        /* Kelp green — done / eco */
  --kelp-50: #edf7e6;
  --buoy: #ee7f1b;        /* Buoy orange — attention / overdue */
  --buoy-50: #fdf0e3;
  --coral: #d64545;       /* Critical */
  --coral-50: #fbe9e9;
  --sand: #f3f6f8;        /* App background (cool, sea-mist) */
  --surface: #ffffff;
  --line: #dde5ec;
  --line-2: #eef2f6;
  --ink: #102233;
  --ink-2: #4a5d70;
  --ink-3: #7b8c9c;
  --shadow: 0 1px 2px rgba(11, 43, 76, .06), 0 4px 16px rgba(11, 43, 76, .05);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar: 248px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

[data-theme='dark'] {
  --sand: #0a1724;
  --surface: #0f2133;
  --line: #1e3449;
  --line-2: #172b3e;
  --ink: #e6eef5;
  --ink-2: #a9bccd;
  --ink-3: #7690a7;
  --ocean-50: #0d2f47;
  --lagoon-50: #0b3533;
  --kelp-50: #1a3320;
  --buoy-50: #3a2614;
  --coral-50: #3b1c1f;
  --deep: #07192b;
  --deep-2: #0e2740;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--sand);
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ocean); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 8px; }
:focus-visible { outline: 2px solid var(--ocean); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hidden { display: none !important; }

/* =========================== Login =========================== */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
  background: var(--surface);
}
.login-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(170deg, #0b2b4c 0%, #0a3b66 55%, #005f8f 100%);
  color: #fff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-hero .brand-lockup { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.login-hero .brand-lockup img { max-height: 40px; }
.login-hero h1 { color: #fff; font-size: clamp(30px, 3.6vw, 46px); font-weight: 800; line-height: 1.08; max-width: 12em; letter-spacing: -.025em; }
.login-hero p { color: rgba(255, 255, 255, .78); font-size: 16px; max-width: 30em; margin-top: 16px; }
.login-hero .facts { display: flex; gap: 36px; position: relative; z-index: 2; }
.login-hero .facts b { display: block; font-size: 26px; font-weight: 800; }
.login-hero .facts span { color: rgba(255, 255, 255, .7); font-size: 13px; }
.tides { position: absolute; left: 0; right: 0; bottom: 0; height: 46%; pointer-events: none; }
.tides svg { position: absolute; bottom: 0; width: 200%; height: 100%; }
.tides .t1 { animation: drift 26s linear infinite; opacity: .16; }
.tides .t2 { animation: drift 38s linear infinite reverse; opacity: .12; bottom: -14px; }
.tides .t3 { animation: drift 54s linear infinite; opacity: .10; bottom: -28px; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tides svg { animation: none !important; } }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.login-form .muted { margin-bottom: 28px; }
.login-form .btn { width: 100%; justify-content: center; height: 44px; font-size: 15px; }
.login-form .field input { height: 44px; font-size: 15px; }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--ink-3); }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { min-height: 260px; padding: 28px; }
  .login-hero .facts { display: none; }
}

/* =========================== Shell =========================== */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--deep);
  color: #c9d8e6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.sidebar .brand img { max-height: 30px; max-width: 150px; }
.sidebar .brand small { display: block; font-weight: 500; font-size: 11px; color: #8fb1cc; letter-spacing: 0; }
.nav { padding: 6px 10px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav .group { font-size: 11px; color: #7f9db8; padding: 16px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: #c9d8e6; font-weight: 600; font-size: 13.5px;
  text-decoration: none; position: relative;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(0, 161, 154, .16); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--kelp); }
.nav a .count { margin-left: auto; background: var(--buoy); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.sidebar .me { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; gap: 10px; align-items: center; }
.sidebar .me .who { flex: 1; min-width: 0; }
.sidebar .me b { color: #fff; display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me span { font-size: 12px; color: #8fb1cc; }
.sidebar .me button { color: #8fb1cc; }
.sidebar .me button:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 28px;
  background: color-mix(in srgb, var(--sand) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; }
.search > svg { position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; color: var(--ink-3); }
.search .results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 420px; overflow: auto; z-index: 50; }
.search .results a { display: flex; gap: 10px; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line-2); text-decoration: none; }
.search .results a:hover, .search .results a.sel { background: var(--ocean-50); }
.search .results .k { font-size: 11px; color: var(--ink-3); width: 82px; flex: none; padding-top: 2px; }
.topbar .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--buoy); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 18px; position: relative; }
.page-head::after { /* tide line */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='6' viewBox='0 0 60 6'%3E%3Cpath d='M0 3 Q15 0 30 3 T60 3' fill='none' stroke='%2300a19a' stroke-opacity='.45' stroke-width='1.4'/%3E%3C/svg%3E") repeat-x;
}
.page-head .titles { flex: 1; min-width: 220px; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.crumbs { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }

/* =========================== Controls =========================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 13px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #c2d0dc; text-decoration: none; background: var(--line-2); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--ocean); border-color: var(--ocean); color: #fff; }
.btn.primary:hover { background: var(--ocean-600); }
.btn.success { background: var(--kelp); border-color: var(--kelp); color: #fff; }
.btn.warn { background: var(--buoy); border-color: var(--buoy); color: #fff; }
.btn.danger { color: var(--coral); }
.btn.danger.solid { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
input, select, textarea {
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); padding: 8px 11px; min-height: 38px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ocean); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ocean) 18%, transparent); }
input[type='checkbox'] { width: 17px; height: 17px; min-height: 0; accent-color: var(--kelp); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { background: var(--coral-50); color: var(--coral); border-radius: 8px; padding: 9px 12px; font-weight: 600; font-size: 13px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 140px; height: 36px; min-height: 36px; padding: 0 10px; }
.filters input[type='search'] { min-width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 34px; font: inherit; font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button svg { width: 15px; height: 15px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--deep); color: #fff; }

/* =========================== Panels =========================== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel > header h2 { font-size: 14.5px; }
.panel > header .grow + * { margin-left: auto; }
.panel .body { padding: 16px 18px; }
.panel .body.flush { padding: 0; }

/* KPI strip: one panel, divided — not a row of identical cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line-2); position: relative; text-decoration: none; color: inherit; display: block; }
.kpi:last-child { border-right: 0; }
a.kpi:hover { background: var(--line-2); text-decoration: none; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi .l { color: var(--ink-2); font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.kpi .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.alert .v { color: var(--buoy); }
.kpi.crit .v { color: var(--coral); }
.kpi.good .v { color: var(--kelp); }

.grid { display: grid; gap: 18px; }
.g-dash { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-detail { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }

/* =========================== Tables =========================== */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--line-2); }
.t .ref { font-weight: 700; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.t .title { font-weight: 700; color: var(--ink); }
.t .title + .muted { font-size: 12px; }

/* =========================== Badges =========================== */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px 2px 8px; border-radius: 20px; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.s-open { background: var(--ocean-50); color: var(--ocean); }
.s-progress { background: var(--lagoon-50); color: var(--lagoon); }
.s-hold { background: var(--buoy-50); color: #c56510; }
.s-done { background: var(--kelp-50); color: #3f8a1c; }
.s-closed { background: var(--line-2); color: var(--ink-2); }
.s-cancel { background: var(--line-2); color: var(--ink-3); text-decoration: line-through; }
.s-bad { background: var(--coral-50); color: var(--coral); }
[data-theme='dark'] .s-hold { color: #f5a85b; }
[data-theme='dark'] .s-done { color: #8fd36a; }
.prio { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.prio i { display: inline-flex; gap: 2px; align-items: flex-end; }
.prio i b { width: 3px; border-radius: 1px; background: var(--line); }
.prio i b:nth-child(1) { height: 5px; } .prio i b:nth-child(2) { height: 8px; } .prio i b:nth-child(3) { height: 11px; } .prio i b:nth-child(4) { height: 14px; }
.p-low i b:nth-child(-n+1), .p-medium i b:nth-child(-n+2) { background: var(--ocean); }
.p-high i b:nth-child(-n+3) { background: var(--buoy); }
.p-critical i b { background: var(--coral); }
.p-critical { color: var(--coral); }
.due { white-space: nowrap; }
.due.over { color: var(--buoy); font-weight: 700; }
.role-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.role-tag::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--ocean)); }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; flex: none; background: var(--c, var(--ocean)); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

.progress { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; background: var(--kelp); border-radius: 4px; }
.progress.ocean > span { background: var(--ocean); }

/* =========================== Kanban =========================== */
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--line-2); border-radius: var(--radius); padding: 10px; min-height: 300px; display: flex; flex-direction: column; gap: 8px; }
.col h3 { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; font-size: 13px; }
.col h3 .n { color: var(--ink-3); font-weight: 600; }
.col.drop { outline: 2px dashed var(--ocean); outline-offset: -4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: grab; display: flex; flex-direction: column; gap: 7px; }
.card:hover { border-color: #b9cad8; }
.card.dragging { opacity: .5; }
.card .ref { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.card .t1 { font-weight: 700; font-size: 13px; line-height: 1.35; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.card .meta .grow { flex: 1; }
.card.overdue { border-left: 3px solid var(--buoy); }

/* =========================== Calendar =========================== */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--line-2); }
.cal .day { min-height: 112px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day .n { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.cal .day.other { background: color-mix(in srgb, var(--line-2) 50%, transparent); }
.cal .day.other .n { opacity: .5; }
.cal .day.today .n { color: #fff; background: var(--ocean); border-radius: 10px; padding: 0 7px; align-self: flex-start; }
.cal .ev { font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-left: 3px solid currentColor; }
.cal .more { font-size: 11px; color: var(--ink-3); padding-left: 6px; }

/* =========================== Detail =========================== */
.desc { white-space: pre-wrap; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done .txt { color: var(--ink-3); text-decoration: line-through; }
.checklist .txt { flex: 1; }
.checklist .by { font-size: 11.5px; color: var(--ink-3); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 0; }
.timeline li.sys { padding: 4px 0 4px 34px; font-size: 12.5px; color: var(--ink-3); }
.timeline li.sys b { color: var(--ink-2); font-weight: 600; }
.timeline .bubble { background: var(--line-2); border-radius: 10px; padding: 9px 12px; flex: 1; }
.timeline .bubble .who { font-size: 12.5px; font-weight: 700; display: flex; gap: 8px; }
.timeline .bubble .who time { color: var(--ink-3); font-weight: 500; }
.timeline .bubble p { margin: 3px 0 0; white-space: pre-wrap; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.file { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); position: relative; }
.file .thumb { height: 92px; background: var(--line-2); display: grid; place-items: center; color: var(--ink-3); }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .thumb svg { width: 30px; height: 30px; }
.file .nm { padding: 6px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .x { position: absolute; top: 4px; right: 4px; background: rgba(255, 255, 255, .9); width: 26px; height: 26px; }
.dropzone { border: 1.5px dashed var(--line); border-radius: 8px; padding: 14px; text-align: center; color: var(--ink-3); cursor: pointer; font-weight: 600; }
.dropzone:hover, .dropzone.over { border-color: var(--ocean); color: var(--ocean); background: var(--ocean-50); }
.status-steps { display: flex; gap: 0; margin: 4px 0 2px; }
.status-steps span { flex: 1; height: 5px; background: var(--line-2); margin-right: 3px; border-radius: 3px; }
.status-steps span.on { background: var(--lagoon); }
.status-steps span.done { background: var(--kelp); }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--buoy-50); color: #9a4f0b; font-weight: 600; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: var(--ocean-50); color: var(--ocean); }
.notice.bad { background: var(--coral-50); color: var(--coral); }
[data-theme='dark'] .notice { color: #f5a85b; }

/* Permission matrix */
.perm-group { margin-bottom: 14px; }
.perm-group h4 { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.perm { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.tick { color: var(--kelp); font-weight: 800; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list li a.fill { color: inherit; display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; text-decoration: none; }
.list .ttl { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .min { min-width: 0; flex: 1; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty svg { width: 36px; height: 36px; opacity: .5; margin-bottom: 8px; }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; }

.proj-card { display: block; padding: 16px 18px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.proj-card:hover { background: var(--line-2); text-decoration: none; }

/* =========================== Overlays =========================== */
.modal-back { position: fixed; inset: 0; background: rgba(7, 25, 43, .45); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 640px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(7, 25, 43, .3); animation: pop .16s ease-out; }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 860px; }
.modal header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal header h2 { flex: 1; font-size: 17px; }
.modal .mbody { padding: 18px 20px; overflow: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--deep); color: #fff; padding: 11px 16px; border-radius: 9px; font-weight: 600; box-shadow: var(--shadow); max-width: 380px; border-left: 4px solid var(--kelp); animation: pop .16s ease-out; }
.toast.err { border-left-color: var(--coral); }
.drop-menu { position: absolute; right: 0; top: 44px; width: 380px; max-height: 480px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px rgba(7, 25, 43, .18); z-index: 60; }
.drop-menu header { display: flex; padding: 12px 16px; border-bottom: 1px solid var(--line-2); align-items: center; }
.drop-menu .n-item { display: block; padding: 11px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.drop-menu .n-item:hover { background: var(--line-2); }
.drop-menu .n-item.unread { background: var(--ocean-50); }
.drop-menu .n-item b { display: block; font-size: 13px; }
.drop-menu .n-item span { font-size: 12.5px; color: var(--ink-2); }
.drop-menu .n-item time { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.cred-box { background: var(--line-2); padding: 12px 14px; border-radius: 8px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; user-select: all; }

/* =========================== Responsive =========================== */
@media (max-width: 1100px) {
  .g-dash, .g-detail { grid-template-columns: 1fr; }
  .g-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  .app.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(7, 25, 43, .4); }
  .topbar { padding: 10px 14px; }
  .topbar .menu-btn { display: inline-grid; }
  .content { padding: 16px 14px 40px; }
  .g-2, .g-3, .form-grid { grid-template-columns: 1fr; }
  .kpi .v { font-size: 24px; }
  .t .hide-sm { display: none; }
  .drop-menu { position: fixed; left: 10px; right: 10px; width: auto; top: 60px; }
  .filters select, .filters input { flex: 1 1 140px; }
}

/* =========================== Print (report export) =========================== */
@media print {
  .sidebar, .topbar, .no-print, .btn, .filters { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .panel { break-inside: avoid; border-color: #ccc; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---- refinements after visual QA ---- */
.app { background: linear-gradient(to right, var(--deep) var(--sidebar), transparent 0); }
.grid > *, .stack > * { min-width: 0; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.filters input[type='checkbox'] { min-width: 0; width: 17px; height: 17px; min-height: 0; padding: 0; flex: none; }
.board { grid-template-columns: repeat(5, minmax(210px, 1fr)); }
.card .meta { min-width: 0; }
.card .meta .person { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 820px) {
  .app { background: none; }
  .list li a.fill { flex-wrap: wrap; row-gap: 6px; }
  .list li a.fill .min { flex-basis: 100%; }
  .t td, .t th { padding: 10px 10px; }
  .t .hide-xs { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-bottom: 1px solid var(--line-2); }
  .page-head .seg { order: 3; }
}

/* Ecocoast wordmark logo */
.login-hero .brand-lockup img.wordmark { height: 44px; max-height: none; width: auto; }
.sidebar .brand.brand-wordmark { display: block; padding: 22px 20px 18px; }
.sidebar .brand.brand-wordmark img { height: 26px; max-height: none; max-width: none; width: auto; display: block; }
.sidebar .brand.brand-wordmark small { margin-top: 8px; }

/* Theme-aware logo in the top bar (mobile, where the sidebar is hidden) */
.topbar .top-logo { display: none; flex: none; }
.topbar .top-logo img { height: 22px; width: auto; display: block; }
.topbar .top-logo .for-dark { display: none; }
[data-theme='dark'] .topbar .top-logo .for-light { display: none; }
[data-theme='dark'] .topbar .top-logo .for-dark { display: block; }
@media (max-width: 820px) { .topbar .top-logo { display: block; } .topbar .search { max-width: none; } }
