:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-strong: #f0f3ef;
  --text: #1d2521;
  --muted: #66736d;
  --line: #d9ded9;
  --primary: #246b57;
  --primary-dark: #164a3c;
  --accent: #a04f25;
  --danger: #9f2f2f;
  --shadow: 0 10px 30px rgba(30, 42, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3,
strong {
  font-weight: 650;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #17251f;
  color: #f5f7f3;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.logout-button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f5f7f3;
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.nav a:hover,
.logout-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.content {
  padding: 28px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  align-items: center;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 650;
  min-height: 42px;
  padding: 9px 14px;
}

.button.secondary {
  background: var(--panel);
  color: var(--primary-dark);
}

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  padding: 18px;
}

.linked-panel {
  padding: 18px;
}

.stat-number {
  display: block;
  font-size: 30px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.list-item + .list-item {
  border-top: 1px solid var(--line);
}

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 8px;
}

.badge {
  background: var(--panel-strong);
  border-radius: 999px;
  color: var(--primary-dark);
  display: inline-block;
  font-size: 13px;
  font-weight: 650;
  padding: 3px 9px;
}

.tag-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  min-height: 26px;
  padding: 5px 10px;
  white-space: nowrap;
}

.tag-status {
  background: #eef5f1;
  border-color: #c8dbd1;
  color: #1f5b48;
}

.tag-status-ready,
.tag-status-active,
.tag-status-done {
  background: #e8f4eb;
  border-color: #b7d6c0;
  color: #1e6436;
}

.tag-status-inbox,
.tag-status-idea,
.tag-status-elaborate {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.tag-status-scout,
.tag-status-planned {
  background: #e8f1fb;
  border-color: #b9d2ee;
  color: #285e91;
}

.tag-status-repeat,
.tag-priority-high {
  background: #fbecea;
  border-color: #e6b8b1;
  color: #97362b;
}

.tag-active {
  box-shadow: 0 0 0 2px rgba(36, 107, 87, 0.2);
}

.saved-views {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag-status-paused,
.tag-status-archived {
  background: #f0f1f2;
  border-color: #d5d8da;
  color: #555f66;
}

.tag-category {
  background: #f0eff8;
  border-color: #d4cdea;
  color: #594c8a;
}

.tag-priority {
  background: #f4eee5;
  border-color: #dfcbb1;
  color: #76542a;
}

.tag-priority-low {
  background: #eef3ed;
  border-color: #cddccc;
  color: #4f6b4d;
}

.tag-priority-medium {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.tag-status-inbox {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.tag-status-elaborate {
  background: #f8eadf;
  border-color: #e3bea2;
  color: #815037;
}

.tag-status-scout {
  background: #e7f2f5;
  border-color: #b5d5df;
  color: #285f70;
}

.tag-status-ready {
  background: #e8f4eb;
  border-color: #b7d6c0;
  color: #1e6436;
}

.tag-status-planned {
  background: #e8f1fb;
  border-color: #b9d2ee;
  color: #285e91;
}

.tag-status-photographed {
  background: #f0eff8;
  border-color: #d4cdea;
  color: #594c8a;
}

.tag-status-repeat {
  background: #fbecea;
  border-color: #e6b8b1;
  color: #97362b;
}

.tag-status-done,
.tag-status-active {
  background: #e7f2e8;
  border-color: #b6d4ba;
  color: #286238;
}

.tag-status-idea {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.tag-status-paused {
  background: #f1efe8;
  border-color: #d8d1bd;
  color: #665c43;
}

.tag-status-archived {
  background: #f0f1f2;
  border-color: #d5d8da;
  color: #555f66;
}

.tag-category-landscape {
  background: #e7f2e8;
  border-color: #b6d4ba;
  color: #286238;
}

.tag-category-night {
  background: #eceaf7;
  border-color: #cbc4e6;
  color: #4d4385;
}

.tag-category-architecture {
  background: #e8f1fb;
  border-color: #b9d2ee;
  color: #285e91;
}

.tag-category-nature {
  background: #eef5f1;
  border-color: #c8dbd1;
  color: #1f5b48;
}

.tag-category-street {
  background: #f4eee5;
  border-color: #dfcbb1;
  color: #76542a;
}

.tag-category-other {
  background: #f0f1f2;
  border-color: #d5d8da;
  color: #555f66;
}

.tag-priority-low {
  background: #eef3ed;
  border-color: #cddccc;
  color: #4f6b4d;
}

.tag-priority-medium {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.tag-priority-high {
  background: #fbecea;
  border-color: #e6b8b1;
  color: #97362b;
}

select.tag-select {
  appearance: auto;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  min-height: 40px;
  width: min(100%, 280px);
}

select.tag-select[data-tag-kind="status"] {
  background: #eef5f1;
  border-color: #c8dbd1;
  color: #1f5b48;
}

select.tag-select[data-tag-kind="status"][data-tag-value="ready"],
select.tag-select[data-tag-kind="status"][data-tag-value="active"],
select.tag-select[data-tag-kind="status"][data-tag-value="done"] {
  background: #e8f4eb;
  border-color: #b7d6c0;
  color: #1e6436;
}

select.tag-select[data-tag-kind="status"][data-tag-value="inbox"],
select.tag-select[data-tag-kind="status"][data-tag-value="idea"],
select.tag-select[data-tag-kind="status"][data-tag-value="elaborate"] {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

select.tag-select[data-tag-kind="status"][data-tag-value="scout"],
select.tag-select[data-tag-kind="status"][data-tag-value="planned"] {
  background: #e8f1fb;
  border-color: #b9d2ee;
  color: #285e91;
}

select.tag-select[data-tag-kind="status"][data-tag-value="repeat"] {
  background: #fbecea;
  border-color: #e6b8b1;
  color: #97362b;
}

select.tag-select[data-tag-kind="status"][data-tag-value="paused"],
select.tag-select[data-tag-kind="status"][data-tag-value="archived"] {
  background: #f0f1f2;
  border-color: #d5d8da;
  color: #555f66;
}

select.tag-select[data-tag-kind="category"] {
  background: #f0eff8;
  border-color: #d4cdea;
  color: #594c8a;
}

select.tag-select[data-tag-kind="priority"] {
  background: #f4eee5;
  border-color: #dfcbb1;
  color: #76542a;
}

select.tag-select[data-tag-kind="priority"][data-tag-value=""] {
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
}

select.tag-select[data-tag-kind="priority"][data-tag-value="low"] {
  background: #eef3ed;
  border-color: #cddccc;
  color: #4f6b4d;
}

select.tag-select[data-tag-kind="priority"][data-tag-value="medium"] {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

select.tag-select[data-tag-kind="priority"][data-tag-value="high"] {
  background: #fbecea;
  border-color: #e6b8b1;
  color: #97362b;
}

.tag-empty {
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
}

.tag-select-native-hidden {
  display: none;
}

.tag-select-control {
  display: inline-block;
  max-width: 100%;
  position: relative;
  width: min(100%, 280px);
}

.tag-select-button {
  cursor: pointer;
  font: inherit;
  justify-content: space-between;
  min-height: 40px;
  width: 100%;
}

.tag-select-button::after {
  content: "▾";
  font-size: 11px;
  margin-left: 12px;
}

.tag-select-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  left: 0;
  margin-top: 6px;
  max-height: 260px;
  min-width: min(320px, 90vw);
  overflow: auto;
  padding: 10px;
  position: absolute;
  top: 100%;
  z-index: 50;
}

.tag-select-menu[hidden] {
  display: none;
}

.tag-select-option {
  cursor: pointer;
  font: inherit;
}

.tag-select-option:hover,
.tag-select-option:focus {
  box-shadow: 0 0 0 2px rgba(36, 107, 87, 0.18);
  outline: 0;
}

.tag-select-button::after {
  content: "\25BE";
}

.filters {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 2fr repeat(6, minmax(120px, 1fr)) auto;
  margin-bottom: 16px;
}

.field,
input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

label {
  display: grid;
  font-weight: 650;
  gap: 6px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid p {
  margin: 0;
}

.form-grid p:has(textarea),
.form-grid p:has([name="title"]),
.form-grid p:has([name="description"]),
.form-grid p:has([name="notes"]),
.form-grid p:has([name="composition_notes"]) {
  grid-column: 1 / -1;
}

.structured-form,
.quick-form {
  display: grid;
  gap: 18px;
}

.form-section {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
}

.form-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.form-section h2,
.section-heading h2 {
  font-size: 19px;
  margin: 0;
}

.section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.action-panel {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}

.action-panel button {
  cursor: pointer;
  font: inherit;
}

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.kv {
  display: grid;
  gap: 10px;
}

.kv div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.kv strong {
  display: block;
}

.map {
  border-radius: 8px;
  height: 420px;
  overflow: hidden;
}

.coordinate-picker {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 16px;
}

.coordinate-header {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.coordinate-header h2 {
  font-size: 20px;
  margin: 0;
}

.coordinate-header p {
  margin: 4px 0 0;
}

.coordinate-map {
  min-height: 360px;
}

.coordinate-status {
  margin: 0;
}

.coordinate-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.coordinate-fields p {
  margin: 0;
}

.form-errors,
.errorlist {
  color: var(--danger);
}

.flash-messages {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.flash-message {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.flash-error {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

.bottom-nav {
  display: none;
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.login-card {
  margin: 12vh auto 0;
  max-width: 420px;
  padding: 24px;
}

.theme-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: rgba(247, 250, 246, 0.62);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  gap: 7px;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(247, 250, 246, 0.9);
}

.theme-toggle-icon {
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
  border: 1.5px solid currentColor;
  border-radius: 999px;
  display: inline-block;
  height: 14px;
  width: 14px;
}

.sidebar .theme-toggle {
  margin: auto 10px 0;
  width: auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.login-theme-toggle,
.mobile-theme-toggle {
  background: rgba(255, 255, 255, 0.56);
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
}

.login-theme-toggle:hover,
.mobile-theme-toggle:hover {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.mobile-theme-toggle {
  display: none;
}

.login-theme-toggle {
  color: var(--text);
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 20;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101613;
  --panel: #17201b;
  --panel-strong: #202b24;
  --text: #e9eee9;
  --muted: #a5b0aa;
  --line: #2e3b34;
  --primary: #64b891;
  --primary-dark: #9bd8b9;
  --accent: #d48a3f;
  --danger: #ef8178;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #141d18 0, var(--bg) 340px);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .bottom-nav {
  background: #0d1511;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .brand::before {
  background: #d48a3f;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .panel {
  background: rgba(23, 32, 27, 0.96);
}

html[data-theme="dark"] .button {
  color: #0d1511;
}

html[data-theme="dark"] .button:hover {
  background: #7bc8a3;
  border-color: #7bc8a3;
}

html[data-theme="dark"] .button.secondary {
  background: #202b24;
  border-color: #3a4a41;
  color: var(--text);
}

html[data-theme="dark"] .button.secondary:hover,
html[data-theme="dark"] .filter-chip:hover,
html[data-theme="dark"] .search-select-option:hover,
html[data-theme="dark"] .search-select-option:focus,
html[data-theme="dark"] .search-select-option[aria-selected="true"] {
  background: #26372e;
  border-color: #4d6659;
  color: var(--text);
}

html[data-theme="dark"] .list-item:hover,
html[data-theme="dark"] .date-form-row,
html[data-theme="dark"] .photo-tile,
html[data-theme="dark"] .coordinate-picker {
  background: #131c17;
}

html[data-theme="dark"] .field,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .chip-choice,
html[data-theme="dark"] .date-delete,
html[data-theme="dark"] .tag-empty,
html[data-theme="dark"] .filter-chip-reset {
  background: #111a15;
  border-color: #35443b;
  color: var(--text);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #7e8b84;
}

html[data-theme="dark"] .search-select-control.has-selection .search-select-input,
html[data-theme="dark"] .filter-chip {
  background: #1c2a23;
  border-color: #496254;
  color: var(--primary-dark);
}

html[data-theme="dark"] .tag,
html[data-theme="dark"] .tag-select-button,
html[data-theme="dark"] .tag-select-option {
  border-color: #3a4a41;
}

html[data-theme="dark"] .tag-status,
html[data-theme="dark"] .tag-category-nature {
  background: #1b2c25;
  border-color: #2f4a3d;
  color: #a8c9bb;
}

html[data-theme="dark"] .tag-status-ready,
html[data-theme="dark"] .tag-status-active,
html[data-theme="dark"] .tag-status-done,
html[data-theme="dark"] .tag-category-landscape,
html[data-theme="dark"] .tag-priority-low,
html[data-theme="dark"] .tag-month,
html[data-theme="dark"] [data-chip-kind="month"] .chip-choice-selected {
  background: #1a2d21;
  border-color: #33533d;
  color: #afd1b8;
}

html[data-theme="dark"] .tag-status-inbox,
html[data-theme="dark"] .tag-status-idea,
html[data-theme="dark"] .tag-priority-medium,
html[data-theme="dark"] .tag-weather,
html[data-theme="dark"] [data-chip-kind="weather"] .chip-choice-selected {
  background: #332916;
  border-color: #5f4c25;
  color: #d8c08a;
}

html[data-theme="dark"] .tag-status-elaborate,
html[data-theme="dark"] .tag-status-paused,
html[data-theme="dark"] .tag-category-street,
html[data-theme="dark"] .tag-date {
  background: #32251b;
  border-color: #5b4330;
  color: #d8b092;
}

html[data-theme="dark"] .tag-status-scout,
html[data-theme="dark"] .tag-status-planned,
html[data-theme="dark"] .tag-category-architecture,
html[data-theme="dark"] .tag-time,
html[data-theme="dark"] [data-chip-kind="time"] .chip-choice-selected {
  background: #182936;
  border-color: #344e62;
  color: #abc8da;
}

html[data-theme="dark"] .tag-status-photographed,
html[data-theme="dark"] .tag-category,
html[data-theme="dark"] .tag-category-night,
html[data-theme="dark"] .tag-equipment,
html[data-theme="dark"] [data-chip-kind="equipment"] .chip-choice-selected {
  background: #29253a;
  border-color: #4b4569;
  color: #c2bddb;
}

html[data-theme="dark"] .tag-status-repeat,
html[data-theme="dark"] .tag-priority-high {
  background: #3a2221;
  border-color: #673c3a;
  color: #d9a3a0;
}

html[data-theme="dark"] .tag-status-archived,
html[data-theme="dark"] .tag-category-other {
  background: #242a29;
  border-color: #3f4947;
  color: #b8c1be;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .kv strong {
  color: #c7d1cc;
}

html[data-theme="dark"] .map {
  background: #111a15;
}

@media (max-width: 1024px) {
  .app-shell {
    display: block;
    padding-bottom: 72px;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 20px;
  }

  .stats,
  .filters,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .coordinate-header {
    align-items: stretch;
    flex-direction: column;
  }

  .coordinate-fields {
    grid-template-columns: 1fr;
  }

  select.tag-select {
    width: 100%;
  }

  .tag-select-control {
    width: 100%;
  }

  .tag-select-menu {
    min-width: 100%;
  }

  .bottom-nav {
    background: #17251f;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 0;
    position: fixed;
    right: 0;
    z-index: 20;
  }

  .bottom-nav a {
    color: #f5f7f3;
    font-size: 13px;
    font-weight: 650;
    padding: 11px 4px;
    text-align: center;
  }

  .bottom-nav .plus {
    background: var(--accent);
    font-size: 20px;
  }

  .mobile-theme-toggle {
    bottom: 78px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    position: fixed;
    right: 14px;
    z-index: 30;
  }

  .mobile-theme-toggle [data-theme-label] {
    display: none;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .page-title {
    font-size: 24px;
  }

  .list-item {
    grid-template-columns: 1fr;
  }

  .map {
    height: 320px;
  }
}

/* Modern UI refresh */
:root {
  --bg: #f3f5f2;
  --panel: #ffffff;
  --panel-strong: #eef3ef;
  --text: #17211c;
  --muted: #64716a;
  --line: #dce3dd;
  --primary: #1f6b56;
  --primary-dark: #164838;
  --accent: #b45f24;
  --danger: #a33a32;
  --shadow: 0 14px 34px rgba(31, 43, 36, 0.08);
}

html {
  background: var(--bg);
}

body {
  background: linear-gradient(180deg, #fbfcfa 0, var(--bg) 340px);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(31, 107, 86, 0.28);
  outline-offset: 2px;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: #16241d;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 16px;
}

.brand {
  align-items: center;
  display: flex;
  font-size: 20px;
  font-weight: 700;
  gap: 10px;
  line-height: 1.1;
  padding: 8px 10px;
}

.brand::before {
  background: #d88736;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  content: "";
  display: inline-block;
  height: 28px;
  width: 28px;
}

.nav {
  gap: 6px;
}

.nav a,
.logout-button {
  align-items: center;
  border-radius: 8px;
  color: rgba(247, 250, 246, 0.86);
  display: flex;
  font-weight: 600;
  min-height: 42px;
}

.nav a:hover,
.logout-button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.content {
  margin: 0 auto;
  max-width: 1480px;
  padding: 32px;
  width: 100%;
}

.topbar {
  align-items: flex-start;
  gap: 18px;
}

.page-title {
  font-size: 30px;
  font-weight: 700;
}

.button {
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(31, 43, 36, 0.06);
  cursor: pointer;
  font-weight: 650;
  justify-content: center;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: #c8d2ca;
  box-shadow: none;
}

.button.secondary:hover {
  background: #e6f2ed;
  border-color: #b9d1c6;
}

.stats {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.card,
.panel {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.card {
  padding: 20px;
}

.card h2,
.panel h2 {
  font-size: 19px;
  font-weight: 650;
  margin: 0 0 14px;
}

.stat-number {
  color: var(--primary-dark);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.stats .card {
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.stats .card:hover {
  border-color: #b9d1c6;
  box-shadow: 0 18px 42px rgba(31, 43, 36, 0.11);
  transform: translateY(-2px);
}

.list {
  gap: 0;
}

.list-item {
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  transition: background 140ms ease;
}

.list-item:hover {
  background: #f8faf7;
}

.list-item strong {
  display: block;
  font-weight: 650;
}

.meta {
  align-items: center;
  margin-top: 5px;
}

.badge,
.tag {
  font-weight: 650;
}

.tag {
  min-height: 28px;
  padding: 6px 11px;
}

.chip-multi {
  display: grid;
  gap: 10px;
}

.chip-single {
  display: grid;
  gap: 10px;
}

.chip-single > input[type="hidden"] {
  display: none;
}

.chip-multi > input[type="hidden"] {
  display: none;
}

.chip-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-choice {
  background: rgba(248, 250, 248, 0.72);
  border-color: #e1e8e2;
  color: #7b8880;
  cursor: pointer;
}

.chip-choice:hover {
  background: #f2f6f3;
  border-color: #b9cbbf;
  color: var(--text);
}

[data-chip-kind="month"] .chip-choice-selected {
  background: #e7f2e8;
  border-color: #a9ccb1;
  color: #245d34;
}

[data-chip-kind="time"] .chip-choice-selected {
  background: #e8f1fb;
  border-color: #abc9e8;
  color: #285e91;
}

[data-chip-kind="weather"] .chip-choice-selected {
  background: #fff4da;
  border-color: #e4c873;
  color: #70500f;
}

[data-chip-kind="equipment"] .chip-choice-selected {
  background: #f0eff8;
  border-color: #c7c0e3;
  color: #51457f;
}

.chip-choice-selected {
  box-shadow: inset 0 0 0 1px currentColor;
}

.dashboard-special-view {
  margin-top: 18px;
}

.dashboard-filters {
  margin: 16px 0;
}

.dashboard-left-column {
  min-width: 0;
}

.dashboard-view-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.dashboard-tab {
  background: var(--panel);
  border-color: var(--line);
  border-radius: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.dashboard-tab:hover {
  background: var(--panel-strong);
  border-color: #b9d1c6;
  color: var(--text);
}

.dashboard-tab.tag-active {
  background: #e6f2ed;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 107, 87, 0.14);
  color: var(--primary-dark);
}

.dashboard-view-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 16px 16px 0;
}

.dashboard-weather-controls {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 16px 16px 0;
}

.dashboard-weather-form {
  margin: 0;
}

.dashboard-weather-form select {
  width: 100%;
}

.maintenance-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-warning {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.idea-secondary-details {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 4px 12px;
  line-height: 1.45;
  margin-top: 5px;
}

[data-chip-kind="status"] .chip-choice-selected {
  background: #e8f1fb;
  border-color: #abc9e8;
  color: #285e91;
}

[data-chip-kind="category"] .chip-choice-selected {
  background: #f0eff8;
  border-color: #c7c0e3;
  color: #51457f;
}

[data-chip-kind="priority"] .chip-choice-selected {
  background: #fff4da;
  border-color: #e4c873;
  color: #70500f;
}

.tag-month {
  background: #e7f2e8;
  border-color: #b6d4ba;
  color: #286238;
}

.tag-time {
  background: #e8f1fb;
  border-color: #b9d2ee;
  color: #285e91;
}

.tag-weather {
  background: #fff4da;
  border-color: #efd38e;
  color: #775614;
}

.tag-equipment {
  background: #f0eff8;
  border-color: #d4cdea;
  color: #594c8a;
}

.tag-date {
  background: #f8eadf;
  border-color: #e3bea2;
  color: #815037;
}

.chip-custom-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 360px) 42px;
}

.chip-add-button {
  font-size: 20px;
  min-height: 42px;
  padding: 0;
  width: 42px;
}

.form-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.form-field-full {
  grid-column: 1 / -1;
}

.section-heading-inline {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.section-heading-inline h2,
.section-heading-inline p {
  margin: 0;
}

.section-heading-inline p {
  margin-top: 4px;
}

.date-form-list {
  display: grid;
  gap: 10px;
}

.date-form-row {
  align-items: end;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  padding: 12px;
}

.date-form-row p {
  margin: 0;
}

.date-delete {
  align-items: center;
  background: #fff;
  border: 1px solid #d5d8da;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 7px;
  min-height: 42px;
  padding: 8px 12px;
}

.date-delete input {
  min-height: 0;
  width: auto;
}

.tag-active {
  box-shadow: 0 0 0 2px rgba(31, 107, 86, 0.2);
}

.tag-select-button::after {
  content: "\25BE";
}

.tag-select-menu {
  box-shadow: 0 20px 46px rgba(31, 43, 36, 0.16);
  margin-top: 8px;
  min-width: min(340px, 90vw);
}

.tag-select-menu[hidden] {
  display: none;
}

.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(31, 43, 36, 0.06);
  margin-bottom: 10px;
  padding: 12px;
}

.active-filters {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.filter-chip {
  background: #f5f8f6;
  border-color: #bfd2c9;
  color: var(--primary-dark);
  gap: 8px;
}

.filter-chip:hover {
  background: #e9f2ed;
  border-color: #a8c5b8;
}

.filter-chip-remove {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.filter-chip-reset {
  background: #fff;
  border-color: #d5d8da;
  color: var(--muted);
}

.field,
input,
select,
textarea {
  border-color: #c8d2ca;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8a958f;
}

.field:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: #9fc2b4;
  box-shadow: 0 0 0 3px rgba(31, 107, 86, 0.12);
  outline: 0;
}

.search-select-native-hidden {
  display: none;
}

.search-select-control {
  max-width: 720px;
  position: relative;
  width: 100%;
}

.search-select-input-wrap {
  position: relative;
}

.search-select-input {
  padding-right: 42px;
}

.search-select-control.has-selection .search-select-input {
  background: #f5f8f6;
  border-color: #afc8bd;
  color: var(--primary-dark);
}

.search-select-clear {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 22px;
  height: 36px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 3px;
  top: 3px;
  width: 36px;
}

.search-select-clear:hover {
  color: var(--danger);
}

.search-select-clear[hidden] {
  display: none;
}

.search-select-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(31, 43, 36, 0.16);
  display: grid;
  left: 0;
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 60;
}

.search-select-menu[hidden] {
  display: none;
}

.search-select-option {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 10px 11px;
  text-align: left;
  width: 100%;
}

.search-select-option:hover,
.search-select-option:focus,
.search-select-option[aria-selected="true"] {
  background: #e9f2ed;
  color: var(--primary-dark);
  outline: 0;
}

.search-select-empty {
  color: var(--muted);
  padding: 12px;
}

.list-item:has(.list-thumb) {
  grid-template-columns: 76px minmax(0, 1fr) auto;
}

.idea-spot-line {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
  margin-bottom: 3px;
}

.idea-next-step {
  color: var(--muted);
  display: block;
  font-size: 14px;
  line-height: 1.35;
  margin-top: 3px;
}

.list-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  height: 58px;
  object-fit: cover;
  width: 76px;
}

.photo-gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  padding: 16px;
}

.form-section .photo-gallery {
  padding: 0;
}

.photo-tile {
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 0;
  overflow: hidden;
  padding: 8px;
}

.photo-tile img {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  display: block;
  object-fit: cover;
  width: 100%;
}

.photo-tile figcaption {
  color: var(--muted);
  font-size: 14px;
}

.photo-tile form {
  display: flex;
  justify-content: flex-end;
}

.photo-delete {
  min-height: 34px;
  padding: 5px 10px;
}

label {
  color: #334139;
  font-size: 14px;
  font-weight: 650;
}

.structured-form,
.quick-form {
  gap: 20px;
}

.structured-form .form-grid,
.quick-form .form-grid {
  grid-template-columns: minmax(0, 1fr);
}

.form-section {
  padding-bottom: 20px;
}

.form-section h2,
.section-heading h2 {
  font-size: 19px;
  font-weight: 650;
}

.section-heading {
  padding: 14px 16px;
}

.kv strong {
  color: #334139;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 3px;
}

.kv div:last-child {
  border-bottom: 0;
}

.coordinate-picker {
  background: #f8faf7;
}

.form-errors,
.errorlist {
  color: var(--danger);
  font-size: 14px;
}

@media (max-width: 1180px) {
  .stats {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .content {
    padding: 20px;
  }

  .actions {
    align-items: stretch;
  }

  .actions .button {
    flex: 1 1 auto;
  }

  .bottom-nav {
    background: #16241d;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -12px 28px rgba(31, 43, 36, 0.14);
  }

  .bottom-nav a {
    color: rgba(247, 250, 246, 0.9);
    min-height: 58px;
  }

  .bottom-nav .plus {
    background: var(--accent);
    color: #fff;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .page-title {
    font-size: 25px;
  }

  .card {
    padding: 16px;
  }

  .search-select-control {
    max-width: none;
  }

  .search-select-menu {
    max-height: 360px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading-inline,
  .date-form-row {
    align-items: stretch;
  }

  .section-heading-inline {
    flex-direction: column;
  }

  .date-form-row {
    grid-template-columns: 1fr;
  }

  .list-item:has(.list-thumb) {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .list-item:has(.list-thumb) .badge {
    grid-column: 2;
    justify-self: start;
  }

  .list-thumb {
    height: 52px;
    width: 64px;
  }
}

/* Dark mode final overrides */
.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar .theme-toggle {
  flex-shrink: 0;
  margin: 14px 10px 0;
  width: auto;
}

.mobile-theme-toggle {
  display: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101613;
  --panel: #17201b;
  --panel-strong: #202b24;
  --text: #e9eee9;
  --muted: #a5b0aa;
  --line: #2e3b34;
  --primary: #64b891;
  --primary-dark: #9bd8b9;
  --accent: #d48a3f;
  --danger: #ef8178;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #101613;
}

html[data-theme="dark"] body {
  background-image: linear-gradient(180deg, #141d18 0, #101613 340px);
  color: var(--text);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .bottom-nav {
  background: #0d1511;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .search-select-menu,
html[data-theme="dark"] .tag-select-menu {
  background: rgba(23, 32, 27, 0.96);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .list-item:hover,
html[data-theme="dark"] .date-form-row,
html[data-theme="dark"] .photo-tile,
html[data-theme="dark"] .coordinate-picker {
  background: #131c17;
}

html[data-theme="dark"] .field,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .chip-choice,
html[data-theme="dark"] .date-delete,
html[data-theme="dark"] .tag-empty,
html[data-theme="dark"] .filter-chip-reset {
  background: #111a15;
  border-color: #35443b;
  color: var(--text);
}

html[data-theme="dark"] .chip-choice {
  background: rgba(17, 26, 21, 0.58);
  border-color: #29372f;
  color: #7f9085;
}

html[data-theme="dark"] .chip-choice:hover {
  background: #17221b;
  border-color: #405247;
  color: var(--text);
}

html[data-theme="dark"] .button {
  color: #0d1511;
}

html[data-theme="dark"] .button.secondary {
  background: #202b24;
  border-color: #3a4a41;
  color: var(--text);
}

html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .search-select-control.has-selection .search-select-input,
html[data-theme="dark"] .search-select-option:hover,
html[data-theme="dark"] .search-select-option:focus,
html[data-theme="dark"] .search-select-option[aria-selected="true"] {
  background: #1c2a23;
  border-color: #496254;
  color: var(--primary-dark);
}

html[data-theme="dark"] [data-chip-kind="status"] .chip-choice-selected {
  background: #1d2d38;
  border-color: #385a72;
  color: #a9c9df;
}

html[data-theme="dark"] [data-chip-kind="category"] .chip-choice-selected {
  background: #29263b;
  border-color: #514a76;
  color: #c3bce3;
}

html[data-theme="dark"] [data-chip-kind="priority"] .chip-choice-selected {
  background: #332916;
  border-color: #5f4c25;
  color: #d8c08a;
}

html[data-theme="dark"] .tag-warning {
  background: #332916;
  border-color: #5f4c25;
  color: #d8c08a;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .kv strong {
  color: #c7d1cc;
}

html[data-theme="dark"] .theme-toggle {
  background: transparent;
  border-color: rgba(233, 238, 233, 0.12);
  color: rgba(233, 238, 233, 0.6);
}

html[data-theme="dark"] .theme-toggle:hover {
  background: rgba(233, 238, 233, 0.07);
  border-color: rgba(233, 238, 233, 0.2);
  color: rgba(233, 238, 233, 0.9);
}

html[data-theme="dark"] .tag-status,
html[data-theme="dark"] .tag-category-nature {
  background: #1b2c25;
  border-color: #2f4a3d;
  color: #a8c9bb;
}

html[data-theme="dark"] .tag-status-ready,
html[data-theme="dark"] .tag-status-active,
html[data-theme="dark"] .tag-status-done,
html[data-theme="dark"] .tag-category-landscape,
html[data-theme="dark"] .tag-priority-low,
html[data-theme="dark"] .tag-month,
html[data-theme="dark"] [data-chip-kind="month"] .chip-choice-selected {
  background: #1a2d21;
  border-color: #33533d;
  color: #afd1b8;
}

html[data-theme="dark"] .tag-status-inbox,
html[data-theme="dark"] .tag-status-idea,
html[data-theme="dark"] .tag-priority-medium,
html[data-theme="dark"] .tag-weather,
html[data-theme="dark"] [data-chip-kind="weather"] .chip-choice-selected {
  background: #332916;
  border-color: #5f4c25;
  color: #d8c08a;
}

html[data-theme="dark"] .tag-status-elaborate,
html[data-theme="dark"] .tag-status-paused,
html[data-theme="dark"] .tag-category-street,
html[data-theme="dark"] .tag-date {
  background: #32251b;
  border-color: #5b4330;
  color: #d8b092;
}

html[data-theme="dark"] .tag-status-scout,
html[data-theme="dark"] .tag-status-planned,
html[data-theme="dark"] .tag-category-architecture,
html[data-theme="dark"] .tag-time,
html[data-theme="dark"] [data-chip-kind="time"] .chip-choice-selected {
  background: #182936;
  border-color: #344e62;
  color: #abc8da;
}

html[data-theme="dark"] .tag-status-photographed,
html[data-theme="dark"] .tag-category,
html[data-theme="dark"] .tag-category-night,
html[data-theme="dark"] .tag-equipment,
html[data-theme="dark"] [data-chip-kind="equipment"] .chip-choice-selected {
  background: #29253a;
  border-color: #4b4569;
  color: #c2bddb;
}

html[data-theme="dark"] .tag-status-repeat,
html[data-theme="dark"] .tag-priority-high {
  background: #3a2221;
  border-color: #673c3a;
  color: #d9a3a0;
}

html[data-theme="dark"] .tag-status-archived,
html[data-theme="dark"] .tag-category-other {
  background: #242a29;
  border-color: #3f4947;
  color: #b8c1be;
}

html[data-theme="dark"] .dashboard-tab {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}

html[data-theme="dark"] .dashboard-tab:hover {
  background: var(--panel-strong);
  border-color: #496254;
  color: var(--text);
}

html[data-theme="dark"] .dashboard-tab.tag-active {
  background: #1c2a23;
  border-color: #5c9075;
  box-shadow: 0 0 0 2px rgba(92, 144, 117, 0.2);
  color: #b9dbc7;
}

@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }

  .mobile-theme-toggle {
    bottom: 78px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    display: inline-flex;
    min-height: 34px;
    padding: 8px;
    position: fixed;
    right: 14px;
    width: 34px;
    z-index: 30;
  }

  .mobile-theme-toggle [data-theme-label] {
    display: none;
  }
}

@media (max-width: 640px) {
  .dashboard-view-nav {
    grid-template-columns: 1fr;
  }
}
