/* ============================================================================
   Three Sixty Transfer — light theme (mirrors threesixty.pt :root tokens)
   ========================================================================== */
:root {
  --bg: #ffffff;
  --bg-admin: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --elevated: #ebebed;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --fg: #3f3f46;
  --fg-strong: #18181b;
  --fg-muted: #71717a;
  --fg-faint: #a1a1aa;
  --primary: #27272a;
  --primary-fg: #ffffff;
  --primary-hover: #18181b;
  --accent: #7c5cff;            /* Three Sixty purple — used for progress + highlights */
  --accent-2: #5a3ff0;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --good: #16a34a;
  --good-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --radius-sm: 3px;
  --radius: 4px;          /* buttons + inputs */
  --radius-lg: 8px;       /* cards + modals */
  --ring: 0 0 0 3px rgba(39, 39, 42, .12);
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow: 0 1px 3px rgba(24, 24, 27, .09), 0 8px 24px rgba(24, 24, 27, .06);
  --maxw: 1120px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--fg-strong); }

h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0; color: var(--fg-strong); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }

.icon { flex: none; vertical-align: -.15em; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b8b8be; }

/* ── Layout helpers ─────────────────────────────────────────────────────── */
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mt-0 { margin-top: 0; }
.text-right { text-align: right; }

/* ── Buttons (4px radius) ───────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--radius);
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong);
  font: inherit; font-weight: 500; cursor: pointer;
  transition: background .14s, border-color .14s, transform .04s, box-shadow .14s, color .14s;
  white-space: nowrap; line-height: 1;
}
.button:hover { background: var(--surface-2); border-color: #c4c4c8; color: var(--fg-strong); }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: none; box-shadow: var(--ring); }
.button.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); font-weight: 600; }
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.button.ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.button.ghost:hover { background: var(--surface-2); color: var(--fg-strong); }
.button.small { padding: 6px 11px; font-size: 13px; }
.button[disabled] { opacity: .5; cursor: not-allowed; }
.button.block { width: 100%; justify-content: center; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius);
  background: transparent; border: 1px solid transparent; color: var(--fg-muted);
  cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--fg-strong); border-color: var(--border); }
.iconbtn.trash:hover { background: var(--danger-soft); color: #dc2626; border-color: transparent; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
label.field { display: block; margin-bottom: 16px; }
.field > .label, label.field > span:first-child {
  display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; color: var(--fg-strong);
}
.field .hint, .hint { display: block; color: var(--fg-faint); font-size: 12px; margin-top: 6px; }

input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; transition: border-color .14s, box-shadow .14s;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #a1a1aa; box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--fg-faint); }
input:disabled { background: var(--surface-2); color: var(--fg-muted); cursor: not-allowed; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m4 6 4 4 4-4'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ── Cards / panels ─────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.send-title { font-size: 17px; margin-bottom: 4px; }
.notify-box { display: flex; flex-direction: column; gap: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap; text-transform: capitalize;
}
.badge-muted { background: var(--surface-2); color: #52525b; border-color: var(--border); }
.badge-info  { background: var(--info-soft); color: #1d4ed8; }
.badge-good  { background: var(--good-soft); color: #15803d; }
.badge-warn  { background: var(--warn-soft); color: #b45309; }
.badge-bad   { background: var(--danger-soft); color: #b91c1c; }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px;
  border: 1px solid var(--border); background: var(--surface-2); font-weight: 500;
}
.flash-success { border-color: #bbf7d0; background: var(--good-soft); color: #15803d; }
.flash-error   { border-color: #fecaca; background: var(--danger-soft); color: #b91c1c; }
.flash-info    { border-color: #bfdbfe; background: var(--info-soft); color: #1d4ed8; }
.flash-close { background: none; border: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; }
.flash-close:hover { opacity: 1; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 64px 24px; color: var(--fg-faint); }
.empty .icon { color: #cbcbd1; margin-bottom: 12px; }
.empty h3 { color: var(--fg-muted); font-weight: 500; margin-bottom: 4px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-faint); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .strong { font-weight: 600; color: var(--fg-strong); }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.cell-actions form { display: inline-flex; }

/* ── Section header ─────────────────────────────────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 6px 0 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; }

/* ── Detail grid ────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.count-pill { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; margin-left: auto; }

/* ── Dropzone ───────────────────────────────────────────────────────────── */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 24px; text-align: center; color: var(--fg-muted); cursor: pointer; transition: border-color .14s, background .14s; background: var(--surface-2); }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--elevated); color: var(--fg-strong); }
.dropzone .icon { color: var(--fg-faint); margin-bottom: 8px; }
.dropzone:hover .icon, .dropzone.dragover .icon { color: var(--accent); }
.dropzone strong { color: var(--fg-strong); font-weight: 600; }

/* ── Progress bar (the beautiful one) ───────────────────────────────────── */
.progress { height: 12px; border-radius: 999px; background: var(--elevated); overflow: hidden; margin-top: 18px; position: relative; box-shadow: inset 0 1px 2px rgba(24,24,27,.08); }
.progress-bar {
  height: 100%; width: 0; border-radius: 999px; position: relative;
  background: linear-gradient(90deg, var(--accent-2), var(--accent) 55%, #9b80ff);
  background-size: 200% 100%;
  animation: barflow 2.4s linear infinite;
  box-shadow: 0 0 12px rgba(124,92,255,.55);
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
/* moving sheen stripes overlaid on the bar */
.progress-bar::after {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  background-image: linear-gradient(115deg, rgba(255,255,255,.28) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.28) 50%, rgba(255,255,255,.28) 75%, transparent 75%);
  background-size: 28px 28px;
  animation: barstripes 1s linear infinite;
  opacity: .55;
}
@keyframes barflow { to { background-position: -200% 0; } }
@keyframes barstripes { from { background-position: 0 0; } to { background-position: 28px 0; } }
.progress-meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12.5px; color: var(--fg-muted); }

/* ── Upload progress overlay ────────────────────────────────────────────── */
.upload-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(255,255,255,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.upload-card { width: min(440px, 94vw); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 26px; }
.upload-card h3 { font-size: 16px; margin-bottom: 2px; }
.upload-card .uf-name { color: var(--fg-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-card { width: min(520px, 94vw); }
.tc-percent { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--fg-strong); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.tc-stats { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--fg-muted); }
.tc-eta { color: var(--accent-2); font-weight: 600; white-space: nowrap; }
.tc-file { margin-bottom: 2px; }
.tc-url { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.tc-done { text-align: center; }
.tc-done .splash-badge { width: 56px; height: 56px; }

/* ── Transfer list (compose) ────────────────────────────────────────────── */
.transfer-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.transfer-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }
.transfer-item .tname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.transfer-item .tsize { color: var(--fg-faint); font-size: 12px; white-space: nowrap; }
.transfer-item button { width: 26px; height: 26px; font-size: 17px; line-height: 1; flex: none; }
.transfer-total { font-size: 12.5px; color: var(--fg-muted); padding: 6px 2px 0; font-weight: 500; }
.transfer-total.over { color: var(--danger); }

/* ── Transfer download page ─────────────────────────────────────────────── */
.transfer-box { box-shadow: var(--shadow); }
.transfer-head { display: flex; align-items: flex-start; gap: 14px; }
.transfer-icon { width: 44px; height: 44px; flex: none; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(124,92,255,.35); }
.transfer-msg { margin: 16px 0 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.55; }
.transfer-files { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.transfer-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--fg); transition: border-color .14s, background .14s; }
.transfer-file:hover { border-color: var(--accent); background: var(--surface-2); color: var(--fg-strong); }
.transfer-file .grow { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.transfer-file .tf-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-file .tf-size { color: var(--fg-faint); font-size: 12px; }
.transfer-file .tf-dl { color: var(--fg-muted); flex: none; }
.transfer-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--fg-faint); font-size: 12.5px; }

/* ── Public stage (download / status pages) ─────────────────────────────── */
.public-stage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px 20px; background: var(--bg-admin); }
.public-foot { color: var(--fg-faint); font-size: 12.5px; }
.public-foot a:hover { color: var(--fg-strong); }

/* ── Splash / status card ───────────────────────────────────────────────── */
.splash { text-align: center; padding: 44px 28px; }
.splash-badge { width: 64px; height: 64px; border-radius: 50%; background: var(--good-soft); color: #16a34a; display: grid; place-items: center; margin: 0 auto 18px; border: 1px solid #bbf7d0; }
.splash-badge.neutral { background: var(--surface-2); color: var(--fg-muted); border-color: var(--border); }
.splash h1 { font-size: 22px; margin-bottom: 8px; }
.splash p { color: var(--fg-muted); max-width: 460px; margin: 0 auto 22px; }

/* ── Auth screen with crossfading background ────────────────────────────── */
.auth-bg { position: fixed; inset: 0; z-index: 0; background: #0a0e1c; overflow: hidden; }
.auth-bg-slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.6s ease-in-out; will-change: opacity; transform: scale(1.04); }
.auth-bg-slide.is-active { opacity: 1; }
.auth-bg-veil { position: absolute; inset: 0; background:
   radial-gradient(120% 90% at 50% 0%, rgba(10,14,28,.25), rgba(10,14,28,.72)),
   linear-gradient(180deg, rgba(10,14,28,.35), rgba(10,14,28,.65)); }

.auth-stage { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px 20px; }
.auth-card {
  width: 100%; max-width: 410px; padding: 30px 30px 28px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: auth-in .4s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand-logo { height: 34px; width: auto; margin-bottom: 12px; }
.auth-product { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-faint); }
.auth-title { font-size: 21px; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--fg-muted); font-size: 13.5px; margin: 0 0 22px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 13px; color: var(--fg-muted); }
.auth-alt a { color: var(--accent-2); font-weight: 600; }
.auth-alt a:hover { color: var(--accent); }
.auth-foot { position: relative; z-index: 1; color: rgba(255,255,255,.7); font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.auth-foot a { color: rgba(255,255,255,.9); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* ── App shell ──────────────────────────────────────────────────────────── */
body.app { background: var(--bg-admin); }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-sub { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-faint); border-left: 1px solid var(--border-strong); padding-left: 10px; }
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar .brand { padding: 8px 10px 16px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius); color: var(--fg-muted); font-weight: 500; transition: background .14s, color .14s; }
.side-nav a:hover { background: var(--surface-2); color: var(--fg-strong); }
.side-nav a.is-active { background: var(--surface-2); color: var(--fg-strong); }
.side-nav a.is-active .icon { color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); color: var(--fg-muted); font-size: 13px; transition: background .14s, color .14s; }
.side-link:hover { background: var(--surface-2); color: var(--fg-strong); }
.side-user { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.side-user-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px 8px; }
.side-user-meta strong { font-size: 13px; font-weight: 600; color: var(--fg-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout:hover { color: #dc2626; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(246,247,249,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.admin-topbar h1 { font-size: 17px; }
.admin-content { padding: 28px; max-width: 1180px; width: 100%; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border-strong); color: var(--fg); border-radius: var(--radius); width: 40px; height: 38px; cursor: pointer; }

/* ── Toast (copy confirmation) ──────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px); z-index: 120; background: var(--fg-strong); color: #fff; font-size: 13px; font-weight: 500; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .detail-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
}
@media (max-width: 680px) {
  .admin-content { padding: 18px 16px; }
  .admin-topbar { padding: 0 16px; }
  .grid-2 { grid-template-columns: 1fr; }
}
