:root {
  --ink: #120a07;
  --panel: #21140e;
  --panel-light: #2c1b12;
  --bronze: #b98561;
  --copper: #d3a17d;
  --champagne: #f2dfca;
  --cream: #fff8f0;
  --muted: rgba(255, 244, 232, .56);
  --line: rgba(217, 157, 113, .2);
  --danger: #df8d82;
}

* { box-sizing: border-box; }
html { background: var(--ink); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 85% -10%, rgba(153, 92, 55, .2), transparent 34%),
    radial-gradient(circle at -10% 110%, rgba(113, 65, 39, .18), transparent 38%),
    var(--ink);
  font-family: Montserrat, Arial, sans-serif;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.admin-app { min-height: 100vh; }

.admin-topbar {
  width: min(1440px, calc(100% - 40px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark { display: flex; flex-direction: column; color: var(--champagne); text-decoration: none; }
.wordmark strong { font-family: "Cormorant Garamond", Georgia, serif; font-size: 29px; font-weight: 400; line-height: .7; }
.wordmark span { margin: 7px 0 0 28px; color: var(--copper); font-family: "Cormorant Garamond", Georgia, serif; font-size: 13px; font-style: italic; }

.live-link {
  padding: 11px 17px;
  border: 1px solid rgba(213, 157, 116, .36);
  color: var(--champagne);
  font-size: 8px;
  letter-spacing: .18em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background .25s ease, border-color .25s ease;
}
.live-link:hover { border-color: var(--copper); background: rgba(205, 143, 97, .11); }

.login-view { min-height: calc(100vh - 88px); display: grid; place-items: center; padding: 40px 18px; }

.login-card {
  position: relative;
  width: min(500px, 100%);
  padding: clamp(34px, 6vw, 62px);
  border: 1px solid rgba(224, 168, 126, .36);
  background: linear-gradient(145deg, rgba(48,29,19,.93), rgba(20,12,8,.96));
  box-shadow: 0 35px 100px rgba(0,0,0,.55), inset 0 0 60px rgba(204,129,75,.06);
}
.login-card::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(215,156,114,.1); pointer-events: none; }

.eyebrow { margin: 0 0 8px; color: var(--copper); font-size: 8px; letter-spacing: .31em; text-transform: uppercase; }

h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 400; }
.login-card h1 { margin: 0; color: var(--champagne); font-size: clamp(48px, 8vw, 68px); line-height: .9; }
.login-copy { margin: 19px 0 28px; color: var(--muted); font-size: 12px; line-height: 1.8; }

label { display: block; margin: 14px 0 7px; color: rgba(255,245,236,.65); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
label small { color: rgba(255,255,255,.3); font-size: 8px; }

input, textarea {
  width: 100%;
  border: 1px solid rgba(215,157,115,.25);
  border-radius: 0;
  outline: none;
  color: var(--cream);
  background: rgba(0,0,0,.27);
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
input { height: 51px; padding: 0 15px; }
textarea { min-height: 135px; padding: 14px 15px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: rgba(255,255,255,.24); }
input:focus, textarea:focus { border-color: var(--copper); background: rgba(0,0,0,.38); box-shadow: 0 0 0 3px rgba(204,142,96,.08); }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; }
.password-wrap button { position: absolute; top: 0; right: 0; height: 100%; padding: 0 16px; border: 0; color: var(--copper); background: transparent; cursor: pointer; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }

.primary-button, .outline-button {
  min-height: 49px;
  border-radius: 0;
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: transform .2s ease, filter .2s ease, background .2s ease;
}
.primary-button { border: 1px solid #f0c7a6; color: #1b0f09; background: linear-gradient(110deg, #b97951, #e6bd9b 52%, #b7784f); }
.outline-button { padding: 0 18px; border: 1px solid rgba(215,157,115,.44); color: var(--champagne); background: transparent; }
.primary-button:hover:not(:disabled), .outline-button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.primary-button:disabled, .outline-button:disabled { cursor: wait; filter: grayscale(.6) brightness(.65); }
.login-card .primary-button { width: 100%; margin-top: 22px; }

.form-message { min-height: 19px; margin: 13px 0 0; color: var(--copper); font-size: 10px; line-height: 1.6; }
.error-message { color: var(--danger); }
.form-message.is-success { color: #c9d3ad; }

.dashboard { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: clamp(38px, 6vw, 75px) 0 70px; }

.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.dashboard-heading h1 { margin: 0; color: var(--champagne); font-size: clamp(50px, 6vw, 82px); line-height: .85; }
.dashboard-heading > div > p:last-child { margin: 17px 0 0; color: var(--muted); font-size: 11px; }
.heading-actions { display: flex; align-items: center; gap: 19px; }
.text-button { border: 0; color: rgba(255,244,233,.45); background: none; cursor: pointer; font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
.text-button:hover { color: var(--cream); }

.stats-row { margin: 44px 0 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stat-card { min-height: 116px; padding: 25px 28px; border: 1px solid var(--line); background: rgba(44,27,18,.57); }
.stat-card span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .17em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 7px; color: var(--champagne); font-family: "Cormorant Garamond", Georgia, serif; font-size: 45px; font-weight: 400; line-height: .8; }
.status-card strong { margin-top: 18px; font-family: Montserrat, Arial, sans-serif; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.status-card i { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #b9c69a; box-shadow: 0 0 13px rgba(185,198,154,.62); }

.admin-grid { display: grid; grid-template-columns: minmax(320px, 430px) minmax(500px, 1fr); align-items: start; gap: 24px; }
.entry-tools { display: grid; gap: 24px; }

.panel { padding: clamp(22px, 3vw, 34px); border: 1px solid var(--line); background: linear-gradient(150deg, rgba(45,28,19,.78), rgba(24,15,10,.8)); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.panel-heading { display: flex; align-items: flex-start; gap: 15px; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.panel-heading > span { width: 31px; height: 31px; display: grid; flex: 0 0 31px; place-items: center; border: 1px solid rgba(211,157,118,.35); border-radius: 50%; color: var(--copper); font-family: "Cormorant Garamond", Georgia, serif; font-size: 15px; }
.panel h2 { margin: 0; color: var(--champagne); font-size: 27px; line-height: .9; }
.panel-heading p { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.stack-form { margin-top: 19px; }
.stack-form .primary-button { width: 100%; margin-top: 19px; }
.full-button { width: 100%; margin-top: 17px; }

.entries-panel { min-height: 650px; }
.list-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.list-toolbar h2 { margin: 0; color: var(--champagne); font-size: 27px; }
.list-toolbar input { width: min(270px, 45%); height: 43px; }

.empty-state { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: rgba(255,255,255,.3); text-align: center; }
.empty-state strong { color: rgba(255,239,226,.5); font-family: "Cormorant Garamond", Georgia, serif; font-size: 29px; font-weight: 400; }
.empty-state span { margin-top: 7px; font-size: 9px; }

.entry-list { max-height: 570px; overflow-y: auto; }
.entry-list::-webkit-scrollbar { width: 5px; }
.entry-list::-webkit-scrollbar-thumb { background: rgba(196,133,88,.38); }

.entry-row { min-height: 68px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; border-bottom: 1px solid rgba(213,156,114,.11); }
.entry-number { color: rgba(255,255,255,.28); font-family: "Cormorant Garamond", Georgia, serif; font-size: 17px; }
.entry-details { min-width: 0; }
.entry-details strong { display: block; overflow: hidden; color: var(--champagne); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.entry-details span { display: block; margin-top: 5px; color: rgba(255,255,255,.36); font-size: 9px; }
.delete-entry { width: 33px; height: 33px; border: 1px solid transparent; color: rgba(231,143,132,.6); background: transparent; cursor: pointer; font-size: 18px; }
.delete-entry:hover { border-color: rgba(222,135,124,.35); color: #f2a79d; background: rgba(165,65,53,.09); }

.danger-zone { margin-top: 28px; padding-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid rgba(223,141,130,.2); }
.danger-zone strong { display: block; color: rgba(255,225,220,.72); font-size: 10px; font-weight: 500; }
.danger-zone span { display: block; margin-top: 5px; color: rgba(255,255,255,.32); font-size: 8px; }
.danger-zone button { padding: 10px 14px; border: 1px solid rgba(223,141,130,.4); color: var(--danger); background: transparent; cursor: pointer; font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }
.danger-zone button:hover { background: rgba(173,70,57,.12); }

@media (max-width: 980px) {
  .admin-grid { grid-template-columns: 1fr; }
  .entry-tools { grid-template-columns: 1fr 1fr; align-items: start; }
  .entry-tools > .form-message { grid-column: 1 / -1; }
  .entries-panel { min-height: auto; }
}

@media (max-width: 700px) {
  .admin-topbar, .dashboard { width: min(100% - 28px, 1440px); }
  .admin-topbar { height: 73px; }
  .dashboard { padding-top: 37px; }
  .dashboard-heading { display: block; }
  .dashboard-heading h1 { font-size: 52px; }
  .heading-actions { margin-top: 25px; justify-content: space-between; }
  .stats-row { grid-template-columns: 1fr; margin-top: 30px; }
  .entry-tools { grid-template-columns: 1fr; }
  .entry-tools > .form-message { grid-column: auto; }
  .list-toolbar { display: block; }
  .list-toolbar input { width: 100%; margin-top: 18px; }
  .panel { padding: 23px 18px; }
  .danger-zone { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
