/* ==========================================================================
   FileDrop — hoja de estilos
   Sistema: tokens → base → layout → componentes → páginas → responsive
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f7f9;
  --bg-grad: radial-gradient(1100px 480px at 50% -180px, rgba(79, 70, 229, 0.10), transparent 70%);
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;

  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --text-4: #98a2b3;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-soft-2: #e0e7ff;
  --accent-text: #4338ca;
  --on-accent: #ffffff;
  --ring: rgba(79, 70, 229, 0.22);

  --success: #079455;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --danger-border: #fecdca;

  --k-image: #7a5af8;   --k-image-bg: #f4f3ff;
  --k-video: #dd2590;   --k-video-bg: #fdf2fa;
  --k-audio: #0e9384;   --k-audio-bg: #f0fdf9;
  --k-pdf: #d92d20;     --k-pdf-bg: #fef3f2;
  --k-doc: #1570ef;     --k-doc-bg: #eff8ff;
  --k-sheet: #079455;   --k-sheet-bg: #ecfdf3;
  --k-slide: #e04f16;   --k-slide-bg: #fef6ee;
  --k-archive: #ca8504; --k-archive-bg: #fefbe8;
  --k-code: #475467;    --k-code-bg: #f2f4f7;
  --k-other: #667085;   --k-other-bg: #f2f4f7;
  --folder: #f5b740;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px -8px rgba(16, 24, 40, 0.12);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f14;
    --bg-grad: radial-gradient(1100px 480px at 50% -180px, rgba(99, 102, 241, 0.18), transparent 70%);
    --surface: #151820;
    --surface-2: #1a1d26;
    --surface-3: #212531;
    --border: #262a36;
    --border-strong: #353a49;

    --text: #f2f4f7;
    --text-2: #c3c8d2;
    --text-3: #98a0b0;
    --text-4: #6b7385;

    --accent: #6366f1;
    --accent-hover: #7c7ff5;
    --accent-soft: rgba(99, 102, 241, 0.14);
    --accent-soft-2: rgba(99, 102, 241, 0.24);
    --accent-text: #a5b4fc;
    --ring: rgba(129, 140, 248, 0.35);

    --success: #47cd89;  --success-soft: rgba(71, 205, 137, 0.12);
    --warning: #fdb022;  --warning-soft: rgba(253, 176, 34, 0.12);
    --danger: #f97066;   --danger-soft: rgba(249, 112, 102, 0.12);  --danger-border: rgba(249, 112, 102, 0.35);

    --k-image-bg: rgba(122, 90, 248, 0.16);  --k-image: #a48afb;
    --k-video-bg: rgba(221, 37, 144, 0.16);  --k-video: #f670c7;
    --k-audio-bg: rgba(14, 147, 132, 0.18);  --k-audio: #2ed3b7;
    --k-pdf-bg: rgba(217, 45, 32, 0.18);     --k-pdf: #f97066;
    --k-doc-bg: rgba(21, 112, 239, 0.18);    --k-doc: #53b1fd;
    --k-sheet-bg: rgba(7, 148, 85, 0.18);    --k-sheet: #47cd89;
    --k-slide-bg: rgba(224, 79, 22, 0.18);   --k-slide: #fd853a;
    --k-archive-bg: rgba(202, 133, 4, 0.18); --k-archive: #fac515;
    --k-code-bg: #262a36;                     --k-code: #c3c8d2;
    --k-other-bg: #262a36;                    --k-other: #98a0b0;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
}
[hidden] { display: none !important; }
a { color: var(--accent-text); }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-4); }
.center { text-align: center; }
svg.ic { width: 16px; height: 16px; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1160px; margin: 0 auto; height: 60px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(180deg, #6366f1, #4f46e5); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 1px 2px rgba(16,24,40,.12);
}
.brand-mark svg { width: 18px; height: 18px; }
.topbar-nav { display: flex; align-items: center; gap: 8px; }

.main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 48px 24px 32px; }
.main-wide { max-width: 1160px; padding-top: 36px; }
.main-center { display: flex; align-items: center; justify-content: center; padding-top: 32px; }

.site-footer {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 24px; color: var(--text-4); font-size: 12.5px;
}
.site-footer span:first-child { font-weight: 600; color: var(--text-3); }

/* ---------- Botones ---------- */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1; letter-spacing: -0.005em;
  text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-sm { --h: 34px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { --h: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.copied, .btn.copied:hover { background: var(--success); border-color: var(--success); color: #fff; }

.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border-radius: var(--r-sm); color: var(--text-3); border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface); color: var(--accent-text); border-color: var(--border); }
.link-btn { background: none; border: 0; padding: 6px 0; font-size: 13px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.link-btn:hover { color: var(--text); }
.link-btn.danger:hover { color: var(--danger); }

/* ---------- Formularios ---------- */
.field { margin-top: 16px; }
.field label { display: flex; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.label-row { justify-content: space-between; align-items: baseline; }
.counter { font-size: 12px; color: var(--text-4); font-weight: 500; font-variant-numeric: tabular-nums; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; height: 40px; padding: 0 12px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-4); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
input[aria-invalid=true] { border-color: var(--danger); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2398a2b3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-icon { position: relative; }
.input-icon > svg.ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-4); pointer-events: none; }
.input-icon > input, .input-icon > select { padding-left: 38px; }
.input-reveal > input { padding-right: 44px; }
.reveal { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--text-4); border-radius: var(--r-xs); cursor: pointer; }
.reveal:hover { color: var(--text-2); background: var(--surface-3); }

.disclosure {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-top: 20px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px dashed var(--border-strong); background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s, color .15s;
}
.disclosure span { flex: 1; }
.disclosure:hover { background: var(--surface-2); color: var(--text); }
.disclosure .chev { transition: transform .2s var(--ease); color: var(--text-4); }
.disclosure[aria-expanded=true] { border-style: solid; border-color: var(--border); background: var(--surface-2); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.disclosure[aria-expanded=true] .chev { transform: rotate(180deg); }
.advanced { display: none; padding: 0 12px 14px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-sm) var(--r-sm); background: var(--surface-2); }
.advanced.open { display: block; }
.advanced .field:first-child { margin-top: 12px; }

.alert { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; }
.alert .ic { margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }
.card-narrow { width: 100%; max-width: 420px; padding: 36px 32px 32px; }
.card-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-top: 18px; }
.card-sub { color: var(--text-3); margin-top: 6px; font-size: 14px; }
.card-narrow .stack { margin-top: 8px; }
.card-narrow .btn-block { margin-top: 20px; }
.card-narrow.center .btn { margin-top: 24px; }
.card-narrow:not(.center) .status-icon { margin: 0; }

.status-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto; }
.status-icon svg { width: 24px; height: 24px; }
.status-icon.success { background: var(--success-soft); color: var(--success); }
.status-icon.error { background: var(--danger-soft); color: var(--danger); }
.status-icon.warning { background: var(--warning-soft); color: var(--warning); }
.status-icon.info, .status-icon.brand { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Copiar enlace ---------- */
.copy-field {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  height: 46px; padding: 0 6px 0 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md);
}
.copy-field > svg.ic { color: var(--text-4); }
.copy-field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 13.5px; font-weight: 500; color: var(--text); text-overflow: ellipsis; }
.copy-field input:focus { box-shadow: none; }
.copy-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.copy-field-lg { height: 52px; }

/* ==========================================================================
   Página de subida
   ========================================================================== */
.hero { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.hero h1 { font-size: clamp(26px, 3.6vw, 36px); line-height: 1.15; font-weight: 700; letter-spacing: -0.03em; }
.hero p { margin-top: 12px; font-size: 16px; color: var(--text-3); }

.upload-card { overflow: hidden; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); min-height: 520px; }
.pane { padding: 28px; display: flex; flex-direction: column; min-width: 0; }
.pane-form { border-left: 1px solid var(--border); background: var(--surface); }
.pane-form-body { flex: 1; }
.pane-form-foot { margin-top: 24px; }
.pane-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.pane-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pane-head-actions { display: flex; gap: 6px; }
.section-label { margin: 24px 0 8px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.fineprint { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--text-4); }
.fineprint .ic { width: 14px; height: 14px; }

/* Zona de arrastre */
.pane-files { padding: 16px; background: var(--surface-2); }
.dropzone { position: relative; flex: 1; display: flex; flex-direction: column; border-radius: var(--r-lg); }
.dropzone-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 40px 24px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); transition: border-color .2s, background .2s;
}
.dropzone-empty:hover { border-color: var(--accent); }
.dz-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.dz-icon svg { width: 26px; height: 26px; }
.dz-title { margin-top: 20px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.dz-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-3); }
.dz-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }

.filelist-wrap { flex: 1; display: flex; flex-direction: column; padding: 12px; min-height: 0; }
.filelist { list-style: none; margin: 0; padding: 0; flex: 1; max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.filelist-wrap .link-btn { align-self: flex-start; margin-top: 8px; }
.fitem {
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  animation: fadeIn .2s var(--ease);
}
.fitem .name-text { flex: 1; }
.fitem .rm { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; border-radius: var(--r-xs); color: var(--text-4); cursor: pointer; }
.fitem .rm:hover { background: var(--danger-soft); color: var(--danger); }
.fitem .rm svg { width: 14px; height: 14px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.drop-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  opacity: 0; transition: opacity .15s;
}
.drop-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--accent-text); font-weight: 600; }
.drop-overlay-inner svg { width: 32px; height: 32px; }
.dropzone.drag .drop-overlay { opacity: 1; }

/* Iconos de archivo (compartidos con el explorador) */
.ficon {
  width: 36px; height: 36px; flex: none; border-radius: 8px; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--k-other); background: var(--k-other-bg);
}
.ficon.folder { color: var(--folder); background: color-mix(in srgb, var(--folder) 14%, transparent); }
.ficon.folder svg { width: 20px; height: 20px; }
.k-image { color: var(--k-image); background: var(--k-image-bg); }
.k-video { color: var(--k-video); background: var(--k-video-bg); }
.k-audio { color: var(--k-audio); background: var(--k-audio-bg); }
.k-pdf { color: var(--k-pdf); background: var(--k-pdf-bg); }
.k-doc { color: var(--k-doc); background: var(--k-doc-bg); }
.k-sheet { color: var(--k-sheet); background: var(--k-sheet-bg); }
.k-slide { color: var(--k-slide); background: var(--k-slide-bg); }
.k-archive { color: var(--k-archive); background: var(--k-archive-bg); }
.k-code { color: var(--k-code); background: var(--k-code-bg); }
.name-text { display: flex; flex-direction: column; min-width: 0; }
.name-main { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Progreso */
.pane-progress { align-items: center; justify-content: center; text-align: center; background: var(--surface-2); padding: 40px 32px; }
.ring { position: relative; width: 168px; height: 168px; margin-bottom: 24px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring-track { stroke: var(--border); }
.ring-bar { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: calc(var(--p) * 1) 100; transition: stroke-dasharray .3s var(--ease); }
.ring.done .ring-bar { stroke: var(--success); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-pct { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-sub { font-size: 12px; color: var(--text-3); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 420px; margin: 28px 0 0; }
.stats div { padding: 10px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.stats dt { font-size: 11.5px; color: var(--text-3); }
.stats dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { width: 100%; max-width: 420px; height: 4px; margin-top: 16px; border-radius: 99px; background: var(--border); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s var(--ease); }
.bar-fill.ok { background: var(--success); }

.progress-list { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.pitem { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.pitem .ficon { width: 32px; height: 32px; }
.pitem-body { flex: 1; min-width: 0; }
.pitem-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.pitem-top .name-main { font-size: 13px; }
.pitem-pct { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.pitem .bar { max-width: none; margin-top: 6px; }
.pitem.complete .pitem-pct { color: var(--success); font-weight: 600; }

/* Completado */
.done { max-width: 520px; margin: 0 auto; padding: 56px 28px; text-align: center; }
.done .status-icon { width: 56px; height: 56px; border-radius: 16px; }
.done-title { margin-top: 20px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.done-sub { margin-top: 6px; color: var(--text-3); }
.done .copy-field { margin-top: 24px; text-align: left; }
.done-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.card-narrow .done-actions .btn { margin-top: 0; }

.features { list-style: none; padding: 0; margin: 28px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; color: var(--text-3); font-size: 13px; }
.features li { display: flex; align-items: center; gap: 8px; }
.features .ic { color: var(--text-4); }

/* ==========================================================================
   Explorador de archivos
   ========================================================================== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head-main { display: flex; gap: 16px; min-width: 0; }
.page-icon { width: 48px; height: 48px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--folder); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.page-icon svg { width: 26px; height: 26px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; word-break: break-word; }
.meta { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--text-3); }
.meta li:not(.chip) + li:not(.chip)::before { content: ""; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); }
.chip .ic { width: 13px; height: 13px; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warning-soft); color: var(--warning); }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.note { display: flex; gap: 12px; padding: 14px 16px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-md); box-shadow: var(--shadow-xs); }
.note > .ic { color: var(--accent-text); margin-top: 2px; }
.note-from { font-size: 13px; color: var(--text-3); }
.note-from strong { color: var(--text); font-weight: 600; }
.note-body { margin-top: 4px; white-space: pre-wrap; color: var(--text-2); }

.explorer { border-radius: var(--r-lg); overflow: hidden; }
.explorer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; font-size: 13.5px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--r-xs); color: var(--text-3); text-decoration: none; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb:hover { background: var(--surface-3); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb-sep { width: 14px; height: 14px; color: var(--text-4); }
.search { position: relative; width: 260px; max-width: 100%; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-4); pointer-events: none; }
.search input { height: 34px; padding-left: 34px; font-size: 13px; box-shadow: none; background: var(--surface-2); }

.table-wrap { overflow-x: auto; }
.ftable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ftable th { padding: 0 16px; height: 38px; text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ftable th button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.ftable th button:hover { color: var(--text); }
.ftable th[aria-sort] button { color: var(--text); font-weight: 600; }
.ftable th[aria-sort=ascending] button::after { content: "↑"; font-size: 11px; }
.ftable th[aria-sort=descending] button::after { content: "↓"; font-size: 11px; }
.ftable td { padding: 8px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.ftable tbody tr:last-child td { border-bottom: 0; }
.ftable tbody tr[data-href] { cursor: pointer; transition: background .1s; }
.ftable tbody tr[data-href]:hover { background: var(--surface-2); }
.ftable tbody tr[data-href]:hover .name-main { color: var(--accent-text); }
.col-name { width: 100%; max-width: 0; }
.col-size, .col-date { font-variant-numeric: tabular-nums; }
.col-act { width: 1%; text-align: right; padding-right: 10px !important; }
.ftable .name { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.ftable .name-sub { display: none; }
.row-up td { padding: 0 16px; }
.up-link { display: inline-flex; align-items: center; gap: 6px; height: 40px; color: var(--text-3); text-decoration: none; font-size: 13px; font-weight: 500; }
.up-link .ic { transform: rotate(180deg); width: 14px; height: 14px; }
.up-link:hover { color: var(--accent-text); }

.empty { padding: 56px 24px; text-align: center; color: var(--text-3); }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-4); }
.empty-icon svg { width: 24px; height: 24px; }
.explorer-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; color: var(--text-3); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: 50;
  padding: 10px 16px; border-radius: var(--r-md); background: #101828; color: #fff; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 32px -8px rgba(16,24,40,.35); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .ftable .col-type { display: none; }
}
@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; min-height: 0; }
  .pane-form { border-left: 0; border-top: 1px solid var(--border); }
  .dropzone-empty { padding: 32px 20px; }
  .filelist { max-height: 300px; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; height: 56px; }
  .topbar-nav .btn span { display: none; }
  .topbar-nav .btn { padding: 0 10px; }
  .main { padding: 28px 16px 24px; }
  .hero { margin-bottom: 22px; }
  .hero p { font-size: 14.5px; }
  .pane { padding: 20px; }
  .pane-files { padding: 12px; }
  .pane-head-actions .btn span { display: none; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stats dd { font-size: 12.5px; }
  .ring { width: 140px; height: 140px; }
  .card-narrow { padding: 28px 20px 24px; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
  .page-title { font-size: 20px; }
  .explorer-bar { padding: 10px; }
  .search { width: 100%; }
  .ftable .col-size, .ftable .col-date { display: none; }
  .ftable .name-sub { display: block; }
  .ftable td { padding: 8px 12px; }
  .features { display: none; }
}
