/* picbox - shared styles */
:root {
  --bg: #0a0b0e;
  --bg-soft: #0e1015;
  --panel: #12151b;
  --panel-2: #171b23;
  --line: #232936;
  --line-soft: #1b202a;
  --text: #e8ebf2;
  --dim: #8d95a9;
  --dim-2: #646c7e;
  --accent: #7c8cff;
  --accent-2: #b06dff;
  --ok: #3ddc97;
  --warn: #ffb020;
  --err: #ff5d6c;
  --radius: 14px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.9);
}
[hidden] { display: none !important; }


* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(124, 140, 255, 0.16), transparent 60%),
    radial-gradient(800px 480px at 92% -14%, rgba(176, 109, 255, 0.12), transparent 62%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1180px, 100% - 40px); margin: 0 auto; }

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 11, 14, 0.72);
  border-bottom: 1px solid var(--line-soft);
}
.top-in {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 17px;
}
.brand:hover { text-decoration: none; }
.logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #0b0d12;
  box-shadow: 0 6px 18px -6px rgba(124, 140, 255, 0.8);
}
.logo svg { width: 15px; height: 15px; }
.brand small {
  font-weight: 500;
  color: var(--dim-2);
  font-size: 12px;
  letter-spacing: 0.02em;
  margin-left: 2px;
}
.spacer { flex: 1; }

/* ---------- buttons / inputs ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s, transform 0.06s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { background: #1c212b; border-color: #2e3646; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #0a0b10;
  font-weight: 650;
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-danger { color: var(--err); border-color: rgba(255, 93, 108, 0.32); background: rgba(255, 93, 108, 0.07); }
.btn-danger:hover { background: rgba(255, 93, 108, 0.14); border-color: rgba(255, 93, 108, 0.5); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }

.input, .select {
  appearance: none;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.input:focus, .select:focus {
  border-color: rgba(124, 140, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.13);
}
.input::placeholder { color: var(--dim-2); }
.select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d95a9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* ---------- layout blocks ---------- */
.hero { padding: 46px 0 10px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 700;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent) 10%, var(--accent-2) 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 0; color: var(--dim); font-size: 15.5px; max-width: 620px; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill {
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line);
  background: rgba(23, 27, 35, 0.6);
  padding: 5px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pill b { color: var(--text); font-weight: 600; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ---------- dropzone ---------- */
.drop {
  margin-top: 26px;
  border: 1.5px dashed #2b3242;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23, 27, 35, 0.55), rgba(14, 16, 21, 0.5));
  padding: 38px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
  position: relative;
}
.drop:hover { border-color: #3a4356; background: linear-gradient(180deg, rgba(27, 32, 42, 0.7), rgba(14, 16, 21, 0.5)); }
.drop.drag {
  border-color: var(--accent);
  background: rgba(124, 140, 255, 0.08);
  transform: scale(1.005);
}
.drop-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, rgba(124, 140, 255, 0.18), rgba(176, 109, 255, 0.14));
  border: 1px solid rgba(124, 140, 255, 0.25);
  color: var(--accent);
}
.drop-icon svg { width: 24px; height: 24px; }
.drop h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.drop p { margin: 0; color: var(--dim-2); font-size: 13px; }
.drop kbd {
  font: 11.5px/1 ui-monospace, "Cascadia Code", Consolas, monospace;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: var(--panel-2);
  color: var(--dim);
  padding: 3px 6px;
  border-radius: 5px;
}

/* ---------- upload queue ---------- */
.queue { margin-top: 16px; display: grid; gap: 8px; }
.qitem {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  animation: rise 0.2s ease both;
}
.qitem .qthumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-2);
  flex: none;
}
.qitem .qname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .qstate { color: var(--dim-2); font-size: 12px; flex: none; }
.qbar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; width: 90px; }
.qbar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.15s; }
.qitem.ok .qstate { color: var(--ok); }
.qitem.err .qstate { color: var(--err); }

/* ---------- gallery ---------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 16px;
}
.section-head h2 { margin: 0; font-size: 17px; font-weight: 620; letter-spacing: -0.01em; }
.count {
  font-size: 12px;
  color: var(--dim);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  cursor: zoom-in;
  animation: rise 0.25s ease both;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.tile:hover img { transform: scale(1.04); }
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 32%, transparent 55%, rgba(0, 0, 0, 0.72) 100%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.tile:hover::after { opacity: 1; }
.tile .meta {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #dfe4ee;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.tile .acts {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s;
}
.tile:hover .meta, .tile:hover .acts { opacity: 1; }
.icon-btn {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 14, 18, 0.72);
  backdrop-filter: blur(6px);
  color: #e8ebf2;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(30, 34, 44, 0.95); }
.icon-btn.del:hover { background: rgba(255, 93, 108, 0.9); color: #fff; }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- empty state ---------- */
.empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 44px 20px;
  text-align: center;
  color: var(--dim-2);
  font-size: 14px;
}
.empty b { color: var(--dim); display: block; margin-bottom: 4px; font-weight: 600; }

/* ---------- modal / lightbox ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 7, 10, 0.78);
  backdrop-filter: blur(6px);
}
.modal.open { display: flex; animation: fade 0.15s ease both; }
.sheet {
  width: min(430px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: pop 0.18s ease both;
}
.sheet h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.sheet p { margin: 0 0 16px; color: var(--dim); font-size: 13.5px; }
.sheet .row { display: flex; gap: 10px; margin-top: 14px; }
.sheet .row .btn { flex: 1; justify-content: center; }
.sheet .input { width: 100%; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 9, 0.92);
  padding: 30px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; animation: fade 0.15s ease both; }
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 90px);
  border-radius: 8px;
  box-shadow: 0 30px 80px -20px #000;
  object-fit: contain;
}
.lb-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent);
  font-size: 13px;
  color: var(--dim);
}
.lb-bar .mono { color: var(--text); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 120;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  background: #1a1f29;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  padding: 9px 15px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease both;
  max-width: 90vw;
}
.toast.ok { border-color: rgba(61, 220, 151, 0.4); }
.toast.err { border-color: rgba(255, 93, 108, 0.45); color: #ffd3d7; }

/* ---------- admin ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 26px 0 20px;
}
.stat {
  background: linear-gradient(180deg, rgba(23, 27, 35, 0.8), rgba(18, 21, 27, 0.8));
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 15px 16px;
}
.stat .k {
  font-size: 11.5px;
  color: var(--dim-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .v {
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat .s { font-size: 12px; color: var(--dim); margin-top: 2px; }
.bar {
  height: 5px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 6px 0 14px;
}
.toolbar .input { flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .grow { flex: 1; }

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim-2);
  font-weight: 600;
  padding: 11px 14px;
  background: rgba(23, 27, 35, 0.6);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(124, 140, 255, 0.045); }
.tbl .media { display: flex; align-items: center; gap: 12px; }
.tbl .thumb-sm {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}
.tbl .id { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; color: var(--dim); }
.tbl .acts-cell { text-align: right; white-space: nowrap; }
.tbl .acts-cell .icon-btn { display: inline-grid; margin-left: 4px; background: var(--panel-2); border-color: var(--line); }
.tbl .acts-cell .icon-btn:hover { background: #212734; }
.tbl .acts-cell .icon-btn.del:hover { background: rgba(255, 93, 108, 0.9); color: #fff; }
.tbl input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.tbl tr.sel { background: rgba(124, 140, 255, 0.08); }
.tbl .exp { color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.tbl .exp.soon { color: var(--warn); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--dim);
}


.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.muted { color: var(--dim); }
.hidden { display: none !important; }

/* ---------- animations ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (hover: none) {
  .tile .meta, .tile .acts { opacity: 1; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  .hero { padding: 30px 0 4px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .tbl th:nth-child(4), .tbl td:nth-child(4) { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 19px; }
  .top-in { height: 56px; }
  .brand small { display: none; }
}

/* ---------- expiry picker (upload) ---------- */
.ttl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 8px 0 18px;
}
.ttl-label {
  font-size: 11.5px;
  color: var(--dim-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-right: 3px;
}
.ttl-opt {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 9px;
  padding: 6px 11px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ttl-opt:hover { color: var(--text); border-color: #2f3748; }
.ttl-opt.is-on {
  color: var(--text);
  border-color: rgba(124, 140, 255, 0.55);
  background: rgba(124, 140, 255, 0.13);
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  margin: 24px 0 4px;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 14px 11px;
  color: var(--dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- status tab ---------- */
.pills-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 14px;
}
.chart-card {
  background: linear-gradient(180deg, rgba(23, 27, 35, 0.8), rgba(18, 21, 27, 0.8));
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 13px 16px 9px;
}
.chart-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.chart-head h3 {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim-2);
  font-weight: 600;
}
.legend { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); }
.legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.legend span { margin-right: 6px; }
.chart { width: 100%; height: 150px; display: block; }
.chart-foot { font-size: 11px; color: var(--dim-2); padding-top: 6px; font-variant-numeric: tabular-nums; }
.live { font-size: 11.5px; color: var(--ok); display: inline-flex; align-items: center; gap: 6px; }
.live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(61, 220, 151, 0.8);
}
.live.stale { color: var(--warn); }
.live.stale::before { background: var(--warn); box-shadow: 0 0 8px rgba(255, 176, 32, 0.7); }
.fine { color: var(--dim-2); font-size: 12px; margin: 16px 0 44px; }
td.perm { color: var(--ok); font-weight: 600; }

/* ---------- account chrome ---------- */
.small { font-size: 12px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  color: var(--text);
}
.user-chip b { font-weight: 600; }
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  color: #0b0d12;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.ttl-note { font-size: 12px; color: var(--dim-2); margin-left: auto; }

/* ---------- auth pages ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; }
.auth-body .top { height: 62px; display: flex; align-items: center; padding: 0 22px; }
.auth-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 36px 16px 72px;
  box-sizing: border-box;
}
.auth-card {
  width: 100%;
  max-width: 396px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(23, 27, 35, 0.94), rgba(18, 21, 27, 0.94));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 24px 26px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5);
  animation: pop 0.25s ease both;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  padding: 4px;
  border-radius: 11px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: none;
  color: var(--dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.is-on { background: #1b2130; color: var(--text); }
.auth-form h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-form > p.muted { margin: 0 0 18px; font-size: 13px; line-height: 1.55; }
.field { display: block; margin: 0 0 14px; }
.field > span {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim-2);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input {
  width: 100%;
  box-sizing: border-box;
  background: #0f131b;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: rgba(124, 140, 255, 0.65); box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.14); }
.field .hint { display: block; margin-top: 5px; font-size: 11.5px; color: var(--dim-2); }
.auth-error {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(255, 93, 108, 0.1);
  border: 1px solid rgba(255, 93, 108, 0.3);
  color: #ffb4bb;
  font-size: 12.5px;
}
.btn.wide { width: 100%; justify-content: center; }
.auth-foot { margin: 0; text-align: center; max-width: 380px; line-height: 1.55; }

@media (max-width: 520px) {
  .ttl-note { margin-left: 0; width: 100%; }
  .user-chip b { display: none; }
}

.role-select { padding: 5px 26px 5px 9px; font-size: 12.5px; width: 110px; }

/* ---------- v3: upload page, tables, user menu ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
  padding: 0 max(20px, calc((100% - 1180px) / 2));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 11, 14, 0.74);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .brand { gap: 9px; }
.brand-sub { color: var(--dim-2); font-size: 12px; letter-spacing: 0.02em; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.user-menu { position: relative; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.user-chip:hover { border-color: #303748; background: #161a22; }
.user-chip b { font-size: 13px; font-weight: 550; }
.user-chip svg { color: var(--dim-2); }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  color: #0b0d12;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}
.avatar-sm { width: 22px; height: 22px; font-size: 11px; display: inline-grid; vertical-align: -6px; margin-right: 6px; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 186px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.menu-item:hover { background: var(--panel-2); text-decoration: none; }
.menu-item.danger { color: #ff8a94; }

/* ---------- generic layout ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.stat-label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim-2); font-weight: 600; }
.stat-value { display: block; font-size: 23px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  height: 38px;
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--dim-2);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; }
.search input::placeholder { color: var(--dim-2); }
.search-clear { border: 0; background: none; color: var(--dim); font-size: 17px; line-height: 1; cursor: pointer; }
.toolbar-acts { display: flex; gap: 8px; margin-left: auto; }
.subhead { display: flex; align-items: center; gap: 10px; margin: 24px 0 8px; }
.subhead .spacer { flex: 1; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }

/* ---------- upload page ---------- */
.wrap-upload { padding-bottom: 60px; display: flex; align-items: center; min-height: calc(100vh - 62px); }
.wrap-upload .upload-card { width: 100%; }
.upload-card { max-width: 760px; margin: 42px auto 0; padding: 20px 22px 22px; }
.upload-card-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.upload-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.ttl-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ttl-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim-2); font-weight: 600; }
.drop-compact {
  margin-top: 16px;
  padding: 30px 20px;
  min-height: 172px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: rgba(18, 21, 27, 0.55);
  cursor: pointer;
}
.drop-compact:hover, .drop-compact.is-over { border-color: var(--accent); background: rgba(124, 140, 255, 0.06); }
.drop-compact b { font-size: 14px; font-weight: 550; }
.drop-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  color: var(--accent);
  background: rgba(124, 140, 255, 0.12);
}
kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel-2);
  font-size: 11.5px;
}

.queue-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.q-thumb { width: 46px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--panel); border: 1px solid var(--line-soft); }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.q-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-bar { height: 4px; margin-top: 7px; border-radius: 3px; background: var(--line); overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.15s ease; }
.q-state { font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.q-state.ok { color: var(--ok); }
.q-state.bad { color: var(--err); }
.q-acts { display: flex; gap: 6px; }

/* ---------- tables ---------- */
.table-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; }
.table-card .tbl { border-collapse: collapse; }
tbl.hidden { display: none; }
.tbl.hidden { display: none; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th.is-sorted { color: var(--text); }
.tbl .arrow { margin-left: 5px; color: var(--accent); font-size: 11px; }
.th-check { width: 42px; }
.th-thumb { width: 58px; }
.th-acts { width: 128px; text-align: right; }
.td-check { width: 42px; }
.td-thumb { width: 58px; }
.td-thumb img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; display: block; background: var(--panel-2); border: 1px solid var(--line-soft); }
.td-name { min-width: 180px; }
.name-btn {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.name-btn:hover { color: var(--accent); }
.name-plain { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-name .sub { font-size: 11px; color: var(--dim-2); margin-top: 2px; }
.td-owner { font-size: 13px; }
.td-acts { text-align: right; white-space: nowrap; }
.td-acts .acts-row { display: flex; justify-content: flex-end; align-items: center; gap: 5px; height: 27px; }
.td-acts .icon-btn { display: inline-grid; width: 27px; height: 27px; padding: 0; background: var(--panel-2); border: 1px solid var(--line); }
.td-acts .icon-btn:hover { background: #212734; color: var(--text); }
.td-acts .icon-btn.danger:hover { background: rgba(255, 93, 108, 0.9); color: #fff; border-color: transparent; }
.exp { color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.exp.perm { color: var(--ok); }
.exp.soon { color: var(--warn); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.table-foot .pager { margin: 0; }
.bulkbar[hidden] { display: none; }
.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 9px 13px;
  border: 1px solid rgba(124, 140, 255, 0.3);
  border-radius: 12px;
  background: rgba(124, 140, 255, 0.08);
  font-size: 13px;
}
.bulkbar b { font-weight: 550; }
.no-select .th-check, .no-select .td-check { display: none; }
td.link-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head p { margin: 3px 0 0; }
.inline-form { display: flex; align-items: center; gap: 8px; }
.select {
  appearance: none;
  padding: 7px 26px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238d95a9' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.tbl-flat th { background: transparent; }
.danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 26px;
  border-color: rgba(255, 93, 108, 0.24);
  background: rgba(255, 93, 108, 0.04);
}
.danger-card p { margin: 3px 0 0; }
.btn-danger-ghost { border-color: rgba(255, 93, 108, 0.4); color: #ff9aa3; background: rgba(255, 93, 108, 0.08); }
.btn-danger-ghost:hover { background: rgba(255, 93, 108, 0.16); }

/* ---------- modals (hidden attribute driven) ---------- */
.modal { display: flex; }
.modal[hidden] { display: none; }
.modal-card {
  width: min(440px, 100%);
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: pop 0.18s ease both;
}
.modal-card h3 { margin: 0 0 4px; font-size: 16.5px; letter-spacing: -0.01em; }
.modal-card p { margin: 0 0 12px; }
.modal-wide { width: min(560px, 100%); }
.modal-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.perm-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; margin: 10px 0 0; }
.perm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 12.5px;
  cursor: pointer;
}
.perm-row > span { display: flex; flex-direction: column; gap: 1px; }
.perm-row .muted { font-size: 11.5px; }

/* ---------- status ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 12px; }
.chart-card { padding: 12px 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 12px; color: var(--dim); }
.chart-head b { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; }
.legend .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.legend .sw:first-child { margin-left: 0; }
.sw-down, .sw-read { background: #5c85ff; }
.sw-up, .sw-write { background: #4fd6b8; }
.chart-card canvas { width: 100%; height: 150px; display: block; }
.chart-foot { margin-top: 6px; font-size: 11.5px; color: var(--dim); }

@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .brand-sub { display: none; }
  .page-head { align-items: stretch; }
  .search { min-width: 0; width: 100%; }
  .upload-card { margin-top: 20px; }
  .charts { grid-template-columns: 1fr; }
  .col-owner, .td-owner { display: none; }
  .q-acts { grid-column: 1 / -1; justify-content: flex-end; }
  .queue-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
}

/* ---------- thumb preview ---------- */
.td-thumb .thumb-btn {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 6px;
  cursor: zoom-in;
  line-height: 0;
}
.td-thumb .thumb-btn img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  transition: transform .12s ease, border-color .12s ease;
}
.td-thumb .thumb-btn:hover img { transform: scale(1.06); border-color: var(--accent); }

body.no-scroll { overflow: hidden; }

.preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 72px 96px;
  background: rgba(6, 7, 12, .9);
  backdrop-filter: blur(6px);
}
.preview img {
  max-width: min(92vw, 1400px);
  max-height: calc(100vh - 180px);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  background: #0b0c12;
}
.pv-btn {
  position: absolute;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 22, 32, .8);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.pv-btn:hover { background: rgba(40, 44, 60, .9); border-color: var(--accent); }
.pv-close { top: 16px; right: 20px; }
.pv-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.pv-next { right: 16px; top: 50%; transform: translateY(-50%); }
.pv-bar {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 14px;
  max-width: 92vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(16, 18, 26, .88);
  border: 1px solid var(--line);
}
.pv-name { font-weight: 600; }
.pv-bar .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-link { color: var(--accent); font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.pv-link:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .preview { padding: 48px 12px 104px; }
  .pv-close { top: 10px; right: 12px; }
  .pv-prev { left: 8px; }
  .pv-next { right: 8px; }
  .pv-bar { flex-wrap: wrap; gap: 6px 12px; }
}

/* ---------- native control polish ---------- */
html { scrollbar-width: thin; scrollbar-color: #262a3a transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #262a3a;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #353b50; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  border: 1px solid #333a4d;
  border-radius: 5px;
  background: #10131b;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  vertical-align: middle;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
input[type="checkbox"]:hover { border-color: #4a5470; }
input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
input[type="checkbox"]:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
input[type="checkbox"]:focus-visible { outline: 2px solid rgba(124, 140, 255, .55); outline-offset: 2px; }
input[type="checkbox"]:disabled { opacity: .45; cursor: default; }

select.select {
  height: 34px;
  padding: 0 34px 0 11px;
  line-height: 32px;
  border-radius: 9px;
  background-color: var(--bg-soft);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d95a9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text);
  cursor: pointer;
}
select.select option { background: #12141c; color: var(--text); }
select.select.role-select {
  width: 106px;
  height: 30px;
  padding: 0 26px 0 10px;
  line-height: 28px;
  font-size: 12.5px;
  background-position: right 8px center;
}
#inviteRole { min-width: 104px; }

/* ---------- themed dialogs (ui.js) ---------- */
.pb-card { width: min(440px, 92vw); }
.pb-card h3 { margin: 0 0 6px; font-size: 17px; }
.pb-msg { margin: 0 0 14px; line-height: 1.5; }
.pb-msg.pb-error { color: var(--err); }
.pb-input { width: 100%; margin: 0 0 6px; }
#pbTitle.pb-danger { color: var(--err); }
