:root {
  color-scheme: light;
  --paper: #f5f3ee;
  --surface: #fffefa;
  --ink: #272622;
  --muted: #77756e;
  --line: #dedbd2;
  --accent: #6b5344;
  --accent-dark: #4a382d;
  --danger: #a23d32;
  --shadow: 0 16px 48px rgb(34 30 25 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { min-height: 100dvh; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 52px); border-bottom: 1px solid var(--line); background: var(--surface); }
.wordmark { color: var(--ink); text-decoration: none; font-family: Georgia, "Times New Roman", serif; font-size: 22px; }
.wordmark span { margin-left: 8px; color: var(--muted); font: 12px var(--sans, sans-serif); letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.connection-status, .muted { color: var(--muted); font-size: 14px; }
.workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100dvh - 72px); }
.sidebar { display: flex; flex-direction: column; gap: 5px; padding: 26px 16px; border-right: 1px solid var(--line); background: #f0eee8; }
.nav-item { width: 100%; padding: 12px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; }
.nav-item:hover, .nav-item.is-active { background: #e4dfd5; }
.sidebar-note { display: flex; gap: 9px; margin: auto 8px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.status-dot { flex: 0 0 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #bd8c3d; }
.content { width: 100%; max-width: 1500px; margin: 0 auto; padding: clamp(24px, 4vw, 52px); }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 3px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 4vw, 48px); font-weight: 500; }
.page-heading p { margin: 0; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid transparent; border-radius: 6px; font-size: 14px; font-weight: 600; text-decoration: none; }
.button-primary { background: var(--accent); color: white; }
.button-primary:hover { background: var(--accent-dark); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--ink); }
.button-danger { border-color: #e5c4bf; background: #fff7f5; color: var(--danger); }
.upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.search-input { width: min(100%, 340px); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea, select { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid rgb(107 83 68 / 24%); outline-offset: 2px; }
.filter-list { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; }
.filter-chip.is-selected { border-color: var(--ink); background: var(--ink); color: white; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.photo-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.photo-card button { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e7e4dc; }
.photo-editor-preview { display: block; width: 100%; max-height: 340px; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 6px; background: #e7e4dc; }
.photo-card img[hidden], .photo-editor-preview[hidden] { display: none; }
.photo-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 14px; margin: 0; color: var(--muted); font-size: 12px; }
.photo-facts div { min-width: 0; overflow-wrap: anywhere; }
.photo-facts dt { font-weight: 650; }
.photo-facts dd { margin: 2px 0 0; }
.photo-card-body { padding: 11px 12px 13px; }
.photo-card-title { overflow: hidden; margin: 0 0 7px; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.photo-card-name { overflow: hidden; margin: 0 0 10px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 3px 7px; border-radius: 999px; background: #ece9e1; color: #59564f; font-size: 10px; }
.tag-protest { background: #f4e3df; color: #7e3329; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.editor-dialog { width: min(680px, calc(100% - 24px)); max-height: min(90dvh, 900px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.editor-dialog::backdrop { background: rgb(25 24 22 / 55%); backdrop-filter: blur(2px); }
.editor-form { display: grid; gap: 15px; padding: clamp(20px, 4vw, 34px); }
.editor-form label { display: grid; gap: 6px; color: #4f4c45; font-size: 13px; font-weight: 600; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 2px; }
.dialog-heading h2 { margin: 0 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; }
.dialog-heading p { margin: 0; overflow-wrap: anywhere; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 24px; }
fieldset { display: grid; gap: 9px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
.choice { display: flex !important; grid-template-columns: 18px 1fr; align-items: center; gap: 9px !important; font-weight: 450 !important; }
.choice input { accent-color: var(--accent); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 9px; padding-top: 8px; }
.message { margin-bottom: 18px; padding: 12px 15px; border: 1px solid #d6c9aa; border-radius: 6px; background: #fbf5e8; color: #5e4d27; font-size: 14px; }
.message-error { border-color: #e5c4bf; background: #fff7f5; color: var(--danger); }
.login-view { display: grid; min-height: 100dvh; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, #e8e1d5, var(--paper) 60%); }
.login-card { width: min(100%, 430px); padding: clamp(26px, 6vw, 44px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h1 { margin: 5px 0 10px; font: 500 38px Georgia, "Times New Roman", serif; }
.login-card > p:not(.eyebrow) { margin: 0 0 26px; color: var(--muted); }
.login-card form { display: grid; gap: 12px; }
.login-card label { font-size: 13px; font-weight: 600; }
.settings-list, .job-list { display: grid; gap: 10px; }
.settings-row, .job-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.settings-row h3, .job-row h3 { margin: 0 0 5px; font-size: 15px; }
.settings-row p, .job-row p { margin: 0; color: var(--muted); font-size: 12px; }
.settings-form { width: min(100%, 720px); padding: 0; }
.settings-form fieldset { margin-bottom: 5px; }
.callout { margin: 20px 0 28px; padding: 16px 18px; border-left: 3px solid var(--accent); background: #ece8df; }
.callout p { margin: 7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
#publishing-panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 500; }
.status-label { color: var(--accent); font-size: 12px; font-weight: 700; }
.trash-section { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.trash-section h2 { font: 500 24px Georgia, "Times New Roman", serif; }

@media (max-width: 760px) {
  .topbar { height: 62px; padding: 0 16px; }
  .workspace { display: block; min-height: calc(100dvh - 62px); padding-bottom: env(safe-area-inset-bottom); }
  .sidebar { position: sticky; z-index: 3; top: 0; flex-direction: row; gap: 4px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { width: auto; flex: 0 0 auto; padding: 9px 12px; font-size: 13px; white-space: nowrap; }
  .sidebar-note { display: none; }
  .content { padding: 25px 16px; }
  .page-heading { align-items: center; gap: 12px; }
  .page-heading h1 { font-size: 34px; }
  .page-heading > .button { padding-inline: 11px; font-size: 12px; }
  .toolbar { align-items: stretch; }
  .search-input { width: 100%; }
  .filter-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .filter-chip { flex: 0 0 auto; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .photo-card-body { padding: 9px; }
  .photo-card-title { font-size: 12px; }
  .topbar-actions { gap: 8px; }
  .connection-status { max-width: 120px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .settings-row, .job-row { align-items: flex-start; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .nav-item, .filter-chip, .photo-card { transition: background-color .15s ease, border-color .15s ease, transform .15s ease; }
  .photo-card:hover { transform: translateY(-2px); }
}
