/* ===== DESIGN TOKENS ===== */
:root {
  color-scheme: light;
  --bg: #f4ede2;
  --surface: rgba(255, 252, 247, 0.95);
  --surface-strong: #fffdf9;
  --surface-hover: rgba(157, 77, 34, 0.05);
  --text: #1c1712;
  --text-soft: #6a5e52;
  --text-muted: #a89480;
  --line: rgba(83, 63, 43, 0.14);
  --line-strong: rgba(83, 63, 43, 0.22);
  --primary: #9d4d22;
  --primary-strong: #7d3914;
  --primary-light: rgba(157, 77, 34, 0.1);
  --secondary: #e8ddd0;
  --success: #2d7a4f;
  --success-bg: rgba(45, 122, 79, 0.1);
  --warning: #b86a00;
  --warning-bg: rgba(184, 106, 0, 0.1);
  --danger: #c0392b;
  --danger-bg: rgba(192, 57, 43, 0.1);
  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.1);
  --shadow-sm: 0 2px 8px rgba(55, 34, 16, 0.07);
  --shadow: 0 8px 30px rgba(55, 34, 16, 0.1);
  --shadow-lg: 0 20px 60px rgba(55, 34, 16, 0.13);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --max-width: 1200px;
  --sidebar-w: 260px;
  --header-h: 68px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131009;
  --surface: rgba(24, 20, 14, 0.97);
  --surface-strong: #1f1a12;
  --surface-hover: rgba(240, 163, 109, 0.06);
  --text: #f2ead8;
  --text-soft: #c0a882;
  --text-muted: #7d6a55;
  --line: rgba(245, 225, 195, 0.1);
  --line-strong: rgba(245, 225, 195, 0.18);
  --primary: #f0a36d;
  --primary-strong: #ffbf91;
  --primary-light: rgba(240, 163, 109, 0.12);
  --secondary: rgba(240, 163, 109, 0.1);
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 10% 5%, rgba(157, 77, 34, 0.06) 0%, transparent 30%),
    radial-gradient(circle at 90% 85%, rgba(157, 77, 34, 0.04) 0%, transparent 28%);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font: inherit; }
ul, ol { list-style: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

/* ===== TYPOGRAPHY ===== */
.heading-serif {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 16px;
}

/* ===== LAYOUT ===== */

/* Landing page shell */
.landing-shell {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 24px 0 60px;
  display: flex;
  flex-direction: column;
}

/* Dashboard / Admin shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

.app-shell .app-header {
  grid-column: 1 / -1;
  grid-row: 1;
}

.app-shell .app-sidebar {
  grid-column: 1;
  grid-row: 2;
}

.app-shell .app-main {
  grid-column: 2;
  grid-row: 2;
}

/* ===== SITE HEADER (Landing) ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 12px;
  z-index: 100;
}

/* ===== APP HEADER (Dashboard / Admin) ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ===== BRAND ===== */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  color: #fff8f1;
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(157, 77, 34, 0.3);
}

.brand-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-soft);
}

/* ===== NAVIGATION ===== */
.header-actions,
.header-links,
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.header-links a {
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 99px;
  transition: background var(--transition), color var(--transition);
}

.header-links a:hover,
.header-links a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== BUTTONS ===== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 0.88rem;
  font-weight: 700;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.button-primary {
  background: linear-gradient(140deg, var(--primary), var(--primary-strong));
  color: #fff8f1;
  box-shadow: 0 4px 14px rgba(157, 77, 34, 0.2);
}

.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(157, 77, 34, 0.3);
}

.button-secondary {
  background: var(--secondary);
  border-color: var(--line);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.button-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-soft);
}

.button-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.button-danger {
  background: var(--danger-bg);
  border-color: rgba(192, 57, 43, 0.3);
  color: var(--danger);
}

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

.button-sm {
  min-height: 34px;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.button-icon {
  width: 38px;
  height: 38px;
  min-height: unset;
  padding: 0;
  border-radius: var(--radius-sm);
}

.button-white {
  background: #fff8f1;
  color: var(--primary-strong);
  font-weight: 800;
}

.button-white:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ===== SIDEBAR ===== */
.app-sidebar {
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  overflow-y: auto;
  background: var(--surface-strong);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition);
}

.sidebar-link .nav-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-link .badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--danger);
  color: white;
  border-radius: 99px;
  padding: 1px 7px;
  line-height: 1.6;
}

/* ===== MAIN CONTENT ===== */
.app-main {
  padding: 28px 32px;
  overflow-y: auto;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-header h1 {
  font-family: "Fraunces", serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.page-header p {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-top: 4px;
}

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

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--primary-strong)); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }

.stat-card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.stat-card-value {
  font-family: "Fraunces", serif;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-soft);
  font-weight: 600;
}

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 42px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

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

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-select {
  height: 42px;
  padding: 0 36px 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--primary); }

/* ===== TABLE ===== */
.items-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.items-table-wrap { overflow-x: auto; }

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.items-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  white-space: nowrap;
}

.items-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.items-table tr:last-child td { border-bottom: none; }

.items-table tr:hover td { background: var(--surface-hover); }

.items-table th:first-child,
.items-table td:first-child { padding-left: 20px; }

.item-name { font-weight: 700; }
.item-category { color: var(--text-soft); font-size: 0.82rem; }

/* ===== ITEM CARDS (grid view) ===== */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px;
}

.item-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.item-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.item-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
}

.item-card-img img { width: 100%; height: 100%; object-fit: cover; }

.item-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-card-title { font-weight: 800; font-size: 0.95rem; }

.item-card-meta {
  font-size: 0.8rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.item-card-qty {
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.item-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-low    { background: var(--warning-bg); color: var(--warning); }
.badge-out    { background: var(--danger-bg);  color: var(--danger);  }
.badge-category {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: min(100%, 540px);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--secondary);
  border: none;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-soft);
  transition: background var(--transition);
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body { padding: 24px 28px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 24px;
  border-top: 1px solid var(--line);
}

/* ===== FORM ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.form-input.error,
.form-select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.form-error { font-size: 0.78rem; color: var(--danger); font-weight: 600; }

/* ===== CAMERA ===== */
.camera-area {
  position: relative;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-area video,
.camera-area img { width: 100%; height: 100%; object-fit: cover; }

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.camera-placeholder-icon { font-size: 3rem; }

.camera-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.img-preview-thumb {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
  margin-bottom: 10px;
  font-size: 2.5rem;
}

.img-preview-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ===== ACTIVITY FEED ===== */
.activity-feed { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.activity-icon.create { background: var(--success-bg); }
.activity-icon.update { background: var(--info-bg); }
.activity-icon.delete { background: var(--danger-bg); }

.activity-text { flex: 1; min-width: 0; }
.activity-title { font-size: 0.88rem; font-weight: 700; }
.activity-detail { font-size: 0.8rem; color: var(--text-soft); }
.activity-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ===== PANELS ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body { padding: 20px 22px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 360px;
  animation: slideInRight 0.25s ease;
  cursor: pointer;
}

.toast-icon { font-size: 1.2rem; }
.toast.success { border-color: var(--success); }
.toast.warning { border-color: var(--warning); }
.toast.error   { border-color: var(--danger);  }
.toast.info    { border-color: var(--info);    }
.toast.removing { animation: slideOutRight 0.25s ease forwards; }

/* ===== CONFIRM DIALOG ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.confirm-overlay.hidden { display: none; }

.confirm-dialog {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: min(100%, 400px);
  padding: 32px;
  text-align: center;
  animation: slideUp 0.2s ease;
}

.confirm-icon { font-size: 3rem; margin-bottom: 16px; }

.confirm-title {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-msg { font-size: 0.9rem; color: var(--text-soft); margin-bottom: 24px; }

.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--text-soft);
  text-align: center;
}

.empty-state-icon { font-size: 4rem; opacity: 0.7; }
.empty-state-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.empty-state-text { font-size: 0.88rem; max-width: 34ch; line-height: 1.6; }

/* ===== BULK BAR ===== */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--primary-light);
  border-bottom: 1px solid rgba(157, 77, 34, 0.2);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}

.bulk-bar.hidden { display: none; }

/* ===== VIEW TOGGLE ===== */
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-btn {
  width: 34px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text-soft);
  transition: all var(--transition);
}

.view-btn.active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ===== TAGS INPUT ===== */
.tags-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  min-height: 44px;
  cursor: text;
  transition: border-color var(--transition);
}

.tags-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.tag-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.tag-pill-remove {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.tags-actual-input {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  padding: 2px 4px;
}

/* ===== CATEGORY CHIPS (Admin) ===== */
.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 22px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  cursor: default;
}

.category-chip:hover { border-color: var(--primary); }

.category-chip-delete {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background var(--transition);
}

.category-chip-delete:hover { background: var(--danger); color: white; }

/* ===== THRESHOLD ROWS (Admin) ===== */
.threshold-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.threshold-row:last-child { border-bottom: none; }

.threshold-row input[type="number"] {
  width: 80px;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  outline: none;
}

.threshold-row input[type="number"]:focus { border-color: var(--primary); }

/* ===== SITE FOOTER ===== */
.site-footer {
  margin-top: 24px;
  padding: 20px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links { display: flex; gap: 16px; }

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-soft);
  font-weight: 600;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--primary); }

.site-footer small { font-size: 0.82rem; color: var(--text-muted); }

/* ===== LANDING: HERO ===== */
.hero {
  padding: 80px 60px;
  border-radius: var(--radius-xl);
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 75% 30%, rgba(157, 77, 34, 0.08), transparent 55%);
  pointer-events: none;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  border: 1px solid rgba(157, 77, 34, 0.15);
}

.hero h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 22px;
  max-width: 16ch;
}

.hero h1 em { font-style: italic; color: var(--primary); }

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 52ch;
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.hero-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
}

.hero-actions { gap: 14px; }

/* ===== LANDING: SECTIONS ===== */
.section { margin-top: 24px; }

/* ===== LANDING: FEATURES ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feature-icon { font-size: 2.4rem; margin-bottom: 14px; }
.feature-title { font-weight: 800; font-size: 1rem; margin-bottom: 6px; }
.feature-desc { font-size: 0.86rem; color: var(--text-soft); line-height: 1.65; }

/* ===== LANDING: USE CASES ===== */
.usecases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.usecase-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.usecase-card:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.usecase-icon { font-size: 2.4rem; margin-bottom: 10px; }
.usecase-title { font-weight: 800; font-size: 0.9rem; }
.usecase-desc { font-size: 0.8rem; color: var(--text-soft); margin-top: 4px; }

/* ===== LANDING: CTA ===== */
.cta-section {
  background: linear-gradient(140deg, var(--primary), var(--primary-strong));
  border-radius: var(--radius-xl);
  padding: 60px;
  text-align: center;
  color: #fff8f1;
  margin-top: 28px;
  box-shadow: 0 20px 60px rgba(157, 77, 34, 0.3);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.cta-section h2 {
  font-family: "Fraunces", serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.cta-section p {
  font-size: 1.05rem;
  opacity: 0.85;
  max-width: 50ch;
  margin: 0 auto 28px;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-soft   { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) auto 1fr;
  }

  .app-shell .app-sidebar {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    gap: 4px;
  }

  .app-shell .app-main {
    grid-column: 1;
    grid-row: 3;
  }

  .sidebar-section-label { display: none; }

  .sidebar-link {
    flex-direction: column;
    padding: 8px 10px;
    font-size: 0.72rem;
    text-align: center;
    white-space: nowrap;
  }

  .sidebar-link .nav-icon { font-size: 1.3rem; }
}

@media (max-width: 700px) {
  .landing-shell { padding: 14px 0 40px; }
  .site-header { border-radius: 20px; }
  .hero { padding: 36px 28px; border-radius: var(--radius-lg); }
  .hero h1 { font-size: 2.4rem; }
  .app-main { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { border-radius: var(--radius-lg); }
  .cta-section { padding: 40px 28px; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 2rem; }
  .features-grid,
  .usecases-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}
