@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --border: #e4dccb;
  --text: #1c1736;
  --muted: #6d675c;
  --accent: #7c5cff;
  --ink: #14100d;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; }
a { color: var(--accent); }

.admin-shell { display: grid; grid-template-columns: 76px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: #f4ecda;
  padding: 0.9rem 0.45rem 1.4rem;
  position: sticky;
  top: 0;
  height: 100vh;
  width: 76px;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 40;
  transition: width 0.18s ease, box-shadow 0.18s ease;
}
.sidebar:hover,
.sidebar:focus-within {
  width: 280px;
  box-shadow: 14px 0 36px rgba(0,0,0,0.28);
}
.side-top { display: flex; align-items: center; gap: 0.35rem; }
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; display: flex; align-items: center; gap: 0.55rem; min-width: 0; flex: 1; }
.brand .ico { flex: 0 0 auto; }
.nav-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  margin-top: 0.7rem;
  padding: 0.62rem;
  background: transparent;
  color: #f4ecda;
  border: 1px solid rgba(244,236,218,0.2);
  border-radius: 0.65rem;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.brand-text, .link-text, .nav-label, .side-note {
  white-space: nowrap;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
}
.sidebar:hover .brand-text,
.sidebar:hover .link-text,
.sidebar:hover .nav-label,
.sidebar:hover .side-note,
.sidebar:focus-within .brand-text,
.sidebar:focus-within .link-text,
.sidebar:focus-within .nav-label,
.sidebar:focus-within .side-note {
  max-width: 220px;
  opacity: 1;
}
.sidebar .muted { color: #b7b0a2; margin: 0.65rem 0.4rem 0.2rem; }
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.nav-label { margin: 1rem 0.45rem 0.3rem; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: #ffc23c; }
.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.62rem;
  color: #f4ecda;
  text-decoration: none;
  border-radius: 0.65rem;
  font-size: 0.98rem;
}
.sidebar:hover nav a,
.sidebar:focus-within nav a { justify-content: flex-start; padding: 0.48rem 0.6rem; }
.sidebar nav a:hover, .sidebar nav a.is-on { background: rgba(255,255,255,0.08); }
.sidebar nav a.is-on { color: #fff; box-shadow: inset 3px 0 0 #bce61f; }
.settings-break { margin: 1.8rem 0 0.2rem; font-size: 1.25rem; }
.main { padding: 1.5rem 1.6rem 3rem; max-width: none; }
h2 { margin: 0 0 0.35rem; font-size: 1.8rem; }
.help { color: var(--muted); margin-top: 0; }
.page-head, .item-row, .booking-card header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.group-label { margin: 1.4rem 0 0.6rem; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.item-list { display: grid; gap: 0.75rem; margin-top: 1rem; }
.item-row, .booking-card, .current-file {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}
.thumb { width: 84px; height: 84px; border-radius: 0.7rem; overflow: hidden; background: #efe8d8; display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; flex: 0 0 auto; }
.thumb img, .current-file img, .current-file video { width: 100%; max-width: 280px; height: 160px; object-fit: cover; border-radius: 0.7rem; display: block; }
.thumb img { width: 84px; height: 84px; }
.row-actions { display: flex; gap: 0.4rem; align-items: center; }
.btn, button.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
form label, .check { display: block; margin: 0.9rem 0 0.3rem; font-weight: 600; }
form input[type='text'], form input[type='email'], form input[type='password'], form input[type='number'], form input[type='date'], form input[type='url'], form textarea, form select {
  width: 100%;
  max-width: 640px;
  padding: 0.7rem 0.75rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
}
.current-file { margin: 1rem 0; max-width: 640px; }
.booking-list { display: grid; gap: 0.7rem; margin-top: 1rem; }
.booking-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
}
.booking-row p { margin: 0.15rem 0 0; color: var(--muted); }
.booking-row .row-actions { flex-direction: column; align-items: stretch; }
.booking-row select { padding: 0.45rem 0.5rem; border-radius: 0.6rem; border: 1px solid var(--border); font: inherit; }
.pill { border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.8rem; text-transform: uppercase; }
.pill.new, .pill.booked, .pill.confirmed { background: #d8f5df; }
.pill.cancelled { background: #ffd9d9; }
.pill.contacted { background: #e4dcff; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-box { width: min(420px, 92vw); background: #fff; border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem; }
.error { color: #b42318; }
.saved { color: #0f7a45; font-weight: 700; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8rem; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 0.8rem; padding: 1rem; color: inherit; text-decoration: none; display: block; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin: 1rem 0 1rem; }
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.05rem 0.9rem;
  min-height: 118px;
}
.stat span { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.stat strong { display: block; margin-top: 0.35rem; font-size: 1.7rem; letter-spacing: -0.03em; line-height: 1.1; }
.stat em { display: block; margin-top: 0.35rem; font-style: normal; color: var(--muted); font-size: 0.9rem; }
.chart-grid { display: grid; grid-template-columns: 1.1fr 0.9fr 1fr; gap: 0.8rem; }
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.05rem 1.1rem;
}
.panel h3 { margin: 0 0 0.8rem; font-size: 1.05rem; }
.pie-wrap { display: grid; grid-template-columns: 168px 1fr; gap: 0.8rem; align-items: center; }
.pie-wrap svg { width: 168px; height: 168px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.legend li { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 0.92rem; }
.swatch { width: 0.7rem; height: 0.7rem; border-radius: 99px; display: inline-block; margin-right: 0.35rem; }
.bars { display: grid; gap: 0.65rem; }
.bar-row { display: grid; grid-template-columns: 7.2rem 1fr auto; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.track { height: 12px; background: #efe8d8; border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: #7c5cff; border-radius: 99px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 0.8rem; align-items: center; }
.donut { width: 150px; height: 150px; }
.donut text { font-size: 22px; font-weight: 700; fill: var(--text); font-family: 'DM Sans', sans-serif; }
.mini-table { width: 100%; border-collapse: collapse; margin-top: 0.2rem; }
.mini-table th, .mini-table td { text-align: left; padding: 0.55rem 0.3rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.mini-table th { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.empty-note { color: var(--muted); margin: 0.4rem 0 0; }
.perm-table { margin-top: 1rem; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.perm-row { display: grid; grid-template-columns: 1.6fr 7rem 7rem; gap: 0.5rem; align-items: center; padding: 0.55rem 0.8rem; border-top: 1px solid var(--border); }
.perm-head { border-top: 0; background: #f6f1e6; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.perm-row label { display: flex; gap: 0.35rem; align-items: center; font-weight: 500; margin: 0; }
@media (max-width: 700px) {
  .perm-row { grid-template-columns: 1fr 5.5rem 5.5rem; }
}
@media (max-width: 1100px) {
  .stat-grid, .chart-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; width: auto; }
  .brand-text, .link-text, .nav-label, .side-note { max-width: 220px; opacity: 1; }
  .sidebar nav a { justify-content: flex-start; padding: 0.48rem 0.6rem; }
  .item-row, .booking-row { flex-wrap: wrap; }
  .stat-grid, .chart-grid, .pie-wrap, .donut-wrap { grid-template-columns: 1fr; }
}
