:root {
  color-scheme: light;
  --ink: #172b29;
  --muted: #5d706d;
  --green: #17685d;
  --green-dark: #124f47;
  --coral: #c75e42;
  --lime: #d5df8b;
  --paper: #f4f5ef;
  --white: #fff;
  --line: #d7dfd9;
  --soft-green: #e8f0eb;
  --danger: #9a3228;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 5.2vw; background: var(--green-dark); color: var(--white); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: var(--green-dark); background: var(--lime); font-family: Georgia, serif; font-size: 22px; font-weight: 600; }
.brand-name { font-size: 19px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.session-label { color: #d8e6df; font-size: 13px; }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; border: 1px solid transparent; border-radius: 4px; font-size: 13px; font-weight: 700; transition: background-color .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .text-button:focus-visible, .nav-item:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.button-primary { background: var(--green); color: var(--white); }
.button-primary:hover { background: var(--green-dark); }
.button-dark { background: var(--ink); color: var(--white); }
.button-dark:hover { background: #314844; }
.button-outline { border-color: var(--line); background: var(--white); color: var(--ink); }
.button-quiet { color: inherit; border-color: rgba(255,255,255,.22); background: transparent; }
.button-quiet:hover { background: rgba(255,255,255,.1); }
.text-button { width: max-content; border: 0; padding: 4px 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.auth-view { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: clamp(40px, 8vw, 130px); align-items: center; max-width: 1240px; min-height: calc(100vh - 140px); margin: 0 auto; padding: 76px 40px 132px; }
.auth-view::before { position: absolute; z-index: -1; top: 0; left: 0; width: 58%; height: 78%; background: radial-gradient(ellipse at 20% 18%, #e7ead8 0, transparent 68%); content: ''; }
.auth-intro { max-width: 570px; padding-bottom: 32px; }
.eyebrow { margin: 0 0 15px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 0; }
.auth-intro h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(48px, 6vw, 76px); font-weight: 500; line-height: .98; }
.auth-intro h1 span { color: var(--green); }
.intro-copy { max-width: 470px; margin: 25px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.safety-note { display: flex; align-items: flex-start; gap: 12px; max-width: 485px; margin: 35px 0 0; padding-top: 18px; border-top: 1px solid #cdd6ce; color: #52615e; font-size: 12px; line-height: 1.65; }
.safety-mark { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #f1ddd3; color: #8a402c; font-weight: 700; }
.capability-list { display: grid; gap: 15px; max-width: 525px; margin-top: 28px; }
.capability-list article { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
.capability-index { padding-top: 2px; color: var(--coral); font-size: 10px; font-weight: 700; }
.capability-list h2 { margin: 0 0 4px; color: var(--ink); font-size: 12px; font-weight: 700; }
.capability-list p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.auth-panel { align-self: center; padding: 34px; border: 1px solid var(--line); border-top: 3px solid var(--coral); background: var(--white); box-shadow: 0 16px 55px rgba(23, 43, 41, .07); }
.panel-heading { margin-bottom: 25px; }
.panel-heading .eyebrow { margin-bottom: 9px; }
.panel-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.muted { color: var(--muted); font-size: 12px; }
.panel-heading .muted { margin: 8px 0 0; font-size: 13px; }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack label, .note-form label { color: #354a46; font-size: 12px; font-weight: 700; }
.form-stack input, .inline-form input, .inline-form select, .note-form textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #bdcbc4; border-radius: 3px; background: var(--white); color: var(--ink); }
.form-stack input:focus, .inline-form input:focus, .inline-form select:focus, .note-form textarea:focus { border-color: var(--green); }
.form-stack .button { width: 100%; margin-top: 11px; }
.form-message { min-height: 22px; margin: 12px 0 0; color: var(--danger); font-size: 12px; line-height: 1.5; }
.form-message.success { color: var(--green); }
.auth-footnote { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid #e6ebe7; color: #71817d; font-size: 11px; line-height: 1.55; }
.ad-slot { position: absolute; right: 40px; bottom: 22px; left: 40px; min-height: 78px; display: grid; place-items: center; border: 1px dashed #aebbb4; background: linear-gradient(120deg, rgba(213,223,139,.14), rgba(255,255,255,.52)); }
.ad-label { color: #768580; font-size: 9px; font-weight: 700; letter-spacing: 0; }

.dashboard { min-height: calc(100vh - 110px); display: grid; grid-template-columns: 238px minmax(0, 1fr); background: #fbfcf9; }
.sidebar { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 32px 16px; border-right: 1px solid var(--line); background: #f2f5ef; }
.sidebar-label { margin: 0 10px 14px; color: #83908c; font-size: 10px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 11px; border: 0; border-radius: 3px; background: transparent; color: #4f615d; text-align: left; font-size: 12px; font-weight: 600; }
.nav-item span { width: 18px; color: var(--green); font-size: 17px; text-align: center; }
.nav-item:hover, .nav-item.active { background: #dfeae2; color: var(--green-dark); }
.sidebar-bottom { position: absolute; right: 16px; bottom: 25px; left: 26px; display: flex; align-items: center; gap: 9px; color: #71817d; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #5b9877; box-shadow: 0 0 0 3px #d9e9dc; }
.workspace { min-width: 0; padding: 38px clamp(20px, 4vw, 58px) 54px; }
.workspace-heading, .section-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 27px; }
.workspace-heading .eyebrow, .section-tools .eyebrow { margin-bottom: 8px; }
.workspace-heading h1, .section-tools h2 { margin: 0; font-family: 'Newsreader', Georgia, serif; font-size: 34px; font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 18px; padding: 13px; border: 1px solid var(--line); background: var(--white); }
.filters label { flex: 1 1 120px; }
.filters input, .filters select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #cbd5cf; border-radius: 3px; background: var(--white); color: var(--ink); font-size: 12px; }
.filters .search-field { flex: 2 1 220px; position: relative; }
.search-field > span:not(.sr-only) { position: absolute; top: 7px; left: 11px; color: #71817d; font-size: 20px; }
.search-field input { padding-left: 34px; }
.filters .button { min-height: 38px; }
.inline-message { min-height: 18px; color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); background: var(--white); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { position: sticky; top: 0; padding: 12px 13px; border-bottom: 1px solid #cbd6cf; background: #f1f5f0; color: #586964; font-size: 10px; font-weight: 700; white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid #e8ede8; color: #314541; font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf8; }
.type-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 2px; background: var(--soft-green); color: var(--green-dark); font-size: 10px; font-weight: 700; text-transform: capitalize; }
.hash { max-width: 120px; overflow: hidden; color: #71817d; font-family: monospace; font-size: 10px; text-overflow: ellipsis; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.small-action { min-height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--green-dark); font-size: 10px; font-weight: 700; }
.small-action:hover { background: var(--soft-green); }
.small-action.danger { color: var(--danger); }
.empty-state { padding: 52px 20px; text-align: center; }
.empty-mark { color: var(--coral); font-family: Georgia, serif; font-size: 40px; }
.empty-state h2 { margin: 6px 0; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; gap: 13px; margin: 0 0 20px; padding: 16px; border: 1px solid var(--line); background: var(--white); }
.inline-form label { display: flex; flex-direction: column; gap: 6px; color: #52635e; font-size: 11px; font-weight: 700; }
.inline-form input, .inline-form select { min-height: 38px; font-size: 12px; }
.permission-list { display: flex; flex-wrap: wrap; gap: 9px; max-width: 360px; }
.permission-list label { display: inline-flex; align-items: center; gap: 4px; color: #52635e; font-size: 10px; }
.permission-list input { accent-color: var(--green); }
.site-footer { min-height: 42px; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 0 5.2vw; border-top: 1px solid var(--line); background: #fbfcf9; color: #71817d; font-size: 10px; }
.media-dialog { width: min(760px, calc(100vw - 28px)); max-height: 88vh; padding: 25px; border: 1px solid var(--line); border-top: 3px solid var(--coral); background: var(--white); color: var(--ink); }
.media-dialog::backdrop { background: rgba(16, 35, 32, .6); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.dialog-heading h2, .notes-section h3 { margin: 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.dialog-heading .button-quiet { color: var(--ink); border-color: var(--line); }
.dialog-media { display: grid; place-items: center; min-height: 80px; margin: 20px 0; padding: 14px; background: #f1f4f0; overflow-wrap: anywhere; }
.notes-section { padding-top: 18px; border-top: 1px solid var(--line); }
.note-list { display: flex; flex-direction: column; gap: 10px; padding-left: 22px; color: #425652; font-size: 12px; line-height: 1.55; }
.note-list li time { display: block; margin-top: 3px; color: #7a8985; font-size: 10px; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.note-form textarea { min-height: 85px; resize: vertical; }
.note-form .button { align-self: flex-start; }

@media (max-width: 800px) {
  .auth-view { grid-template-columns: 1fr; gap: 28px; min-height: auto; padding: 48px 22px 128px; }
  .auth-intro { max-width: 620px; padding-bottom: 0; }
  .auth-intro h1 { font-size: 54px; }
  .auth-panel { width: min(100%, 520px); }
  .ad-slot { right: 22px; left: 22px; bottom: 20px; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; overflow: auto; padding: 9px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-label, .sidebar-bottom { display: none; }
  .nav-item { flex: none; }
  .workspace { padding: 26px 16px 40px; }
  .workspace-heading h1 { font-size: 29px; }
  .site-footer { padding: 10px 18px; }
}

@media (max-width: 480px) {
  .topbar { height: 58px; padding: 0 17px; }
  .session-label { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .auth-view { padding: 36px 16px 128px; }
  .auth-intro h1 { font-size: 47px; }
  .intro-copy { margin-top: 17px; font-size: 14px; }
  .auth-panel { padding: 24px 19px; }
  .filters { align-items: stretch; }
  .filters label, .filters .button { flex: 1 1 100%; }
  .workspace-heading { align-items: flex-end; }
  .workspace-heading .button { min-height: 36px; padding: 0 10px; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 5px; }
  .media-dialog { padding: 18px; }
}
.thumb-cell { width: 92px; }
.thumb-button { display: grid; place-items: center; width: 80px; height: 60px; padding: 0; overflow: hidden; border: 1px solid var(--line, #d6ddd3); border-radius: 3px; background: #e8eee6; cursor: pointer; }
.thumb-button:hover, .thumb-button:focus-visible { outline: 2px solid var(--green-dark, #17685d); outline-offset: 1px; }
.thumb-button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-button.thumb-video::before { content: "\25B6"; font-size: 22px; color: var(--green-dark, #17685d); }
.thumb-button.thumb-audio::before { content: "\266B"; font-size: 24px; color: var(--green-dark, #17685d); }
.dialog-media { display: grid; gap: 10px; justify-items: center; }
.dialog-media-item { max-width: 100%; max-height: 65vh; border-radius: 3px; }
.dialog-map { width: 100%; height: 240px; border: 0; border-radius: 3px; }

.beacon-panel { border: 2px solid #b91c1c; background: #fef2f2; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.beacon-panel h2 { margin: 0 0 8px; font-size: 1rem; color: #7f1d1d; }
.beacon-row { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 0; align-items: baseline; }
.beacon-live { color: #b91c1c; }

.category-input { width: 140px; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.category-input.saved { border-color: #15803d; background: #f0fdf4; }

.report-bar { display: flex; gap: 12px; align-items: center; margin: 0 0 12px; padding: 10px 14px; background: #ecfdf5; border: 1px solid #15803d; border-radius: 8px; }
.hide-note-col .note-col, .hide-select-col .select-col { display: none; }
.note-input { width: 220px; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; resize: vertical; }
.note-latest { max-width: 220px; margin-bottom: 4px; white-space: pre-wrap; word-break: break-word; }

.table-wrap { overflow: scroll; max-height: calc(100vh - 230px); min-height: 200px; scrollbar-width: auto; }
.table-wrap::-webkit-scrollbar { height: 14px; width: 14px; }
.table-wrap::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 7px; border: 3px solid #f1f5f9; }
.table-wrap::-webkit-scrollbar-track { background: #f1f5f9; }
#media-table { min-width: 1500px; }
#media-table thead th { position: sticky; top: 0; z-index: 2; background: #eef3ec; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 14px 0; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager-current { background: #14532d; color: #fff; border-color: #14532d; }
.pager-gap { padding: 0 4px; color: #64748b; }
.pager-size { margin-left: 12px; font-size: .9rem; }
