:root {
  --bg: #E9EDF1;
  --surface: #F8FAFB;
  --ink: #17212B;
  --muted: #5A6876;
  --line: #CDD5DD;
  --accent: #23527C;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCE6F0;
  --danger: #A63D2A;
  --track: #D5DCE3;
  --tick: rgba(23, 33, 43, .28);
  --ok: #2F6B45;
  --radius: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171D;
    --surface: #19212A;
    --ink: #E2E8EE;
    --muted: #93A1AF;
    --line: #2C3743;
    --accent: #7FA8D1;
    --accent-ink: #0E1A26;
    --accent-soft: #22344A;
    --danger: #E07A63;
    --track: #26313C;
    --tick: rgba(226, 232, 238, .3);
    --ok: #7DC495;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.5em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wordmark { font-size: 26px; letter-spacing: -0.02em; font-weight: 600; }

/* butoane */
.btn {
  font: inherit; font-size: 14px; font-weight: 500;
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 4px 8px; }
.btn.quiet:hover { color: var(--ink); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

input[type=text], input[type=password], input:not([type]), select {
  font: inherit; width: 100%; padding: 8px 10px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink);
}

/* autentificare */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; }
.login-card label { font-size: 14px; color: var(--muted); }

/* structura */
.shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--line); padding: 24px 22px;
  display: flex; flex-direction: column; gap: 32px;
}
.brand { display: flex; align-items: baseline; justify-content: space-between; }
.main { position: relative; padding: 20px 28px 120px; min-width: 0; }

/* discuri: fiecare diviziune de pe bara = 1 TB */
.disks { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.disk { display: grid; gap: 6px; cursor: pointer; border-radius: var(--radius); }
.disk-head { display: flex; justify-content: space-between; align-items: baseline; }
.disk-name { font-weight: 600; font-size: 17px; }
.disk.active .disk-name { color: var(--accent); }
.meter { position: relative; height: 16px; background: var(--track); border-radius: 3px; overflow: hidden; }
.meter .used { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.meter.full .used { background: var(--danger); }
.meter::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(to right, transparent 0 calc(var(--tb) - 1px), var(--tick) calc(var(--tb) - 1px) var(--tb));
}
.disk-free { font-size: 13px; color: var(--muted); }

.machine { display: grid; gap: 6px; margin-top: auto; }
.machine .btn { margin-top: 10px; justify-self: start; }
.pending { display: grid; gap: 8px; margin-top: 10px; color: var(--danger); }

/* bara de sus */
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 18px; min-width: 0; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 4px; border-radius: 4px; }
.crumbs a:hover { color: var(--ink); background: var(--accent-soft); }
.crumbs .here { font-weight: 600; padding: 2px 4px; overflow-wrap: anywhere; }
.crumbs .sep { color: var(--line); }
.actions { display: flex; gap: 8px; }

/* tabel */
.table-wrap { overflow-x: auto; }
.files { width: 100%; border-collapse: collapse; }
.files th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.files td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.files tbody tr:hover { background: var(--surface); }
.files .num, .files .when { white-space: nowrap; color: var(--muted); }
.files .num { text-align: right; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell a, .name-cell span { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.name-cell a:hover { text-decoration: underline; }
.kind { flex: none; width: 32px; height: 18px; white-space: nowrap; letter-spacing: .02em; display: inline-grid; place-items: center; font-size: 10px; font-weight: 600; border-radius: 3px; color: var(--muted); border: 1px solid var(--line); }
.kind.dir { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-actions .btn { padding: 4px 8px; font-size: 13px; text-decoration: none; }
.row-actions .btn.del:hover { color: var(--danger); }
.empty { padding: 48px 10px; color: var(--muted); }

.drop-hint {
  position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  display: grid; place-items: center; font-size: 17px; font-weight: 500; color: var(--accent);
}

/* coada de incarcari */
.queue {
  position: fixed; right: 20px; bottom: 20px; width: min(400px, calc(100vw - 40px));
  max-height: 50vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.queue header { display: flex; justify-content: space-between; align-items: center; }
.queue ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.q-item { display: grid; gap: 4px; font-size: 14px; }
.q-top { display: flex; justify-content: space-between; gap: 8px; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-bar { height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; }
.q-bar span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.q-item.done .q-bar span { background: var(--ok); }
.q-item.failed .q-bar span { background: var(--danger); }
.q-info { font-size: 12px; color: var(--muted); }
.q-item.failed .q-info { color: var(--danger); }

/* dialog si toast */
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 22px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 15, 20, .45); }
dialog h2 { font-size: 17px; color: var(--ink); margin-bottom: 12px; }
#dlg-body { display: grid; gap: 10px; }
#dlg-body p { overflow-wrap: anywhere; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btn.primary.danger-ok { background: var(--danger); border-color: var(--danger); color: #fff; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); font-size: 14px; max-width: calc(100vw - 40px);
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); gap: 20px; padding: 18px; }
  .machine { margin-top: 0; }
  .main { padding: 16px 14px 120px; }
  .files thead { display: none; }
  .files .when { display: none; }
  .files tr { display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .files td { border: 0; padding: 4px 6px; }
  .files td:nth-child(4) { grid-column: 1 / -1; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; margin-left: 36px; }
  .row-actions .btn { padding: 4px 10px 4px 0; }
}
@media (prefers-reduced-motion: reduce) { .q-bar span { transition: none; } }
