@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg: #05050a;
  --sidebar: #0c0c14;
  --card: #12121b;
  --border: rgba(255,255,255,.08);
  --accent: #38bdf8;
  --text: #e2e8f0;
  --muted: #64748b;
  --gradient: linear-gradient(135deg, #2596be, #38bdf8);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  text-decoration: none;
  margin-bottom: 2rem;
  display: block;
}

.sidebar-logo {
  width: 2.5rem;
  height: auto;
  display: block;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: .25rem;
  transition: background .2s, color .2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(56,189,248,.1);
  color: var(--accent);
}

.sidebar-nav a i { font-size: 1.1rem; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .7rem 1rem;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 10px;
  color: #fca5a5;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}

.main-content {
  padding: 2rem;
  overflow-y: auto;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: .25rem;
}

.page-sub {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 2rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}

.dash-card h3 {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.dash-card h3 i { color: var(--accent); }

.dash-card .value {
  font-size: 1.1rem;
  font-weight: 600;
  word-break: break-all;
}

.dash-card .value.mono {
  font-family: monospace;
  font-size: 1rem;
  color: #4ade80;
  letter-spacing: .05em;
}

.key-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}

.key-status.active {
  background: rgba(34,197,94,.15);
  color: #4ade80;
}

.key-status.inactive {
  background: rgba(239,68,68,.1);
  color: #fca5a5;
}

.loader-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
}

.loader-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56,189,248,.1);
  border: 1px solid rgba(56,189,248,.2);
  border-radius: 16px;
  font-size: 2rem;
  color: var(--accent);
}

.loader-card h3 {
  font-size: 1.2rem;
  margin-bottom: .5rem;
}

.loader-card p {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 2rem;
  background: var(--gradient);
  color: #0f172a;
  font-weight: 700;
  font-size: .95rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow .2s;
}

.btn-download:hover {
  box-shadow: 0 0 30px rgba(56,189,248,.35);
}

.btn-download:disabled,
.btn-download.disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th,
.orders-table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}

.orders-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
}

.hidden { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  position: relative;
}

.auth-back {
  position: absolute;
  top: 1.5rem;
  left: 2rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.auth-back:hover { color: var(--accent); }

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
}

.auth-brand-logo {
  display: block;
  width: 5rem;
  height: auto;
  margin: 0 auto .5rem;
  filter: drop-shadow(0 0 20px rgba(56,189,248,.35));
}

.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
}

.auth-tab {
  flex: 1;
  padding: .65rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--gradient);
  color: #0f172a;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .4rem;
  font-weight: 500;
}

.auth-field input {
  width: 100%;
  padding: .8rem 1rem;
  background: #0a0a12;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
}

.auth-field input:focus {
  border-color: rgba(56,189,248,.4);
}

.auth-btn {
  width: 100%;
  padding: .9rem;
  margin-top: .5rem;
  border: none;
  border-radius: 10px;
  background: var(--gradient);
  color: #0f172a;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-btn:disabled { opacity: .6; cursor: wait; }

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .85rem;
  color: var(--muted);
}

.auth-footer a { color: var(--accent); text-decoration: none; }

.auth-alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 1rem;
  text-align: center;
}

.auth-alert-error {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
}

.auth-alert-success {
  background: rgba(34,197,94,.15);
  border: 1px solid rgba(34,197,94,.3);
  color: #86efac;
}

.dash-card-key .btn-copy-key {
  margin-top: .75rem;
  padding: .5rem 1rem;
  background: rgba(56,189,248,.1);
  border: 1px solid rgba(56,189,248,.25);
  border-radius: 8px;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}

.loader-hint {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 1rem;
}

.orders-card { margin-top: 2rem; }

.table-wrap { overflow-x: auto; }

.empty-row {
  color: var(--muted) !important;
  text-align: center;
  padding: 1.5rem !important;
}

.key-cell {
  font-family: monospace;
  color: #4ade80 !important;
  font-size: .8rem;
}

.key-status a { color: var(--accent); }

@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
}
