/* ──────────────────────────────────────────────────────────────
   PREMIUM DESIGN SYSTEM — Sertifikat QR
   ────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Palette (HSL Tailored Colors) ── */
  --primary:        #4f46e5; /* Vibrant Indigo */
  --primary-dark:   #3730a3;
  --primary-light:  #e0e7ff;
  --primary-glow:   rgba(79, 70, 229, 0.18);
  --accent:         #06b6d4; /* Vibrant Cyan */
  --accent-glow:    rgba(6, 182, 212, 0.15);
  --gold:           #d97706; /* Premium Gold */
  --gold-light:     #fef3c7;
  --success:        #10b981;
  --success-bg:     rgba(16, 185, 129, 0.08);
  --danger:         #ef4444;
  --danger-bg:      rgba(239, 68, 68, 0.08);
  --warning:        #f59e0b;

  /* ── Surfaces ── */
  --bg:             #f8fafc; /* Sleek Slate Light */
  --bg-soft:        #ffffff;
  --surface:        #ffffff;
  --surface-2:      #f1f5f9;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  /* ── Text ── */
  --text:           #0f172a;
  --text-2:         #334155;
  --text-muted:     #64748b;
  --text-soft:      #94a3b8;

  /* ── Radius ── */
  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  /* ── Shadows (Premium Multi-Layered) ── */
  --shadow-sm:      0 1px 3px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow:         0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-md:      0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  --shadow-lg:      0 25px 50px -12px rgba(15, 23, 42, 0.12);
  --shadow-glow:    0 8px 30px var(--primary-glow);
  --shadow-inset:   inset 0 1px 0 rgba(255, 255, 255, 0.8);

  /* ── Gradients ── */
  --grad-primary:   linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --grad-primary-h: linear-gradient(135deg, #3730a3 0%, #0891b2 100%);
  --grad-gold:      linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-surface:   linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --grad-bg:        linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);

  /* ── Easing ── */
  --ease:           cubic-bezier(.4, 0, .2, 1);
  --ease-out:       cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*, *::before, *::after { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { font-family: 'Outfit', sans-serif; letter-spacing: -0.02em; font-weight: 700; line-height: 1.25; }
a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--primary-dark); }

::selection { background: rgba(99, 102, 241, 0.2); color: var(--text); }

/* Scrollbar */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius); border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; user-select: none; white-space: nowrap;
  text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease), border-color .2s var(--ease);
  position: relative; isolation: isolate;
}
.btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: rgba(255,255,255,.15); opacity: 0;
  transition: opacity .15s var(--ease); z-index: -1;
}
.btn:active { transform: translateY(1px); }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--grad-primary); color: #fff;
  box-shadow: var(--shadow-sm), 0 4px 14px var(--primary-glow), var(--shadow-inset);
}
.btn-primary:hover {
  background: var(--grad-primary-h);
  box-shadow: var(--shadow), 0 8px 22px var(--primary-glow);
}

.btn-gold {
  background: var(--grad-gold); color: #fff;
  box-shadow: var(--shadow-sm), 0 4px 14px rgba(217,119,6,.25), var(--shadow-inset);
}
.btn-gold:hover {
  box-shadow: var(--shadow), 0 8px 22px rgba(217,119,6,.35);
}

.btn-outline {
  background: var(--surface); color: var(--primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-ghost {
  background: transparent; color: var(--text-2);
}
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }

.btn-danger {
  background: var(--danger); color: #fff;
  box-shadow: var(--shadow-sm), 0 4px 14px rgba(239,68,68,.25);
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 16px 32px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  transition: box-shadow .25s var(--ease), border-color .2s var(--ease), transform .25s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); border-color: rgba(79, 70, 229, 0.2); }
.card-elevated { box-shadow: var(--shadow-md); }
.card-elevated:hover { box-shadow: var(--shadow-lg); }

/* ── FORMS ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 7px; color: var(--text-2); letter-spacing: -.005em;
}
.form-control {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: 500 14px/1.5 inherit;
  color: var(--text); background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.form-control::placeholder { color: var(--text-soft); }
.form-control:hover { border-color: #cbd5e1; }
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
  background: var(--surface);
}
.form-control:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.form-hint  { color: var(--text-soft); font-size: 12px; margin-top: 5px; }

/* ── NAVBAR (glassmorphism) ── */
.navbar {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  padding: 0 32px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.nav-brand {
  font-size: 18px; font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  letter-spacing: -.02em;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active {
  color: var(--primary); background: var(--primary-light);
  font-weight: 600;
}

/* ── SIDEBAR ── */
.layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 240px; background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 14px; flex-shrink: 0;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  color: var(--text-muted); text-decoration: none;
  margin-bottom: 5px;
  transition: all .25s var(--ease);
  position: relative;
}
.sidebar-link:hover {
  background: var(--bg);
  color: var(--text);
}
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.08), rgba(6, 182, 212, 0.04));
  color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.sidebar-link.active::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px;
  background: var(--grad-primary); border-radius: 0 4px 4px 0;
}
.sidebar-icon {
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.03);
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
}
.sidebar-link:hover .sidebar-icon {
  background: rgba(99, 102, 241, 0.08);
  transform: scale(1.1);
}
.sidebar-link.active .sidebar-icon {
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.1);
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }


/* ── MAIN ── */
.main { flex: 1; padding: 32px; overflow-y: auto; }

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.06), transparent 70%);
  border-radius: 50%; transform: translate(40%, -40%);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
  box-shadow: var(--shadow-inset);
}
.stat-value {
  font-size: 28px; font-weight: 800;
  letter-spacing: -.02em; color: var(--text);
  line-height: 1.1;
}
.stat-label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: .04em; margin-top: 4px;
}

/* ── TABLE ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th {
  background: var(--bg-soft);
  padding: 14px 18px; text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 16px 18px; font-size: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
}
tr:hover td { background: rgba(99,102,241,.025); }
tr:first-child td { border-top: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .02em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.12); color: #b45309; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-gold    {
  background: linear-gradient(135deg, rgba(251,191,36,.18), rgba(212,169,61,.15));
  color: #92400e;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 92%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: scale(.96) translateY(8px);
  transition: transform .25s var(--ease-out);
  border: 1px solid var(--border);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.modal-close {
  background: var(--bg); border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 18px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ── ALERTS ── */
.alert {
  padding: 14px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success {
  background: var(--success-bg); color: #065f46;
  border-color: rgba(16,185,129,.25);
}
.alert-danger {
  background: var(--danger-bg); color: #991b1b;
  border-color: rgba(239,68,68,.25);
}
.alert-info {
  background: var(--primary-light); color: var(--primary-dark);
  border-color: rgba(99,102,241,.25);
}

/* ── AUTH PAGES ── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(168,85,247,.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(99,102,241,.2) 0%, transparent 70%),
    linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  padding: 20px;
}
.auth-card {
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 {
  font-size: 28px; font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.02em;
}
.auth-logo p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.auth-tab {
  display: flex; border-radius: 10px;
  background: var(--bg); padding: 4px;
  margin-bottom: 28px;
}
.auth-tab button {
  flex: 1; padding: 10px;
  border: none; border-radius: 8px;
  font: 600 14px inherit; cursor: pointer;
  background: transparent; color: var(--text-muted);
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.auth-tab button.active {
  background: var(--surface); color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── CERTIFICATE CARDS ── */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.cert-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99,102,241,.3);
}
.cert-preview {
  height: 170px;
  background:
    linear-gradient(135deg, rgba(99,102,241,.15), rgba(168,85,247,.1)),
    linear-gradient(45deg, var(--bg-soft) 25%, transparent 25%, transparent 75%, var(--bg-soft) 75%, var(--bg-soft)) 0 0 / 16px 16px,
    linear-gradient(45deg, var(--bg-soft) 25%, transparent 25%, transparent 75%, var(--bg-soft) 75%, var(--bg-soft)) 8px 8px / 16px 16px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.cert-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.cert-card:hover .cert-preview img { transform: scale(1.05); }
.cert-body { padding: 18px; }
.cert-name {
  font-size: 15px; font-weight: 700;
  margin-bottom: 4px; color: var(--text);
  letter-spacing: -.01em;
}
.cert-meta { font-size: 13px; color: var(--text-muted); }
.cert-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.cert-actions .btn {
  padding: 6px 2px !important;
  font-size: 11px !important;
  font-weight: 700;
  border-radius: 8px;
  text-align: center;
  justify-content: center;
}
.cert-actions .btn-span-2 {
  grid-column: span 2;
}

/* ── PLAN CARDS ── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}
.plan-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center; position: relative;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.plan-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.plan-card.popular {
  border-color: var(--primary);
  background:
    linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 30%);
  box-shadow: var(--shadow), 0 0 0 1px rgba(99,102,241,.15);
}
.plan-badge {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--grad-primary); color: #fff;
  padding: 6px 16px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.plan-price {
  font-size: 40px; font-weight: 800;
  margin: 18px 0; letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.plan-price span {
  font-size: 15px; font-weight: 500;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
}
.plan-features {
  list-style: none; text-align: left;
  margin: 24px 0;
}
.plan-features li {
  padding: 8px 0; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text-2);
}
.plan-features li::before {
  content: '✓'; color: var(--success); font-weight: 800;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--success-bg); border-radius: 50%;
  font-size: 11px; flex-shrink: 0;
}

/* ── CONSTRUCTOR ── */
.constructor-layout { display: flex; height: calc(100vh - 64px); }
.constructor-sidebar {
  width: 320px; border-right: 1px solid var(--border);
  overflow-y: auto; padding: 20px; background: var(--surface);
}
.constructor-canvas {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg); overflow: auto;
}
.constructor-right {
  width: 280px; border-left: 1px solid var(--border);
  overflow-y: auto; padding: 20px; background: var(--surface);
}
.canvas-cert {
  position: relative; background: #fff;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
}
.canvas-text { position: absolute; cursor: move; user-select: none; }
.canvas-text:hover { outline: 2px dashed var(--primary); }
.canvas-text.selected { outline: 2px solid var(--primary); }

/* ── PAGINATION ── */
.pagination {
  display: flex; align-items: center; gap: 6px;
  justify-content: center; margin-top: 28px;
}
.page-btn {
  min-width: 38px; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
  font: 600 14px inherit; color: var(--text-2);
  transition: all .15s var(--ease);
  display: inline-flex; align-items: center; justify-content: center;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
  background: var(--grad-primary); color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ── LOADING ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

/* ── BOTTOM NAVIGATION (premium glass + center action) ── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid rgba(232,236,243,.7);
  box-shadow: 0 -8px 32px rgba(15,23,42,.06);
  height: 68px;
  padding: 0 6px;
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform .35s var(--ease-out);
}
.bottom-nav.bn-hidden {
  transform: translateY(calc(100% + env(safe-area-inset-bottom)));
}
.bottom-nav-inner {
  display: flex; align-items: stretch; height: 100%;
  max-width: 560px; margin: 0 auto;
}

/* Oddiy navigatsiya elementi */
.bn-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px; font-weight: 600;
  letter-spacing: .01em;
  border-radius: 14px; margin: 6px 2px;
  transition: color .25s var(--ease);
  position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.bn-item:hover { color: var(--text-2); }

/* Outline → Filled icon swap */
.bn-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s var(--ease-out), opacity .2s var(--ease);
}
.bn-icon svg { width: 24px; height: 24px; display: block; }
.bn-icon-filled { display: none; }
.bn-item.active { color: var(--primary); }
.bn-item.active .bn-icon-outline { display: none; }
.bn-item.active .bn-icon-filled  { display: flex; }
.bn-item.active .bn-icon {
  transform: translateY(-2px) scale(1.05);
}
.bn-label {
  transition: opacity .2s var(--ease), transform .25s var(--ease);
  font-size: 10px;
}
.bn-item.active .bn-label { font-weight: 700; }

/* Top indikator (faol element ustida) */
.bn-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--grad-primary);
  box-shadow: 0 2px 10px var(--primary-glow);
  animation: bnIndicator .35s var(--ease-out);
}
@keyframes bnIndicator {
  from { width: 0; opacity: 0; }
  to   { width: 32px; opacity: 1; }
}

/* MARKAZDAGI "+" ACTION TUGMASI (elevated FAB style) */
.bn-action {
  flex: 0 0 auto;
  width: 64px; margin: 0 6px;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 4px;
}
.bn-action-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px;
  box-shadow:
    0 6px 16px var(--primary-glow),
    0 2px 6px rgba(99,102,241,.25),
    var(--shadow-inset),
    0 0 0 4px var(--surface);
  transition: transform .25s var(--ease-out), box-shadow .2s var(--ease);
  position: relative;
}
.bn-action-btn svg { width: 26px; height: 26px; }
.bn-action:hover .bn-action-btn {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 12px 28px var(--primary-glow),
    0 4px 8px rgba(99,102,241,.3),
    var(--shadow-inset),
    0 0 0 4px var(--surface);
}
.bn-action:active .bn-action-btn { transform: scale(.92); }
.bn-action.active .bn-action-btn::after {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: .35;
  animation: bnActionRing 1.6s var(--ease-out) infinite;
}
@keyframes bnActionRing {
  0%   { transform: scale(1);    opacity: .35; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* Ripple */
.bn-ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--primary);
  opacity: .14;
  pointer-events: none;
  transform: scale(0);
  animation: bnRipple .6s var(--ease-out);
}
@keyframes bnRipple {
  to { transform: scale(1); opacity: 0; }
}

/* ── TOAST NOTIFICATIONS ── */
.toast-container {
  position: fixed; top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  width: calc(100% - 32px); max-width: 420px;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  font-size: 14px; font-weight: 500;
  color: var(--text);
  opacity: 0; transform: translateY(-12px) scale(.96);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
}
.toast.toast-in { opacity: 1; transform: translateY(0) scale(1); }
.toast.toast-out { opacity: 0; transform: translateY(-12px) scale(.96); }
.toast-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.toast-icon svg { width: 18px; height: 18px; }
.toast-body { flex: 1; line-height: 1.5; }
.toast-close {
  background: transparent; border: none; cursor: pointer;
  width: 24px; height: 24px; border-radius: 6px;
  font-size: 20px; line-height: 1; color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.toast-close:hover { background: var(--bg); color: var(--text); }
.toast-success { border-color: rgba(16,185,129,.3); }
.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-error   { border-color: rgba(239,68,68,.3); }
.toast-error   .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast-info    { border-color: rgba(99,102,241,.3); }
.toast-info    .toast-icon { background: var(--primary-light); color: var(--primary); }
.toast-warning { border-color: rgba(245,158,11,.3); }
.toast-warning .toast-icon { background: rgba(245,158,11,.12); color: var(--warning); }

/* ── PWA INSTALL BUTTON ── */
.pwa-install-btn {
  position: fixed; left: 16px; right: 16px; bottom: 92px;
  z-index: 180; margin: 0 auto;
  max-width: 360px;
  background: var(--grad-primary); color: #fff;
  border: none; border-radius: 14px;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  font: 600 14px inherit;
  cursor: pointer; text-align: left;
  box-shadow: 0 12px 32px var(--primary-glow), var(--shadow-inset);
  animation: pwaSlideUp .35s var(--ease-out);
}
.pwa-install-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.pwa-install-btn span { flex: 1; }
.pwa-install-close {
  background: rgba(255,255,255,.2); border: none;
  width: 28px; height: 28px; border-radius: 8px;
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pwa-install-close:hover { background: rgba(255,255,255,.3); }
@keyframes pwaSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (min-width: 769px) {
  .pwa-install-btn { left: auto; right: 24px; bottom: 24px; max-width: 320px; }
}

/* ── HELPERS ── */
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-gradient {
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.divider {
  height: 1px; background: var(--border);
  margin: 24px 0;
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg) 0%, var(--border) 50%, var(--bg) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 8px;
}
.fade-in { animation: fadeIn .4s var(--ease-out) both; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .sidebar { display: none; }
  .main { padding: 18px; padding-bottom: 92px; }
  .navbar { padding: 0 18px; }
  .navbar .nav-links { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .cert-grid { grid-template-columns: 1fr; }
  .constructor-sidebar, .constructor-right { display: none; }
  .card { padding: 22px; }
  .modal { padding: 28px 22px; }
}

@media (max-width: 640px) {
  /* Bottom sheet modal */
  .modal-overlay {
    align-items: flex-end;
  }
  .modal {
    width: 100%; max-width: 100%;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    padding: 24px 22px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
    max-height: 90vh; overflow-y: auto;
    position: relative;
  }
  .modal::before {
    content: '';
    position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 4px;
    background: var(--border-strong); border-radius: 2px;
  }
  .modal-header { margin-top: 12px; }
  .modal-overlay.open .modal { transform: translateY(0); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-value { font-size: 22px; }
  .stat-icon { width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }
  .stat-label { font-size: 11px; }
  .card { padding: 18px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }
  .plans-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 32px 24px; border-radius: var(--radius-lg); }
  .nav-brand { font-size: 16px; }
  .navbar { height: 56px; }
  .form-control { min-height: 44px; font-size: 16px; /* prevent iOS zoom */ }
  .toast { font-size: 13px; padding: 12px 14px; }
}

/* Mobile app shell refinements */
@media (max-width: 768px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body { background: var(--bg-soft); }

  .container {
    width: 100%;
    max-width: none;
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
  }

  .layout { display: block; min-height: auto; }
  .navbar {
    position: sticky; top: 0; z-index: 150;
    height: 58px; padding: 0 14px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 1px 0 rgba(15,23,42,.06);
  }
  .nav-brand {
    max-width: calc(100vw - 32px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .main {
    width: 100%;
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  h1 { font-size: 24px; line-height: 1.18; }
  h2 { font-size: 18px; line-height: 1.25; }
  p, li { overflow-wrap: anywhere; }

  .hero {
    padding: 36px 16px !important;
    text-align: left !important;
  }
  .hero h1 {
    font-size: 28px !important;
    line-height: 1.12;
  }
  .hero p {
    font-size: 15px !important;
  }
  .hero-btns {
    justify-content: stretch !important;
  }
  .hero-btns > *,
  .btn-white {
    width: 100%;
    text-align: center;
  }

  .templates-section {
    padding: 18px 14px calc(96px + env(safe-area-inset-bottom)) !important;
  }
  .tpl-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .tpl-card:hover {
    transform: none !important;
  }
  .tpl-thumb {
    height: auto !important;
    aspect-ratio: 4 / 3;
  }

  .drop-zone {
    padding: 28px 16px !important;
  }

  .card {
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
  }
  .card:hover,
  .cert-card:hover,
  .plan-card:hover,
  .stat-card:hover {
    transform: none;
  }

  .grid,
  .grid2,
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .filters,
  .page-head {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .filters .form-control,
  .filters input,
  .filters select,
  .filters button,
  .filter-search {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card {
    min-height: 94px;
    padding: 14px;
    gap: 10px;
    align-items: flex-start;
    border-radius: 8px;
  }
  .stat-card::after { display: none; }
  .stat-icon { width: 38px; height: 38px; border-radius: 8px; font-size: 18px; }
  .stat-value { font-size: 22px; line-height: 1.15; word-break: break-word; }
  .stat-label { font-size: 10px; line-height: 1.25; letter-spacing: .03em; }

  .cert-grid { grid-template-columns: 1fr; gap: 14px; }
  .cert-card { border-radius: 8px; }
  .cert-preview { height: auto; aspect-ratio: 4 / 3; }
  .cert-body { padding: 14px; }
  .cert-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .cert-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 9px 8px !important;
    font-size: 12px !important;
  }

  .table-wrap {
    max-width: 100%;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table { min-width: 680px; }
  th, td { padding: 12px 14px; }

  .form-control { min-height: 44px; }
  .btn {
    min-height: 42px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }
  .btn-sm { min-height: 38px; }

  .btn-row,
  .actions,
  .cert-actions {
    gap: 8px;
  }

  .pagination {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .page-btn { flex: 0 0 auto; min-width: 36px; height: 36px; }

  .bottom-nav {
    height: calc(72px + env(safe-area-inset-bottom));
    padding: 0 6px env(safe-area-inset-bottom);
    background: rgba(255,255,255,.95);
    box-shadow: 0 -10px 30px rgba(15,23,42,.08);
  }
  .bottom-nav-inner { width: 100%; max-width: 100%; }
  .bn-item { min-width: 0; border-radius: 8px; margin: 6px 1px; }
  .bn-icon { width: 24px; height: 24px; }
  .bn-icon svg { width: 23px; height: 23px; }
  .bn-label {
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
  }
  .bn-action { width: 58px; margin: 0 2px; padding-top: 3px; }
  .bn-action-btn {
    width: 52px; height: 52px;
    margin-top: -18px;
    box-shadow: 0 8px 20px var(--primary-glow), 0 0 0 4px var(--surface);
  }
  .bn-action-btn svg { width: 24px; height: 24px; }

  .pwa-install-btn {
    left: 12px; right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    border-radius: 8px;
  }
}

@media (max-width: 420px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .stats-grid { gap: 8px; }
  .stat-card { flex-direction: column; min-height: 118px; }
  .cert-actions { grid-template-columns: 1fr 1fr; }
  .bn-label { font-size: 9px; max-width: 48px; }

  .table-wrap table { min-width: 600px; }
  th, td { padding: 10px 12px; font-size: 13px; }
}
/* Shared extracted utility styles */
.doc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.doc-type-badge-certificate { background: #eef2ff; color: #4338ca; }
.doc-type-badge-diploma { background: #fef3c7; color: #92400e; }
.doc-type-badge-gratitude { background: #dcfce7; color: #15803d; }
.doc-type-badge-honor { background: #fee2e2; color: #991b1b; }
.doc-type-badge-commendation { background: #fef9c3; color: #854d0e; }
.sidebar-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 14px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.group-icon {
  font-size: 13px;
  opacity: 0.85;
}
.sidebar-group-label.spaced { padding-top: 20px; }
.sidebar-bottom-block {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.sidebar-admin-link,
.sidebar-admin-link svg,
.admin-nav-link {
  color: var(--primary);
}
.sidebar-admin-link,
.admin-nav-link {
  font-weight: 700;
}
.admin-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lang-selector-wrap,
.lang-switch-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 12px;
}
.lang-constructor-select,
.lang-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 28px 7px 10px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}
.lang-nav-select {
  background: rgba(255,255,255,0.06);
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-constructor-select {
  background: rgba(17, 23, 41, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 11px;
  padding: 6px 8px;
  cursor: pointer;
}
