/* =========================================================
   ARYANISPE FAM API — DESIGN SYSTEM v3.0
   Premium Light Mode | Stripe/Linear-inspired
   ========================================================= */

/* Fonts */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/poppins-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/poppins-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/poppins-700.woff2') format('woff2');
}

/* Prevent Lucide icon flashing & layout shift */
i[data-lucide], svg.lucide {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---- DESIGN TOKENS ---- */
:root {
  /* Brand */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* Surfaces */
  --surface-page:   #f6f8fb;
  --surface-card:   #ffffff;
  --surface-raised: #ffffff;
  --surface-input:  #ffffff;

  /* Ink */
  --ink-900: #0f172a;
  --ink-700: #1e293b;
  --ink-500: #334155;
  --ink-400: #475569;
  --ink-300: #64748b;
  --ink-200: #94a3b8;
  --ink-100: #cbd5e1;
  --ink-50:  #e2e8f0;

  /* Semantic */
  --color-primary:       var(--blue-600);
  --color-primary-deep:  var(--blue-700);
  --color-primary-press: var(--blue-800);
  --color-primary-soft:  var(--blue-100);
  --color-primary-glow:  rgba(37, 99, 235, 0.14);

  --color-ink:           var(--ink-900);
  --color-ink-secondary: var(--ink-500);
  --color-ink-mute:      var(--ink-300);
  --color-ink-mute-2:    var(--ink-200);

  --color-canvas:        var(--surface-card);
  --color-canvas-soft:   var(--surface-page);

  --color-hairline:      var(--ink-50);
  --color-hairline-input: var(--ink-100);

  /* Status */
  --color-success-bg:     #dcfce7;
  --color-success-text:   #16a34a;
  --color-success-border: #bbf7d0;
  --color-warning-bg:     #fef9c3;
  --color-warning-text:   #ca8a04;
  --color-warning-border: #fde68a;
  --color-danger-bg:      #fee2e2;
  --color-danger-text:    #dc2626;
  --color-danger-border:  #fca5a5;
  --color-ruby:           #ef4444;

  /* Sidebar */
  --sidebar-bg:     #0f172a;
  --sidebar-active: #1e293b;
  --sidebar-text:   #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-width:  256px;

  /* Radii */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-pill: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-inset: inset 0 2px 4px 0 rgba(0,0,0,0.04);

  /* Typography */
  --font: 'Poppins', system-ui, -apple-system, sans-serif;

  /* Transition */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t-fast: 0.15s;
  --t-mid:  0.25s;
}

/* ---- RESET ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: #f6f8fb;
}

body {
  font-family: var(--font);
  background: var(--color-canvas-soft);
  color: var(--color-ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, button, textarea, select { font-family: var(--font); }

/* ---- TYPOGRAPHY ---- */
.tnum { font-variant-numeric: tabular-nums; }
.display-lg { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.75px; color: var(--color-ink); }
.heading-lg  { font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -0.4px; color: var(--color-ink); }
.heading-md  { font-size: 17px; font-weight: 600; line-height: 1.4; letter-spacing: -0.3px; color: var(--color-ink); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  border: 1px solid transparent;
  font-family: var(--font);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-sm { font-size: 13px; padding: 5px 12px; border-radius: var(--r-sm); }

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3), 0 0 0 0 rgba(37,99,235,0);
}
.btn-primary:hover {
  background: var(--color-primary-deep);
  box-shadow: 0 3px 8px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { background: var(--color-primary-press); transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: var(--color-canvas);
  color: var(--color-ink);
  border-color: var(--color-hairline-input);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--color-canvas-soft); border-color: var(--ink-200); }

.btn-dark {
  background: var(--ink-900);
  color: #ffffff;
}
.btn-dark:hover { background: var(--ink-700); }

.btn-danger {
  background: var(--color-canvas);
  color: var(--color-danger-text);
  border-color: var(--color-danger-border);
}
.btn-danger:hover { background: var(--color-danger-bg); }

.btn-ghost {
  background: transparent;
  color: var(--color-ink-mute);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-canvas-soft); color: var(--color-ink); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-ink-secondary);
  letter-spacing: 0.01em;
}
.form-input {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--color-hairline-input);
  border-radius: var(--r-md);
  background: var(--surface-input);
  color: var(--color-ink);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}
.form-input::placeholder { color: var(--ink-200); }

/* ---- CARDS ---- */
.card {
  background: var(--color-canvas);
  border-radius: var(--r-xl);
  padding: 28px;
  border: 1px solid var(--color-hairline);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: box-shadow var(--t-mid) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { margin-bottom: 20px; }
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card-sub { font-size: 13px; color: var(--color-ink-mute); margin-top: 4px; }

/* ---- BADGES / PILLS ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger-text); }
.badge-soft    { background: var(--color-primary-soft); color: var(--blue-700); }
.badge-neutral { background: var(--ink-50); color: var(--ink-400); }

/* ---- ALERTS / CALLOUTS ---- */
.callout { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); margin-bottom: 20px; font-size: 13px; border: 1px solid transparent; }
.callout-success { background: var(--color-success-bg); color: var(--color-success-text); border-color: var(--color-success-border); }
.callout-warning { background: var(--color-warning-bg); color: var(--color-warning-text); border-color: var(--color-warning-border); }
.callout-error   { background: var(--color-danger-bg);  color: var(--color-danger-text);  border-color: var(--color-danger-border); }
.callout-info    { background: var(--blue-50);           color: var(--blue-700);           border-color: var(--blue-200); }
.msg.error   { background: var(--color-danger-bg); color: var(--color-danger-text); border: 1px solid var(--color-danger-border); padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 13px; }
.msg.success { background: var(--color-success-bg); color: var(--color-success-text); border: 1px solid var(--color-success-border); padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 13px; }

/* ================================================================
   DASHBOARD LAYOUT
   ================================================================ */
.dashboard-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--surface-page);
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 280px;
  gap: 20px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 30;
  transition: transform 0.3s var(--ease);
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-header {
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37,99,235,0.4);
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.sidebar-brand-tagline {
  font-size: 10px;
  color: var(--sidebar-text);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(148,163,184,0.5);
  padding: 10px 8px 6px;
  margin-top: 8px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.07);
  color: #e2e8f0;
}
.sidebar-item.active {
  background: rgba(37,99,235,0.18);
  color: #bfdbfe;
}
.sidebar-item.active i[data-lucide] { color: var(--blue-500); }
.sidebar-item i[data-lucide] { width: 16px; height: 16px; flex-shrink: 0; transition: color var(--t-fast); }

.sidebar-item-badge {
  margin-left: auto;
  background: var(--blue-600);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
  text-decoration: none;
}
.sidebar-user-card:hover { background: rgba(255,255,255,0.07); }
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin-top: 4px;
  border-radius: var(--r-md);
  color: #f87171;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast);
  text-decoration: none;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.1); color: #fca5a5; }
.sidebar-logout i[data-lucide] { width: 15px; height: 15px; }

/* ---- MOBILE HEADER ---- */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 22px 22px;
  min-height: 72px;
  background: var(--sidebar-bg);
  color: #ffffff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  flex-shrink: 0;
  z-index: 20;
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.3px;
}
.mobile-menu-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.12); }

/* ---- OVERLAY ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px);
  z-index: 25;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--surface-page);
  min-width: 0;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-thumb { background: var(--ink-100); border-radius: 3px; }

/* ---- TOP BAR (inside main) ---- */
.page-header {
  padding: 24px 32px 0;
  margin-bottom: 24px;
}
.page-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.5px;
}
.page-header-sub { font-size: 13px; color: var(--color-ink-mute); margin-top: 3px; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

/* ---- TABLES ---- */
.table-container {
  overflow-x: auto;
  border-top: 1px solid var(--color-hairline);
  margin: 20px -28px -28px;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.card > .table-container:last-child { margin-bottom: -1px; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  white-space: nowrap;
}
.table thead th {
  background: var(--surface-page);
  padding: 14px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--color-hairline);
  white-space: nowrap;
}
.table thead th:first-child { padding-left: 28px; }
.table tbody td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-hairline);
  color: var(--color-ink-secondary);
  vertical-align: middle;
  white-space: nowrap;
}
.table tbody td:first-child { padding-left: 28px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover { background: var(--surface-page); }

/* ---- STAT CARDS (inside dashboard) ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--t-mid), transform var(--t-mid);
}
.stat-card:hover { box-shadow: 0 8px 24px rgba(15,23,42,0.06); transform: translateY(-3px); }
.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card-icon.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; box-shadow: 0 4px 10px rgba(37,99,235,0.25); }
.stat-card-icon.green  { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 10px rgba(16,185,129,0.25); }
.stat-card-icon.red    { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 4px 10px rgba(239,68,68,0.25); }
.stat-card-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 4px 10px rgba(245,158,11,0.25); }
.stat-card-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #fff; box-shadow: 0 4px 10px rgba(139,92,246,0.25); }
.stat-card-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.5px;
  line-height: 1;
}
.stat-card.featured {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(37,99,235,0.3);
}
.stat-card.featured .stat-card-label { color: rgba(219,234,254,0.7); }
.stat-card.featured .stat-card-value { color: #ffffff; }
.stat-card.featured .stat-card-icon  { background: rgba(255,255,255,0.15); color: #bfdbfe; }
.stat-card.featured:hover { box-shadow: 0 8px 30px rgba(37,99,235,0.4); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-page);
  border: 2px solid var(--color-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--color-ink-mute);
}
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--color-ink); margin-bottom: 6px; }
.empty-state-sub   { font-size: 13px; color: var(--color-ink-mute); }

/* ---- CODE / API KEY ---- */
.code-block {
  background: var(--ink-900);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  overflow-x: auto;
}
.code-block code {
  color: #a5f3fc;
  font-size: 13px;
  font-family: 'Consolas', 'Monaco', monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-btn {
  background: var(--color-canvas);
  color: var(--color-ink-mute);
  border: 1px solid var(--color-hairline);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.copy-btn:hover { background: var(--color-canvas-soft); color: var(--color-ink); box-shadow: var(--shadow-xs); }
.copy-btn.copied { background: var(--color-success-bg); color: var(--color-success-text); border-color: var(--color-success-border); }

/* ---- DOCS ---- */
.desc { font-size: 14px; color: var(--color-ink-secondary); line-height: 1.65; margin-bottom: 20px; }
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--color-primary-soft);
  color: var(--blue-700);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  margin-right: 8px;
}

/* ---- MOBILE RESPONSIVENESS ---- */
@media (max-width: 960px) {
  .dashboard-layout { flex-direction: column; height: 100dvh; }
  .mobile-header    { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .wrap { padding: 20px 18px 48px; }
  .card { padding: 20px; }
  .table-container { margin: 16px -20px -20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { padding: 16px 18px 0; }
  .dashboard-bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .wrap { padding: 16px 14px 40px; }
  .card { padding: 16px; border-radius: var(--r-lg); }
  .table-container { margin: 14px -16px -16px; }
  #closeSidebarBtn { display: block !important; }
  .form-input { font-size: 16px; /* prevent iOS zoom */ }
}

/* =============================================
   PREMIUM MICRO-INTERACTIONS (Admin Panel)
============================================= */

/* Button tactile press — feels physical */
.btn:active { transform: scale(0.97) translateY(1px); }

/* Table rows — smooth highlight on hover */
.table tbody tr {
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.table tbody tr:hover {
  background: var(--blue-50);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

/* Cards — subtle lift on hover (upgrade from just shadow) */
.card {
  transition: box-shadow var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

/* Sidebar items — smooth icon color transition */
.sidebar-item { transition: background var(--t-fast), color var(--t-fast), padding-left var(--t-mid); }
.sidebar-item:hover { padding-left: 16px; }
.sidebar-item.active { padding-left: 12px; }

/* Sidebar slide-in — smoother bezier curve */
.sidebar { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

/* Stat card icon pulse on hover */
.stat-card:hover .stat-card-icon { transform: scale(1.1); transition: transform var(--t-mid); }

/* Overlay fade-in */
.sidebar-overlay { transition: opacity 0.25s ease; }

/* =============================================
   MERCHANT PANEL — ENTRANCE ANIMATIONS
   Powered by IntersectionObserver (no lib)
============================================= */

@keyframes dashFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dashFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dashSlideRight {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Utility animation classes — initial hidden state */
.dash-anim-up      { opacity: 0; will-change: opacity, transform; }
.dash-anim-in      { opacity: 0; will-change: opacity; }
.dash-anim-right   { opacity: 0; will-change: opacity, transform; }

/* Triggered by .is-visible (added via JS) */
.dash-anim-up.is-visible    { animation: dashFadeUp  0.55s cubic-bezier(.22,1,.36,1) forwards; }
.dash-anim-in.is-visible    { animation: dashFadeIn  0.5s ease forwards; }
.dash-anim-right.is-visible { animation: dashSlideRight 0.55s cubic-bezier(.22,1,.36,1) forwards; }

/* Stagger: children appear one after another */
.dash-stagger > * { opacity: 0; will-change: opacity, transform; }
.dash-stagger.is-visible > *:nth-child(1) { animation: dashFadeUp .5s .04s cubic-bezier(.22,1,.36,1) forwards; }
.dash-stagger.is-visible > *:nth-child(2) { animation: dashFadeUp .5s .12s cubic-bezier(.22,1,.36,1) forwards; }
.dash-stagger.is-visible > *:nth-child(3) { animation: dashFadeUp .5s .20s cubic-bezier(.22,1,.36,1) forwards; }
.dash-stagger.is-visible > *:nth-child(4) { animation: dashFadeUp .5s .28s cubic-bezier(.22,1,.36,1) forwards; }
.dash-stagger.is-visible > *:nth-child(5) { animation: dashFadeUp .5s .36s cubic-bezier(.22,1,.36,1) forwards; }
.dash-stagger.is-visible > *:nth-child(6) { animation: dashFadeUp .5s .44s cubic-bezier(.22,1,.36,1) forwards; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .dash-anim-up, .dash-anim-in, .dash-anim-right,
  .dash-stagger > * {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* =============================================
   MERCHANT PANEL — RESPONSIVENESS FIXES
============================================= */

/* API Key display on mobile — prevent overflow */
.api-key-display {
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Payment link URL cell on mobile */
@media (max-width: 640px) {
  .table td code {
    display: block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .wrap {
    padding: 14px 12px 60px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card-value {
    font-size: 22px;
  }
  .page-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  /* Fixes for Profile and forms on mobile */
  .form-row {
    grid-template-columns: 1fr !important;
  }
  #updateProfileForm, #requestEmailForm, #verifyEmailForm {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  #updateProfileForm > div, #requestEmailForm > div, #verifyEmailForm > div {
    min-width: 100% !important;
  }
  #updateProfileForm > div[style*="display: flex"] {
    flex-direction: row !important;
  }
  
  /* Dashboard layout fixes */
  .card {
    padding: 16px !important;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .card-header > div {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  #updateProfileForm > div[style*="display: flex"] {
    flex-direction: column !important;
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-icon {
  animation: spin 1s linear infinite !important;
  transform-origin: center !important;
  transform-box: fill-box !important;
  position: relative;
  top: 2px;
}
