@font-face {
    font-family: Rift;
    src: url("fonts/Rift-Medium-DvhVlbgm.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: Rift;
    src: url("fonts/Rift-Demi-DCOVp0up.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: Rift;
    src: url("fonts/Rift-Bold-CGwxiHSj.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    --ink: #023047;
    --text: #212529;
    --muted: #5c6f7a;
    --line: #e3e8ee;
    --panel: #ffffff;
    --canvas: #f4f5f8;
    --nav: #0b2b4c;
    --nav-hover: rgba(255, 255, 255, .1);
    --accent: #ff5b00;
    --accent-dark: #e04e00;
    --green: #147d64;
    --red: #c64040;
    --amber: #a66600;
    --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --display: Rift, "Arial Narrow", sans-serif;
    font-family: var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); color: var(--text); font-size: 14px; }
h1, h2, .panel-heading h2, .login-card h1, .topbar h1 {
    color: var(--ink);
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
h3 {
    color: var(--ink);
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: .01em;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; align-items: start; }
.sidebar {
    background: var(--nav);
    color: #d7e2ec;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: 26px 18px;
    position: sticky;
    top: 0;
}
.brand, .login-brand { display: flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.02em; }
.brand { color: #fff; padding: 0 10px 28px; }
.brand small, .login-brand small { display: block; color: rgba(255, 255, 255, .62); font-family: var(--font); font-size: 10px; font-weight: 600; letter-spacing: .12em; margin-top: 2px; text-transform: uppercase; }
.brand-mark {
    align-items: center;
    background: var(--accent);
    border-radius: 11px;
    color: #fff;
    display: inline-flex;
    font-size: 18px;
    font-weight: 850;
    height: 38px;
    justify-content: center;
    width: 38px;
}
nav { display: grid; gap: 6px; flex: 1; min-height: 0; overflow: auto; }
nav a {
    align-items: center;
    border-radius: 10px;
    color: rgba(255, 255, 255, .78);
    display: flex;
    font-weight: 600;
    gap: 11px;
    padding: 12px 13px;
}
nav a:hover, nav a.active { background: var(--nav-hover); color: #fff; }
.nav-dot { background: currentColor; border-radius: 50%; height: 7px; opacity: .75; width: 7px; }
nav a.active .nav-dot { background: var(--accent); opacity: 1; }
.sidebar-foot { flex-shrink: 0; margin-top: 12px; }
.logout-form { margin-top: 0; padding: 10px 10px 8px; }
.lang-switch {
    display: flex;
    gap: 6px;
    padding: 4px 10px 0;
}
.lang-switch a {
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 3px;
    color: rgba(255, 255, 255, .82);
    flex: 1;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    padding: 7px 0;
    text-align: center;
}
.lang-switch a:hover { color: #fff; border-color: #fff; }
.lang-switch a.is-active {
    background: var(--accent);
    border-color: transparent;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2);
    color: #fff;
}
.login-lang {
    bottom: 18px;
    left: 18px;
    position: fixed;
}
.login-lang a {
    background: #fff;
    border-color: #d5dbe6;
    color: #4c5870;
    min-width: 52px;
    flex: none;
    padding: 7px 14px;
}
.login-lang a.is-active { color: #fff; }
.text-button { background: none; border: 0; color: #8f9bb0; cursor: pointer; padding: 0; }
.text-button:hover { color: #fff; }

.main { min-width: 0; padding: 34px 38px 50px; }
.topbar { align-items: center; display: flex; justify-content: space-between; margin-bottom: 28px; }
.topbar h1 { font-size: 34px; line-height: .95; margin: 4px 0 0; }
.eyebrow { color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; margin: 0; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.6; }

.primary-button, .secondary-button {
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 700;
    padding: 11px 16px;
}
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: #fff; border: 1px solid #d5dde6; color: var(--ink); }

.stats-grid { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.stat-card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(28, 38, 58, .04);
}
.stat-card { padding: 21px 22px; }
.stat-card span, .stat-card small { color: var(--muted); display: block; }
.stat-card span { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.stat-card strong { color: var(--ink); display: block; font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: .01em; margin: 10px 0 5px; }
.settings-intro { margin: 0 0 18px; max-width: 72ch; }
.settings-stats .stat-card { position: relative; }
.usage-bar {
    /* HTML sets --usage-pct as 0..100 (number). Legacy --pct as "NN%" still works. */
    --usage-pct: 0;
    --pct: 0%;
    background: #e8edf4;
    border-radius: 999px;
    height: 8px;
    margin-top: 12px;
    overflow: hidden;
    position: relative;
}
.usage-bar::after {
    background: #16a34a;
    border-radius: 999px;
    content: '';
    display: block;
    height: 100%;
    width: var(--pct);
    width: calc(var(--usage-pct) * 1%);
}
.usage-bar.warn::after { background: #d97706; }
.usage-bar.danger::after { background: var(--red); }
.usage-bar.ok::after { background: #16a34a; }
.usage-bar-caption { font-size: 11px; margin: 6px 0 0; }
.openai-spend-panel { margin-bottom: 20px; }
.openai-spend-stats { margin: 14px 0 16px; }
.openai-spend-detail { margin-bottom: 16px; }
.openai-wallet-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    margin: 0 0 10px;
}
.openai-wallet-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
}
.openai-wallet-form input[type="number"],
.openai-wallet-form input[type="text"] {
    min-width: 160px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    color: var(--ink);
}
.openai-wallet-form input[type="text"] { min-width: 220px; }

.pipeline-dashboard { margin-bottom: 20px; }
.pipeline-steps { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .pipeline-steps { grid-template-columns: 1fr; } }
.pipeline-step { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, rgba(255,255,255,.02)); }
.pipeline-step-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.pipeline-step-meta { font-size: 12px; margin: 6px 0 0; }
.pipeline-step-note { font-size: 11px; margin: 8px 0 0; line-height: 1.45; }
.vision-report-panel { margin-bottom: 20px; }
.vision-report-intro { font-size: 13px; margin: 0 0 12px; }
.vision-report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .vision-report-grid { grid-template-columns: repeat(2, 1fr); } }
.vision-report-block h3 { font-size: 13px; margin: 0 0 6px; }
.vision-report-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.vision-report-list li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.vision-report-foot { font-size: 12px; margin: 14px 0 0; line-height: 1.5; }
.items-filter-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}
.items-tagged-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 980px;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.items-tagged-check:has(input:checked) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}
.items-tagged-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    accent-color: #2563eb;
    cursor: pointer;
}
.items-tagged-check span { line-height: 1; }
.vision-tagged { color: #1a9d4f; font-weight: 700; }
.col-tagged { width: 28px; text-align: center; }
.proc-compact-panel { margin-bottom: 20px; }
.proc-compact-hint { font-size: 12px; margin: 0; }
.proc-task-list { display: flex; flex-direction: column; gap: 14px; }
.proc-task { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, rgba(255,255,255,.02)); }
.proc-task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.proc-task-meta { font-size: 12px; margin: 6px 0 0; }
.proc-task-log { font-size: 11px; margin: 4px 0 0; font-family: ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proc-vision-panel { margin-bottom: 16px; }
.proc-vision-text { font-size: 13px; line-height: 1.55; margin: 0; }
.proc-osm-panel { margin-bottom: 20px; }
.proc-osm-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 800px) {
  .proc-osm-grid { grid-template-columns: 1fr; }
}
.proc-donut-wrap { text-align: center; }
.proc-donut {
  --pct: 0;
  width: 148px;
  height: 148px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: conic-gradient(#16a34a 0 calc(var(--pct) * 1%), #e8eaef calc(var(--pct) * 1%) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.proc-donut-hole {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--panel, #fff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.proc-donut-hole strong { font-size: 22px; }
.proc-donut-hole small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.proc-donut-legend { list-style: none; padding: 0; margin: 0; font-size: 12px; text-align: left; display: inline-block; }
.proc-donut-legend li { margin: 4px 0; }
.proc-donut-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.swatch-done { background: #16a34a; }
.swatch-left { background: #e8eaef; }
.proc-osm-meta { margin: 0 0 10px; }
.proc-excl-stats { margin-top: 14px; max-width: 420px; }
.proc-subhead { font-size: 14px; margin: 22px 0 8px; }
.proc-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.45;
  max-height: 320px;
  overflow: auto;
  background: #0f1419;
  color: #c8d0da;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.proc-osm-table .proc-tag-cell { font-size: 12px; max-width: 340px; }
.usage-daily-table td, .usage-daily-table th { font-size: 13px; }
.map-toggles {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: flex-end;
    max-width: min(72vw, 820px);
}
.content-grid { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; margin-bottom: 20px; }
.content-grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel-placeholder { background: #fafbfc; }
.panel { margin-bottom: 20px; overflow: hidden; padding: 22px; }
.panel-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 18px; }
.panel-heading h2 { font-size: 22px; line-height: 1; margin: 4px 0 0; }
.panel-heading > a, .panel-heading > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.status-list { display: grid; gap: 4px; }
.status-list > div { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 11px 0; }
.status-list > div:last-child { border-bottom: 0; }

.badge, .format {
    border-radius: 999px;
    display: inline-flex;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    padding: 5px 8px;
    text-transform: uppercase;
    white-space: nowrap;
}
.format { background: #edf0f5; color: #46536b; }
.badge.pending { background: #fff3dc; color: var(--amber); }
.badge.processing { background: #e8efff; color: #3868c8; }
.badge.done { background: #e1f5ef; color: var(--green); }
.badge.no_photos { background: #edf0f5; color: #667188; }
.badge.error { background: #fee9e7; color: var(--red); }

.table-wrap { margin: 0 -22px -22px; overflow-x: auto; }
table { border-collapse: collapse; min-width: 980px; width: 100%; }
th, td { border-top: 1px solid var(--line); padding: 13px 16px; text-align: left; vertical-align: middle; }
th { background: #fafbfc; color: var(--muted); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
td { color: #3f4a60; }
td strong { color: var(--ink); }
td small { color: var(--muted); display: block; font-size: 11px; margin-top: 4px; }
.coordinates { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.message { max-width: 320px; overflow-wrap: anywhere; }
.preview-cell { min-width: 220px; }
.preview-empty { color: #b0b8c6; }
.item-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.item-thumb {
    border: 1px solid var(--line);
    border-radius: 7px;
    display: block;
    height: 52px;
    overflow: hidden;
    width: 52px;
}
.item-thumb img {
    background: #e9edf3;
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}
.item-thumb:hover { box-shadow: 0 4px 14px rgba(25, 35, 53, .14); outline: 2px solid rgba(255, 122, 26, .35); outline-offset: 1px; }
.item-thumb, .photo-card.js-photo-lightbox { cursor: zoom-in; }

.photo-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.photo-grid.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.photo-card { border: 1px solid var(--line); border-radius: 10px; min-width: 0; overflow: hidden; transition: transform .16s ease, box-shadow .16s ease; }
.photo-card:hover { box-shadow: 0 10px 26px rgba(25, 35, 53, .12); transform: translateY(-2px); }
.photo-card img { background: #e9edf3; display: block; height: 145px; object-fit: cover; width: 100%; }
.photo-grid.compact .photo-card img { height: 105px; }
.photo-card > span,
.photo-card-body { color: var(--muted); display: block; font-size: 11px; line-height: 1.45; overflow: hidden; padding: 10px; text-overflow: ellipsis; }
.photo-card strong, .photo-card small { color: var(--ink); display: block; }
.photo-card small { color: var(--muted); margin-top: 4px; }
.photo-card-wrap { position: relative; min-width: 0; }
.photo-src-btn {
  position: absolute;
  top: 8px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  line-height: 1;
}
.photo-src-btn.src-c { right: 72px; background: rgba(37, 99, 235, 0.9); }
.photo-src-btn.src-g { right: 40px; background: rgba(15, 23, 42, 0.85); }
.photo-src-btn:hover { filter: brightness(1.08); }
.photo-src-btn.is-loading { opacity: 0.45; cursor: wait; }
.photo-src-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  vertical-align: middle;
}
.photo-src-badge.src-c { background: #dbeafe; color: #1d4ed8; }
.photo-src-badge.src-g { background: #e5e7eb; color: #374151; }
.photo-refetch-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: rgba(10, 14, 24, 0.72);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.92;
}
.photo-refetch-btn:hover { background: rgba(255, 122, 26, 0.95); }
.photo-refetch-btn.is-loading { opacity: 0.5; cursor: wait; }
.photo-card-wrap { position: relative; }
.photo-card-media { position: relative; }
.settings-tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.settings-tabs a {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  font-size: 13px;
}
.settings-tabs a.active { background: var(--accent, #ff7a1a); border-color: transparent; color: #fff; }
.gpt-prompt-textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  min-height: 360px;
}
.gpt-prompt-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.gpt-prompt-reset-form { margin-top: 10px; }
.gpt-prompt-hint { font-size: 13px; max-width: 78ch; }
.gpt-prompt-path { font-size: 11px; margin-top: 12px; }
.photo-vision-badge { display: inline-block; font-size: 9px; margin-bottom: 4px; padding: 2px 6px; vertical-align: middle; }
.photo-vision-line { font-size: 10px; line-height: 1.35; margin: 6px 0 0; color: var(--muted); white-space: normal; }
.photo-dup-line { color: #6b7280; font-style: italic; }
.photo-group-line { font-size: 10px; margin: 2px 0 4px; color: #4b5563; }
.photo-scene-badge { font-size: 9px; margin-right: 4px; }
.photos-hint { font-size: 12px; margin: 0 0 12px; max-width: 78ch; }
.empty { color: var(--muted); grid-column: 1 / -1; padding: 25px 0; text-align: center; }

body.lightbox-open { overflow: hidden; }
.lightbox[hidden] { display: none !important; }
.lightbox {
    inset: 0;
    position: fixed;
    z-index: 1000;
}
.lightbox-backdrop {
    background: rgba(10, 14, 24, .82);
    inset: 0;
    position: absolute;
}
.lightbox-frame {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    inset: 0;
    padding: 18px 20px 14px;
    position: absolute;
}
.lightbox-toolbar {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}
.lightbox-caption {
    color: #f3f6fb;
    font-size: 13px;
    font-weight: 650;
    max-width: min(70vw, 720px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lightbox-actions { display: flex; gap: 8px; }
.lightbox-btn {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 700;
    height: 36px;
    justify-content: center;
    min-width: 36px;
    padding: 0 10px;
    text-decoration: none;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .2); }
.lightbox-stage {
    align-items: center;
    cursor: grab;
    display: flex;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    position: relative;
    touch-action: none;
    user-select: none;
}
.lightbox-stage.is-zoomed { cursor: grab; }
.lightbox-stage:active { cursor: grabbing; }
.lightbox-stage img {
    max-height: calc(100vh - 120px);
    max-width: min(92vw, 1200px);
    object-fit: contain;
    transform-origin: center center;
    transition: transform .05s linear;
    will-change: transform;
}
.lightbox-nav {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 34px;
    height: 48px;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    z-index: 2;
}
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-nav:hover { background: rgba(255, 255, 255, .22); }
.lightbox-hint {
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
    margin: 8px 0 0;
    text-align: center;
}

.alert { border-radius: 10px; margin: 0 0 20px; padding: 12px 14px; }
.alert.success { background: #e3f5ef; color: var(--green); }
.alert.error { background: #fee9e7; color: var(--red); }
.alert.warn { background: #fff8e6; border: 1px solid #fcd34d; color: #92400e; }
.settings-keys-panel { margin-bottom: 18px; }
.settings-key-alert { margin-top: 14px; }
.settings-key-hint { font-size: 12px; margin: 12px 0 0; }
.login-layout { align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 70px rgba(30, 41, 61, .12); max-width: 440px; padding: 38px; width: 100%; }
.login-brand { margin-bottom: 38px; }
.login-card h1 { font-size: 36px; line-height: .95; margin: 7px 0 8px; }
.login-form { display: grid; gap: 10px; margin-top: 25px; }
.login-form label { font-size: 12px; font-weight: 750; }
.login-form input { border: 1px solid #ccd3df; border-radius: 9px; outline: none; padding: 12px 13px; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 26, .12); }
.login-form button { margin-top: 6px; }

.tag-sections {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tag-section-card {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}
.tag-section-card h3 { margin: 0 0 4px; font-size: 16px; }
.tag-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag-pill {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    flex-direction: column;
    font-weight: 750;
    gap: 2px;
    padding: 8px 12px;
}
.tag-pill small { color: var(--muted); font-size: 10px; font-weight: 600; }
.tag-pill-used { border-color: rgba(26, 157, 79, 0.35); }
.tag-pill-count {
  font-size: 10px;
  font-weight: 700;
  color: #1a9d4f;
  margin-left: 4px;
}
.tags-table-note { font-size: 13px; margin: 0 0 12px; max-width: 72ch; }
.tags-set-nav { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tags-set-nav a {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  text-decoration: none;
  color: inherit;
}
.tags-set-nav a.active { background: var(--accent, #ff7a1a); border-color: transparent; color: #fff; }
.tags-page-meta { font-size: 12px; margin: 0 0 10px; }
.tag-summary-cell { font-size: 11px; max-width: 520px; }
.tag-pill-score {
    color: var(--accent);
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}
.tag-scoring-intro { margin: 0 0 18px; max-width: 72ch; }
.tag-deferred {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid #e2c9a8;
    background: #fff8ef;
    border-radius: 8px;
    max-width: 72ch;
    font-size: 0.92rem;
}
.tag-deferred ul { margin: 8px 0 0; padding-left: 1.2rem; }
.tag-deferred li { margin: 4px 0; }
.tag-scoring-sections {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tag-scoring-block {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px;
}
.tag-scoring-block h3 { font-size: 15px; margin: 0 0 6px; }
.tag-scoring-note { font-size: 12px; margin: 8px 0 10px; color: var(--muted); }
.tag-scoring-list,
.tag-scoring-footnotes {
    font-size: 12px;
    line-height: 1.45;
    margin: 0;
    padding-left: 18px;
}
.tag-scoring-list li { margin-bottom: 6px; }
.tag-scoring-footnotes { margin-top: 10px; color: var(--muted); }
.tag-score {
    background: #e8f5ef;
    border-radius: 6px;
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    margin-left: 6px;
    padding: 2px 6px;
    white-space: nowrap;
}
.tag-score.minus { background: #fee9e7; color: var(--red); }
.badge.prio-1 { background: #e3f5ef; color: var(--green); }
.badge.prio-2 { background: #fff4df; color: var(--amber); }
.badge.prio-3 { background: #eef1f6; color: #4c5870; }
.badge.prio-exclude { background: #fee9e7; color: var(--red); }

.items-table { min-width: 1400px; }
.items-table-slim { min-width: 1100px; }
.items-table th,
.items-table td {
    vertical-align: middle;
}
.items-table td {
    line-height: 1.35;
}
.items-table td.col-actions {
    display: table-cell;
    min-width: 112px;
    padding-left: 14px;
    padding-right: 10px;
    vertical-align: middle;
    width: 1%;
    white-space: nowrap;
}
.items-table .row-map-actions {
    align-items: center;
    display: inline-flex;
    flex-direction: row;
    gap: 6px;
    height: 32px;
}
.items-table .icon-map-btn,
.items-table .icon-sv-btn {
    -webkit-appearance: none;
    appearance: none;
    align-items: center;
    background: #eef1f6;
    border: 0;
    border-radius: 8px;
    box-sizing: border-box;
    color: #3868c8;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 800;
    height: 32px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    min-height: 32px;
    min-width: 32px;
    padding: 0;
    text-decoration: none;
    width: 32px;
}
.items-table .icon-map-btn {
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 16px;
    position: relative;
    top: 0;
}
.items-table .icon-sv-btn {
    background: #e8f0fe;
    color: #1a73e8;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 800;
}
.items-table .icon-sv-lab-btn {
    background: #fff3e8;
    color: #c45a00;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.items-table .icon-map-btn:hover { background: #e0e7f5; }
.items-table .icon-sv-btn:hover { background: #d2e3fc; }
.items-table .icon-sv-lab-btn:hover { background: #ffe8d2; }
.sv-lab-frame {
    grid-template-rows: auto minmax(0, 1fr);
    inset: 6vh 8vw;
    max-width: 920px;
    margin: 0 auto;
    min-height: auto;
    position: relative;
    width: auto;
    left: 0;
    right: 0;
}
.sv-lab-body { overflow: auto; padding: 0 16px 16px; }
.sv-lab-hint { font-size: 12px; margin: 0 0 12px; }
.sv-lab-status {
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 12px;
    padding: 10px 12px;
}
.sv-lab-status.ok { background: #ecfdf3; border: 1px solid #86efac; color: #166534; }
.sv-lab-status.warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.sv-lab-status.err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.sv-lab-osm {
    background: #f4f7fb;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
    margin: 0 0 12px;
    max-height: 42vh;
    overflow: auto;
    padding: 12px 14px;
}
.sv-lab-osm h3 { font-size: 13px; margin: 0 0 8px; }
.sv-lab-osm h4 { font-size: 12px; margin: 12px 0 6px; }
.sv-lab-osm .osm-grid {
    display: grid;
    gap: 6px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 8px;
}
.sv-lab-osm .osm-grid div { display: flex; justify-content: space-between; gap: 8px; }
.sv-lab-osm ul { margin: 0; padding-left: 18px; }
.sv-lab-osm li { margin: 0 0 4px; }
.sv-lab-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.sv-lab-pre {
    background: #0f172a;
    border-radius: 10px;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    line-height: 1.45;
    max-height: 42vh;
    overflow: auto;
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
}
.sv-lab-preview { margin-top: 14px; text-align: center; }
.sv-lab-preview img {
    border: 1px solid var(--line);
    border-radius: 10px;
    max-height: min(70vh, 640px);
    max-width: 100%;
}
.sv-lab-tags {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 12px;
    padding: 12px 14px;
}
.sv-lab-tags h3 {
    font-size: 13px;
    margin: 0 0 8px;
}
.sv-lab-tags .tag-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.sv-lab-tags .tag-pill-mini {
    background: #fff;
    border: 1px solid #d8dee8;
    border-radius: 999px;
    padding: 3px 10px;
}
.sv-lab-tags .tag-pill-mini strong { color: #1e293b; }
.sv-lab-tags .suitability {
    font-weight: 600;
    margin-top: 4px;
}
.sv-lab-tags .suitability.excluded { color: var(--red); }
.sv-lab-tags .suitability.review_required { color: #b45309; }
.sv-lab-tags .suitability.suitable { color: #15803d; }
.items-table .col-stack {
    min-width: 120px;
}
.items-table .cell-main {
    color: #3f4a60;
    display: block;
    line-height: 1.35;
}
.items-table .cell-sub {
    color: var(--muted);
    display: block;
    font-size: 11px;
    line-height: 1.3;
    margin-top: 3px;
}
.items-table .col-bid strong {
    display: inline-block;
    line-height: 1.35;
}
.items-table .col-format .format {
    vertical-align: middle;
}
.items-table td.coordinates {
    line-height: 1.4;
}
.nav-group { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .14); }
.nav-group-label {
    color: rgba(255, 255, 255, .5);
    display: block;
    font-size: 11px;
    letter-spacing: .06em;
    margin: 0 0 8px 12px;
    text-transform: uppercase;
}
.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin: 12px 0 16px;
}
.pagination-links { display: flex; gap: 10px; }
.pagination-links a { color: var(--accent); font-weight: 600; text-decoration: none; }
.toolbar-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; align-items: center; }
.toolbar-form input[type="text"],
.toolbar-form input:not([type]),
.items-filters > input#items-q {
    min-width: 220px;
    border: 1px solid #ccd3df;
    border-radius: 9px;
    padding: 10px 12px;
}
.items-filters select {
    border: 1px solid #ccd3df;
    border-radius: 9px;
    padding: 10px 12px;
    background: #fff;
    min-width: 140px;
    height: 38px;
}
.items-filters .secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    text-decoration: none;
    white-space: nowrap;
}
.text-nav {
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
    padding: 0;
}
.text-nav:disabled { color: #b0b8c6; cursor: default; }
.map-btn .map-icon { font-size: 15px; line-height: 1; }
.map-modal[hidden] { display: none !important; }
.map-modal { inset: 0; position: fixed; z-index: 1100; }
.map-modal-backdrop { background: rgba(10, 14, 24, .72); inset: 0; position: absolute; }
.map-modal-frame {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(20, 28, 45, .28);
    display: grid;
    grid-template-rows: auto minmax(55vh, 1fr) auto;
    inset: 4vh 4vw;
    min-height: 72vh;
    overflow: hidden;
    position: absolute;
}
.map-modal-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
}
.map-modal-toolbar strong { display: block; }
.map-modal-toolbar .muted { font-size: 12px; }
.map-modal-actions { align-items: center; display: flex; gap: 12px; }
.map-toggle { color: var(--muted); font-size: 12px; font-weight: 700; }
.map-chain-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: -3px;
  border-radius: 50%;
  object-fit: cover;
}
.items-map-canvas { min-height: 55vh; width: 100%; height: 100%; }
.map-hint { color: var(--muted); font-size: 11px; margin: 0; padding: 8px 14px 12px; }
.map-hint strong { color: #004b9b; font-weight: 800; }
.datatable-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.datatable-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    text-decoration: none;
}
.datatable-card strong { color: var(--text); }
.datatable-card span { color: var(--muted); font-size: 13px; }
.subpanel { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.inline-grid-form { align-items: end; display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { display: inline; }
.row-actions { white-space: nowrap; }
.wide-input { min-width: 160px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.danger-button { background: #fff; border: 1px solid #e0b4b4; color: #a33; }
.items-table th.tag-col,
.items-table td.tag-col {
    min-width: 88px;
    white-space: nowrap;
    vertical-align: middle;
}
.items-table th.tag-col {
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}
.tag-cell {
    background: #f3f6fa;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-block;
    font-size: 11px;
    font-weight: 750;
    padding: 4px 8px;
}
.tag-cell.badge { border: 0; }

@media (max-width: 1000px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .photo-grid, .photo-grid.compact { grid-template-columns: repeat(3, 1fr); }
    .tag-sections { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { height: auto; overflow: visible; padding: 16px; position: static; }
    .brand { padding-bottom: 16px; }
    nav { display: flex; flex: none; min-height: 0; overflow-x: auto; }
    nav a { white-space: nowrap; }
    .logout-form { position: absolute; right: 18px; top: 26px; }
    .main { padding: 24px 16px 40px; }
    .topbar { align-items: flex-start; gap: 18px; }
    .content-grid, .content-grid.three-col { grid-template-columns: 1fr; }
    .photo-grid, .photo-grid.compact { grid-template-columns: repeat(2, 1fr); }
}

.item-photo-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 72px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.item-photo-btn img {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    background: #eee;
}
.item-photo-empty { font-size: 11px; color: #888; }
.item-photo-cap {
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #0a7a32;
    font-weight: 700;
}
.review-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
}
.review-modal[hidden] { display: none; }
.review-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 16, 24, .55);
}
.review-modal-frame {
    position: relative;
    margin: 12px;
    flex: 1;
    background: #fff;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.review-modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #ececec;
}
.review-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.review-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #f8fafc;
    color: #111827;
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.review-close-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
.review-modal-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.review-grid {
    display: grid;
    grid-template-columns: 620px 1fr 320px;
    gap: 16px;
    min-height: 420px;
}
.review-col h3 { margin: 0 0 4px; font-size: 15px; }
.review-hint { margin: 0 0 8px; font-size: 12px; }
.review-photo-stage {
    width: 600px;
    max-width: 100%;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.review-photo-stage img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    display: block;
}
.review-photo-stage img.review-photo-zoomable {
    cursor: zoom-in;
}
.review-photo-stage.is-full {
    position: fixed;
    inset: 0;
    z-index: 90;
    width: auto;
    border-radius: 0;
    min-height: 0;
}
.review-photo-stage.is-full img { max-height: 100vh; width: auto; max-width: 100vw; }
.review-photo-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
}
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    font-size: 13px;
    line-height: 1.35;
}
.review-decision .review-row { grid-template-columns: 118px 1fr; align-items: start; }
.review-k { color: #666; font-weight: 600; }
.review-decision {
    position: relative;
    background: #f7f8fb;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e6e9f0;
}
.review-comment-panel {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 0 0 1px #e6e9f0;
}
.review-comment-panel[hidden] { display: none; }
.review-comment-panel h3 { margin: 0; }
.review-comment-panel textarea {
    flex: 1;
    min-height: 160px;
    width: 100%;
    resize: none;
    border: 1px solid #d5dde6;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
    line-height: 1.4;
}
.review-comment-actions { display: flex; align-items: center; gap: 10px; }
#review-comment-btn {
    background: #ffd8b0;
    border-color: #f0b27a;
    color: #8a3d00;
}
#review-comment-btn:hover { background: #ffc892; }
#review-comment-btn.is-open {
    background: #f5a35c;
    border-color: #e08a3c;
    color: #fff;
}
.review-decision-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.review-decision-head h3 { margin: 0 0 2px; }
.review-decision-head .review-hint { margin: 0; }
.review-reason { font-size: 12.5px; line-height: 1.4; color: #222; }
.dec-chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.3;
}
.chip-good { background: #e6f6ea; color: #0b7a32; }
.chip-mid { background: #fff4d6; color: #9a6b00; }
.chip-warn { background: #ffe8d6; color: #b45309; }
.chip-bad { background: #fde8e8; color: #b42318; }
.chip-neutral { background: #eef0f4; color: #444; }

/* Compact circular score — filled arc in tone color, rest gray */
.score-ring { flex: 0 0 auto; }
.score-ring-track {
    --fill: 0deg;
    --tone: #9ca3af;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: conic-gradient(var(--tone) 0deg var(--fill), #e5e7eb var(--fill) 360deg);
    display: grid;
    place-items: center;
}
.score-ring-core {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #f7f8fb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
}
.score-ring-num {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--tone);
}
.score-ring-sub {
    font-size: 9px;
    font-weight: 600;
    color: #8a8f9a;
    margin-top: 1px;
}
.score-ring.tone-good { --tone: #16a34a; }
.score-ring.tone-mid { --tone: #d97706; }
.score-ring.tone-bad { --tone: #e11d48; }
.score-ring.tone-unknown { --tone: #9ca3af; }

.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sort.is-sorted { color: #0f172a; text-decoration: underline; }
.col-score { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-prio .dec-chip,
.col-suit .dec-chip { font-size: 11px; padding: 2px 6px; }

.review-foot {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #d7dbe6;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.review-foot-label {
    display: block;
    font-size: 11px;
    color: #777;
    font-weight: 600;
    margin-bottom: 3px;
}
.review-foot-score { font-size: 13px; }
.review-foot-score strong { font-size: 14px; }
.review-map-wrap { display: flex; flex-direction: column; gap: 6px; }
.review-map-caption { display: flex; gap: 12px; align-items: baseline; }
.review-map { height: 280px; border-radius: 10px; background: #eee; }
.lang-pack-tools {
    align-items: center;
    background: #fff;
    display: flex;
    gap: 10px;
    margin: 4px 0 12px;
    padding: 8px 0;
    position: sticky;
    top: 0;
    z-index: 3;
}
.lang-pack-tools input[type="search"] {
    border: 1px solid #ccd3df;
    border-radius: 9px;
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
}
.lang-pack-wrap { max-height: calc(100vh - 280px); overflow: auto; }
.lang-pack-table .lang-en {
    color: var(--ink);
    vertical-align: top;
    width: 46%;
    word-break: break-word;
}
.lang-pack-table td:last-child { width: 54%; }
.lang-pack-table .lang-de {
    border: 1px solid #ccd3df;
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
}
.lang-pack-table tr.is-hidden { display: none; }
.lang-pack-table tr.is-custom .lang-en { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 1100px) {
    .review-grid { grid-template-columns: 1fr; }
    .review-photo-stage { width: 100%; }
}
