/* public/css/style.css — MVP Shop Admin: design system */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0F1216;
  --surface: #171B21;
  --surface-2: #1E2430;
  --surface-3: #262E3B;
  --border: #2A313D;
  --text: #E7EAEE;
  --text-dim: #8891A0;
  --text-faint: #5B6373;
  --accent: #4FA8A0;
  --accent-strong: #6FC2BA;
  --accent-bg: #16302D;
  --danger: #E0555F;
  --danger-bg: #3A1E22;
  --warning: #D6A64B;
  --warning-bg: #362A17;
  --success: #4FA8A0;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: var(--accent-strong); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06201D; font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.field input, .field select, .field textarea {
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 10px 12px;
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
}
.field textarea { min-height: 90px; resize: vertical; font-family: var(--font-ui); }
.field .hint { font-size: 12px; color: var(--text-faint); }
.field .error { font-size: 12.5px; color: var(--danger); }
.mono-input input { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top, 0px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.auth-brand { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); letter-spacing: 0.04em; margin-bottom: 4px; }
.auth-title { font-size: 20px; margin-bottom: 6px; }
.auth-sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 24px; }
.auth-steps { display: flex; gap: 6px; margin-bottom: 24px; }
.auth-step-dot { flex: 1; height: 3px; border-radius: 2px; background: var(--border); }
.auth-step-dot.done { background: var(--accent); }
.auth-step-dot.current { background: var(--accent-strong); }
.auth-error {
  background: var(--danger-bg); color: #FFB4BA; border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 16px;
}
.auth-locked {
  background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning);
  border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 16px;
}
.phrase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.phrase-grid input { text-align: center; padding: 8px 4px; font-family: var(--font-mono); font-size: 13px; }
.totp-input input { text-align: center; letter-spacing: 0.3em; font-size: 20px; font-family: var(--font-mono); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateX(0);
  transition: transform 180ms ease;
  z-index: 40;
}
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-brand { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); letter-spacing: 0.04em; }
.sidebar-email { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; word-break: break-all; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  cursor: pointer; margin-bottom: 2px; min-height: 40px;
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-strong); }
.nav-icon { width: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  font-weight: 600; padding: 1px 6px; border-radius: 999px; font-family: var(--font-mono);
}
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top, 0px);
  position: sticky; top: 0; background: var(--bg); z-index: 20;
}
.topbar h1 { font-size: 16px; }
.hamburger { display: none; }
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 39;
  opacity: 0; pointer-events: none; transition: opacity 180ms ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }

@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); width: 84vw; max-width: 320px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .content { padding: 16px; }
}

/* ---------- Cards / tables ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px;
}
.card-title { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.card-sub { font-size: 12.5px; color: var(--text-faint); margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.stat-value { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.stat-note { font-size: 11px; color: var(--text-faint); margin-top: 6px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-input { min-width: 220px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: none; color: var(--text-faint);
  font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface);
}
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.cell-mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }
.cell-amount { font-family: var(--font-mono); font-weight: 600; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-pending .status-dot, .status-processing .status-dot { background: var(--warning); }
.status-approved .status-dot, .status-paid .status-dot, .status-open .status-dot { background: var(--accent); }
.status-rejected .status-dot, .status-cancelled .status-dot { background: var(--danger); }
.status-expired .status-dot, .status-closed .status-dot { background: var(--text-faint); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 28px; margin-bottom: 12px; opacity: 0.6; }
.empty-state .title { color: var(--text); font-weight: 600; margin-bottom: 6px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 6px;
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 10px; }
.pagination .info { font-size: 12.5px; color: var(--text-faint); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 60;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 440px; max-height: 90dvh; overflow-y: auto;
}
.modal-title { font-size: 16px; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

.toast-wrap {
  position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.toast {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; font-size: 13px; max-width: 320px; box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--accent); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  font-family: var(--font-mono);
}
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-accent { background: var(--accent-bg); color: var(--accent-strong); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 10px 14px; font-size: 13px; color: var(--text-dim); border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font-ui); min-height: 40px;
}
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.detail-item .k { font-size: 11.5px; color: var(--text-faint); margin-bottom: 4px; }
.detail-item .v { font-size: 13.5px; }
.detail-item .v.mono { font-family: var(--font-mono); }

.unsaved-bar {
  position: sticky; bottom: 0; background: var(--surface-3); border-top: 1px solid var(--border);
  padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
