/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --border:    #2a2a2a;
  --accent:    #e8e8e8;
  --muted:     #666;
  --danger:    #c0392b;
  --success:   #27ae60;
  --text:      #d4d4d4;
  --radius:    6px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.card .subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.2rem; }

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
}

.field input:focus,
.field select:focus { border-color: #555; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { opacity: 0.85; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--border); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-full { width: 100%; }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  margin-top: 1rem;
  display: block;
  text-align: center;
}
.btn-link:hover { color: var(--accent); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: #2a1515; border: 1px solid #5a2020; color: #e07070; }
.alert-success { background: #142a1e; border: 1px solid #1e5a3a; color: #60c080; }

/* ── Dashboard layout ────────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar .logo {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.main-content {
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
  height: calc(100vh - 56px);
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  background: var(--surface);
}

.sidebar h3 {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

.sidebar-item {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}
.sidebar-item:hover   { background: var(--border); }
.sidebar-item.active  { background: var(--border); color: var(--accent); }

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #1f1f1f;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #1f1f1f; }

.data-table .actions { display: flex; gap: 0.5rem; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 500;
}
.badge-neutral { background: #2a2a2a; color: var(--muted); }
.badge-active  { background: #142a1e; color: #60c080; }
.badge-expired { background: #2a1515; color: #e07070; }

/* ── Upload drop zone ────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  margin-bottom: 1.5rem;
}
.drop-zone.dragover {
  border-color: #666;
  background: #1f1f1f;
  color: var(--accent);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
  display: none;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem;
}
.modal-close:hover { color: var(--accent); }

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ── File picker list ────────────────────────────────────────────────────── */
.file-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0.4rem;
}

.file-picker label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #1f1f1f;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.file-picker label:last-child { border-bottom: none; }
.file-picker label:hover { background: #1f1f1f; }
.file-picker input[type=checkbox] { accent-color: var(--accent); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.upload-progress {
  margin-top: 1rem;
  display: none;
}
.upload-progress.show { display: block; }
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s;
}

/* ── Download page ───────────────────────────────────────────────────────── */
.file-list { list-style: none; margin: 1.5rem 0; }

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.file-list li:last-child { border-bottom: none; }

.file-list .fname {
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-all;
}
.file-list .fsize {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm      { font-size: 0.82rem; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.flex  { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
