:root {
  --ink: #1E2A26;
  --paper: #F6F1E7;
  --gold: #C99A3A;
  --sage: #5F7A64;
  --sage-dark: #46604B;
  --clay: #A6614F;
  --mist: #E7E4D8;
  --white: #FFFFFF;
  --gray: #6B7268;
  --font-display: 'Fraunces', serif;
  --font-body: 'Work Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --radius: 6px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); color: var(--ink); background: var(--mist); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; }
code { font-family: var(--font-mono); background: rgba(30,42,38,0.06); padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }

/* ===== Login ===== */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 20px; }
.login-card { background: var(--paper); border-radius: var(--radius-lg); padding: 46px 40px; width: 100%; max-width: 380px; box-shadow: 0 30px 60px rgba(0,0,0,0.3); }
.login-eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.login-card h1 { font-size: 1.8rem; margin-bottom: 26px; }
.login-hint { font-size: 0.82rem; color: var(--gray); margin-top: 18px; text-align: center; }
.back-link { display: block; text-align: center; margin-top: 16px; font-size: 0.85rem; color: var(--sage-dark); text-decoration: none; }
.btn-block { width: 100%; }

/* ===== Buttons ===== */
.btn { display: inline-block; padding: 12px 24px; border-radius: 30px; font-weight: 500; font-size: 0.92rem; transition: var(--transition); cursor: pointer; border: 1.5px solid transparent; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--sage-dark); }
.btn-ghost { border-color: rgba(30,42,38,0.25); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: rgba(30,42,38,0.06); }
.btn-sm { padding: 9px 18px; font-size: 0.85rem; }

/* ===== Shell layout ===== */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--ink); color: var(--paper); display: flex; flex-direction: column;
  padding: 26px 18px; position: sticky; top: 0; height: 100vh; flex-shrink: 0; transition: var(--transition);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; padding: 6px 10px 30px; }
.logo-mark { color: var(--gold); display: inline-flex; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; color: #B7BEB1; text-decoration: none; padding: 12px 14px; border-radius: var(--radius); font-size: 0.92rem; font-weight: 500; transition: var(--transition); }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: var(--paper); }
.sidebar-nav a.active { background: var(--gold); color: var(--ink); }
.nav-ico { font-size: 0.9rem; width: 18px; text-align: center; }

.sidebar-footer { display: flex; flex-direction: column; gap: 6px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer a { color: #8B9285; text-decoration: none; font-size: 0.85rem; padding: 8px 14px; }
.sidebar-footer a:hover { color: var(--gold); }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; background: var(--paper); border-bottom: 1px solid rgba(30,42,38,0.08); position: sticky; top: 0; z-index: 10; }
.admin-page-title { font-size: 1.5rem; }
.admin-topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-username { font-size: 0.9rem; font-weight: 500; }
.admin-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sage); color: var(--white); display: flex; align-items: center; justify-content: center; font-weight: 600; font-family: var(--font-mono); }
.admin-hamburger { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; }
.admin-hamburger span { width: 22px; height: 2px; background: var(--ink); }

.admin-content { padding: 32px; flex: 1; background: var(--mist); }

/* ===== Stat tiles ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-tile { background: var(--white); border-radius: var(--radius-lg); padding: 22px 24px; border: 1px solid rgba(30,42,38,0.06); position: relative; overflow: hidden; }
.stat-tile-accent { background: var(--ink); color: var(--paper); }
.stat-label { display: block; font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray); margin-bottom: 10px; }
.stat-tile-accent .stat-label { color: #A8AFA3; }
.stat-value { display: block; font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; margin-bottom: 12px; }
.stat-spark { color: var(--gold); opacity: 0.7; }

/* ===== Panels / grid ===== */
.admin-grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.panel { background: var(--white); border-radius: var(--radius-lg); padding: 26px; border: 1px solid rgba(30,42,38,0.06); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { font-size: 1.15rem; }
.link-arrow-sm { font-size: 0.85rem; font-weight: 500; color: var(--sage-dark); }

.recent-list { display: flex; flex-direction: column; gap: 4px; }
.recent-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid rgba(30,42,38,0.06); gap: 12px; }
.recent-list li:last-child { border-bottom: none; }
.recent-meta { display: block; font-size: 0.8rem; color: var(--gray); margin-top: 2px; }

/* ===== Status badges ===== */
.status-badge { font-family: var(--font-mono); font-size: 0.72rem; padding: 4px 12px; border-radius: 20px; text-transform: capitalize; white-space: nowrap; }
.status-new { background: #FCE9CF; color: #8A5A16; }
.status-contacted { background: #DDE6F5; color: #2E4E86; }
.status-confirmed { background: #DDEEDD; color: #2C6B36; }
.status-cancelled { background: #F3DCDA; color: #A03B34; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th { text-align: left; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray); padding: 10px 12px; border-bottom: 2px solid rgba(30,42,38,0.08); white-space: nowrap; }
.admin-table td { padding: 14px 12px; border-bottom: 1px solid rgba(30,42,38,0.06); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: none; }
.muted { color: var(--gray); font-size: 0.85rem; }
.msg-cell { max-width: 260px; }
.badge-sm { background: var(--gold); color: var(--ink); font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

.table-actions { display: flex; gap: 8px; white-space: nowrap; }
.icon-btn { background: transparent; border: 1px solid rgba(30,42,38,0.15); color: var(--ink); padding: 6px 12px; border-radius: var(--radius); font-size: 0.8rem; cursor: pointer; transition: var(--transition); }
.icon-btn:hover { background: rgba(30,42,38,0.06); }
.icon-btn-danger { color: var(--clay); border-color: rgba(166,97,79,0.3); }
.icon-btn-danger:hover { background: rgba(166,97,79,0.08); }

.status-select { font-family: var(--font-mono); font-size: 0.78rem; padding: 6px 10px; border-radius: 20px; border: 1px solid rgba(30,42,38,0.15); background: var(--white); cursor: pointer; }

.table-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn { padding: 7px 16px; border-radius: 20px; border: 1.5px solid rgba(30,42,38,0.15); background: transparent; color: var(--ink); font-size: 0.82rem; cursor: pointer; transition: var(--transition); }
.filter-btn.active, .filter-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.empty-state-sm { text-align: center; color: var(--gray); padding: 30px !important; }

/* ===== Alerts / forms (shared) ===== */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.9rem; }
.alert-error { background: #F5E5E1; color: var(--clay); }
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.88rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 11px 13px; border: 1.5px solid rgba(30,42,38,0.15); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 0.95rem; background: var(--white);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--sage); }
.form-check label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form-check input { width: auto; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(30,42,38,0.5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--paper); border-radius: var(--radius-lg); padding: 30px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-close { background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--gray); line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .admin-grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .admin-hamburger { display: flex; }
  .admin-sidebar { position: fixed; left: 0; top: 0; z-index: 150; transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .form-row { grid-template-columns: 1fr; }
  .admin-content { padding: 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
