:root {
  --bg: #0e1621;
  --panel: #17212b;
  --panel-2: #1c2836;
  --hover: #202b36;
  --active: #2b5278;
  --text: #e9edf1;
  --muted: #708499;
  --accent: #64b5ef;
  --badge: #5288c1;
  --line: rgba(255,255,255,.07);
  --danger: #e37272;
  --success: #6cc070;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 15px/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden], .hidden { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button, .file-btn {
  border: 0;
  background: var(--badge);
  color: #fff;
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, opacity .15s ease;
}
button:hover:not(:disabled), .file-btn:hover { background: #5f9ad6; }
button:disabled { opacity: .35; cursor: default; }
button.secondary, .file-btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
button.secondary:hover:not(:disabled), .file-btn.secondary:hover { background: var(--hover); color: var(--text); }
button.danger, button.delete-link {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(227,114,114,.35);
}
button.danger:hover:not(:disabled), button.delete-link:hover:not(:disabled) { background: rgba(227,114,114,.1); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3846; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #364656; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: #2a3846 transparent; }

.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 22px 38px; }
.brand {
  height: 54px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.brand span { color: var(--accent); }
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
}
h1, h2 { margin: 0; font-weight: 500; }
h1 { font-size: 19px; }
h2 { font-size: 15px; }
.sub { color: var(--muted); font-size: 13px; margin: 5px 0 16px; line-height: 1.45; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.field { flex: 1 1 260px; }
.field.small { flex: 0 1 260px; }
.field label { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}
.field textarea { min-height: 78px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.status { min-height: 20px; margin-top: 9px; font-size: 13px; color: var(--muted); }
.status.error { color: var(--danger); }
.status.ok { color: var(--success); }
.divider { height: 1px; background: var(--line); margin: 20px 0; }

.upload-drop {
  border: 1px dashed #3b4d5f;
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.upload-drop:hover, .upload-drop.drag { border-color: var(--accent); background: #202f3f; }
.upload-drop b { display: block; margin-bottom: 4px; font-weight: 500; }
.upload-drop span { font-size: 12.5px; color: var(--muted); }
.album-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.album-count { font-size: 13px; color: var(--muted); }
.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 8px;
  min-height: 1px;
}
.photo {
  position: relative;
  border: 2px solid transparent;
  border-radius: 9px;
  overflow: hidden;
  background: var(--panel-2);
  aspect-ratio: 1;
  cursor: pointer;
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 130px 130px;
}
.photo:hover { background: var(--hover); }
.photo.selected { border-color: var(--accent); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--panel-2); }
.photo-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 11px; background: linear-gradient(135deg,var(--panel-2),#202e3c); }
.photo .remove {
  position: absolute; top: 5px; right: 5px; width: 27px; height: 27px; padding: 0;
  border-radius: 6px; background: rgba(14,22,33,.88); border: 1px solid var(--line); z-index: 2;
}
.photo .remove:hover { background: rgba(227,114,114,.85); }
.photo .name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 5px;
  background: linear-gradient(transparent,rgba(14,22,33,.92)); font-size: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo .preview-tag { position: absolute; left: 5px; top: 5px; padding: 3px 6px; border-radius: 6px; background: var(--badge); font-size: 9px; font-weight: 600; }
.preview-box { border: 1px solid var(--line); border-radius: 10px; padding: 15px; background: var(--bg); margin-top: 18px; }
.preview-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.file-btn { font-size: 12.5px; padding: 7px 11px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 7px; }
.progress { height: 5px; border-radius: 10px; background: var(--panel-2); overflow: hidden; margin-top: 12px; display: none; }
.progress.on { display: block; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s; }
.result { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); flex-wrap: wrap; }
.result a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; flex: 1; }
.result-card { width: 100%; display: flex; gap: 11px; align-items: center; border-top: 1px solid var(--line); padding-top: 11px; }
.result-card img { width: 105px; height: 68px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.rtitle { font-weight: 500; font-size: 13px; }
.rdesc { font-size: 11px; color: var(--muted); margin-top: 3px; }

.links { display: flex; flex-direction: column; gap: 5px; }
.item {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  background: transparent;
  display: grid;
  grid-template-columns: 86px minmax(210px,1.35fr) minmax(200px,1fr) auto;
  gap: 12px;
  align-items: center;
  border-radius: 8px;
}
.item:last-child { border-bottom-color: transparent; }
.item:hover { background: var(--hover); }
.link-thumb { width: 86px; height: 58px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; color: var(--muted); font-size: 10px; text-align: center; }
.link-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.url { font-size: 13px; color: var(--accent); overflow-wrap: anywhere; }
.link-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; overflow-wrap: anywhere; }
.meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sender-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mini-avatar { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--active); font-size: 11px; font-weight: 600; flex: none; }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pill { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 11px; margin-left: 5px; }
.pill.on { color: #84cc88; background: rgba(108,192,112,.1); }
.pill.off { color: #e99595; background: rgba(227,114,114,.1); }
.actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.actions button { padding: 6px 9px; font-size: 12px; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 9px; }


/* Shared files: photo previews and lightweight cards for all other formats. */
.photo:not(.photo--image){cursor:default;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:7px;padding:12px}
.photo .file-icon{font-size:28px;line-height:1}
.photo .file-type{font-size:11px;color:var(--muted);letter-spacing:.06em;font-weight:700}
.photo .file-meta{font-size:10px;color:var(--muted)}
.photo--image .file-meta{display:none}
.upload-drop:focus-within{border-color:var(--accent)}
@media (max-width: 800px) {
  .wrap { padding: 0 12px 26px; }
  .card { padding: 15px; }
  .item { grid-template-columns: 1fr; padding: 12px 4px; }
  .link-thumb { width: 100%; height: auto; aspect-ratio: 16/7; }
  .row button { width: 100%; }
  .photos { grid-template-columns: repeat(3,1fr); gap: 6px; }
  .upload-drop { padding: 18px 10px; }
  .preview-actions > * { flex: 1 1 auto; }
  .top button { width: auto; }
  .actions { justify-content: flex-start; }
}


/* Link setup: shared Teleshare form language for proxy and custom URLs. */
.link-setup { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:14px; margin-top:16px; }
.link-setup .field { min-width:0; }
.link-mode-switch { display:flex; gap:4px; padding:4px; border:1px solid var(--line); border-radius:10px; background:#121e2b; min-height:43px; }
.link-mode-switch label { flex:1; display:flex; align-items:center; justify-content:center; text-align:center; margin:0; border-radius:7px; padding:8px 12px; font-size:13px; color:#a6b7c9; cursor:pointer; transition:background .15s,color .15s; }
.link-mode-switch input { position:absolute; width:1px; height:1px; opacity:0; }
.link-mode-switch label:has(input:checked) { background:#2b5278; color:#fff; box-shadow:0 1px 4px rgba(0,0,0,.18); }
.link-mode-switch label:has(input:focus-visible) { outline:2px solid var(--accent); outline-offset:1px; }
.slug-field { margin-top:10px; }
.slug-composite { display:flex; align-items:stretch; min-height:43px; width:100%; border:1px solid #30445b; border-radius:9px; background:var(--panel-2); overflow:hidden; transition:border-color .15s; }
.slug-composite:focus-within { border-color:var(--accent); }
.slug-composite.invalid { border-color:var(--danger); }
.slug-prefix { display:flex; align-items:center; flex:none; padding:0 10px 0 13px; color:#91adc5; font-size:13px; border-right:1px solid #30445b; white-space:nowrap; }
.slug-composite input { min-width:0; width:100%; border:0; background:transparent; padding:10px 12px; border-radius:0; font-size:14px; }
.slug-composite input:focus { border:0; }
.proxy-select-shell { position:relative; }
.proxy-select-shell:after { content:''; width:8px; height:8px; border-right:2px solid #9bbbd4; border-bottom:2px solid #9bbbd4; transform:rotate(45deg); position:absolute; right:17px; top:15px; pointer-events:none; }
.field .proxy-select-shell select { display:block; width:100%; min-width:0; height:43px; padding:0 42px 0 14px; appearance:none; -webkit-appearance:none; border:1px solid #30445b; border-radius:9px; background:var(--panel-2); color:var(--text); font:inherit; font-size:14px; outline:none; cursor:pointer; }
.field .proxy-select-shell select:focus-visible { border-color:var(--accent); outline:2px solid var(--accent); outline-offset:1px; }
.field .proxy-select-shell select option { background:var(--panel); color:var(--text); }
.link-setting-hint { margin-top:8px; min-height:18px; font-size:12px; color:#92a5b8; line-height:1.4; }
.link-setting-hint.error { color:var(--danger); }
.video-reveal-settings { margin-top:18px; border:1px solid var(--line); border-radius:12px; background:linear-gradient(180deg,rgba(32,68,99,.34),rgba(12,29,45,.42)); overflow:hidden; }
.video-reveal-settings > summary { list-style:none; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; cursor:pointer; user-select:none; font-weight:700; color:var(--text); }
.video-reveal-settings > summary::-webkit-details-marker { display:none; }
.video-reveal-settings > summary:after { content:'›'; font-size:24px; line-height:1; color:#9eb6ca; transform:rotate(90deg); transition:transform .16s ease; }
.video-reveal-settings[open] > summary:after { transform:rotate(-90deg); }
.video-reveal-summary { display:flex; align-items:center; gap:9px; min-width:0; }
.video-reveal-optional { padding:3px 7px; border-radius:999px; background:rgba(42,171,238,.12); color:#9edcff; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
.video-reveal-panel { border-top:1px solid var(--line); padding:15px 16px 16px; }
.video-reveal-toggle { display:flex; align-items:flex-start; gap:10px; cursor:pointer; font-size:14px; font-weight:650; }
.video-reveal-toggle input { width:17px; height:17px; margin:1px 0 0; accent-color:var(--accent); flex:none; }
.video-reveal-toggle small { display:block; margin-top:4px; color:var(--muted); font-size:11.5px; line-height:1.45; font-weight:400; }
.video-reveal-body { margin-top:15px; }
.video-reveal-queue-note { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 11px; border:1px solid rgba(42,171,238,.16); border-radius:9px; background:rgba(42,171,238,.07); color:var(--muted); font-size:11.5px; line-height:1.45; }
.video-reveal-queue-note b { color:#ccecff; font-size:12px; white-space:nowrap; }
.video-reveal-list { display:flex; flex-direction:column; gap:8px; margin-top:13px; }
.video-reveal-row { display:grid; grid-template-columns:minmax(0,1fr) 138px auto; gap:12px; align-items:center; padding:10px 11px; border:1px solid rgba(255,255,255,.08); border-radius:10px; background:rgba(4,19,32,.34); }
.video-reveal-file { display:flex; align-items:center; gap:9px; min-width:0; }
.video-reveal-file input { width:16px; height:16px; accent-color:var(--accent); flex:none; }
.video-reveal-order { display:grid; place-items:center; min-width:27px; height:22px; padding:0 5px; border-radius:7px; background:rgba(42,171,238,.12); color:#a9e1ff; font-size:10px; font-weight:750; flex:none; }
.video-reveal-file-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12.5px; font-weight:650; }
.video-reveal-time-field { min-width:0; }
.video-reveal-time-field label { display:block; margin-bottom:5px; color:var(--muted); font-size:10px; font-weight:600; }
.video-reveal-time-input { display:flex; align-items:center; min-height:36px; border:1px solid #30445b; border-radius:8px; background:var(--panel-2); overflow:hidden; }
.video-reveal-time-input input { width:100%; min-width:0; height:34px; padding:7px 5px 7px 9px; border:0; border-radius:0; background:transparent; color:var(--text); }
.video-reveal-time-input input:focus { border:0; }
.video-reveal-time-input span { padding:0 9px 0 3px; color:#8fa7bb; font-size:10px; }
.video-reveal-time-input:focus-within { border-color:var(--accent); }
.video-reveal-time-input:has(input:disabled) { opacity:.48; }
.video-reveal-preview { display:flex; align-items:center; justify-content:flex-end; gap:7px; min-width:0; }
.video-reveal-preview .hint { max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.video-reveal-empty { padding:12px; border:1px dashed var(--line); border-radius:9px; color:var(--muted); font-size:12px; text-align:center; }
.pill.reveal { color:#c8b9ff; border-color:rgba(151,119,255,.28); background:rgba(113,80,219,.12); }
@media (max-width:700px) { .link-setup { grid-template-columns:1fr; gap:15px; } .link-mode-switch label { padding:9px 6px; } }
@media (max-width:900px) { .video-reveal-row { grid-template-columns:minmax(0,1fr) 138px; } .video-reveal-preview { grid-column:1/-1; justify-content:flex-start; flex-wrap:wrap; } }
@media (max-width:600px) { .video-reveal-row { grid-template-columns:1fr; } .video-reveal-preview { grid-column:auto; } .video-reveal-queue-note { flex-direction:column; } }

/* Login uses the Console gate layout; authenticated Admin styles stay unchanged. */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  --muted: #95a5b6;
  --accent: #79b9ef;
  width: min(360px, 100%);
  min-width: 0;
  padding: 32px;
  background: var(--panel);
  border-radius: 12px;
  font-size: 14px;
}
.login-panel h1 { font-size: 20px; margin: 0 0 6px; font-weight: 500; }
.login-panel p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-panel button { width: 100%; margin-top: 18px; padding: 10px; font-weight: 400; }
.login-panel .row { display: block; }
.login-panel .field label { font-size: 13px; }
.login-panel .field input { border-radius: 18px; padding: 8px 14px; }
.login-panel .status {
  min-height: 0;
  margin: 12px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.login-panel .status:empty { display: none; }
