/* hostedit.cloud — design system */

/* ── 1. Reset & base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ── 2. CSS Variables ────────────────────────────── */
:root {
  --bg: #09090f;
  --surface: #101019;
  --surface-2: #17172a;
  --surface-3: #1e1e35;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --accent: #6366f1;
  --accent-muted: rgba(99,102,241,0.12);
  --accent-hover: #818cf8;
  --accent-glow: rgba(99,102,241,0.25);
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #4b5563;
  --green: #22c55e;
  --green-muted: rgba(34,197,94,0.12);
  --red: #f43f5e;
  --red-muted: rgba(244,63,94,0.12);
  --yellow: #fbbf24;
  --yellow-muted: rgba(251,191,36,0.12);
  --orange: #fb923c;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
  --sidebar-w: 240px;
  --transition: 0.18s ease;
}

/* ── 3. Typography ───────────────────────────────── */
h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.875rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.375rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }
p { color: var(--text-2); }
.gradient-text {
  background: linear-gradient(135deg, #818cf8, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── 4. Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
}
.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger {
  background: var(--red-muted);
  color: var(--red);
  border: 1px solid rgba(244,63,94,0.2);
}
.btn-danger:hover { background: rgba(244,63,94,0.2); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; font-weight: 600; }
.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
  justify-content: center;
  border-radius: 8px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── 5. Form Inputs ──────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
}
.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.input::placeholder { color: var(--text-3); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 40px; }
.input-icon-wrap .input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 0.85rem;
}

/* ── 6. Cards ────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-sm { padding: 16px; border-radius: var(--radius); }
.card:hover { border-color: var(--border-hover); }

/* ── 7. Badges ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-gray { background: rgba(255,255,255,0.07); color: var(--text-2); }
.badge-green { background: var(--green-muted); color: var(--green); }
.badge-red { background: var(--red-muted); color: var(--red); }
.badge-yellow { background: var(--yellow-muted); color: var(--yellow); }
.badge-accent { background: var(--accent-muted); color: var(--accent-hover); }

/* ── 8. App layout (sidebar + main) ─────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── 9. Sidebar ──────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img {
  height: 38px !important;
  width: auto;
  display: block;
}
.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-logo-name { font-weight: 700; font-size: 0.95rem; }
.sidebar-logo-tld { color: var(--accent-hover); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 10px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); background: var(--accent-muted); }
.nav-link.active i { color: var(--accent-hover); }
.nav-link i { width: 16px; text-align: center; font-size: 0.85rem; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-hover);
  flex-shrink: 0;
}
.sidebar-user-text { flex: 1; min-width: 0; }
.sidebar-username { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-email { font-size: 0.72rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-plan { display: none; }
.sidebar-storage-wrap { padding: 4px 12px 8px; }
.sidebar-storage-label { font-size: 0.72rem; color: var(--text-3); margin-bottom: 4px; }
.sidebar-storage-bar { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.sidebar-storage-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.5s ease; }
.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-3);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
}
.logout-btn:hover { color: var(--red); background: var(--red-muted); }

/* ── Notification panel ── */
.notif-item { padding:9px 10px; border:1px solid var(--border); border-radius:8px; cursor:default; transition:background 0.15s; }
.notif-unread { background:var(--accent-muted); border-color:rgba(99,102,241,0.22); cursor:pointer; }
.notif-unread:hover { background:rgba(99,102,241,0.18); }
.notif-subject { font-size:0.82rem; font-weight:600; color:var(--text); }
.notif-body { font-size:0.78rem; color:var(--text-2); margin-top:3px; line-height:1.45; white-space:pre-wrap; word-break:break-word; }
.notif-time { font-size:0.72rem; color:var(--text-3); margin-top:5px; }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 38px;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── 10. Main content area ───────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 2px; }
.page-subtitle { font-size: 0.875rem; color: var(--text-2); }
.page-body { padding: 28px 32px; flex: 1; }

/* ── 11. Stats grid ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  margin-bottom: 4px;
}
.stat-icon-accent { background: var(--accent-muted); color: var(--accent-hover); }
.stat-icon-green { background: var(--green-muted); color: var(--green); }
.stat-icon-yellow { background: var(--yellow-muted); color: var(--yellow); }
.stat-icon-red { background: var(--red-muted); color: var(--red); }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-2); font-weight: 500; }

/* ── 12. Upload zone ─────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.upload-zone-icon {
  font-size: 2rem;
  color: var(--text-3);
  margin-bottom: 12px;
  transition: color var(--transition);
}
.upload-zone:hover .upload-zone-icon, .upload-zone.drag-over .upload-zone-icon {
  color: var(--accent-hover);
}
.upload-zone-title { font-weight: 600; margin-bottom: 4px; }
.upload-zone-sub { font-size: 0.85rem; color: var(--text-3); }

/* ── 13. Upload queue ────────────────────────────── */
.upload-queue { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.upload-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.upload-item-icon { font-size: 1.1rem; flex-shrink: 0; }
.upload-item-info { flex: 1; min-width: 0; }
.upload-item-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item-meta { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.upload-item-bar { height: 3px; background: var(--surface-3); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.upload-item-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.2s ease; }
.upload-item-fill.done { background: var(--green); }
.upload-item-fill.error { background: var(--red); }
.upload-item-status { font-size: 0.75rem; flex-shrink: 0; }

/* ── 14. Files table ─────────────────────────────── */
.files-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap .input { padding-left: 36px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 0.8rem; }
.select {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.select:focus { border-color: var(--accent); }

.custom-select {
  position: relative;
  min-width: 170px;
}
.custom-select-btn {
  min-height: 42px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color var(--transition), background var(--transition);
}
.custom-select-btn:hover,
.custom-select.open .custom-select-btn {
  border-color: var(--border-hover);
  background: var(--surface-3);
}
.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.custom-select.open .custom-select-menu { display: block; }
.custom-option {
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 0.84rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.custom-option:hover,
.custom-option.active {
  color: var(--text);
  background: var(--accent-muted);
}
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.segmented-btn {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.segmented-btn:hover,
.segmented-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-muted);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.setting-copy { min-width: 0; }
.setting-title { font-size: 0.86rem; font-weight: 600; }
.setting-sub { font-size: 0.76rem; color: var(--text-3); margin-top: 2px; }
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-hover);
  transition: all var(--transition);
}
.toggle::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 2px;
  left: 3px;
  border-radius: 50%;
  background: var(--text-2);
  transition: all var(--transition);
}
.toggle.active {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle.active::after {
  left: 21px;
  background: #fff;
}

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface-2); }

.file-name-cell { display: flex; align-items: center; gap: 10px; }
.file-icon { font-size: 1.1rem; flex-shrink: 0; }
.file-name-text { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.file-actions { display: flex; align-items: center; gap: 4px; }

/* ── 15. Modals ──────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.9rem;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── 16. Storage bar ─────────────────────────────── */
.storage-bar-wrap { margin-bottom: 8px; }
.storage-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 6px;
}
.storage-bar-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.storage-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease, background 0.3s ease;
}

/* ── 17. Plan cards ──────────────────────────────── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition);
  position: relative;
}
.plan-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow); }
.plan-card.current { border-color: var(--accent); }
.plan-card.popular {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(99,102,241,0.08), var(--surface));
}
.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.plan-name { font-size: 1rem; font-weight: 700; }
.plan-price { font-size: 2rem; font-weight: 800; line-height: 1; }
.plan-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-2); }
.plan-storage { font-size: 0.85rem; color: var(--text-2); }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.plan-features li { font-size: 0.82rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.plan-features li i { color: var(--green); font-size: 0.75rem; }

/* ── 18. Toasts ──────────────────────────────────── */
#toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  font-weight: 500;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  max-width: 340px;
}
.toast.show { transform: translateX(0); }
.toast-success { border-left: 3px solid var(--green); }
.toast-success i { color: var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-error i { color: var(--red); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-info i { color: var(--accent-hover); }

/* ── 19. Copy-link input ─────────────────────────── */
.copy-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copy-wrap .input { flex: 1; font-size: 0.8rem; color: var(--text-2); }
.copy-btn { flex-shrink: 0; }

/* ── 20. Empty state ─────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}
.empty-icon {
  width: 64px;
  height: 64px;
  background: var(--surface-2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-3);
  margin-bottom: 4px;
}
.empty-title { font-weight: 600; font-size: 1.1rem; }
.empty-sub { font-size: 0.875rem; color: var(--text-3); max-width: 300px; }

/* ── 21. Animations ──────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}
@keyframes float2 {
  0%, 100% { transform: translateY(-6px) rotate(-2deg); }
  50% { transform: translateY(6px) rotate(2deg); }
}
.spin { animation: spin 1s linear infinite; }
.fade-in { animation: fadeIn 0.3s ease; }

/* ── 22. Loading skeleton ────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 23. Section divider ─────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-3);
  font-size: 0.8rem;
  margin: 8px 0;
}
.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── 24. Utilities ───────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-2); }
.text-dim { color: var(--text-3); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 25. Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .page-header { padding: 20px 20px 16px; padding-left: 64px; }
  .page-body { padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.75rem; }
  .plans-grid { grid-template-columns: 1fr; }
  .files-controls { flex-direction: column; align-items: stretch; }
  .modal { padding: 20px; }
  .btn-lg { padding: 12px 20px; font-size: 0.95rem; }
  .plan-card-row { flex-direction: column; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table-wrap { font-size: 0.8rem; }
  th, td { padding: 10px 12px; }
  .modal-backdrop { padding: 12px; }
  .modal { padding: 18px; max-width: 100%; }
  .copy-wrap { flex-direction: column; }
  .stat-value { font-size: 1.4rem; }
  .page-title { font-size: 1.25rem; }
}

/* ── 26. Auth pages responsive ───────────────────────── */
@media (max-width: 480px) {
  .auth-card { max-width: 100%; }
  .card { padding: 24px 20px; }
}

/* 27. Device compatibility polish */
html, body { max-width: 100%; overflow-x: hidden; }
input, select, textarea, button { max-width: 100%; }
.main-content, .page-body, .page-header, .card, .section-card, .panel, .modal, .checkout-modal { min-width: 0; }
.table-wrap, .users-table-wrap { -webkit-overflow-scrolling: touch; }
.file-actions, .action-row, .modal-footer, .files-controls, .copy-wrap { min-width: 0; }
/* Mobile elements — hidden by default, shown via media queries */
.mobile-appbar { display: none; }
.mobile-hamburger { display: none; }

/* ── App-page mobile (≤640px): sidebar becomes a drawer ─── */
@media (max-width: 640px) {
  body.app-page {
    background:
      radial-gradient(circle at 25% -10%, rgba(99,102,241,0.2), transparent 34%),
      radial-gradient(circle at 100% 20%, rgba(20,184,166,0.11), transparent 34%),
      var(--bg);
  }

  /* Sidebar slides in from the left as a drawer */
  .app-page .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: min(82vw, 280px);
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  .app-page .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 48px rgba(0,0,0,0.65);
  }
  .app-page .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 299;
  }
  .app-page .sidebar-overlay.open { display: block; }
  .app-page .sidebar-toggle { display: none !important; }

  .app-page .main-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
  }

  /* Top appbar */
  .app-page .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    padding: 10px 14px;
    background: rgba(8,8,15,0.92);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(20px);
  }
  .app-page .mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-2);
    flex-shrink: 0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.18s;
  }
  .app-page .mobile-hamburger:hover { color: var(--text); background: rgba(255,255,255,0.1); }
  .app-page .mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.92rem;
  }
  .app-page .mobile-brand img { width: 34px; height: 34px; object-fit: contain; }
  .app-page .mobile-app-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .app-page .mobile-action {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.9rem;
  }
  .app-page .mobile-action:active { background: rgba(255,255,255,0.1); }

  /* Page content */
  .app-page .page-header { padding: 18px 16px 12px; border-bottom: 0; }
  .app-page .page-title { font-size: clamp(1.35rem, 7vw, 1.75rem); line-height: 1.12; }
  .app-page .page-body { padding: 12px 14px 28px; }
  .app-page .card,
  .app-page .section-card,
  .app-page .current-plan-card,
  .app-page .pc,
  .app-page .upload-zone,
  .app-page .table-wrap {
    background: rgba(255,255,255,0.045);
    border-radius: 16px;
  }
}

@media (max-width: 1024px) {
  .stats-grid,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .plan-grid,
  .plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-body {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  body {
    min-width: 0;
  }
  .sidebar {
    width: min(86vw, 300px);
  }
  .sidebar-logo {
    min-height: 64px;
  }
  .page-header {
    padding: 18px 16px 14px;
    padding-left: 64px;
  }
  .page-body {
    padding: 18px 16px 28px;
  }
  .page-title {
    font-size: 1.35rem;
    line-height: 1.25;
  }
  .page-subtitle {
    font-size: 0.82rem;
  }
  .card,
  .section-card,
  .panel,
  .current-plan-card,
  .plan-card,
  .pc,
  .stat-card {
    border-radius: 12px;
  }
  .section-card,
  .panel,
  .current-plan-card {
    padding: 20px;
  }
  .upload-zone {
    padding: 30px 16px;
  }
  .upload-section-header,
  .modal-header,
  .storage-bar-label,
  .dl-usage,
  .section-row,
  .welcome-row {
    gap: 10px;
  }
  .files-controls {
    display: grid;
    grid-template-columns: 1fr;
  }
  .search-wrap {
    min-width: 0;
    width: 100%;
  }
  .select,
  .input,
  .btn {
    min-height: 42px;
  }
  .btn {
    justify-content: center;
  }
  .table-wrap table,
  .users-table-wrap table {
    min-width: 720px;
  }
  .modal-backdrop,
  .checkout-modal-backdrop,
  .ip-modal-backdrop {
    align-items: flex-end;
    padding: 12px;
  }
  .modal,
  .checkout-modal,
  .ip-modal {
    max-width: 100%;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    border-radius: 14px;
  }
  .modal-footer {
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 140px;
  }
  #toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    width: 100%;
    max-width: none;
  }
  .layout {
    min-width: 0;
  }
  .topbar {
    padding: 14px 16px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .hamburger {
    display: inline-flex;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.35rem; }
  .stats-grid,
  .stat-grid,
  .plan-grid,
  .plans-grid {
    grid-template-columns: 1fr;
  }
  .card,
  .section-card,
  .panel,
  .current-plan-card,
  .plan-card,
  .pc {
    padding: 18px;
  }
  .file-name-text {
    max-width: 180px;
  }
  .upload-item,
  .qi {
    align-items: flex-start;
  }
  .qi-pct,
  .upload-item-status {
    min-width: auto;
  }
  .copy-wrap,
  .search-row,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .copy-btn,
  .action-row .btn,
  .action-row .btn-xs {
    width: 100%;
  }
  .ip-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 640px) {
  body.app-page .page-header {
    padding: 18px 16px 12px !important;
    border-bottom: 0 !important;
  }
  body.app-page .page-body {
    padding: 12px 14px 28px !important;
  }
  body.app-page .stats-grid,
  body.app-page .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
