:root {
  --bg: #eef2f6;
  --shell: #f7f8fb;
  --card: #ffffff;
  --ink: #142033;
  --muted: #6b778c;
  --line: #e6ebf2;
  --navy: #101828;
  --navy-2: #172033;
  --mint: #1fad74;
  --mint-soft: #e7f8f0;
  --mint-2: #149463;
  --danger: #e11d48;
  --warn: #d97706;
  --shadow: 0 18px 40px rgba(16, 24, 40, .08);
  --sidebar: 248px;
  --radius: 22px;
}
html[data-theme="dark"] {
  --bg: #0b1220;
  --shell: #0f172a;
  --card: #162033;
  --ink: #e8eef8;
  --muted: #93a0b8;
  --line: #243049;
  --navy: #0b1220;
  --navy-2: #111a2e;
  --mint-soft: #123528;
  --shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
html[data-look="harbour"] {
  --bg: #f3efe6;
  --shell: #faf6ef;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #6f655b;
  --line: #e4d8c4;
  --navy: #143d3a;
  --navy-2: #1d524e;
  --mint: #0f6e6a;
  --mint-soft: #e4f3f1;
  --mint-2: #0b5552;
  --radius: 10px;
  --shadow: 0 12px 28px rgba(20, 61, 58, .08);
}
html[data-look="harbour"][data-theme="dark"] {
  --bg: #10211f;
  --shell: #16302c;
  --card: #1c3a36;
  --ink: #f3ecdf;
  --muted: #cbbfaa;
  --line: #2c4d48;
  --navy: #0c1917;
  --navy-2: #14302c;
  --mint: #7dcec6;
  --mint-soft: #1e3f3b;
  --mint-2: #b7ebe4;
  --shadow: 0 16px 36px rgba(0, 0, 0, .35);
}
html[data-look="harbour"] body { font-family: "Source Sans 3", sans-serif; }
html[data-look="harbour"] h1,
html[data-look="harbour"] h2,
html[data-look="harbour"] h3,
html[data-look="harbour"] .brand strong { font-family: Fraunces, serif; font-weight: 560; }
html[data-look="harbour"] .sidebar nav a.active { color: var(--mint-2); }
html[data-look="harbour"] .sidebar nav a:hover { background: rgba(15, 110, 106, .1); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.choice-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--card); }
.choice-card.on { outline: 2px solid var(--mint); }
.swatch { display: flex; height: 36px; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.swatch span { flex: 1; }
.lh-mini { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 8px; font-size: 12px; }
.lh-mini .bar { background: var(--navy); color: #fff; padding: 8px; }
.lh-mini .mid { text-align: center; padding: 8px; border-bottom: 3px solid var(--mint); }
.lh-mini .split { display: flex; justify-content: space-between; padding: 8px; border-bottom: 1px solid var(--ink); }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.app-body { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar);
  background: var(--shell);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .28s ease;
}
.sidebar.collapsed { width: 88px; }
.sidebar.collapsed span, .sidebar.collapsed small, .sidebar.collapsed .collapse span { display: none; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand strong { display: block; font-size: 18px; }
.brand small { color: var(--muted); font-size: 11px; line-height: 1.3; display: block; max-width: 150px; }
.logo, .avatar {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--mint-soft); color: var(--mint-2); font-weight: 800;
  object-fit: cover;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.sidebar nav a, .collapse, .me {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px; color: #526075;
  border: 0; background: transparent; text-align: left; cursor: pointer;
}
html[data-theme="dark"] .sidebar nav a { color: #b7c3d8; }
.sidebar nav a.active { background: var(--mint-soft); color: #127a4d; font-weight: 700; }
.sidebar nav a i { transition: transform .25s ease; }
.sidebar nav a:hover { background: rgba(31, 173, 116, .08); }
.sidebar nav a:hover i { transform: translateX(3px) scale(1.12); }
.sidebar nav a.active i { animation: navpop .45s ease; }
@keyframes navpop { 50% { transform: scale(1.2); } }
.logo img { width: 28px; height: 28px; object-fit: contain; }
.menu-btn { display: none; }
.collapse { margin-top: auto; color: var(--muted); }
.me { margin-top: 8px; background: var(--card); border: 1px solid var(--line); }
.me small { display: block; color: var(--muted); }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px 0;
}
.topbar h1 { margin: 0; font-size: 22px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn, .branch-filter select, .btn, .ghost {
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 10px 12px; cursor: pointer;
}
.btn {
  background: var(--mint); color: white; border: 0; font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 173, 116, .25);
}
.btn.danger { background: var(--danger); }
.btn.slim, .ghost { box-shadow: none; font-weight: 600; }
.ghost { background: transparent; color: var(--ink); }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--mint-soft); color: var(--mint-2); }
.content { padding: 18px 28px 40px; animation: rise .45s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.grid-4, .grid-3, .grid-2 { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: 1.15fr 1fr .9fr .95fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.4fr .8fr; }
.dark-card, .light-card, .panel {
  border-radius: var(--radius); padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.dark-card {
  background: radial-gradient(1200px 180px at 10% -40%, rgba(31,173,116,.35), transparent 40%), linear-gradient(180deg, var(--navy-2), var(--navy));
  color: white; min-height: 210px; box-shadow: var(--shadow);
  animation: pop .5s ease both;
}
.dark-card:nth-child(2) { animation-delay: .05s; }
.dark-card:nth-child(3) { animation-delay: .1s; }
.dark-card:nth-child(4) { animation-delay: .15s; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.dark-card .kicker { color: #b7c4da; font-size: 13px; display: flex; justify-content: space-between; }
.dark-card h2 { margin: 8px 0; font-size: 28px; letter-spacing: -.03em; }
.dark-card .big-date { font-size: 64px; line-height: .9; margin: 8px 0; font-weight: 800; }
.mini { background: rgba(255,255,255,.06); border-radius: 16px; padding: 12px; }
.progress { height: 8px; background: #243044; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #6ee7b7); width: 0; transition: width 1s ease; }
.quick a { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); color: white; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 12px; }
.cal b { width: 28px; height: 28px; display: grid; place-items: center; margin: 0 auto; border-radius: 50%; }
.cal b.on { background: var(--mint); color: white; }
.cal b.mark { box-shadow: inset 0 0 0 2px #34d399; }
.light-card, .panel { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kpi { font-size: 34px; font-weight: 800; letter-spacing: -.04em; margin: 8px 0; }
.up { color: var(--mint-2); font-weight: 700; }
.down { color: var(--danger); font-weight: 700; }
.muted { color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px; }
td { padding: 12px 10px; border-top: 1px solid var(--line); }
tr { transition: background .2s; }
tbody tr:hover { background: rgba(31,173,116,.05); }
.who { display: flex; gap: 10px; align-items: center; }
.who small { display: block; color: var(--muted); }
.pill { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; background: var(--mint-soft); color: #127a4d; }
.pill.warn { background: #fff6e5; color: #a16207; }
.pill.bad { background: #ffe4e9; color: #be123c; }
.pill.neutral { background: #eef2ff; color: #3730a3; }
html[data-theme="dark"] .pill.warn { background: #3a2d12; }
.switch { width: 44px; height: 26px; border-radius: 99px; background: #d5dbe6; position: relative; border: 0; cursor: pointer; }
.switch.on { background: var(--mint); }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: white; transition: .2s; }
.switch.on i { left: 21px; }
.filters, .form-grid, .export-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
input, select, textarea {
  background: var(--shell); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
textarea { min-height: 90px; }
.toast {
  position: fixed; right: 24px; top: 20px; background: var(--navy); color: white;
  padding: 14px 16px; border-radius: 14px; z-index: 20; animation: rise .35s ease;
}
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.tabs a.on { background: var(--navy); color: white; }
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; width: 62px; height: 62px; border: 0; border-radius: 50%;
  background: var(--mint); color: white; box-shadow: 0 12px 30px rgba(31,173,116,.4); cursor: pointer; z-index: 30;
}
.chat-fab .pulse { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--mint); animation: ping 1.6s infinite; }
@keyframes ping { 70% { transform: scale(1.15); opacity: 0; } }
.chat-panel {
  position: fixed; right: 24px; bottom: 98px; width: 340px; height: 440px; background: var(--card);
  border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 30; overflow: hidden;
  border: 1px solid var(--line); animation: rise .25s ease;
}
.chat-panel[hidden] { display: none !important; }
.chat-panel header, .chat-panel form { display: flex; justify-content: space-between; gap: 8px; padding: 12px; align-items: center; }
.chat-stream { flex: 1; overflow: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 80%; padding: 8px 10px; border-radius: 14px; background: var(--shell); }
.bubble.mine { margin-left: auto; background: var(--mint-soft); }
.public-body { min-height: 100vh; background:
  radial-gradient(900px 400px at 90% -10%, rgba(31,173,116,.25), transparent 50%),
  radial-gradient(700px 300px at -10% 20%, rgba(16,24,40,.08), transparent 40%), var(--bg); }
.nav-public { display: flex; justify-content: space-between; align-items: center; padding: 22px 7vw; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; padding: 20px 7vw 60px; align-items: center; }
.hero h1 { font-size: 58px; line-height: 1.02; letter-spacing: -.04em; margin: 0 0 12px; }
.lede { font-size: 18px; color: var(--muted); max-width: 520px; }
.hero-card { animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-8px); } }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(440px, 100%); background: var(--card); border-radius: 28px; padding: 28px;
  box-shadow: var(--shadow); animation: rise .55s ease;
}
.auth-card.leave { animation: leave .45s ease forwards; }
@keyframes leave { to { opacity: 0; transform: translateY(20px) scale(.96); } }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 0 7vw 50px; }
.feature-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 0 7vw 40px; }
.chart-box { height: 260px; }
.notice { padding: 12px 14px; border-radius: 14px; background: var(--mint-soft); margin-bottom: 12px; }
@media (max-width: 1100px) {
  .grid-4, .grid-3, .hero, .stat-row, .feature-row, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 40; transform: translateX(-105%);
    transition: transform .28s ease; display: flex; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .hero h1 { font-size: 40px; }
  table { display: block; overflow-x: auto; }
  .chat-panel { width: min(340px, calc(100vw - 24px)); right: 12px; }
}
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
.stat-card { min-height: auto; padding: 14px 16px; }
.stat-card strong { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 0; }
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 12px; }
.pager-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pager-nav .ghost[aria-disabled="true"] { pointer-events: none; opacity: .45; }
dialog.desk-dialog:not([open]) { display: none; }
dialog.desk-dialog[open] { display: flex; }
dialog.desk-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(760px, calc(100vw - 32px));
  max-height: min(90vh, 880px);
  height: fit-content;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.desk-inline-form { margin-bottom: 16px; max-width: 760px; }
.notice-secret { border: 1px solid var(--mint); background: var(--mint-soft); margin-bottom: 16px; }
.notice-secret dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 8px 0 0; }
.notice-secret dt { color: var(--muted); }
.notice-secret code { font-size: 15px; }
dialog.desk-dialog::backdrop { background: rgba(16, 24, 40, .45); }
.desk-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.desk-dialog-body { padding: 18px 20px 20px; overflow-x: hidden; overflow-y: auto; min-height: 0; }
.desk-dialog-body .form-grid,
.desk-inline-form .form-grid {
  margin: 0;
  width: 100%;
  align-items: start;
  gap: 12px 16px;
}
.desk-dialog-body .form-grid > *,
.desk-inline-form .form-grid > * { min-width: 0; }
.desk-dialog-body input,
.desk-dialog-body select,
.desk-dialog-body textarea,
.desk-inline-form input,
.desk-inline-form select,
.desk-inline-form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.desk-dialog-body .form-grid > .btn,
.desk-inline-form .form-grid > .btn {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 4px;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.help-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.help-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.help-toc { position: sticky; top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.help-toc strong { display: block; margin-bottom: 8px; }
.help-toc ol { margin: 8px 0 0; padding-left: 18px; }
.help-toc a { color: var(--ink); text-decoration: none; }
.help-toc a:hover { color: var(--mint-2); }
.help-toc input { width: 100%; margin-top: 4px; }
.help-body { padding: 22px 24px 32px; }
.help-section { scroll-margin-top: 12px; margin-top: 22px; padding-top: 8px; border-top: 1px solid var(--line); }
.help-section:first-of-type { border-top: 0; margin-top: 0; }
.help-hero { margin-bottom: 8px; }
.help-body h2 { font-size: 22px; margin: 0 0 10px; }
.help-body h3 { font-size: 16px; margin: 16px 0 8px; }
.help-body ul, .help-body ol { padding-left: 20px; }
.help-pdf { padding: 0; overflow: hidden; }
.help-pdf iframe { width: 100%; height: min(78vh, 920px); border: 0; display: block; background: var(--shell); }
.manual-fig { margin: 14px 0 18px; background: var(--shell); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.manual-fig img { width: 100%; height: auto; display: block; }
.manual-fig figcaption { padding: 8px 12px 10px; font-size: 13px; color: var(--muted); }
@media (max-width: 1100px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; }
}
@media print {
  .sidebar, .topbar, .export-bar, .chat-fab, .chat-panel, .btn, .help-toolbar, .help-toc { display: none !important; }
  .content { padding: 0; }
  .help-layout { display: block !important; }
}
