/* Owner dashboard shell. Built on the tokens/buttons already defined in
   styles.css — same dark/neon brand as the public site, just denser. */

body.app-body { background: var(--bg); }

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--bg-alt);
  border-right: 1px solid var(--surface-line);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-sidebar .brand { padding: 24px; border-bottom: 1px solid var(--surface-line); color: var(--cream); }

.app-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.app-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.app-nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--cream); }
.app-nav a.active { background: rgba(230, 59, 212, 0.12); color: var(--cream); border-left-color: var(--magenta); }

.app-sidebar-foot { padding: 16px; border-top: 1px solid var(--surface-line); }
.app-user { font-size: 0.82rem; margin-bottom: 10px; line-height: 1.3; color: var(--cream); }
.app-user .role-tag {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--cyan);
  margin-top: 2px;
}
.app-sidebar-foot button {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-line);
  color: var(--cream);
  padding: 9px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
}
.app-sidebar-foot button:hover { background: rgba(255, 255, 255, 0.1); }

.app-main { flex: 1; min-width: 0; padding: 36px 44px 60px; }
.app-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; flex-wrap: wrap; gap: 16px; }
.app-head h1 { font-size: 1.7rem; margin-bottom: 4px; }
.app-head p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.panel { display: none; }
.panel.active { display: block; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 36px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 16px;
  padding: 20px 22px;
}
.stat-card .stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.9rem; color: var(--cream); }

.card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 24px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 1.15rem; margin: 0; }

/* Pure-CSS scroll shadow: shows a dark fade on whichever edge still has
   hidden columns, and it disappears once you've scrolled that direction —
   so "there's more this way" is visible at a glance instead of a silent
   horizontal scroll nobody discovers (this bit us once already with the
   mobile nav menu, see the comment on .app-nav below). The two "cover"
   gradients scroll with the content and mask the shadow exactly at the
   real start/end; the two shadow gradients stay fixed to the edges. */
.table-wrap {
  overflow-x: auto;
  margin: 0 -2px;
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(30, 20, 48, 0)) local,
    linear-gradient(to left, var(--surface) 30%, rgba(30, 20, 48, 0)) local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)) scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)) scroll;
  background-repeat: no-repeat;
  background-color: var(--surface);
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-position: 0 0, 100% 0, 0 0, 100% 0;
}

/* Explicit backup to the shadow above — inserted by dashboard.js only when
   a table actually overflows, hidden again once scrolled to the end. Not
   relying on the shadow alone for discoverability; it's a nice touch but
   still something a user has to notice on their own. */
.table-scroll-hint {
  display: none;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  margin-bottom: 8px;
}
.table-scroll-hint.show { display: flex; }

table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--surface-line);
  font-weight: 600;
}
tbody td { padding: 13px 12px; border-bottom: 1px solid var(--surface-line); vertical-align: top; color: var(--cream); }
tbody tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); font-size: 0.85rem; }
.empty-row td { text-align: center; padding: 32px 12px; color: var(--muted); }

.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 10px; border-radius: 999px; }
.status-paid { background: rgba(255, 182, 39, 0.16); color: var(--amber); }
.status-label_purchased { background: rgba(47, 217, 234, 0.16); color: var(--cyan); }
.status-shipped { background: rgba(139, 61, 240, 0.18); color: #c9a4ff; }
.status-delivered { background: rgba(63, 200, 122, 0.16); color: #5fe0a0; }
.status-cancelled,
.status-refunded { background: rgba(230, 59, 212, 0.14); color: var(--magenta); }
.status-new { background: rgba(255, 182, 39, 0.16); color: var(--amber); }
.status-quoted,
.status-accepted,
.status-in_progress { background: rgba(47, 217, 234, 0.16); color: var(--cyan); }
.status-completed { background: rgba(63, 200, 122, 0.16); color: #5fe0a0; }
.status-declined { background: rgba(230, 59, 212, 0.14); color: var(--magenta); }

select.status-select,
.inline-input {
  font-size: 0.82rem;
  padding: 7px 10px;
  border-radius: 7px;
  width: auto;
  background: var(--bg);
  border: 1px solid var(--surface-line);
  color: var(--cream);
  font-family: var(--font-body);
}

.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; align-items: end; margin-bottom: 4px; }
.inline-form .field { margin-bottom: 0; }
.inline-form label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.inline-form input,
.inline-form select,
.inline-form textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.88rem;
}

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.rate-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  font-size: 0.85rem;
}

.product-thumb-sm {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-right: 10px;
}
.product-thumb-sm img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- auth pages ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 20px;
  padding: 36px 32px;
}
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.4rem; text-align: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 26px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 0.88rem; color: var(--muted); }

.form-status.show { margin-top: 12px; font-size: 0.85rem; }
.form-status.show.err { color: var(--magenta); }
.form-status.show.ok { color: var(--cyan); }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .app-sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
  .app-sidebar .brand { border-bottom: none; padding: 16px 18px; align-self: flex-start; }
  /* Wraps onto multiple rows instead of a hidden horizontal scroll — the
     scroll version was genuinely missed in real use (user didn't realize
     "Accounting" existed off-screen), so visible wrapping is worth the
     extra vertical space it costs. */
  .app-nav { flex-direction: row; flex-wrap: wrap; overflow-x: visible; padding: 0 10px 10px; }
  .app-nav a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .app-nav a.active { border-left-color: transparent; border-bottom-color: var(--magenta); }
  .app-sidebar-foot { border-top: 1px solid var(--surface-line); display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; }
  .app-user { display: block; }
  .app-main { padding: 26px 20px 50px; }
}
