/* Arete admin panel */
:root {
  --paper: #fbf9f6;
  --ink: #1b1c1a;
  --muted: #6d7070;
  --line: #e4e2df;
  --wine: #8b1a2b;
  --wine-dark: #70011a;
  --gold: #c9a44c;
  --white: #fff;
  --good: #1f7a4d;
  --warn: #96660a;
  --bad: #ba1a1a;
  --radius: 10px;
  --shadow: 0 4px 20px rgba(26, 26, 26, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.55 Inter, system-ui, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: 'Playfair Display', Georgia, serif; margin: 0; }
a { color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--wine);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 20;
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------- structure */
.layout { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

.sidebar {
  background: #211f1e;
  color: #fff;
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { font: 700 22px 'Playfair Display', serif; padding: 0 12px 26px; }
.brand small {
  display: block;
  color: var(--gold);
  font: 600 10px Inter, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 6px;
}

.side { display: flex; flex-direction: column; }
.side-label {
  color: #94908c;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 20px 12px 8px;
}
.side a {
  color: #d7d1cd;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  gap: 11px;
  align-items: center;
  font-weight: 500;
}
.side a:hover { background: #322f2d; color: #fff; }
.side a.active { background: var(--wine); color: #fff; }
.side .material-symbols-outlined { font-size: 20px; }

.logout { margin-top: auto; border-top: 1px solid #45413f; padding-top: 14px; display: grid; gap: 2px; }
.logout a {
  color: #d7d1cd;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  gap: 11px;
  align-items: center;
}
.logout a:hover { background: #322f2d; color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

.top {
  min-height: 70px;
  border-bottom: 1px solid rgba(201, 164, 76, 0.35);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 34px;
  background: rgba(251, 249, 246, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 4;
}
.top-title { display: flex; flex-direction: column; min-width: 0; }
.top-title small { text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-size: 10px; }
.top-title strong { font-size: 15px; }

.mobile-menu { display: none; border: 0; background: none; padding: 8px; border-radius: 8px; cursor: pointer; }
.mobile-menu:hover { background: rgba(0, 0, 0, 0.05); }

.profile { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.profile .who { text-align: right; line-height: 1.3; }
.profile .who small { color: var(--muted); font-size: 11px; display: block; }
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #ded9d2;
  display: grid; place-items: center;
  font-weight: 700;
  text-decoration: none;
  flex: none;
}

.content { padding: 30px 34px 60px; max-width: 1400px; width: 100%; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--wine); text-decoration: none; font-weight: 600; }
.crumbs .sep { opacity: 0.5; }

.heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.heading h1 { font-size: 30px; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); margin: 6px 0 0; }

/* ---------------------------------------------------------------- pieces */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2, .card-head h3 { font-size: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stat p { margin: 0; color: var(--muted); font-size: 12px; }
.stat h2 { font-size: 28px; margin-top: 10px; }
.icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: #f4eae8;
  color: var(--wine);
  flex: none;
}

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
tbody tr:hover { background: #faf7f4; }
td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 34px 10px; text-align: center; color: var(--muted); }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c8c9c7;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 16px; }
.field .hint { color: var(--muted); font-size: 11px; margin-top: 5px; }
.row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
legend { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); padding: 0 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 11px 17px;
  background: var(--wine);
  color: #fff;
  font: 600 13px Inter, sans-serif;
  cursor: pointer;
  text-decoration: none;
  min-height: 42px;
}
.btn:hover { background: var(--wine-dark); }
.btn .material-symbols-outlined { font-size: 18px; }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.gold:hover { filter: brightness(0.95); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid #c8c9c7; }
.btn.ghost:hover { background: #f2efec; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(186, 26, 26, 0.35); }
.btn.danger:hover { background: rgba(186, 26, 26, 0.08); }
.btn.small { padding: 7px 11px; font-size: 12px; min-height: 34px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin-bottom: 0; min-width: 165px; }

/* Alerts + pills */
.alert { border-radius: 9px; padding: 13px 16px; margin-bottom: 18px; font-weight: 500; border: 1px solid transparent; }
.alert-success { background: #e8f5ee; border-color: #bfe0cd; color: #14532d; }
.alert-error { background: #fdecec; border-color: #f5c6c6; color: #7f1d1d; }
.alert-info { background: #eef2fb; border-color: #cdd8f0; color: #1e3a8a; }
.alert-warning { background: #fdf4e3; border-color: #f0dcae; color: #7a4d05; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #eee;
  white-space: nowrap;
}
.pill-good { background: #e4f3ea; color: var(--good); }
.pill-warn { background: #fbf0d9; color: var(--warn); }
.pill-bad { background: #fbe3e3; color: var(--bad); }
.pill-neutral { background: #ecebe8; color: #4b4b4b; }

.tag { display: inline-block; background: #f1ece6; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 11px; }

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 5; }
.scrim[hidden] { display: none; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #211f1e 0%, #3a2b2c 55%, #5d2730 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 34px; width: min(430px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-card .eyebrow { color: var(--wine); font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.login-hint { margin-top: 20px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

/* Paper preview / print */
.paper-sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; max-width: 820px; margin: 0 auto; }
.paper-sheet h2 { text-align: center; }
.paper-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 18px; font-size: 13px; }
.paper-section { margin-bottom: 26px; }
.paper-section h3 { font-size: 17px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 12px; }
.paper-q { margin-bottom: 14px; display: flex; gap: 10px; }
.paper-q .num { font-weight: 700; flex: none; }
.paper-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; margin-top: 6px; font-size: 13px; }

@media print {
  .sidebar, .top, .heading, .crumbs, .no-print, .scrim { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .paper-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 6;
  }
  .sidebar.open { transform: none; }
  .mobile-menu { display: inline-flex; }
  .top { padding: 10px 18px; }
  .content { padding: 22px 18px 60px; }
  .profile .who { display: none; }
  body.sidebar-open { overflow: hidden; }
}

@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .heading h1 { font-size: 24px; }
  .filters .field { min-width: 100%; }
  .paper-options { grid-template-columns: 1fr; }
  td.actions .btn { margin-top: 4px; }
}
