:root {
  --ink: #211b18;
  --muted: #756d67;
  --paper: #f7f4ee;
  --card: #fffdf9;
  --line: #ded8cf;
  --wine: #762e3d;
  --wine-dark: #58202d;
  --gold: #c99742;
  --sage: #688071;
  --shadow: 0 18px 50px rgba(54, 40, 31, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.55 "DM Sans", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: "Fraunces", Georgia, serif; line-height: 1.08; }
h1 { margin-bottom: 13px; font-size: clamp(2.25rem, 5vw, 4rem); letter-spacing: -.045em; }
h2 { margin-bottom: 12px; font-size: 1.45rem; }

.shell { width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 72px 0 90px; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 82px; padding: 0 max(24px, calc((100% - 1220px) / 2)); background: rgba(247,244,238,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--wine); border-radius: 50% 50% 46% 46%; font: 700 14px/1 "Fraunces", serif; box-shadow: inset 0 0 0 2px rgba(255,255,255,.22); }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 20px/1.1 "Fraunces", serif; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 26px; font-size: 14px; font-weight: 600; }
.nav a { color: #514943; }
.nav a:hover { color: var(--wine); }
.nav form { margin: 0; }
.nav-logout { border: 0; width: 35px; height: 35px; border-radius: 50%; background: #ebe5dc; cursor: pointer; color: var(--wine); font-size: 18px; }

.eyebrow { margin-bottom: 12px; color: var(--wine); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 42px; }
.hero-row h1 { margin-bottom: 8px; }
.hero-row p:last-child { margin-bottom: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 20px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--wine); box-shadow: 0 8px 20px rgba(118,46,61,.2); }
.button.primary:hover { background: var(--wine-dark); }
.button.secondary { background: var(--ink); color: white; }
.button.ghost { border-color: var(--line); background: transparent; }
.button.danger { margin-right: auto; color: #9a2b37; background: #f9e8e9; }
.button.full { width: 100%; }
.plus { font-size: 21px; font-weight: 400; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat { display: flex; align-items: center; gap: 15px; padding: 21px; background: var(--card); border: 1px solid #e9e3da; border-radius: 14px; box-shadow: 0 7px 22px rgba(46,34,26,.035); }
.stat-icon { display: grid; place-items: center; flex: 0 0 43px; height: 43px; border-radius: 11px; color: var(--wine); background: #f4e7e8; font-size: 19px; }
.stat-icon.amber { color: #93691f; background: #f7eddb; }
.stat-icon.rose { color: #a84a59; background: #fae9eb; }
.stat-icon.sage { color: #466356; background: #e4eee8; }
.stat strong, .stat small { display: block; }
.stat strong { font: 700 24px/1.1 "Fraunces", serif; }
.stat small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.filters { display: grid; grid-template-columns: minmax(260px, 1fr) 190px 170px auto; gap: 10px; margin-bottom: 30px; }
.filters input, .filters select { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); outline: none; }
.filters input:focus, .filters select:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(118,46,61,.09); }
.filters select { padding: 0 36px 0 13px; }
.search { position: relative; }
.search span { position: absolute; left: 15px; top: 10px; color: var(--muted); font-size: 20px; }
.search input { padding: 0 15px 0 43px; }

.drink-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.drink-card { overflow: hidden; background: var(--card); border: 1px solid #e5dfd6; border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.drink-card:hover { transform: translateY(-3px); box-shadow: 0 22px 54px rgba(54,40,31,.14); }
.drink-photo { height: 250px; position: relative; overflow: hidden; background: linear-gradient(145deg, #d7c4ac, #eee5d8); }
.drink-photo img { width: 100%; height: 100%; object-fit: cover; }
.category-pill { position: absolute; left: 15px; top: 15px; padding: 6px 11px; border-radius: 99px; color: #fff; background: rgba(36,28,24,.75); backdrop-filter: blur(8px); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.edit-link { position: absolute; right: 15px; top: 15px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 3px 15px rgba(0,0,0,.12); }
.bottle-placeholder { width: 100%; height: 100%; display: grid; place-items: center; }
.bottle-placeholder span { position: relative; display: block; width: 60px; height: 145px; border-radius: 13px 13px 17px 17px; background: linear-gradient(90deg, #573423, #82533a 45%, #50301f); box-shadow: 18px 15px 35px rgba(58,35,23,.22); }
.bottle-placeholder span::before { content: ""; position: absolute; width: 26px; height: 52px; left: 17px; top: -42px; border-radius: 5px 5px 0 0; background: #593522; }
.bottle-placeholder span::after { content: "LA CAVE"; position: absolute; display: grid; place-items: center; left: 8px; right: 8px; top: 55px; height: 43px; background: #e9dfca; color: #714638; font: 700 8px "Fraunces", serif; letter-spacing: .08em; }
.drink-body { padding: 22px; }
.stars { color: var(--gold); letter-spacing: 2px; font-size: 16px; }
.stars span { color: #ded7cb; }
.drink-body h2 { margin: 8px 0 3px; font-size: 1.65rem; }
.producer { min-height: 23px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.notes { display: -webkit-box; overflow: hidden; margin-bottom: 17px; color: #5c534d; font-size: 13px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 15px; border-top: 1px solid #ece7de; color: var(--muted); font-size: 11px; }
.card-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed #d5cdc2; border-radius: var(--radius); background: rgba(255,255,255,.35); }
.empty-icon { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: var(--wine); background: #eee2df; font-size: 35px; }

.page-narrow { width: min(880px, 100%); margin: 0 auto; }
.page-narrow.small { width: min(620px, 100%); }
.back-link { display: inline-block; margin-bottom: 40px; color: var(--wine); font-weight: 700; }
.page-heading { margin-bottom: 30px; }
.page-heading h1 { font-size: clamp(2.2rem, 6vw, 3.5rem); }
.form-card { padding: 34px; background: var(--card); border: 1px solid #e4ddd3; border-radius: var(--radius); box-shadow: var(--shadow); }
.form-card section + section { margin-top: 32px; padding-top: 30px; border-top: 1px solid #e9e3da; }
.form-card h2 { font-size: 1.35rem; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid label, .rating-field legend { color: #4d4540; font-size: 13px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; margin-top: 7px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); outline: none; }
.form-grid input, .form-grid select { height: 46px; }
.form-grid textarea { resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(118,46,61,.08); }
.form-grid label > small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.span-2 { grid-column: span 2; }
.rating-field { padding: 0; border: 0; margin: 0; }
.star-input { display: inline-flex; flex-direction: row-reverse; margin-top: 4px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { padding: 0 4px 0 0; color: #d9d2c7; cursor: pointer; font-size: 31px; line-height: 42px; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--gold); }
.photo-upload { cursor: pointer; }
.photo-upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-upload > span { display: flex; align-items: center; justify-content: center; flex-direction: column; height: 100px; margin-top: 7px; border: 1px dashed #c9bfb3; border-radius: 10px; background: #faf7f2; color: var(--wine); }
.photo-upload small { color: var(--muted); font-weight: 400; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 32px; padding-top: 25px; border-top: 1px solid #e9e3da; }

.admin-grid { display: grid; grid-template-columns: 330px 1fr; align-items: start; gap: 28px; }
.form-card.compact { padding: 25px; }
.user-list { overflow: visible; border: 1px solid #e4ddd3; border-radius: 14px; background: var(--card); }
.user-row { display: flex; align-items: center; gap: 13px; min-height: 82px; padding: 15px 18px; border-bottom: 1px solid #ece6de; }
.user-row:last-child { border: 0; }
.avatar { width: 42px; height: 42px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: var(--wine); font: 700 18px "Fraunces", serif; }
.user-main { flex: 1; min-width: 0; }
.user-main strong, .user-main span { display: block; }
.user-main span { color: var(--muted); font-size: 12px; }
.role-pill, .status { padding: 4px 9px; border-radius: 99px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.role-pill { color: var(--wine); background: #f1e1e4; }
.status.active { color: #3b684b; background: #e1eee5; }
.status.inactive { color: #875f59; background: #eee6e3; }
.user-actions { position: relative; }
.user-actions summary { cursor: pointer; list-style: none; padding: 5px; }
.user-actions > div { position: absolute; z-index: 5; right: 0; top: 30px; width: 235px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.user-actions form { display: flex; gap: 6px; }
.user-actions form + form { margin-top: 8px; }
.user-actions input { width: 145px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 7px; }
.user-actions button { border: 0; border-radius: 6px; padding: 7px 9px; cursor: pointer; color: var(--wine); background: #f4e9e9; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #f8f5ef; }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; overflow: hidden; padding: 56px clamp(40px, 7vw, 100px); color: white; background: linear-gradient(145deg, rgba(37,19,23,.65), rgba(52,18,26,.88)), radial-gradient(circle at 20% 20%, #a66350, #3b1c24 65%); }
.login-story::before, .login-story::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; }
.login-story::before { width: 540px; height: 540px; right: -260px; top: 80px; }
.login-story::after { width: 340px; height: 340px; right: -120px; top: 180px; }
.login-brand, .story-copy, .story-quote { position: relative; z-index: 1; }
.login-brand .brand-mark { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.45); }
.login-brand small { color: rgba(255,255,255,.65); }
.story-copy { max-width: 650px; }
.story-copy .eyebrow { color: #e5bd79; }
.story-copy h1 { font-size: clamp(3rem, 6vw, 5.7rem); }
.story-copy > p:last-child { max-width: 550px; color: rgba(255,255,255,.7); font-size: 18px; }
.story-quote { color: rgba(255,255,255,.65); font-family: "Fraunces", serif; }
.story-quote span { color: #e4bb74; font-size: 30px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { margin-bottom: 8px; font-size: 2.25rem; }
.auth-card > .muted { margin-bottom: 35px; }
.auth-card label { display: block; margin-bottom: 18px; color: #4d4540; font-size: 13px; font-weight: 700; }
.auth-card input { width: 100%; height: 49px; margin-top: 7px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: white; outline: none; }
.auth-card input:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(118,46,61,.09); }
.auth-card .button { margin-top: 10px; }

.flash-stack { position: fixed; z-index: 100; top: 96px; right: 24px; width: min(390px, calc(100% - 48px)); }
.flash { margin-bottom: 8px; padding: 13px 16px; border-radius: 9px; background: #fff; box-shadow: 0 10px 35px rgba(0,0,0,.16); border-left: 4px solid var(--gold); }
.flash.success { border-color: #548264; }
.flash.error { border-color: #a13947; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .drink-grid { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search { grid-column: span 2; }
  .admin-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 43vh; padding: 38px; }
  .story-quote { display: none; }
  .story-copy h1 { font-size: 3rem; }
  .login-panel { min-height: 57vh; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 28px, 1220px); padding-top: 42px; }
  .topbar { height: auto; min-height: 72px; padding: 12px 15px; }
  .topbar .brand small { display: none; }
  .nav { gap: 12px; font-size: 12px; }
  .nav a:first-child { display: none; }
  .hero-row { align-items: stretch; flex-direction: column; }
  .hero-row .button { align-self: flex-start; }
  .stats-grid { gap: 9px; }
  .stat { padding: 14px; }
  .stat-icon { display: none; }
  .filters { grid-template-columns: 1fr; }
  .search { grid-column: auto; }
  .drink-grid { grid-template-columns: 1fr; }
  .drink-photo { height: 290px; }
  .form-card { padding: 21px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .danger { width: 100%; margin: 0 0 6px; }
  .user-row { flex-wrap: wrap; }
  .user-main { flex-basis: calc(100% - 60px); }
  .login-story { min-height: 38vh; padding: 28px 24px; }
  .story-copy > p:last-child { display: none; }
  .story-copy h1 { margin-bottom: 0; font-size: 2.6rem; }
  .login-panel { min-height: 62vh; padding: 35px 24px; }
}

