/* HOD Share — House of D Tech palette: electric blue + silver on deep navy */
:root {
  --bg: #070d18;
  --bg2: #0a1628;
  --panel: #0e1c33;
  --panel2: #12233f;
  --line: #1f3557;
  --silver: #8a97ad;
  --chrome: #c0c8d8;
  --text: #e6ebf3;
  --muted: #8796ad;
  --blue: #1565c0;
  --blue-hi: #1e7be0;
  --glow: #00bfff;
  --ok: #2ecc71;
  --warn: #f0b429;
  --bad: #e5484d;
  --notch: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(21, 101, 192, .22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(0, 191, 255, .08), transparent 60%),
    var(--bg);
  color: var(--text);
}
[hidden] { display: none !important; }
a { color: var(--glow); }
.muted { color: var(--muted); }

/* ---------- panels: silver accents + notched corner ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-left: 3px solid var(--silver);
  border-top: 2px solid var(--silver);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)));
}

/* ---------- buttons + inputs ---------- */
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
  background: #16294a;
  border: 1px solid #2b4673;
  padding: 8px 14px;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #1d3561; border-color: var(--glow); }
.btn:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--blue-hi), var(--blue)); border-color: #3b8fe8; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 0 14px rgba(0, 191, 255, .45); }
.btn.danger { background: #3a1418; border-color: #7a2a30; }
.btn.danger:hover:not(:disabled) { background: #5a1a20; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 6px 10px; }
.btn.wide { width: 100%; }

input, select {
  font: inherit;
  color: var(--text);
  background: #08111f;
  border: 1px solid var(--line);
  padding: 8px 10px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--glow); box-shadow: 0 0 0 2px rgba(0, 191, 255, .2); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--glow); cursor: pointer; }
label { display: block; font-size: 13px; color: var(--chrome); margin: 12px 0 0; }
label input, label select { margin-top: 5px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--silver);
  color: var(--chrome);
}
.badge.admin { border-color: var(--glow); color: var(--glow); }

/* ---------- sign-in views ---------- */
.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 28px 28px 24px; text-align: center; }
.auth-card label { text-align: left; }
.auth-card h1 { margin: 6px 0 2px; font-size: 22px; letter-spacing: .14em; color: var(--chrome); }
.auth-card p { margin: 0 0 8px; }
.auth-card .btn { margin-top: 16px; }
.auth-card .btn + .btn { margin-top: 8px; }
.auth-logo { width: 190px; max-width: 70%; filter: drop-shadow(0 0 18px rgba(0, 191, 255, .35)); }
.auth-logo.small { width: 80px; }
.form-error { color: var(--bad); min-height: 1.2em; margin: 10px 0 0 !important; font-size: 14px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  background: rgba(7, 13, 24, .85);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(0, 191, 255, .15);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 38px; filter: drop-shadow(0 0 8px rgba(0, 191, 255, .5)); }
.brand-name { font-weight: 800; letter-spacing: .16em; color: var(--chrome); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.disk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-left: auto; }
.disk-bar { width: 120px; height: 6px; background: #08111f; border: 1px solid var(--line); }
.disk-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--glow)); }
.disk-fill.high { background: var(--warn); }
.disk-fill.full { background: var(--bad); }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---------- main ---------- */
.main { max-width: 1200px; margin: 0 auto; padding: 18px 20px 120px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 12px; font-size: 15px; }
.crumbs button {
  font: inherit;
  background: none;
  border: none;
  color: var(--glow);
  cursor: pointer;
  padding: 3px 4px;
}
.crumbs button:hover { text-decoration: underline; }
.crumbs button[aria-current] { color: var(--text); font-weight: 700; cursor: default; text-decoration: none; }
.crumbs .sep { color: var(--silver); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 12px 14px; margin-bottom: 12px; }
.tool-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tool-group.grow { flex: 1 1 220px; justify-content: flex-end; }
.tool-group.grow input { max-width: 280px; }

/* ---------- file table ---------- */
.table-wrap { position: relative; padding: 4px 0; min-height: 220px; overflow-x: auto; }
table.files { width: 100%; border-collapse: collapse; }
.files th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--silver);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.files th.sortable { cursor: pointer; }
.files th.sortable:hover { color: var(--chrome); }
.files th[data-dir="asc"]::after { content: " ▲"; color: var(--glow); }
.files th[data-dir="desc"]::after { content: " ▼"; color: var(--glow); }
.files td { padding: 9px 12px; border-bottom: 1px solid rgba(31, 53, 87, .55); }
.files tbody tr:hover { background: rgba(21, 101, 192, .12); }
.files tbody tr.selected { background: rgba(0, 191, 255, .12); }
.col-check { width: 40px; }
.col-size { width: 110px; text-align: right !important; white-space: nowrap; }
.col-date { width: 190px; white-space: nowrap; color: var(--muted); }
td.col-size { color: var(--muted); font-variant-numeric: tabular-nums; }
.name-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  word-break: break-all;
}
.name-link:hover { color: var(--glow); }
.ficon { width: 22px; text-align: center; flex: none; font-size: 17px; }
.ficon.dir { color: #58a6ff; }
.empty { text-align: center; padding: 40px 10px; }
.hint { font-size: 13px; margin-top: 10px; }

.drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 191, 255, .1);
  border: 2px dashed var(--glow);
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--glow);
  pointer-events: none;
}
.table-wrap.dragging .drop-overlay { display: grid; }

/* ---------- upload queue ---------- */
.queue {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.queue-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.queue ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.queue li { padding: 8px 12px; border-bottom: 1px solid rgba(31, 53, 87, .5); font-size: 13px; }
.q-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-status { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-status.ok { color: var(--ok); }
.q-status.bad { color: var(--bad); }
.q-bar { height: 4px; background: #08111f; margin-top: 6px; }
.q-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--glow)); transition: width .2s; }
.q-cancel { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
.q-cancel:hover { color: var(--bad); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 12, .72);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}
.modal { width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.narrow { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; letter-spacing: .1em; text-transform: uppercase; color: var(--chrome); }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-body p { margin: 0 0 10px; line-height: 1.45; }
.modal-body ul.names { margin: 0 0 10px; padding-left: 20px; max-height: 180px; overflow-y: auto; color: var(--chrome); word-break: break-all; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button {
  font: inherit;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 8px 12px;
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--glow); border-bottom-color: var(--glow); }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid + p { margin-top: 14px !important; }
.grid th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--silver); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.grid td { padding: 7px 8px; border-bottom: 1px solid rgba(31, 53, 87, .5); vertical-align: middle; }
.grid td.actions { text-align: right; white-space: nowrap; }
.grid select { width: auto; padding: 4px 6px; }
.add-user { display: grid; grid-template-columns: 1fr 1fr 120px auto; gap: 8px; align-items: end; margin-top: 16px; }
.add-user label { margin: 0; }
.audit td { font-size: 13px; }
.audit .when { color: var(--muted); white-space: nowrap; }
.audit .path { word-break: break-all; color: var(--chrome); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--glow);
  padding: 10px 16px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.toast.bad { border-left-color: var(--bad); }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .disk { margin-left: 0; order: 3; width: 100%; }
  .who { margin-left: auto; }
  .main { padding: 14px 16px 120px; }
  .col-date { display: none; }
  .add-user { grid-template-columns: 1fr; }
  .tool-group.grow { justify-content: flex-start; }
}
