/* ==========================================================================
   CLOVE — dashboard styles.
   Shares the brand palette with the store: copper, charcoal, cream, beige.
   ========================================================================== */
:root {
  --copper: #BD823F;
  --copper-deep: #9a6b2e;
  --copper-dark: #a5712e;
  --charcoal: #282828;
  --charcoal-2: #1f1d1a;
  --cream: #F4EEE5;
  --cream-soft: #faf7f1;
  --beige: #D9C7AE;
  --ink: #282828;
  --ink-2: #6b6257;
  --ink-3: #9a9186;
  --line: #e4dbc9;
  --card: #fffdf9;
  --error: #b3402f;
  --ok: #2e7d43;
  --radius: 3px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Jost', -apple-system, 'Segoe UI', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14.5px; color: var(--ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.03em; }
.strong { font-weight: 600; }
.muted { color: var(--ink-3); }
.ta-r { text-align: right; }

/* ---------- shell ---------- */
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.admin-side {
  background: var(--charcoal); color: var(--cream);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: baseline; gap: 6px; padding: 26px 24px 20px;
  font-size: 24px; font-weight: 600; letter-spacing: 0.3em;
}
.side-brand span { color: var(--cream); }
.side-brand em { font-style: normal; color: var(--copper); }
.side-brand small { font-size: 10px; letter-spacing: 0.22em; color: var(--beige); text-transform: uppercase; margin-left: auto; }
.side-nav { display: flex; flex-direction: column; padding: 8px 14px; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  font-size: 13.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(244, 238, 229, 0.66); border-radius: var(--radius);
  transition: background .2s, color .2s;
}
.side-nav a:hover { color: var(--cream); background: rgba(244, 238, 229, 0.06); }
.side-nav a.is-active { color: var(--cream); background: rgba(189, 130, 63, 0.22); box-shadow: inset 3px 0 0 var(--copper); }
.side-nav svg { width: 19px; height: 19px; flex: none; }
.side-count { margin-left: auto; font-size: 11px; color: var(--ink-2); background: var(--beige); padding: 2px 8px; border-radius: 999px; letter-spacing: 0.05em; }
.side-count-new { background: var(--copper); color: var(--charcoal-2); font-weight: 600; }
.side-foot { margin-top: auto; padding: 18px 24px 24px; border-top: 1px solid rgba(244, 238, 229, 0.12); display: flex; flex-direction: column; gap: 10px; }
.side-foot a { font-size: 13px; color: rgba(244, 238, 229, 0.6); }
.side-foot a:hover { color: var(--copper); }
.side-logout:hover { color: #e08a8a; }

.admin-main { padding: 0 clamp(20px, 3vw, 44px) 60px; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 26px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.admin-topbar h1 { font-family: var(--font-display); font-weight: 500; font-size: 34px; }
.topbar-user { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }

.admin-flashes { margin-bottom: 18px; }
.flash { padding: 12px 18px; border-radius: var(--radius); font-size: 14px; margin-bottom: 10px; border: 1px solid; max-width: 760px; }
.flash-success { background: #edf5ef; border-color: #cfe5d4; color: var(--ok); }
.flash-error { background: #fdefed; border-color: #f2d4cf; color: var(--error); }
.flash-info { background: #f6f1e7; border-color: var(--line); color: var(--ink-2); }

/* ---------- panels / tables ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 26px;
}
.panel-plain { background: transparent; border: 0; padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { font-size: 13px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--copper-deep); }
.panel-sub { color: var(--ink-2); font-size: 13.5px; max-width: 70ch; }
.panel-empty { color: var(--ink-2); padding: 26px 0; text-align: center; }
.h-quiet { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table thead th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--cream-soft); }
.row-hidden td { opacity: 0.5; }
.td-sub { display: block; font-size: 12px; color: var(--ink-3); }
.td-inspired { font-family: var(--font-display); font-style: italic; font-size: 15.5px; color: var(--ink-2); max-width: 220px; }
.td-thumb img { width: 52px; height: 52px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--cream-soft); }
.td-actions { white-space: nowrap; }
.inline-form { display: inline; }
.price-final { color: var(--ink); }
.row-total td { border-bottom: 0; padding: 6px 12px; color: var(--ink-2); }
.row-grand td { font-weight: 600; color: var(--ink); font-size: 15px; border-top: 1px solid var(--line); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
}
.b-new { background: var(--copper); color: var(--charcoal-2); }
.b-in_progress { background: var(--beige); color: var(--charcoal); }
.b-delivered { background: #dcebdd; color: var(--ok); }
.b-cancelled { background: #f6dfd9; color: var(--error); }
.b-ok { background: #dcebdd; color: var(--ok); }
.b-out { background: var(--charcoal); color: var(--cream); }
.b-low { background: #f3e7d3; color: var(--ink-2); }
.b-live { background: #dcebdd; color: var(--ok); }
.b-hidden { background: #ece7df; color: var(--ink-3); }
.chip-sale-inline {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--charcoal); color: var(--copper); font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
}

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; display: flex; flex-direction: column; gap: 4px;
  transition: transform .22s ease, box-shadow .22s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -18px rgba(40,40,40,.25); }
.stat-num { font-family: var(--font-display); font-weight: 500; font-size: 38px; line-height: 1; color: var(--ink); }
.stat-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--copper-deep); font-weight: 600; }
.stat-foot { font-size: 12.5px; color: var(--ink-3); }
.quick-row { display: flex; flex-wrap: wrap; gap: 12px; }
.quick-link {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 10px 20px; font-size: 13px; color: var(--ink-2);
}
.quick-link:hover { border-color: var(--copper); color: var(--copper-deep); }

/* ---------- forms ---------- */
.field { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 18px; }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 8px; background: var(--cream-soft);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px;
  font-size: 14.5px; font-weight: 400; letter-spacing: 0.02em; text-transform: none; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--copper); box-shadow: 0 0 0 4px rgba(189, 130, 63, 0.14); background: #fff;
}
.field textarea { resize: vertical; }
.field.has-error input { border-color: var(--error); }
.field-error { display: block; margin-top: 6px; font-size: 12px; color: var(--error); text-transform: none; letter-spacing: 0.02em; font-weight: 500; }
.field-hint { display: block; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); text-transform: none; letter-spacing: 0.02em; font-weight: 400; }
.field-check { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--ink-2); margin: 6px 0 18px; }
.field-check input { width: auto; margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-inline { display: flex; gap: 10px; margin-top: 8px; }
.field-inline input, .field-inline select { margin: 0; width: auto; flex: 1; }
.field-inline input { max-width: 110px; }
.field-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); display: block; margin-bottom: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: var(--radius);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  border: 1px solid transparent; transition: all .22s ease;
}
.btn-primary { background: var(--copper); color: var(--charcoal-2); }
.btn-primary:hover { background: var(--copper-dark); color: #1c1710; }
.btn-outline { border-color: var(--charcoal); color: var(--charcoal); background: transparent; }
.btn-outline:hover { border-color: var(--copper); color: var(--copper-deep); }
.btn-danger { background: transparent; border: 1px solid var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-ghost { color: var(--ink-2); padding: 10px 14px; }
.btn-ghost:hover { color: var(--copper-deep); }
.btn-block { width: 100%; }
.text-btn {
  background: none; border: 0; padding: 3px 2px; font-size: 13px; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 3px;
}
.text-btn:hover { color: var(--copper-deep); }
.text-danger:hover { color: var(--error); }

/* ---------- page-specific ---------- */
.page-actions { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 20px; }
.admin-note { font-size: 13px; color: var(--ink-3); max-width: 80ch; }

.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 42px; }
.edit-actions { display: flex; gap: 12px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 22px; }
.img-preview {
  width: 132px; height: 132px; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--cream-soft); margin-bottom: 12px;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
input[type="file"] { font-size: 13px; color: var(--ink-2); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.settings-panel h2 { font-size: 13px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--copper-deep); margin-bottom: 6px; }
.settings-panel .btn { margin-right: 10px; margin-bottom: 6px; }

.order-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 26px; align-items: start; }
.detail-list { margin: 0; }
.detail-list > div { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { width: 110px; flex: none; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; padding-top: 2px; }
.detail-list dd { margin: 0; }
.status-form { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.delete-order-form {
  margin-top: 18px; border-top: 1px dashed rgba(179, 64, 47, 0.35);
  padding-top: 18px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.delete-order-form .del-note { font-size: 12.5px; color: var(--ink-2); max-width: 44ch; }

.order-filter { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-block; border: 1px solid rgba(40, 40, 40, 0.25); border-radius: 999px;
  padding: 8px 18px; font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2); background: transparent;
}
.pill a { display: block; }
.pill:hover { border-color: var(--copper); color: var(--copper-deep); }
.pill.is-active { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }
.sort-label { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 10px; }
.sort-label input { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 9px 12px; margin-top: 0; width: auto; display: inline-block; }

/* ---------- login ---------- */
.login-body { background: var(--charcoal); min-height: 100vh; display: flex; align-items: center; }
.login-shell {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
  width: min(880px, 100% - 40px); margin: 40px auto;
  background: var(--cream); border-radius: 4px; overflow: hidden;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.6);
}
.login-brand {
  background: var(--charcoal); color: var(--cream); padding: 44px 40px;
  display: flex; flex-direction: column; gap: 10px;
}
.login-brand .wordmark { font-size: 34px; font-weight: 600; letter-spacing: 0.32em; }
.login-brand .wordmark span { color: var(--cream); }
.login-brand .wordmark em { font-style: normal; color: var(--copper); }
.login-brand p { font-size: 10.5px; letter-spacing: 0.26em; color: var(--beige); text-transform: uppercase; }
.login-brand img { width: 120px; margin-top: auto; opacity: 0.9; align-self: flex-end; }
.login-panel { padding: 48px 44px; }
.login-panel h1 { font-family: var(--font-display); font-weight: 500; font-size: 40px; }
.login-sub { color: var(--ink-2); font-size: 14.5px; margin: 8px 0 22px; }
.login-panel .field input { background: #fff; }
.login-alt { margin-top: 22px; font-size: 13px; color: var(--ink-3); }
.login-alt a { color: var(--copper-deep); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .settings-grid, .order-grid, .edit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; }
  .side-brand { padding: 18px 20px 12px; }
  .side-brand small { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; padding: 6px 12px; }
  .side-nav a { white-space: nowrap; padding: 10px 12px; }
  .side-count { margin-left: 8px; }
  .side-foot { flex-direction: row; justify-content: space-between; padding: 14px 20px; }
  .admin-topbar h1 { font-size: 26px; }
  .login-shell { grid-template-columns: 1fr; margin: 20px auto; }
  .login-brand img { display: none; }
  .login-brand { padding: 32px 28px; }
  .login-panel { padding: 34px 28px; }
  .field-row { grid-template-columns: 1fr; }
}
