/* NOVA Living demo admin. Shares tokens and type with the storefront. */

body.admin { background: var(--paper); }

.admin-banner {
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  line-height: 1.45;
  padding: 10px var(--gutter);
  text-align: center;
}
.admin-banner p { margin: 0 auto; max-width: none; }
.admin-banner strong { font-weight: 600; }

.admin-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: calc(100vh - 41px);
}
.admin-side {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 41px);
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.admin-side .wordmark { color: var(--ink); }
.admin-side__tag { margin: 6px 0 0; font-size: 0.85rem; color: var(--stone); }
.admin-nav { list-style: none; display: grid; gap: 2px; }
.admin-nav a {
  display: block;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-weight: 500;
  text-decoration: none;
}
.admin-nav a:hover { background: var(--oat); }
.admin-nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.admin-side__foot { margin-top: auto; display: grid; gap: 4px; font-size: 0.9rem; }
.admin-side__foot a, .admin-side__foot button {
  display: block;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  text-align: left;
  color: var(--stone);
  text-decoration: none;
  cursor: pointer;
}
.admin-side__foot a:hover, .admin-side__foot button:hover { background: var(--oat); color: var(--ink); }

.admin-main { padding: clamp(24px, 3.4vw, 56px); min-width: 0; }
.admin-title { font-family: var(--font-display); font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem); line-height: 1.05; }
.admin-sub { margin: 8px 0 0; color: var(--stone); }
.admin-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: clamp(24px, 3vw, 40px); }
.admin-section { margin-top: clamp(40px, 5vw, 72px); }
.admin-section > h2, .admin-section__head h2 { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.admin-section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 18px; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    padding: 16px var(--gutter);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .admin-side__tag { display: none; }
  .admin-nav { display: flex; order: 3; width: 100%; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
  .admin-side__foot { margin-top: 0; margin-left: auto; display: flex; gap: 0; width: auto; }
  .admin-side__foot a, .admin-side__foot button { width: auto; padding: 8px 10px; }
}

/* KPIs: one ruled row, not a row of cards */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.kpi { padding: 22px clamp(14px, 2vw, 28px); }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi:first-child { padding-left: 0; }
.kpi__label { margin: 0 0 6px; font-size: 0.9rem; color: var(--stone); }
.kpi__value { margin: 0; font-family: var(--font-display); font-size: clamp(2rem, 1.4rem + 1.6vw, 2.9rem); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi__note { margin: 8px 0 0; font-size: 0.85rem; color: var(--stone); }
@media (max-width: 760px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* Chart */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { min-height: 38px; padding: 0 16px; background: transparent; border: 0; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-body); font-size: 12px; fill: var(--stone); }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--moss); }
.chart .bar:hover, .chart .bar:focus { fill: var(--ink); outline: none; }
.chart-summary { margin: 14px 0 0; font-size: 0.9rem; color: var(--stone); }

/* Tables */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line-strong); }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--stone);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: rgba(238, 232, 219, 0.45); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .link-btn { margin-left: 14px; }
.cell-product { display: flex; align-items: center; gap: 14px; min-width: 240px; }
.cell-product img { width: 48px; height: 60px; object-fit: cover; background: var(--oat); border-radius: 2px; flex: none; }
.cell-product strong { display: block; font-weight: 600; }
.cell-product span { font-size: 0.85rem; color: var(--stone); }
.input--sm { min-height: 40px; padding: 7px 10px; width: 108px; text-align: right; font-variant-numeric: tabular-nums; }
.input--stock { width: 84px; }
.inline-money { position: relative; display: inline-block; }
.inline-money::before { content: "R"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--stone); font-size: 0.9rem; pointer-events: none; }
.inline-money .input--sm { padding-left: 26px; }
.empty-row td { text-align: center; color: var(--stone); padding: 48px 14px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 550;
  background: var(--oat);
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--stone); }
.status--Packed { background: #ece6d2; }
.status--Packed::before { background: var(--ochre); }
.status--Dispatched { background: var(--moss-tint); }
.status--Dispatched::before { background: var(--moss); }
.status--Delivered { background: var(--moss); color: var(--paper); }
.status--Delivered::before { background: var(--paper); }
.status--Cancelled { background: var(--danger-tint); color: var(--danger); }
.status--Cancelled::before { background: var(--danger); }

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.filters .input { max-width: 300px; }

/* Modal forms */
.modal {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--paper);
  overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; animation: modal-in 0.28s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 14px 28px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-family: var(--font-display); font-size: 1.8rem; line-height: 1; }
.modal__body { padding: 24px 28px; overflow-y: auto; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--paper); }
.modal--sm { width: min(460px, calc(100vw - 32px)); }
.preview { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.preview img { width: 64px; height: 80px; object-fit: cover; background: var(--oat); border-radius: 2px; }
.preview p { margin: 0; font-size: 0.85rem; color: var(--stone); }

.order-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 32px; margin-bottom: 24px; }
.order-grid h3 { font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.order-grid p { margin: 0; color: var(--stone); font-size: 0.95rem; }
.history { list-style: none; margin: 12px 0 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.history li span:last-child { color: var(--stone); }
@media (max-width: 560px) { .order-grid { grid-template-columns: 1fr; } }

/* Login */
.login-wrap { min-height: calc(100vh - 41px); display: grid; place-items: center; padding: 32px var(--gutter); }
.login { width: min(100%, 440px); }
.login .wordmark { margin-bottom: 36px; }
.login h1 { font-family: var(--font-display); font-size: 2.6rem; line-height: 1.05; margin-bottom: 10px; }
.login form { display: grid; gap: 18px; margin-top: 28px; }
.creds { margin: 24px 0 0; padding: 16px 18px; background: var(--oat); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 0.9rem; }
.creds p { margin: 0 0 6px; max-width: none; }
.creds code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; background: var(--white); padding: 2px 6px; border-radius: 3px; border: 1px solid var(--line); }
.creds .link-btn { margin-top: 6px; }
