@import url('https://fonts.googleapis.com/css2?family=Cousine:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ─── Custom properties ─────────────────────────────────────────────────────── */
:root {
  --bg:           #fdf8f0;
  --bg-card:      #fffdf8;
  --bg-elevated:  #fff9ee;
  --border:       #e8d9c0;
  --border-light: #f0e6d3;

  --text:         #1e100a;
  --text-2:       #35251d;
  --text-3:       #3d2f27;

  --accent:       #312216;
  --accent-light: #c4996a;
  --accent-bg:    #f5ebe0;

  --tag-bg:       #f0e6d8;
  --tag-text:     #7a4f35;

  --green:        #5a7a4a;
  --green-bg:     #eef4eb;

  --shadow-sm:    0 1px 3px rgba(44, 24, 16, 0.08);
  --shadow-md:    0 4px 16px rgba(44, 24, 16, 0.12);
  --shadow-lg:    0 8px 32px rgba(44, 24, 16, 0.18);

  --radius:       8px;
  --radius-lg:    14px;

  --font:         "Cousine", monospace;
  --font-size:    14px;
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }




html { font-size: var(--font-size); -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--accent); }

/* ─── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--bg);
  
  position: sticky;
  top: 0;
  z-index: 100;
  /* box-shadow: var(--shadow-sm); */
  /*padding: 16px 0 0 0;*/
}

@media (max-width: 1200px) {
  .app-header {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.app-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 0 0 0;
  display: flex;
  align-items: center;
  gap: 24px;
  /*height: 56px;*/
  border-bottom: 1px solid var(--border);
}

.app-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.02em;
  white-space: nowrap;
  width: 100%;
  text-decoration: none;
  cursor: pointer;
}

/* ─── Tab navigation ────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  align-items: flex-end;
}

/* Nav links */
.nav-link {
  position: relative;
  padding: 8px 18px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;

  background: var(--bg);
  color: var(--text-2);

  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;

  margin-left: -10px;
  z-index: 1;

  transition: background 0.15s, color 0.15s;
}

.nav-link:first-child {
  margin-left: 0;
}

.nav-link:hover {
  background: var(--border);
  color: var(--text);
}

.nav-link.active {
  background: var(--bg);
  color: var(--text);
  z-index: 2;
  height: 42px;
}

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0 40px;
}

/* ─── States ────────────────────────────────────────────────────────────────── */
.state-loading {
  padding: 48px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 0.95rem;
}

@media (max-width: 1200px) {
  .app-main {
    padding-left: 16px;
    padding-right: 16px;
  }
}

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

.state-empty h2 {
  font-size: 1.3rem;
  color: var(--text-2);
  margin-bottom: 8px;
}

.state-empty p {
  font-size: 1rem;
  margin-bottom: 20px;
}

/* ─── Timeline filters ──────────────────────────────────────────────────────── */
.timeline-filters {
  padding: 16px 0 8px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
}

.search-input {
  width: auto;
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  padding-left: 36px; /* space for icon */
}

.search-input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.1);
}

.search-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  pointer-events: none; /* clicks go to input */
  color: #888; /* use currentColor if path fill="currentColor" */
}


.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select, .filter-year {
  flex: 1;
  min-width: 100px;
  padding: 8px 28px 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233d2f27' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.filter-select:focus, .filter-year:focus {
  border-color: var(--accent-light);
}

.filter-year { max-width: 100px; flex: 0 1 100px; }

.filter-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* Chip-based filter multiselect */
.filter-chip-select {
  position: relative;
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: text;
  transition: border-color 0.15s;
}

.filter-chip-select:focus-within {
  border-color: var(--accent-light);
}

.filter-chip-chips {
  display: contents;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.72rem;
  padding: 2px 4px 2px 7px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 160px;
}

.filter-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.filter-chip-event {
  background: var(--green-bg);
  color: var(--green);
}

.filter-chip-x {
  background: none;
  border: none;
  color: inherit;
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.filter-chip-x:hover { opacity: 1; }

.filter-chip-input {
  flex: 1;
  min-width: 60px;
  border: none;
  background: none;
  outline: none;
  font-size: 0.82rem;
  color: var(--text);
  padding: 3px 0;
}

.filter-chip-input::placeholder { color: var(--text-3); }

/* Re-use .tag-dropdown for filter dropdowns (already styled) */
.filter-chip-select > .tag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 500;
}

.filter-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-2);
}

.filter-status.hidden { display: none; }

.filter-status-text { flex: 1; }

.clear-filters-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
  white-space: nowrap;
}

.clear-filters-btn:hover {
  background: var(--accent-bg);
}

/* ─── Timeline content ──────────────────────────────────────────────────────── */
.timeline-content { padding-top: 8px; }

.year-group { margin-bottom: 32px; }

.year-header {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 55px;
  z-index: 10;
  background-color: var(--bg);
}

.year-label {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.04em;
  width: 100%;
}

.year-count {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 400;
  white-space: nowrap;
}

.month-group { margin-bottom: 20px; }

.month-header {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}

@media (min-width: 480px) {
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
}

@media (min-width: 768px) {
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

.thumb-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border-light);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.thumb-item:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

.thumb-item img.loading { opacity: 0; }

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 1.6rem;
}

.thumb-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(44, 24, 16, 0.6);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* Thumbnail checkbox */
.thumb-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  cursor: pointer;
  display: flex;
}

.thumb-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.thumb-check-mark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-check-mark::after {
  content: '';
  display: none;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -1px;
}

.thumb-checkbox:checked + .thumb-check-mark {
  background: var(--accent);
  border-color: var(--accent);
}

.thumb-checkbox:checked + .thumb-check-mark::after {
  display: block;
}

/* Show checkbox on hover or when selected */
.thumb-check { opacity: 0; transition: opacity 0.15s; }
.thumb-item:hover .thumb-check,
.thumb-item.selected .thumb-check { opacity: 1; }

.thumb-item.selected { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ── Selection bar (floating bottom) ── */
.selection-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.selection-bar-text { font-weight: 600; color: var(--text); white-space: nowrap; }

.selection-bar-btn {
  padding: 7px 14px;
  font-size: 0.82rem;
  flex: none;
}

/* Undated section */
.undated-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}

.undated-header {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
  margin-bottom: 12px;
}

/* ─── Dashboard ─────────────────────────────────────────────────────────────── */
.dashboard-content { padding: 20px 0; }

.dashboard-section { margin-bottom: 28px; }

.dashboard-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 4px;
}

.attention-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attention-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  text-align: left;
  width: 100%;
}

.attention-card:hover {
  background: var(--accent-bg);
  box-shadow: var(--shadow-md);
}

.attention-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.attention-text { flex: 1; }

.attention-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.attention-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 1px;
}

.attention-count {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

/* Upload button */
.btn-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-upload:hover {
  background: #7a5235;
  box-shadow: var(--shadow-md);
}

.btn-upload svg { flex-shrink: 0; }

.activity-list { display: flex; flex-direction: column; gap: 8px; }

.activity-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--text-2);
}

.activity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { color: var(--text-3); white-space: nowrap; font-size: 0.78rem; }

/* ─── Overlay ────────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay.hidden { display: none; }

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 10, 5, 0.75);
  backdrop-filter: blur(4px);
}

.overlay-panel {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 94vw;
  height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.overlay-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  border: none;
  width: 24px;
  height: 24px;
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  background: transparent;
  border-radius: var(--radius);
}

.overlay-close img {
  width: 16px;
  height: 16px;
}

.overlay-close:hover { background: var(--border-light); }

.overlay-menu {
  position: absolute;
  top: 20px;
  right: 60px;
  z-index: 2;
  border: none;
  width: 24px;
  height: 24px;
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  background: transparent;
  border-radius: var(--radius);
}

.overlay-menu img {
  width: 16px;
  height: 16px;
}

.overlay-menu:hover { background: var(--border-light); }

.overlay-menu-dropdown {
  position: absolute;
  top: 52px;
  right: 20px;
  z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  overflow: hidden;
}

.overlay-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.overlay-menu-item:hover { background: var(--accent-bg); }

.overlay-menu-item-danger { color: #c0392b; }
.overlay-menu-item-danger:hover { background: #fdf0ee; }

.overlay-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: var(--accent-bg);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  width: 28px;
  height: 28px;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}

.overlay-nav img {
  width: 20px;
  height: 20px;
}

.overlay-nav:hover { background: var(--border); }
.overlay-prev { left: 10px; }
.overlay-next { right: 10px; }
.overlay-nav:disabled { opacity: 0.2; pointer-events: none; }

@media (min-width: 640px) {
  .overlay-next { right: calc(30% + 10px); }
}

.overlay-content {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Asset detail inside overlay */
.asset-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
}

@media (min-width: 640px) {
  .asset-detail { flex-direction: row; }
}

.asset-media {
  flex: 0 1 70%;
  background: #1a0f08;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  overflow: hidden;
  position: relative;
}

@media (max-width: 639px) {
  .asset-media { flex: 0 1 50%; min-height: 0; }
  .overlay-nav { top: 25%; }
}

.zoom-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.zoom-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: 3px 6px;
  z-index: 10;
}

.zoom-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.1s;
}

.zoom-btn:hover { background: rgba(255, 255, 255, 0.2); }

.zoom-level {
  color: #fff;
  font-size: 0.72rem;
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 640px) {
  .asset-media {
    //width: 55%;
    flex: 0 1 70%;
  }
}

.asset-media img, .asset-media video {
  max-width: 100%;
  max-height: 60dvh;
  object-fit: contain;
}

.asset-media img#zoom-img {
  transform-origin: center center;
  user-select: none;
  will-change: transform;
  transition: transform 0.12s ease-out;
  cursor: default;
}

.zoom-wrap.is-zoomed img#zoom-img { cursor: grab; }
.zoom-wrap.is-grabbing img#zoom-img { cursor: grabbing; transition: none; }

@media (min-width: 640px) {
  .asset-media img, .asset-media video { max-height: 80dvh; }
}

.asset-info {
  flex: 1 1 0;
  padding: 20px;
  overflow-y: auto;
}

.asset-info-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  max-width: 100%;
}

.date-editor {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.date-editor-input {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}
.date-editor-input:focus { border-color: var(--accent-light); }

.date-editor-precision {
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

.btn-small {
  padding: 5px 6px;
  font-size: 0.78rem;
}

.date-tag {
  cursor: pointer;
}
.date-precision-hint {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-left: 6px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.asset-info-section { margin-bottom: 14px; }

.asset-info-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-3);
  margin-bottom: 5px;
}

.asset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
}

.tag.event-tag {
  background: var(--green-bg);
  color: var(--green);
}

/* Removable tag chips */
.tag-removable {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-right: 4px;
}

.tag-label {
  cursor: text;
  border-radius: 3px;
  transition: background 0.12s;
}
.tag-label:hover { background: rgba(0,0,0,0.08); }

.tag-edit-input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0;
  width: 8ch;
  min-width: 4ch;
  max-width: 24ch;
}
.tag-edit-input-event { color: var(--green); }

.tag-x {
  background: none;
  border: none;
  color: var(--tag-text);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 3px;
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s;
}

.tag-x:hover { opacity: 1; background: rgba(0,0,0,0.08); }

.tag-x-event { color: var(--green); }

/* Tag editor (chips + search input + dropdown) */
.tag-editor { display: flex; flex-direction: column; gap: 6px; }

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-add-row { position: relative; }

.tag-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-search-input {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.tag-search-input:focus { border-color: var(--accent-light); }

.tag-search-input::placeholder { color: var(--text-3); }

.tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.tag-dropdown.hidden { display: none; }

.tag-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.tag-dropdown-item:hover { background: var(--accent-bg); }

.tag-dropdown-create {
  color: var(--accent);
  font-weight: 600;
  border-top: 1px solid var(--border-light);
}

.tag-dropdown-empty {
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-3);
}

.asset-info-notes {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.6;
  font-style: italic;
  white-space: pre-wrap;
}

.notes-editable {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background 0.12s;
}
.notes-editable:hover { background: var(--accent-bg); }

.notes-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.notes-textarea:focus { border-color: var(--accent-light); }

.asset-info-meta {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.7;
}



/* ─── Upload panel ───────────────────────────────────────────────────────────── */
.upload-panel {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(94vw, 680px);
  max-height: 92dvh;
  overflow-y: auto;
  padding: 24px;
}

.upload-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 16px;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-light);
  background: var(--accent-bg);
}

.drop-zone-icon { font-size: 2.5rem; margin-bottom: 8px; }

.drop-zone-text {
  font-size: 0.9rem;
  color: var(--text-2);
  margin-bottom: 4px;
}

.drop-zone-sub { font-size: 0.78rem; color: var(--text-3); }

.upload-file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.upload-file-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-file-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border-light);
}

.upload-file-name {
  flex: 1;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.upload-file-size { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; }

.upload-meta-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.field-row { display: flex; flex-direction: column; gap: 4px; }

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

.field-input {
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.field-input:focus { border-color: var(--accent-light); }

.btn-row { display: flex; gap: 10px; }

/* ─── Button system ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 6px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Primary — solid fill, main actions */
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #4a3422; }

/* Secondary — outlined, supporting actions */
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--accent-bg); border-color: var(--accent-light); }

/* Tertiary — text only, low emphasis */
.btn-tertiary {
  background: transparent;
  color: var(--text-2);
  padding: 6px 10px;
}
.btn-tertiary:hover:not(:disabled) { color: var(--text); background: var(--accent-bg); }

/* Ghost — alias for secondary (backward compat) */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--accent-bg); }

/* Danger */
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a93226; }

/* Add button — used for "+ Add date", "+ Add person" etc */
.tag-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  color: var(--text-2);
  border: 1px var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: fit-content;
}
.tag-add-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent-light);
  color: var(--text);
}

.upload-progress {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-2);
  text-align: center;
}

.progress-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }
