/* ===== APPLEDLC — INK × JADE ===== */
:root {
  /* Backgrounds — slightly cooler than crimson era, still near-black */
  --bg:        #0c0708;
  --bg2:       #120a0c;
  --bg3:       #1a0e10;
  --surface:   #190a0e;
  --surface2:  #25101a;

  /* Borders */
  --border:    rgba(225,29,72,0.12);
  --border2:   rgba(225,29,72,0.22);

  /* Primary accent — deep jade / teal */
  --accent:       #e11d48;
  --accent2:      #f43f5e;
  --accent-light: #fb7185;
  --accent-glow:  rgba(225,29,72,0.4);
  --accent-glow2: rgba(225,29,72,0.15);

  /* Supporting colours */
  --red:    #ef4444;
  --green:  #10b981;
  --yellow: #f5b942;
  --cyan:   #fb7185;   /* soft mint */

  /* Text */
  --text:  #f6e8eb;
  --text2: #b08c92;
  --text3: #65454d;

  /* Misc */
  --font-head: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --radius:    8px;
  --radius-lg: 16px;
  --shadow:    0 8px 40px rgba(0,0,0,0.7);
  --shadow-accent: 0 0 40px var(--accent-glow);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-head);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Noise grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.45;
}

/* Scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #0a0506; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(225,29,72,.95), rgba(13,118,108,.95));
  border-radius: 999px;
  border: 3px solid #0a0506;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255,217,225,.95), rgba(16,150,140,.95));
}

/* Grid background */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(225,29,72,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225,29,72,0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14,6,8,0.88);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo span { color: var(--accent-light); }

/* Lotus emblem (svg-based) */
.nav-lotus {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--accent-light);
  filter: drop-shadow(0 0 8px rgba(255,217,225,0.45));
}
/* SVG-фигура лотоса занимает верх viewBox (y 7→50 в 64px-сетке) — опускаем на 2px,
   чтобы оптический центр совпадал с центром текста "AppleDLC". */
.nav-lotus svg { width: 100%; height: 100%; transform: translateY(2px); }

.logo-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

.nav-links { display: flex; align-items: center; gap: 8px; list-style: none; }
.nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links .btn-nav { background: var(--accent); color: white; border-radius: var(--radius); padding: 7px 18px; }
.nav-links .btn-nav:hover { background: var(--accent2); color: white; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn:hover::before { opacity: 1; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 22px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 32px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-danger  { background: #b91c1c; color: white; }
.btn-success { background: var(--green); color: #001b14; }
.btn-sm { padding: 7px 16px; font-size: 0.78rem; }
.btn-xs { padding: 5px 12px; font-size: 0.72rem; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover::before { opacity: 1; }
.card:hover { border-color: var(--border2); }

.card-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 0.85rem;
  transition: all 0.2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(225,29,72,0.18);
}
.form-control::placeholder { color: var(--text3); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5b56' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-active  { background: rgba(16,185,129,0.12);  color: var(--green); border: 1px solid rgba(16,185,129,0.25); }
.badge-expired { background: rgba(239,68,68,0.12);   color: var(--red);   border: 1px solid rgba(239,68,68,0.3); }
.badge-admin   { background: rgba(225,29,72,0.18);  color: var(--accent-light); border: 1px solid rgba(225,29,72,0.4); }
.badge-user    { background: rgba(138,163,156,0.1);  color: var(--text2); border: 1px solid var(--border); }

/* ===== FLASH MESSAGES ===== */
.flash-container {
  position: fixed;
  top: 80px; right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.flash {
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  backdrop-filter: blur(20px);
  animation: flash-in 0.3s ease;
  cursor: pointer;
}
@keyframes flash-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.flash-success { background: rgba(16,185,129,0.08);  border-color: rgba(16,185,129,0.25); color: var(--green); }
.flash-danger  { background: rgba(239,68,68,0.1);    border-color: rgba(239,68,68,0.3);   color: var(--red); }
.flash-info    { background: rgba(255,217,225,0.08);  border-color: rgba(255,217,225,0.25); color: var(--accent-light); }
.flash-warning { background: rgba(245,185,66,0.08);  border-color: rgba(245,185,66,0.2);  color: var(--yellow); }

/* ===== TABLE ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
tbody td {
  padding: 13px 16px;
  font-size: 0.85rem;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { background: var(--surface); transition: background 0.15s; }
tbody tr:hover { background: var(--surface2); }
.mono { font-family: var(--font-mono); font-size: 0.8rem; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  justify-content: center;
}
.page-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
}
.page-btn:hover, .page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===== SIDEBAR ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 64px;
}
.sidebar {
  width: 240px;
  min-height: calc(100vh - 64px);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 64px;
  align-self: flex-start;
  flex-shrink: 0;
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 12px;
  margin-bottom: 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 600;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--surface); color: var(--text); }
.sidebar-link.active {
  background: rgba(225,29,72,0.12);
  color: var(--accent-light);
  border: 1px solid rgba(225,29,72,0.22);
}
.sidebar-link svg { width: 16px; height: 16px; opacity: 0.8; flex-shrink: 0; }

.main-content { flex: 1; padding: 40px; max-width: 1200px; min-width: 0; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 36px; }
.page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.page-subtitle { color: var(--text3); font-size: 0.88rem; margin-top: 8px; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}
.auth-glow {
  position: fixed;
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(225,29,72,0.14) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg,#1a0e10 0%,#0c0708 100%);
  border: 1px solid rgba(244,63,94,.22);
  border-radius: var(--radius-lg);
  padding: 40px;
  position: relative;
  z-index: 1;
  box-shadow:0 28px 70px -24px rgba(225,29,72,.45), 0 0 0 1px rgba(244,63,94,.05) inset;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 40px; right: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #fb7185, transparent);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .brand { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.auth-logo .brand span { color: #fb7185; }
.auth-logo .lotus { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--accent-light); filter: drop-shadow(0 0 12px rgba(255,217,225,0.5)); }
.auth-logo .lotus svg { width: 100%; height: 100%; }
.auth-title { font-size: 1.4rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.auth-subtitle { font-size: 0.85rem; color: var(--text3); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.83rem; color: var(--text3); }
.auth-footer a { color: var(--accent-light); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { color: var(--accent2); }

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ===== COPY INPUT ===== */
.copy-wrap { display: flex; gap: 8px; align-items: stretch; }
.copy-wrap .form-control { flex: 1; }

/* ===== SUB STATUS ===== */
.sub-status {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
}
.sub-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.sub-icon.active  { background: rgba(16,185,129,0.12); }
.sub-icon.expired { background: rgba(239,68,68,0.12); }
.sub-info { flex: 1; }
.sub-label { font-size: 0.72rem; color: var(--text3); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sub-value { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-top: 2px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { padding: 24px; }
  .navbar { padding: 0 20px; }
}
@media (max-width: 600px) {
  .auth-card { padding: 28px 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== UTILITY ===== */
.text-accent  { color: var(--accent-light); }
.text-muted   { color: var(--text3); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-mono    { font-family: var(--font-mono); }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.flex  { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
