/* ============================================================================
   JADI.PARTY dashboard — premium dark UI
   ========================================================================== */
:root {
  /* surfaces — navy family matched to the BintoroSoftID logo (#0a1629) */
  --bg: #070e1a;
  --bg-2: #0a1629;
  --panel: #0d1b2e;
  --panel-2: #122339;
  --surface-hover: #172b42;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  /* text */
  --text: #e9eef5;
  --muted: #94a3b8;
  --faint: #647488;

  /* brand — emerald green sampled from the logo */
  --primary: #1cc665;
  --primary-2: #0fa552;
  --primary-bright: #4ce75e;
  --primary-soft: rgba(28, 198, 101, 0.15);

  /* status */
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; cursor: pointer; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; }
::selection { background: rgba(28, 198, 101, 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2f3d; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4154; background-clip: padding-box; }

svg.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Login ============================================================== */
.login-screen {
  position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; overflow: hidden;
}
.login-aurora {
  position: absolute; inset: -30%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 38% at 22% 18%, rgba(28, 198, 101, 0.30), transparent 70%),
    radial-gradient(34% 34% at 82% 26%, rgba(76, 231, 94, 0.20), transparent 70%),
    radial-gradient(40% 40% at 60% 92%, rgba(15, 165, 82, 0.18), transparent 70%);
  filter: blur(20px);
}
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  background: linear-gradient(180deg, rgba(28, 31, 44, 0.85), rgba(18, 20, 28, 0.9));
  border: 1px solid var(--border-strong); border-radius: 22px; padding: 36px 32px;
  box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.login-brand { display: flex; align-items: center; gap: 13px; }
.logo-mark, .brand-mark { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 8px rgba(28, 198, 101, 0.5)); }
.login-logo-img { width: 54px; height: 54px; border-radius: 15px; display: block; box-shadow: 0 8px 22px -6px rgba(28, 198, 101, 0.45); }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; display: block; }
.logo-text { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.logo-text span, .brand-text span { background: linear-gradient(90deg, var(--primary-bright), var(--primary)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-sub { color: var(--muted); margin: 14px 0 22px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label, .form-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
.login-foot { text-align: center; color: var(--faint); font-size: 11px; margin-top: 18px; }

/* ===== Inputs / buttons =================================================== */
input, select, textarea {
  width: 100%; background: rgba(10, 11, 16, 0.6); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px; outline: none; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: rgba(10, 11, 16, 0.9); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa3b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }

.btn {
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  padding: 9px 15px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: transform 0.12s, filter 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-bright), var(--primary-2)); border-color: transparent; color: #04231a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 8px 20px -8px rgba(28, 198, 101, 0.7);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--primary-bright), var(--primary-2)); }
.btn-danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fda4a4; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; justify-content: center; margin-top: 8px; padding: 12px; }

.form-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== App shell ========================================================== */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-text { font-size: 18px; font-weight: 800; letter-spacing: -0.4px; }
.brand-mark { font-size: 20px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  color: var(--muted); font-weight: 500; position: relative; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--primary-soft), rgba(28, 198, 101, 0.02)); color: #fff;
}
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--primary), var(--primary-2));
}
.nav-item.active .ic { color: var(--primary-2); }

.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }
.who-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.who { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 30px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
  background: rgba(7, 14, 26, 0.78); backdrop-filter: blur(12px);
}
.topbar-title { min-width: 0; }
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text); cursor: pointer; flex-shrink: 0; }
.menu-btn:hover { background: var(--surface-hover); }
.menu-btn .ic { width: 20px; height: 20px; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(3, 7, 14, 0.6); backdrop-filter: blur(2px); z-index: 55; animation: fadein 0.2s ease; }
.view { padding: 26px 30px; animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Stat cards ========================================================= */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; }
.stat-icon .ic { width: 20px; height: 20px; }
.stat-meta { min-width: 0; }
.stat-card .value { font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -0.5px; }
.stat-card .label { color: var(--muted); font-size: 12px; margin-top: 5px; }
.tone-accent { background: var(--primary-soft); color: var(--primary-2); }
.tone-green  { background: rgba(52, 211, 153, 0.14); color: var(--green); }
.tone-blue   { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.tone-amber  { background: rgba(251, 191, 36, 0.14); color: var(--amber); }
.tone-red    { background: rgba(248, 113, 113, 0.14); color: var(--red); }

/* ===== Panels ============================================================= */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; }
.chart-wrap { height: 190px; }
canvas { width: 100%; height: 100%; display: block; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 46px; color: var(--faint); }

/* ===== Responsive / mobile ================================================ */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  /* Sidebar becomes a slide-in drawer toggled by the hamburger button. */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 272px; z-index: 60;
    transform: translateX(-100%); transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: none; }
  .nav-item.active::before { left: -14px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .view { padding: 20px 16px; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 17px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; margin-bottom: 18px; }
  .stat-card { padding: 14px; gap: 11px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-card .value { font-size: 22px; }
  .panel { padding: 16px; }
  .toolbar .grow { min-width: 140px; }
}

@media (max-width: 600px) {
  /* Action buttons drop to their own full-width row so they stay tappable. */
  .topbar { flex-wrap: wrap; }
  .topbar-actions { width: 100%; justify-content: stretch; }
  .topbar-actions .btn { flex: 1; justify-content: center; }
  .page-sub { display: none; }
  th, td { padding: 11px 13px; }
  .modal-body { padding: 18px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ===== Toolbar / tables =================================================== */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar input, .toolbar select { width: auto; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; background: var(--bg-2); position: sticky; top: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
td code { background: rgba(10, 11, 16, 0.7); padding: 3px 8px; border-radius: 7px; border: 1px solid var(--border); font-size: 12px; }
.row-actions { display: flex; gap: 6px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: capitalize; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.unused { background: rgba(96, 165, 250, 0.12); color: var(--blue); border-color: rgba(96, 165, 250, 0.25); }
.badge.active { background: rgba(52, 211, 153, 0.12); color: var(--green); border-color: rgba(52, 211, 153, 0.25); }
.badge.suspended { background: rgba(251, 191, 36, 0.12); color: var(--amber); border-color: rgba(251, 191, 36, 0.25); }
.badge.revoked, .badge.expired { background: rgba(248, 113, 113, 0.12); color: var(--red); border-color: rgba(248, 113, 113, 0.25); }
.badge.trial { background: rgba(96, 165, 250, 0.12); color: var(--blue); border-color: rgba(96, 165, 250, 0.25); }
.badge.lifetime { background: var(--primary-soft); color: #86efac; border-color: rgba(28, 198, 101, 0.3); }
.badge.monthly, .badge.yearly { background: rgba(255, 255, 255, 0.05); color: var(--muted); border-color: var(--border); }
.badge.monthly::before, .badge.yearly::before { background: var(--faint); }

.pagination { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 16px; color: var(--muted); font-size: 12.5px; }

/* ===== Modal ============================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 6, 10, 0.65); display: grid; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(4px); animation: fadein 0.15s ease; }
.modal { width: 100%; max-width: 540px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; animation: pop 0.18s ease; }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; width: 30px; height: 30px; border-radius: 8px; transition: background 0.15s, color 0.15s; }
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ===== Toasts ============================================================= */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { background: var(--panel-2); border: 1px solid var(--border-strong); border-left: 3px solid var(--primary); padding: 13px 17px; border-radius: 12px; box-shadow: var(--shadow); max-width: 360px; font-size: 13px; animation: slidein 0.22s ease; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes slidein { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Misc =============================================================== */
.key-reveal { background: rgba(10, 11, 16, 0.7); border: 1px dashed var(--primary); border-radius: 12px; padding: 16px; font-family: 'JetBrains Mono', monospace; font-size: 15px; letter-spacing: 1px; text-align: center; color: #fff; word-break: break-all; margin: 12px 0; }
.bulk-keys { max-height: 250px; overflow: auto; background: rgba(10, 11, 16, 0.7); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
