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

/* Dark mode (default) */
:root, [data-theme="dark"] {
  --bg:           #0f1117;
  --surface:      #1a1d27;
  --border:       #2a2d3e;
  --accent:       #4f8ef7;
  --accent-h:     #3a7ae0;
  --danger:       #e05555;
  --success:      #3db87a;
  --warn:         #e0a050;
  --text:         #e8eaf0;
  --muted:        #8890a8;
  --radius:       10px;
  --alert-ok-bg:  #1a3329;
  --alert-err-bg: #321a1a;
  --alert-inf-bg: #1a2540;
}

/* Light mode */
[data-theme="light"] {
  --bg:           #f0f2f8;
  --surface:      #ffffff;
  --border:       #d4d8ea;
  --accent:       #2f6de0;
  --accent-h:     #1f58c4;
  --danger:       #cc3333;
  --success:      #2a9a5e;
  --warn:         #b86e10;
  --text:         #1a1d2e;
  --muted:        #6a7192;
  --radius:       10px;
  --alert-ok-bg:  #e6f5ee;
  --alert-err-bg: #fceaea;
  --alert-inf-bg: #e8effc;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  transition: background .25s, color .25s;
}

.theme-btn { font-size: 16px; padding: 6px 10px; }

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

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.logo { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
nav { display: flex; align-items: center; gap: 14px; }
.user-badge {
  font-size: 13px;
  color: var(--muted);
  background: var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── Main ── */
main { max-width: 900px; margin: 0 auto; padding: 28px 20px; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert-success { background: var(--alert-ok-bg);  border-color: var(--success); color: var(--success); }
.alert-error   { background: var(--alert-err-bg); border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: var(--alert-inf-bg); border-color: var(--accent);  color: var(--accent); }

/* ── Auth cards ── */
.card-center {
  max-width: 400px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  text-align: center;
}
.card-icon { font-size: 48px; margin-bottom: 12px; }
h1 { font-size: 22px; margin-bottom: 6px; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ── Form fields ── */
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }
.code-input { font-size: 24px; letter-spacing: 8px; text-align: center; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-outline  { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: rgba(79,142,247,.1); }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger   { background: var(--danger); color: #fff; padding: 8px 12px; }
.btn-danger:hover { opacity: .85; }
.btn-sm       { padding: 6px 12px; font-size: 13px; }
.btn-full     { width: 100%; justify-content: center; margin-top: 8px; }

.link-hint { margin-top: 20px; font-size: 13px; color: var(--muted); }

/* ── Dashboard ── */
.dashboard { display: flex; flex-direction: column; gap: 24px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}
.panel h2 { font-size: 17px; margin-bottom: 18px; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px 20px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 14px;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79,142,247,.05);
}
.drop-zone-inner { text-align: center; }
.drop-icon { font-size: 36px; }
.drop-zone-inner p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.link-label { color: var(--accent); cursor: pointer; }
.link-label:hover { text-decoration: underline; }

.file-preview { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.file-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* File table */
.file-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.file-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding: 0 10px 10px;
}
.file-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.file-table tr:last-child td { border-bottom: none; }
.fname { font-weight: 500; }
.fsize, .fdate { color: var(--muted); white-space: nowrap; }
.factions { text-align: right; white-space: nowrap; display: flex; gap: 6px; justify-content: flex-end; }

.empty-msg { color: var(--muted); text-align: center; padding: 20px 0; font-size: 14px; }
