/* ══════════════════════════════════════════════════════════════
   R2 VAULT — Giao diện tối + cyan glow
   Bảng màu: slate-950 nền · cyan-500 → sky-500 điểm nhấn
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #020617;            /* slate-950 */
  --bg-2: #0f172a;          /* slate-900 */
  --bg-3: #1e293b;          /* slate-800 */
  --line: #1e293b;          /* border */
  --line-2: #334155;        /* border sáng hơn */
  --text: #f1f5f9;          /* slate-100 */
  --muted: #94a3b8;         /* slate-400 */
  --cyan: #06b6d4;          /* cyan-500 */
  --cyan-2: #22d3ee;        /* cyan-400 */
  --sky: #0ea5e9;           /* sky-500 */
  --ok: #10b981;            /* emerald-500 */
  --warn: #f59e0b;          /* amber-500 */
  --danger: #ef4444;        /* red-500 */
  --grad: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

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

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Nền có quầng sáng mờ hai góc */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(600px circle at 15% -10%, rgba(6, 182, 212, .10), transparent 60%),
    radial-gradient(600px circle at 90% 110%, rgba(14, 165, 233, .08), transparent 60%);
}

.boot { padding: 4rem; text-align: center; color: var(--muted); }
button { font-family: inherit; }
a { color: var(--cyan-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: rgba(15, 23, 42, .6);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand .logo { font-size: 1.7rem; filter: drop-shadow(0 0 10px rgba(6,182,212,.5)); }
.brand h1 {
  font-size: 1.05rem; font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand p { font-size: .7rem; color: var(--muted); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--muted); background: transparent; border: 0;
  font-size: .9rem; cursor: pointer; text-align: left; width: 100%;
  transition: all .18s;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.nav-item.active {
  background: var(--grad); color: #fff; font-weight: 600;
  box-shadow: 0 6px 20px rgba(6, 182, 212, .28);
}
.nav-item .ic { width: 20px; text-align: center; }

.sidebar .spacer { flex: 1; }

.logout-btn {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  cursor: pointer; background: rgba(239, 68, 68, .08);
  color: #fca5a5; font-size: .82rem; transition: all .18s;
}
.logout-btn:hover { background: rgba(239, 68, 68, .18); color: #fff; }

.main { flex: 1; padding: 28px 32px; max-width: 1280px; }

/* ── Panel / card ── */
.panel {
  position: relative;
  background: rgba(15, 23, 42, .55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* Quầng glow hai góc, nở ra khi hover — theo card mẫu */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 190px; height: 190px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: .35;
  pointer-events: none;
  transition: all .5s;
}
.panel::before { top: -80px; left: -80px; background: radial-gradient(circle, rgba(6,182,212,.5), transparent 70%); }
.panel::after  { bottom: -80px; right: -80px; background: radial-gradient(circle, rgba(14,165,233,.45), transparent 70%); }
.panel:hover::before, .panel:hover::after { transform: scale(1.4); opacity: .5; }
.panel > * { position: relative; z-index: 1; }
.panel + .panel { margin-top: 18px; }

.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h2 { font-size: 1.35rem; font-weight: 700; }
.page-title p { color: var(--muted); font-size: .85rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line-2);
  background: rgba(30, 41, 59, .6); color: var(--text);
  font-size: .85rem; cursor: pointer; transition: all .18s; text-decoration: none;
}
.btn:hover { background: var(--bg-3); border-color: var(--cyan); transform: translateY(-1px); }
.btn-primary {
  background: var(--grad); border: 0; color: #fff; font-weight: 600;
  box-shadow: 0 8px 24px rgba(6, 182, 212, .25);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(6, 182, 212, .4); transform: translateY(-1px); }
.btn-danger { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .3); color: #fca5a5; }
.btn-danger:hover { background: rgba(239, 68, 68, .2); border-color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: .75rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Inputs ── */
.input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line-2); border-radius: 10px;
  font-size: .92rem; background: rgba(2, 6, 23, .6); color: var(--text);
  transition: all .18s;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6, 182, 212, .15); }
select.input option { background: var(--bg-2); color: var(--text); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .76rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; letter-spacing: .02em; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th {
  text-align: left; padding: 11px 14px;
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line-2);
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(30, 41, 59, .6); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: rgba(6, 182, 212, .05); }

.fname { font-family: 'SF Mono', Consolas, monospace; font-size: .8rem; word-break: break-all; color: var(--text); }
.fmeta { color: var(--muted); font-size: .74rem; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Dropzone (theo card mẫu) ── */
.dropzone {
  position: relative;
  border: 2px dashed var(--line-2); border-radius: var(--radius);
  padding: 46px 20px; text-align: center; color: var(--muted);
  cursor: pointer; transition: all .25s;
  background: rgba(15, 23, 42, .5);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--cyan); background: rgba(6, 182, 212, .06);
  box-shadow: inset 0 0 40px rgba(6, 182, 212, .08);
}
.dropzone .big {
  width: 80px; height: 80px; margin: 0 auto 16px;
  display: grid; place-items: center; font-size: 2.2rem;
  border-radius: 50%; background: var(--bg-2);
  box-shadow: 0 0 0 1px var(--line), 0 0 30px rgba(6, 182, 212, .2);
}
.dropzone p.lead { font-size: 1rem; color: var(--text); font-weight: 500; margin-bottom: 6px; }
.dropzone p.sm { font-size: .8rem; }
.dropzone p.xs { font-size: .72rem; opacity: .7; }

/* ── Upload rows ── */
.up-row {
  background: rgba(15, 23, 42, .5); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 15px; margin-bottom: 10px;
}
.up-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.up-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.up-ic {
  width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 10px; background: rgba(6, 182, 212, .1); font-size: 1.1rem;
}
.up-ic.done { background: rgba(16, 185, 129, .1); }
.up-name { font-size: .86rem; font-weight: 500; word-break: break-all; }
.up-sub { font-size: .72rem; color: var(--muted); }
.up-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.up-pct { font-size: .8rem; font-weight: 600; color: var(--cyan-2); }
.up-pct.done { color: var(--ok); }
.up-status { font-size: .74rem; color: var(--muted); }

.bar { height: 6px; margin-top: 11px; background: var(--bg-3); border-radius: 6px; overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 0; border-radius: 6px;
  background: var(--grad); transition: width .25s;
}
.bar > i.done { background: var(--ok); }
/* hiệu ứng shimmer chạy trên progress bar */
.bar > i::after {
  content: ''; display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 2s infinite;
}
.bar > i.done::after { display: none; }
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Stats ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  position: relative;
  background: rgba(15, 23, 42, .55); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,.35), transparent 70%);
  filter: blur(24px);
}
.stat .v {
  position: relative; font-size: 1.6rem; font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .l { position: relative; font-size: .74rem; color: var(--muted); margin-top: 4px; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
}
.login-card {
  position: relative; width: 100%; max-width: 400px;
  background: rgba(15, 23, 42, .7); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 36px; box-shadow: var(--shadow); text-align: center; overflow: hidden;
}
.login-card::before, .login-card::after {
  content: ''; position: absolute; width: 200px; height: 200px;
  border-radius: 50%; filter: blur(60px); opacity: .4; pointer-events: none;
}
.login-card::before { top: -90px; left: -90px; background: radial-gradient(circle, rgba(6,182,212,.6), transparent 70%); }
.login-card::after  { bottom: -90px; right: -90px; background: radial-gradient(circle, rgba(14,165,233,.5), transparent 70%); }
.login-card > * { position: relative; z-index: 1; }

.login-card .logo { font-size: 2.8rem; filter: drop-shadow(0 0 16px rgba(6,182,212,.6)); }
.login-card h1 { font-size: 1.4rem; margin: 10px 0 4px; }
.login-card .sub { color: var(--muted); font-size: .85rem; margin-bottom: 22px; }
.login-card .input { text-align: center; }

.alert {
  padding: 11px 14px; border-radius: 10px; font-size: .82rem; margin-bottom: 14px;
  background: rgba(239, 68, 68, .1); color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, .25); text-align: left;
}
.alert.info { background: rgba(6, 182, 212, .1); color: var(--cyan-2); border-color: rgba(6, 182, 212, .25); }
#turnstile-box { display: flex; justify-content: center; margin: 16px 0; min-height: 65px; }

/* ── Toast ── */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: rgba(15, 23, 42, .95); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: .84rem;
  box-shadow: var(--shadow); animation: slideIn .22s ease; max-width: 340px;
}
.toast.err { border-color: rgba(239, 68, 68, .5); background: rgba(127, 29, 29, .9); }
.toast.ok  { border-color: rgba(16, 185, 129, .5); background: rgba(6, 78, 59, .9); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(2, 6, 23, .9); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.modal.hidden { display: none; }
.modal-inner {
  position: relative; background: rgba(15, 23, 42, .97);
  border: 1px solid var(--line-2); border-radius: 18px;
  max-width: min(1100px, 95vw); max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow);
}
.modal-inner img { max-width: 100%; display: block; }
.modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2);
  cursor: pointer; background: rgba(2, 6, 23, .7); color: #fff; font-size: 1.1rem;
  transition: all .18s;
}
.modal-close:hover { background: var(--danger); border-color: var(--danger); }
.modal-body { padding: 24px; }

.link-box {
  display: flex; gap: 8px; align-items: center;
  background: rgba(2, 6, 23, .6); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin: 8px 0;
}
.link-box code { flex: 1; font-size: .74rem; word-break: break-all; font-family: Consolas, monospace; color: var(--cyan-2); }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .68rem; font-weight: 600;
}
.badge.on  { background: rgba(16, 185, 129, .12); color: var(--ok); border: 1px solid rgba(16, 185, 129, .3); }
.badge.off { background: rgba(245, 158, 11, .12); color: var(--warn); border: 1px solid rgba(245, 158, 11, .3); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 2.8rem; opacity: .35; margin-bottom: 10px; }

/* Dòng placeholder thư mục (không có nội dung để tải/link) */
tr.is-folder td { opacity: .75; }
tr.is-folder .fname { color: var(--muted); }
.muted { color: var(--muted); font-size: .8rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ── Settings table ── */
.cfg-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid rgba(30,41,59,.6); }
.cfg-row:last-child { border-bottom: 0; }
.cfg-k { font-size: .84rem; }
.cfg-v { font-size: .78rem; color: var(--muted); font-family: Consolas, monospace; word-break: break-all; text-align: right; max-width: 60%; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 6px 8px; }
  .nav-item { width: auto; padding: 9px 12px; font-size: .8rem; }
  .sidebar .spacer { display: none; }
  .main { padding: 16px; }
  .up-name { font-size: .8rem; }
}
