/* ===== Exo 2 (local, full variable woff2 — all glyphs in one file) ===== */
@font-face {
  font-family: 'Exo 2';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/Exo2-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Exo 2';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/Exo2-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Exo 2';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/Exo2-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Exo 2';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/Exo2-variable.woff2') format('woff2');
}

/* ===== Base ===== */
:root {
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #dbeafe 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 10%, #ede9fe 0%, transparent 55%),
             linear-gradient(180deg, #f4f6fb 0%, #eef2f9 100%);
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e6e9f2;
  --accent: #034EA2;
  --accent-2: #2B7FD9;
  --accent-grad: linear-gradient(135deg, #034EA2 0%, #2B7FD9 100%);
  --accent-soft: #e6f2fb;
  --danger: #dc2626;
  --danger-grad: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  --ok: #059669;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
  --shadow-lg: 0 20px 40px rgba(16,24,40,.12), 0 8px 16px rgba(16,24,40,.06);
  --radius: 14px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  background-image: var(--bg-grad); background-attachment: fixed;
  min-height: 100vh; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px; padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--accent); }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-grad); display: grid; place-items: center;
  color: #fff; box-shadow: var(--shadow);
}
.brand .logo svg { width: 18px; height: 18px; }
.brand .dot { color: var(--accent-2); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { line-height: 1.1; }
.brand-sub { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
@media (max-width: 720px) { .brand-sub { display: none; } }
.topbar-spacer { flex: 1; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px;
}
.user-chip svg { width: 16px; height: 16px; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tabs a {
  padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  text-decoration: none; transition: .18s;
}
.nav-tabs a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav-tabs a.active { background: var(--accent-grad); color: #fff; box-shadow: var(--shadow-sm); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; color: var(--text);
  cursor: pointer; transition: .18s; text-decoration: none; box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent-grad); color: #fff; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: var(--danger-grad); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 9px; }
.btn-block { width: 100%; }

/* ===== Layout ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.card-head .spacer { flex: 1; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 34px 30px 28px; text-align: center;
}
.login-card .logo {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
  background: var(--accent-grad); display: grid; place-items: center;
  color: #fff; box-shadow: var(--shadow);
}
.login-card .logo svg { width: 28px; height: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--accent); }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* ===== Forms ===== */
.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; font-family: inherit; font-size: 15px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; color: var(--text);
  transition: .18s; outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 13px !important;
}

/* ===== Dropzone ===== */
.dropzone {
  border: 2px dashed #c7d2fe; border-radius: var(--radius);
  background: linear-gradient(180deg, #f8faff 0%, #f5f8ff 100%);
  padding: 40px 24px; text-align: center; cursor: pointer;
  transition: .2s; position: relative;
}
.dropzone:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.dropzone.drag { border-color: var(--accent-2); background: var(--accent-soft); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.dropzone .dz-icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  background: var(--accent-grad); display: grid; place-items: center; color: #fff;
  box-shadow: var(--shadow);
}
.dropzone .dz-icon svg { width: 28px; height: 28px; }
.dropzone h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.dropzone p { margin: 0; color: var(--muted); font-size: 13px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* file queue */
.queue { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.qitem {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
}
.qitem .qicon { width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.qitem .qicon svg { width: 18px; height: 18px; }
.qitem .qmeta { flex: 1; min-width: 0; }
.qitem .qname { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem .qsub { font-size: 12px; color: var(--muted); }
.qitem .qbar { height: 6px; border-radius: 999px; background: #e6e9f2; margin-top: 6px; overflow: hidden; }
.qitem .qbar > i { display: block; height: 100%; width: 0; background: var(--accent-grad); transition: width .2s; }
.qitem.done .qbar > i { width: 100% !important; }
.qitem.err { border-color: #fecaca; background: #fef2f2; }
.qitem.done .qicon { background: #dcfce7; color: var(--ok); }

/* ===== Table ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search {
  flex: 1; min-width: 220px; position: relative;
}
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.toolbar .search input {
  width: 100%; font-family: inherit; font-size: 14px;
  padding: 10px 12px 10px 38px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; outline: none; transition: .18s;
}
.toolbar .search input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm); }
table.files { width: 100%; border-collapse: collapse; min-width: 760px; }
table.files th, table.files td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.files thead th {
  background: #f8faff; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  position: sticky; top: 0;
}
table.files tbody tr { transition: .15s; }
table.files tbody tr:hover { background: #f8faff; }
table.files tbody tr:last-child td { border-bottom: none; }
.fcell { display: flex; align-items: center; gap: 12px; }
.ficon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.ficon svg { width: 18px; height: 18px; }
.ficon.pdf { background: #dc2626; }
.ficon.img { background: #0d9488; }
.ficon.doc { background: #2563eb; }
.ficon.sheet { background: #059669; }
.ficon.slide { background: #ea580c; }
.ficon.arch { background: #7c3aed; }
.ficon.audio { background: #db2777; }
.ficon.video { background: #9333ea; }
.ficon.code { background: #0369a1; }
.ficon.file { background: #6b7280; }
.fname { font-weight: 600; font-size: 14px; }
.fname .orig { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.link-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.link-cell .url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--accent-2);
  background: var(--accent-soft); padding: 5px 9px; border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px;
  display: block; min-width: 0;
}
.row-actions { display: flex; gap: 6px; }
.row-actions .btn-icon { padding: 7px; }
.row-actions svg { width: 16px; height: 16px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; opacity: .5; margin-bottom: 10px; }

/* ===== Result cards ===== */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.rcard { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 14px; box-shadow: var(--shadow-sm); }
.rcard .rh { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rcard .rlink {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: var(--accent-soft); padding: 7px 9px; border-radius: 8px; color: var(--accent-2);
  word-break: break-all;
}

/* ===== Modal ===== */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17,24,39,.45); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.show { display: flex; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 460px; background: var(--card);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.modal .mhead { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal .mhead h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal .mhead .spacer { flex: 1; }
.modal .mhead .x { background: transparent; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.modal .mhead .x:hover { background: #f3f4f6; }
.modal .mbody { padding: 20px 22px; }
.modal .mbody p { margin: 0 0 14px; color: var(--muted); }
.modal .mbody .fname-strong { color: var(--text); font-weight: 600; }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: #f9fafb; }
.warn-box { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.warn-box svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.preview-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--accent-soft); color: var(--accent); padding: 8px 11px; border-radius: 8px; margin-top: 8px; word-break: break-all; }

/* ===== Toast ===== */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent-2);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 16px; min-width: 260px; max-width: 360px;
  display: flex; align-items: center; gap: 10px; animation: slidein .2s ease;
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--danger); }
.toast .tmsg { font-size: 13px; }

/* ===== Misc ===== */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.grow { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.flash.ok { background: #dcfce7; color: #065f46; border: 1px solid #bbf7d0; }
.flash.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .val { font-size: 22px; font-weight: 700; color: var(--accent); margin-top: 2px; }
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
  .wrap { padding: 16px 14px 50px; }
  .card-pad { padding: 16px; }
  .table-wrap { border-radius: 10px; }
}

/* ===== Batch group (recently uploaded) ===== */
.batch-group {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); margin-bottom: 12px; overflow: hidden;
}
.batch-group + .batch-group { margin-top: 12px; }
.batch-group[open] { box-shadow: 0 1px 0 var(--border); }
.batch-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; background: #f8faff; border-bottom: 1px solid transparent;
  cursor: pointer; list-style: none; user-select: none;
}
.batch-group[open] .batch-summary { border-bottom-color: var(--border); }
.batch-summary::-webkit-details-marker { display: none; }
.batch-summary::before {
  content: ""; width: 0; height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease; margin-right: 2px;
}
.batch-group[open] .batch-summary::before { transform: rotate(90deg); }
.batch-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 4px 10px; border-radius: 999px;
}
.batch-tag svg { width: 14px; height: 14px; }
.batch-title { font-size: 14px; font-weight: 600; }
.batch-meta { font-size: 12px; color: var(--muted); }
.batch-summary .spacer { flex: 1; }

/* mini table (inside batch + modal) */
table.files.mini th, table.files.mini td { padding: 7px 12px; font-size: 13px; }
table.files.mini .ficon { width: 28px; height: 28px; border-radius: 7px; }
table.files.mini .ficon svg { width: 13px; height: 13px; }
table.files.mini .fname { font-size: 13px; }
table.files.mini .url { max-width: 320px; font-size: 11px; }

/* compact rows in the main files table */
table.files td.nowrap, table.files th.nowrap { white-space: nowrap; }
table.files .fcell { align-items: center; min-width: 0; }
table.files .fname { line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
a.fname { color: inherit; text-decoration: none; }
a.fname:hover { color: var(--accent); text-decoration: underline; }
.url.clickable { cursor: pointer; }
.url.clickable:hover { color: var(--accent); }
/* truncate file name + link inside the mini tables too */
table.files.mini .fcell { min-width: 0; }
table.files.mini .fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
table.files.mini .link-cell .url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }

/* user management */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.b { background: var(--accent-soft); color: var(--accent); }

/* ===== Filter form (list page) ===== */
form.toolbar { gap: 10px; align-items: flex-end; }
form.toolbar .field { min-width: 120px; margin: 0; }
form.toolbar .field label { margin-bottom: 4px; }
form.toolbar .field select {
  padding: 10px 12px; font-size: 14px; height: 40px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
}
form.toolbar .search { flex: 1; min-width: 180px; }
@media (max-width: 640px) {
  form.toolbar { flex-wrap: wrap; }
  form.toolbar .field { flex: 1; min-width: calc(50% - 10px); }
  form.toolbar .search { order: 5; width: 100%; flex-basis: 100%; }
}

/* ===== Wide modal (links) ===== */
.modal.wide { max-width: 820px; }
.modal.wide .table-wrap { max-height: 60vh; overflow: auto; }

table.files.mini.links .url { font-size: 12px; }
table.files.mini.links td { vertical-align: top; }

/* ===== Exo 2 on ALL form elements everywhere ===== */
input, select, textarea, button {
  font-family: 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
