/* Shared dashboard styling for partner & admin portals.
   Single stylesheet — keep it small, no preprocessor. */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e6e8ee;
  --text: #1a1f2e;
  --text-secondary: #6b7280;
  --text-hint: #9ca3af;
  --primary: #1f2e5c;
  --action: #ee7637;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  /* Sidebar is fixed-positioned at 240px on desktop; main shifts left
     to make room. On mobile the sidebar becomes a drawer (hidden) and
     a topbar takes its place. */
  min-height: 100vh;
}
.topbar {
  display: none; /* desktop hidden */
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-logo { height: 28px; width: auto; }
.topbar-tagline {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}
.hamburger {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.sidebar {
  background: var(--primary);
  color: white;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  width: 240px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}
.sidebar .brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.sidebar .brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}
.sidebar .brand-tagline {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}
.sidebar-backdrop.show { display: block; }
.sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  gap: 2px;
  flex: 1;
}
.sidebar nav a {
  color: rgba(255, 255, 255, 0.75);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  text-decoration: none;
}
.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-left-color: var(--action);
}
.sidebar .footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.sidebar .footer a {
  color: rgba(255, 255, 255, 0.85);
  display: block;
  margin-top: 6px;
}

.main {
  padding: 24px 32px;
  max-width: 1100px;
  margin-left: 240px; /* room for the fixed sidebar */
}
.main h1 {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 800;
}
.main .sub {
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--action);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.field { margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--action); color: white; }
.btn-primary:hover { background: #d65f23; }
.btn-secondary { background: white; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: white; border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.06); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}
tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.pill-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.pill-approved { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.pill-rejected, .pill-suspended, .pill-fraud_blocked, .pill-invalidated, .pill-expired {
  background: rgba(239, 68, 68, 0.15); color: var(--error);
}
.pill-redeemed, .pill-completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.pill-open { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.pill-closed { background: rgba(156, 163, 175, 0.2); color: var(--text-secondary); }
.pill-admin { background: rgba(238, 118, 55, 0.15); color: var(--action); }
.pill-partner { background: rgba(59, 130, 246, 0.15); color: var(--info); }

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-secondary);
}

/* Login layout */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: white;
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-card h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
}
.login-card p.sub { color: var(--text-secondary); margin: 0 0 24px; font-size: 13px; }
.login-card .err {
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  display: none;
}
.login-card .err.show { display: block; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--text);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms, transform 200ms;
  pointer-events: none;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Scrollable table wrapper for narrow screens. Cards keep their padding
   but tables overflow horizontally instead of squashing or wrapping. */
.card { overflow-x: auto; }
.card table { min-width: 560px; }

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .main { padding: 20px; max-width: none; }
}

@media (max-width: 768px) {
  .topbar { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .main {
    margin-left: 0;
    padding: 16px;
  }
  .row, .row.three { grid-template-columns: 1fr; }
  th, td { padding: 8px 10px; font-size: 12px; }
  th { font-size: 10px; }
  .login-card { padding: 24px; }
}

@media (max-width: 420px) {
  .main h1 { font-size: 18px; }
  .card { padding: 14px; }
  .btn { padding: 7px 11px; font-size: 12px; }
}
