:root {
  --navy: #323c5a; --navy-deep: #262e46; --teal: #00b3aa; --coral: #dc5a64; --gold: #e6aa28;
  --teal-ink: #00857e; --coral-ink: #b8414b; --gold-ink: #9a6c08;
  --bg: #f5f3ee; --card: #ffffff; --ink: #1f2537; --muted: #5d6478; --line: #e3e0d8; --soft: #faf9f6;
  --radius: 14px; --shadow: 0 1px 2px rgba(31,37,55,.06), 0 4px 14px rgba(31,37,55,.06);
  --serif: 'Fraunces', Georgia, serif; --sans: 'Source Sans 3', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-variation-settings: 'SOFT' 100; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 600; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
input, select, textarea, button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 60%, transparent); outline-offset: 2px; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 20px; color: var(--navy); }
.brand b { font-weight: 700; color: var(--teal-ink); }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--navy); color: #fff; font-size: 15px; font-weight: 700; box-shadow: inset 0 -4px 0 var(--gold); }
.brand-lg { font-size: 28px; }
.logo { height: 40px; width: 40px; display: block; }
.brand-lg .logo { height: 60px; width: 60px; }
.brand-lg .mark { width: 48px; height: 48px; font-size: 19px; border-radius: 13px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; text-decoration: none; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: #cfcabe; background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); border-color: var(--navy-deep); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(50,60,90,.07); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--coral-ink); }
.btn[disabled] { opacity: .5; cursor: default; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(0,179,170,.18), transparent 60%), var(--navy); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 18px; padding: 32px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); border-top: 5px solid var(--gold); }
.login-sub { color: var(--muted); margin: 10px 0 22px; }
.login-foot { color: rgba(255,255,255,.65); font-size: 14px; margin-top: 18px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,179,170,.18); }
textarea { min-height: 90px; resize: vertical; }
.form-error { color: var(--coral-ink); font-size: 14px; min-height: 1em; margin: 0 0 10px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 12px clamp(16px, 4vw, 40px); background: rgba(245,243,238,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topnav { display: flex; gap: 4px; }
.topnav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.topnav a:hover { background: rgba(50,60,90,.06); color: var(--ink); }
.topnav a.active { color: var(--navy); background: rgba(50,60,90,.09); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; font-weight: 700; font-size: 14px; }
.who-name { font-weight: 600; font-size: 15px; }

/* Layout */
.view { max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.hero-tight { margin-bottom: 16px; }
.eyebrow { margin: 0 0 6px; color: var(--teal-ink); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.search { position: relative; display: flex; align-items: center; width: min(380px, 100%); margin: 0; }
.search svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { padding: 11px 40px 11px 38px; border-radius: 12px; box-shadow: var(--shadow); }
.search kbd { position: absolute; right: 10px; font: 600 12px var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--soft); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }

/* Pinned banner */
.pin { display: flex; gap: 14px; align-items: flex-start; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 24px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.pin::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--gold); }
.pin-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(230,170,40,.2); display: grid; place-items: center; }
.pin-icon svg { width: 18px; height: 18px; stroke: var(--gold); fill: none; stroke-width: 2; }
.pin h3 { font-size: 17px; }
.pin p { margin: 2px 0 0; color: rgba(255,255,255,.82); white-space: pre-line; }
.pin + .pin { margin-top: -12px; }

/* Tiles */
.group { margin-bottom: 26px; }
.group-title { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 12px; }
.group-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { --c: var(--navy); --ci: var(--navy); position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 170px; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(31,37,55,.06), 0 12px 28px rgba(31,37,55,.1); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.tile[data-color=teal] { --c: var(--teal); --ci: var(--teal-ink); }
.tile[data-color=coral] { --c: var(--coral); --ci: var(--coral-ink); }
.tile[data-color=gold] { --c: var(--gold); --ci: var(--gold-ink); }
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, #fff); }
.ico svg { width: 22px; height: 22px; fill: none; stroke: var(--ci); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #c5c1b6; }
.status[data-s=up] i { background: #1fa971; box-shadow: 0 0 0 3px rgba(31,169,113,.15); }
.status[data-s=down] i { background: var(--coral); box-shadow: 0 0 0 3px rgba(220,90,100,.15); }
.tile h3 { font-size: 19px; margin-bottom: 4px; color: var(--ink); }
.tile p { margin: 0 0 14px; color: var(--muted); font-size: 15px; flex: 1; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.open { font-weight: 700; color: var(--ci); }
.tile .sub { font-weight: 600; color: var(--muted); text-decoration: none; padding: 2px 8px; border-radius: 6px; position: relative; z-index: 2; }
.tile .sub:hover { background: var(--soft); color: var(--ink); }
.tile-link { position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.tile.needs { border-style: dashed; box-shadow: none; background: var(--soft); }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(230,170,40,.18); color: var(--gold-ink); }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Side panels */
.side { display: grid; gap: 16px; position: sticky; top: 84px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 12px; }
.news { padding: 12px 0; border-top: 1px solid var(--line); }
.news:first-child { border-top: 0; padding-top: 0; }
.news:last-child { padding-bottom: 0; }
.news h3 { font-family: var(--sans); font-size: 15px; font-weight: 700; }
.news .meta { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.news p { margin: 0; font-size: 14px; color: var(--muted); white-space: pre-line; }
.links, .recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.links a, .recent a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 15px; }
.links a:hover, .recent a:hover { background: var(--soft); }
.links a::after { content: '↗'; color: var(--muted); font-weight: 400; }
.recent .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.recent a { justify-content: flex-start; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* Settings */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--teal); }
.hint { color: var(--muted); margin: 0 0 16px; }
.edit-list { display: grid; gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.edit-item { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 0 12px; align-items: end; }
.edit-item label { margin-bottom: 10px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; } .span-2 { grid-column: span 2; }
.edit-tools { grid-column: span 12; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.edit-tools .grow { flex: 1; }
.check { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; color: var(--ink); }
.check input { width: auto; }
.row-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.dirty-note { color: var(--gold-ink); font-weight: 600; font-size: 14px; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow); }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--soft); }
.table tr:last-child td { border-bottom: 0; }
.table select { width: auto; padding: 6px 8px; }
.role { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(50,60,90,.09); color: var(--navy); text-transform: capitalize; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid h3, .form-grid .form-error, .form-grid button { grid-column: 1 / -1; }
.form-grid h3 { margin-bottom: 14px; }
.form-grid button { justify-self: start; }
.narrow { max-width: 460px; grid-template-columns: 1fr; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; flex-wrap: wrap; }
  .brand span { display: none; }
  .who-name { display: none; }
  .hero { align-items: stretch; }
  .search { width: 100%; }
  .search kbd { display: none; }
  .edit-item > label, .edit-item > .edit-tools { grid-column: span 12; }
  .form-grid { grid-template-columns: 1fr; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Sign-in extras, notices, user status */
.login-alt { text-align: center; margin: 14px 0 0; font-size: 14px; }
.login-alt a { color: var(--teal-ink); font-weight: 600; }
.login-h { margin-bottom: 6px; }
#forgot-form .muted { margin-bottom: 16px; }
.form-ok { color: var(--teal-ink) !important; }
.span-all { grid-column: 1 / -1; }
.notice { background: #fff6e0; border: 1px solid #f0d58f; color: #6b4b05; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; max-width: 460px; }
.status-pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(230,170,40,.18); color: var(--gold-ink); white-space: nowrap; }
.status-pill.ok { background: rgba(31,169,113,.12); color: #157a52; }
code { font-size: 13px; background: var(--soft); padding: 1px 5px; border-radius: 5px; }
