:root {
  --navy: #123e56;
  --navy-deep: #0d2f44;
  --navy-soft: #e9f0f4;
  --orange: #e47d3d;
  --orange-soft: #f9ece4;
  --ink: #24333b;
  --muted: #687984;
  --line: #d7e0e5;
  --canvas: #eef2f4;
  --white: #fff;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
body { font-family: var(--sans); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow, .sidebar-label { display: block; color: var(--orange); font: 700 10px/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.mono { font-family: var(--mono); }
.ghost-mark { width: 39px; height: 44px; border: 2px solid var(--orange); border-radius: 50% 50% 44% 44%; position: relative; display: inline-block; background: rgba(228,125,61,.08); }
.ghost-mark:before, .ghost-mark:after { content: ''; position: absolute; top: 14px; width: 5px; height: 7px; background: var(--orange); border-radius: 50%; }
.ghost-mark:before { left: 10px; } .ghost-mark:after { right: 10px; }
.ghost-mark i { position: absolute; width: 11px; height: 6px; left: 12px; top: 24px; border-bottom: 2px solid var(--orange); border-radius: 0 0 12px 12px; }
.ghost-mark.small { width: 29px; height: 33px; border-width: 1px; }
.ghost-mark.small:before, .ghost-mark.small:after { top: 10px; width: 3px; height: 5px; }
.ghost-mark.small:before { left: 7px; } .ghost-mark.small:after { right: 7px; }
.ghost-mark.small i { width: 7px; height: 4px; left: 9px; top: 18px; border-width: 1px; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--navy-deep), var(--navy)); }
.auth-card { width: min(430px, 100%); background: var(--white); border-radius: 3px; padding: 38px 42px 32px; box-shadow: 0 24px 80px rgba(4,20,29,.28); }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand h1 { margin: 3px 0 0; color: var(--navy); font: 400 29px var(--serif); letter-spacing: -.04em; }
.auth-rule { height: 1px; background: var(--line); margin: 30px 0 27px; }
.auth-card h2 { margin: 0 0 8px; color: var(--navy); font: 400 25px var(--serif); }
.auth-copy, .auth-footnote { color: var(--muted); line-height: 1.55; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); margin-top: 20px; }
.auth-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 9px 4px; font-size: 12px; }
.auth-tabs button.active { color: var(--navy); border-bottom-color: var(--orange); }
.auth-form { display: grid; gap: 17px; margin-top: 24px; }
.auth-form label, .filter-label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
input, select { width: 100%; min-height: 38px; border: 1px solid #c9d4da; border-radius: 2px; padding: 9px 10px; background: var(--white); color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(228,125,61,.14); }
input::placeholder { color: #aab7be; }
.auth-form .primary-button { min-height: 42px; margin-top: 3px; }
.form-error { min-height: 18px; color: #bb3f3f; font-size: 12px; margin: 12px 0 0; }
.auth-footnote { border-top: 1px solid var(--line); padding-top: 18px; margin: 25px 0 0; font-size: 12px; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(18,62,86,.08); position: relative; z-index: 2; }
.header-main { min-height: 84px; display: grid; grid-template-columns: 250px minmax(260px, 1fr) auto; align-items: center; gap: 25px; padding: 0 clamp(18px, 4vw, 56px); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup strong { color: var(--navy); font: 400 25px var(--serif); letter-spacing: -.04em; }
.page-heading { border-left: 1px solid var(--line); padding-left: 26px; }
.page-heading h1 { color: var(--navy); font: 400 24px var(--serif); margin: 3px 0 0; }
.account-tools { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.connection { display: inline-flex; align-items: center; gap: 6px; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #2ca46b; box-shadow: 0 0 0 3px rgba(44,164,107,.12); }
.account-email { max-width: 185px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { border: 0; background: transparent; color: var(--navy); font-size: 12px; padding: 5px 0; }
.logout-button:hover { color: var(--orange); }
.main-nav { display: flex; align-items: stretch; gap: 2px; background: var(--navy); padding: 0 clamp(18px, 4vw, 56px); }
.main-nav .nav-item { border: 0; border-bottom: 3px solid transparent; color: #d9e5eb; background: transparent; padding: 13px 17px 11px; font-size: 12px; }
.main-nav .nav-item:hover, .main-nav .nav-item.active { color: var(--white); border-bottom-color: var(--orange); background: rgba(255,255,255,.06); }
.app-body { display: grid; grid-template-columns: 215px minmax(0, 1fr); min-height: calc(100vh - 129px); }
.left-sidebar { background: #f7f9fa; border-right: 1px solid var(--line); padding: 25px 13px 15px; display: flex; flex-direction: column; }
.sidebar-section { display: grid; gap: 4px; }
.sidebar-section .sidebar-label { padding: 0 12px 9px; color: var(--muted); font-size: 9px; }
.sidebar-link { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--muted); padding: 10px 12px; text-align: left; }
.sidebar-link:first-letter { color: var(--orange); }
.sidebar-link:hover, .sidebar-link.active { color: var(--navy); background: var(--navy-soft); border-left-color: var(--orange); }
.sidebar-lower { margin-top: auto; padding-top: 30px; }
.account-card { display: flex; align-items: center; gap: 9px; padding: 11px 12px; background: var(--white); border: 1px solid var(--line); margin-bottom: 10px; }
.user-badge { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--white); font: 700 11px var(--mono); }
.account-card strong, .account-card small { display: block; overflow: hidden; max-width: 130px; text-overflow: ellipsis; white-space: nowrap; }
.account-card strong { color: var(--navy); font-size: 12px; }
.account-card small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.sidebar-footer { display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--line); color: var(--muted); font: 10px var(--mono); margin-top: 25px; padding: 15px 10px 0; }
.sidebar-footer strong { color: #2ca46b; font-weight: 400; }
.content-area { min-width: 0; padding: 24px clamp(18px, 4vw, 54px) 55px; }
.breadcrumbs { display: flex; gap: 9px; color: #8b9aa2; font: 10px var(--mono); margin-bottom: 18px; text-transform: uppercase; letter-spacing: .08em; }
.view { display: none; animation: appear .22s ease both; }
.view.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.module-toolbar { display: flex; min-height: 46px; align-items: center; justify-content: space-between; border: 1px solid var(--line); background: var(--white); }
.toolbar-menu { align-self: stretch; border: 0; border-right: 1px solid var(--line); background: #f7f9fa; color: var(--navy); padding: 0 18px; font-size: 12px; }
.toolbar-menu:first-letter { color: var(--orange); }
.toolbar-actions { display: flex; align-items: center; gap: 0; height: 100%; }
.toolbar-actions button { height: 100%; border: 0; border-left: 1px solid var(--line); background: var(--white); color: var(--muted); padding: 0 14px; font-size: 11px; }
.toolbar-actions button:hover { background: var(--orange-soft); color: var(--navy); }
.search-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; border: 1px solid var(--line); border-top: 0; background: var(--white); min-height: 600px; }
.filter-rail { min-width: 0; background: #f7f9fa; border-right: 1px solid var(--line); padding: 18px 16px 22px; }
.source-form { display: grid; gap: 12px; }
.source-form h3 { color: var(--navy); font: 400 19px var(--serif); margin: 0 0 2px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; border: 0; border-radius: 2px; background: var(--orange); color: var(--white); padding: 0 16px; font-weight: 700; }
.primary-button:hover { background: #cc6630; }
.primary-button span { font-size: 16px; }
.primary-button.full { width: 100%; }
.reset-button { border: 0; background: transparent; color: var(--muted); text-align: left; padding: 3px 0; font-size: 11px; }
.reset-button:hover { color: var(--orange); }
.filter-block { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; display: grid; gap: 9px; }
.filter-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--navy); font-size: 11px; }
.filter-heading button { border: 0; background: transparent; color: var(--muted); font-size: 10px; padding: 0; }
.filter-heading button:hover { color: var(--orange); }
.filter-label { font-size: 10px; }
.check-row { color: var(--muted); font-size: 11px; display: flex; gap: 7px; align-items: center; }
.check-row input { width: auto; min-height: auto; }
.recent-searches { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 15px; }
.recent-searches p { color: #a3afb5; font-size: 11px; margin: 9px 0; }
.time-grid, .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.results-pane { min-width: 0; padding: 21px 24px 34px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 13px; margin-bottom: 17px; }
.result-head h2 { color: var(--navy); font: 400 24px var(--serif); letter-spacing: -.025em; margin: 4px 0 0; }
.result-count { color: var(--muted); font: 10px var(--mono); white-space: nowrap; }
.results-list { display: grid; }
.result-card { display: grid; grid-template-columns: 114px minmax(0, 1fr); gap: 16px; border-bottom: 1px solid var(--line); padding: 15px 0; }
.result-card:hover { background: #fbfcfc; }
.result-thumb { display: grid; place-items: center; min-height: 83px; border: 1px solid var(--line); background: linear-gradient(135deg, #dfe9ed, #f8fafb); color: var(--navy); font: 11px var(--mono); }
.result-thumb img { display: block; width: 100%; height: 100%; min-height: 83px; object-fit: cover; }
.result-body { min-width: 0; }
.result-meta { display: flex; justify-content: space-between; gap: 10px; color: #83939c; font: 10px var(--mono); text-transform: uppercase; }
.result-card h4 { color: var(--navy); font: 400 18px/1.22 var(--serif); margin: 8px 0 6px; }
.result-card p { color: var(--muted); line-height: 1.45; margin: 0; font-size: 12px; }
.media-button { margin-top: 10px; border: 1px solid var(--navy); background: var(--navy); color: white; padding: 8px 12px; font: 10px var(--mono); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.media-button:hover { background: var(--teal); border-color: var(--teal); }
.result-foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tag { border: 1px solid #ccd9df; color: var(--navy); padding: 3px 6px; font: 9px var(--mono); text-transform: uppercase; }
.empty-state { color: var(--muted); border: 1px dashed var(--line); padding: 25px 18px; font-size: 12px; }
.media-dialog { width: min(900px, calc(100vw - 32px)); padding: 0; border: 1px solid #aabdc6; background: #f7fafb; color: var(--ink); box-shadow: 0 28px 90px rgba(8, 31, 43, .3); }
.media-dialog::backdrop { background: rgba(6, 24, 34, .74); backdrop-filter: blur(3px); }
.media-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: white; }
.media-dialog-head h2 { margin: 3px 0 0; color: var(--navy); font: 400 23px var(--serif); }
.media-close { border: 0; background: transparent; color: var(--navy); font: 32px/1 var(--serif); cursor: pointer; }
.media-stage { position: relative; display: grid; place-items: center; min-height: 360px; padding: 20px; background: #071820; }
.media-stage video, .media-stage audio { display: none; width: 100%; max-height: 65vh; }
.media-stage video.active, .media-stage audio.active { display: block; }
.media-loading { position: absolute; inset: auto; color: #dce9ee; font: 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; pointer-events: none; }
.media-note { margin: 0; padding: 10px 20px; color: var(--muted); font: 10px var(--mono); background: white; }
.syntax-help { border: 1px solid var(--line); background: #f7f9fa; margin-top: 27px; padding: 16px; }
.syntax-help h3 { color: var(--navy); font: 400 17px var(--serif); margin: 0 0 10px; }
.syntax-row { display: grid; grid-template-columns: 50px 1.1fr 1fr; gap: 10px; border-top: 1px solid var(--line); padding: 8px 0; color: var(--muted); font-size: 11px; }
.syntax-row b { color: var(--orange); font: 700 10px var(--mono); }
.syntax-row small { color: #8c9aa2; }
.timeline { border-top: 1px solid var(--line); }
.timeline-row { display: grid; grid-template-columns: 150px minmax(0,1fr) 180px; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); padding: 16px 0; }
.timeline-time { color: var(--orange); font: 10px/1.45 var(--mono); }
.timeline-title { color: var(--navy); font: 400 18px var(--serif); }
.timeline-station { color: var(--muted); font: 10px var(--mono); text-align: right; text-transform: uppercase; }
.watchlist-layout { display: grid; grid-template-columns: minmax(210px, .72fr) minmax(0, 1.6fr); gap: clamp(25px, 6vw, 80px); border: 1px solid var(--line); background: var(--white); padding: 26px 24px 36px; }
.watchlist-intro { border-left: 3px solid var(--orange); padding-left: 17px; }
.watchlist-intro h2, .admin-intro h2 { color: var(--navy); font: 400 30px var(--serif); letter-spacing: -.04em; margin: 9px 0; }
.watchlist-intro p, .admin-intro p { color: var(--muted); line-height: 1.55; max-width: 275px; margin: 0 0 22px; font-size: 12px; }
.secondary-button { color: var(--navy); background: var(--navy-soft); border: 1px solid #c7d7df; }
.secondary-button:hover { background: #dceaf0; }
.watchlist-list, .member-list { display: grid; gap: 8px; }
.watch-item, .member-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); padding: 13px 14px; }
.watch-item:hover, .member-item:hover { border-color: #a9c1cc; }
.watch-type { color: var(--orange); font: 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.watch-item h4, .member-item h4 { color: var(--navy); font: 400 17px var(--serif); margin: 5px 0; }
.watch-item p, .member-item p { color: var(--muted); margin: 0; font-size: 11px; }
.delete-button { border: 1px solid #e8b9a7; background: var(--orange-soft); color: #b55528; font-size: 10px; padding: 6px 8px; }
.delete-button:hover { background: #f6dcd0; }
.watchlist-form { display: grid; gap: 15px; max-width: 760px; border: 1px solid var(--line); background: var(--white); padding: 20px 24px; margin-top: 16px; }
.watchlist-form.hidden { display: none; }
.form-heading-row { display: flex; justify-content: space-between; align-items: center; }
.form-heading-row h3 { color: var(--navy); font: 400 20px var(--serif); margin: 0; }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.text-button:hover { color: var(--orange); }
.admin-layout { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.6fr); gap: clamp(25px, 6vw, 80px); border: 1px solid var(--line); background: var(--white); padding: 26px 24px 36px; }
.admin-intro { border-left: 3px solid var(--orange); padding-left: 17px; }
.admin-intro .source-form { margin-top: 26px; }
.admin-intro .invite-form { border-top: 1px solid var(--line); padding-top: 22px; }
.created-invite { background: var(--navy-soft); border: 1px solid #c7d7df; color: var(--navy); padding: 10px; font: 10px/1.45 var(--mono); overflow-wrap: anywhere; }
.created-invite button { margin-top: 8px; border: 1px solid #aec4ce; background: var(--white); color: var(--navy); padding: 6px 8px; }
.admin-subhead { margin-top: 32px; }
.member-status { color: #2ca46b; font: 10px var(--mono); text-transform: uppercase; }
.member-status.disabled { color: #bd5b4e; }
.toast { position: fixed; right: 24px; bottom: 22px; z-index: 5; max-width: 360px; border: 1px solid var(--navy); background: var(--navy); color: var(--white); padding: 12px 15px; font-size: 12px; transform: translateY(140%); transition: .25s; }
.toast.show { transform: none; }

@media (max-width: 980px) {
  .header-main { grid-template-columns: 210px 1fr auto; gap: 12px; }
  .account-email { display: none; }
  .toolbar-actions button { padding: 0 9px; font-size: 10px; }
  .app-body { grid-template-columns: 175px minmax(0,1fr); }
  .search-layout { grid-template-columns: 220px minmax(0,1fr); }
}
@media (max-width: 760px) {
  .header-main { grid-template-columns: 1fr auto; min-height: 69px; }
  .page-heading { display: none; }
  .main-nav { overflow-x: auto; padding: 0 10px; }
  .main-nav .nav-item { white-space: nowrap; padding: 12px 11px 10px; }
  .app-body { display: block; }
  .left-sidebar { display: none; }
  .content-area { padding: 18px 12px 40px; }
  .module-toolbar { overflow-x: auto; }
  .toolbar-actions { margin-left: auto; }
  .toolbar-actions button { white-space: nowrap; }
  .search-layout, .watchlist-layout, .admin-layout { grid-template-columns: 1fr; }
  .filter-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .results-pane { padding: 18px 14px 27px; }
}
@media (max-width: 460px) {
  .auth-card { padding: 30px 22px 24px; }
  .brand-lockup .eyebrow { display: none; }
  .connection { display: none; }
  .result-head { align-items: flex-start; flex-direction: column; gap: 7px; }
  .result-card { grid-template-columns: 1fr; }
  .result-thumb { min-height: 55px; }
  .timeline-row { grid-template-columns: 1fr; gap: 7px; }
  .timeline-station { text-align: left; }
  .syntax-row { grid-template-columns: 40px 1fr; }
  .syntax-row small { grid-column: 2; }
}
