:root {
    --bg:          #313338;
    --bg-2:        #2b2d31;
    --bg-3:        #1e1f22;
    --bg-4:        #111214;
    --surface:     #383a40;
    --surface-2:   #404249;
    --border:      #3f4147;
    --border-2:    #4e505a;
    --blurple:     #5865f2;
    --blurple-h:   #4752c4;
    --blurple-dim: #1a1d4f;
    --green:       #23a55a;
    --green-h:     #1a7a44;
    --green-dim:   #1a3a28;
    --green-text:  #3ba55d;
    --red:         #f23f43;
    --red-dim:     #3d1215;
    --red-h:       #a12d30;
    --yellow:      #f0b232;
    --yellow-dim:  #2a2000;
    --text:        #dbdee1;
    --text-muted:  #80848e;
    --text-dim:    #949ba4;
    --white:       #ffffff;
    --radius:      8px;
    --radius-sm:   4px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-3); color: var(--text); font-family: 'Noto Sans', 'Segoe UI', sans-serif; font-size: 14px; min-height: 100vh; display: flex; flex-direction: column; }

/* ── LOGIN ── */
#login-screen { position: fixed; inset: 0; background: var(--bg-4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px; padding: 40px 48px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.login-logo { width: 100px; height: 100px; border-radius: 50%; display: block; margin: 0 auto 24px; object-fit: cover; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }
.field input { background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--white); font-size: 14px; padding: 10px 12px; outline: none; transition: border-color .15s; width: 100%; }
.field input:focus { border-color: var(--blurple); }
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 38px !important; flex: 1; }
.pw-eye { position: absolute; right: 10px; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; line-height: 1; font-size: 15px; transition: color .15s; }
.pw-eye:hover { color: var(--white); }
.admin-pw-wrap { position: relative; display: flex; align-items: center; }
.admin-pw-wrap input { padding-right: 34px !important; flex: 1; width: 100%; box-sizing: border-box; }
.admin-pw-wrap .pw-eye { font-size: 13px; right: 8px; }
.login-error { font-size: 12px; color: var(--red); margin-bottom: 12px; min-height: 16px; text-align: center; }
.btn-login { width: 100%; background: var(--blurple); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s, opacity .15s; margin-top: 4px; }
.btn-login:hover { background: var(--blurple-h); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

/* ── APP ── */
#app { display: none; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── TOPBAR ── */
.topbar { background: var(--bg-2); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 10px; flex-shrink: 0; position: sticky; top: 0; z-index: 10; }
.topbar-logo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--white); flex-shrink: 0; }
.topbar-divider { width: 1px; height: 20px; background: var(--border-2); flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.status-chip { font-size: 12px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-text); animation: pulse 2s ease infinite; }
.status-chip .dot.loading { background: var(--yellow); animation: none; }
.status-chip .dot.error   { background: var(--red); animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.topbar-select-group { display: flex; align-items: center; gap: 6px; }
.topbar-select-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.topbar-select { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--text); font-size: 12px; padding: 4px 8px; outline: none; transition: border-color .15s; cursor: pointer; }
.topbar-select:focus { border-color: var(--blurple); }
.topbar-select option { background: var(--bg-2); }
.btn-reset-defaults { background: none; border: 1px solid var(--border-2); color: var(--text-muted); font-size: 11px; padding: 4px 9px; border-radius: var(--radius-sm); cursor: pointer; transition: color .15s, border-color .15s; white-space: nowrap; flex-shrink: 0; }
.btn-reset-defaults:hover { color: var(--yellow); border-color: var(--yellow); }
.user-chip { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px 3px 6px; font-size: 12px; color: var(--text-dim); }
.user-avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--blurple); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--white); flex-shrink: 0; }
.btn-logout { background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 3px; transition: color .15s; }
.btn-logout:hover { color: var(--red); }

/* ── TOPBAR TABS ── */
.topbar { height: 52px; }
.topbar-tab { font-size: 13px; font-weight: 600; padding: 0 18px; height: 52px; border: none; background: none; color: var(--text-muted); cursor: pointer; transition: color .15s, background .15s; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.topbar-tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.topbar-tab.active { color: var(--white); border-bottom-color: var(--blurple); }


/* ── FILES TOOLBAR ── */
.files-toolbar { background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.files-toolbar-top { display: flex; align-items: center; gap: 10px; }
.files-toolbar-settings { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 8px; }
.files-toolbar-divider { width: 1px; height: 16px; background: var(--border-2); margin: 0 2px; flex-shrink: 0; }



/* ── LAYOUT ── */
.content { flex: 1; display: flex; flex-direction: column; padding: 0; min-height: 0; overflow: hidden; max-width: 1600px; width: 100%; margin: 0 auto; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 160px; max-width: 340px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-wrap input { width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; padding: 7px 10px 7px 32px; outline: none; transition: border-color .15s; }
.search-wrap input:focus { border-color: var(--blurple); }
.search-wrap input::placeholder { color: var(--text-muted); }
.btn-sm { background: none; border: 1px solid var(--border-2); color: var(--text-muted); font-size: 12px; padding: 5px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: color .15s, border-color .15s; white-space: nowrap; }
.btn-sm:hover { color: var(--text); border-color: var(--text-muted); }
/* ── TAB SCROLL AREA ── */
.tab-scroll-area { flex: 1; min-height: 0; overflow: hidden; }

/* ── TAB NAV ── */
.tab-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); background: var(--bg-2); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.tab-btn { font-size: 13px; font-weight: 600; padding: 11px 20px; border: none; background: none; color: var(--text-muted); cursor: pointer; transition: color .15s, background .15s; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab-btn:hover { color: var(--text); background: var(--surface); }
.tab-btn.active { color: var(--white); border-bottom-color: var(--blurple); }
.tab-pane { display: none; height: 100%; flex-direction: column; }
.tab-pane.active { display: flex; }
.panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-header { padding: 11px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-title { font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.panel-count { font-size: 11px; color: var(--text-muted); background: var(--surface); padding: 2px 8px; border-radius: 10px; }

/* ── FILE ROWS ── */
.file-list { display: flex; flex-direction: column; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); transition: background .1s; cursor: pointer; user-select: none; }
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--surface); }
.file-row.sel { background: rgba(88,101,242,.1); border-left: 3px solid var(--blurple); padding-left: 11px; }
.file-row.sel:hover { background: rgba(88,101,242,.16); }
.file-cb { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--blurple); cursor: pointer; pointer-events: none; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.file-size.large { color: var(--yellow); }
.file-s3url { display: flex; align-items: center; gap: 4px; margin-top: 3px; min-width: 0; }
.file-s3url-label { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.file-s3url-link { font-size: 10px; color: var(--blurple); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .15s; }
.file-s3url-link:hover { color: var(--white); text-decoration: underline; }
.btn-dl-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; }
.btn-dl { background: none; border: 1px solid var(--border-2); color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; transition: color .15s, border-color .15s, background .15s; width: 34px; height: 28px; display: flex; align-items: center; justify-content: center; }
.btn-dl:hover { color: var(--white); border-color: var(--blurple); background: var(--blurple); }
.btn-dl:disabled { opacity: .4; cursor: not-allowed; }
.btn-dl svg { pointer-events: none; }
.btn-dl-label { font-size: 9px; color: var(--text-muted); letter-spacing: .03em; pointer-events: none; transition: color .15s; }
.btn-dl-wrap:hover .btn-dl-label { color: var(--blurple); }

/* ── FILE ROW ACTION BUTTONS ── */
.file-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.btn-file-action { background: none; border: 1px solid var(--border-2); color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; transition: color .15s, border-color .15s, background .15s; height: 28px; padding: 0 9px; font-size: 11px; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.btn-file-action:hover { color: var(--white); border-color: var(--text-muted); background: var(--surface-2); }
.btn-file-action.rename:hover { border-color: var(--blurple); color: var(--blurple); background: rgba(88,101,242,.1); }
.btn-file-action.replace:hover { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-dim); }
.btn-file-action.delete:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.btn-file-action:disabled { opacity: .4; cursor: not-allowed; }

/* ── RENAME MODAL ── */
.rename-input-wrap { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 4px; }
.rename-input-label { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.rename-input { background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--white); font-size: 13px; padding: 9px 12px; outline: none; transition: border-color .15s; width: 100%; }
.rename-input:focus { border-color: var(--blurple); }
.rename-input.conflict { border-color: var(--red) !important; }
.rename-conflict-msg { font-size: 11px; color: var(--red); margin-top: 4px; min-height: 14px; line-height: 1.4; }
.rename-old-label { font-size: 11px; color: var(--text-muted); margin-bottom: 14px; word-break: break-all; }
.rename-old-label span { color: var(--text); font-weight: 500; }

/* ── DOCS TAB ── */
.docs-render { max-width: 800px; margin: 0 auto; padding: 28px 24px; line-height: 1.7; color: var(--text); }
.docs-render h1 { font-size: 22px; font-weight: 700; color: var(--white); margin: 0 0 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.docs-render h2 { font-size: 16px; font-weight: 700; color: var(--white); margin: 32px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.docs-render h3 { font-size: 14px; font-weight: 700; color: var(--text-dim); margin: 20px 0 8px; }
.docs-render p  { margin: 0 0 12px; font-size: 13px; }
.docs-render ul, .docs-render ol { margin: 0 0 12px 20px; font-size: 13px; }
.docs-render li { margin-bottom: 4px; }
.docs-render code { background: var(--bg-3); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 12px; color: var(--text-dim); font-family: monospace; }
.docs-render pre { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin: 0 0 14px; }
.docs-render pre code { background: none; border: none; padding: 0; font-size: 12px; }
.docs-render blockquote { border-left: 3px solid var(--blurple); margin: 0 0 12px; padding: 8px 14px; background: rgba(88,101,242,.07); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-muted); font-size: 12px; }
.docs-render blockquote p { margin: 0; }
.docs-render table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 0 0 16px; }
.docs-render th { background: var(--surface); color: var(--text-dim); font-weight: 700; text-align: left; padding: 8px 12px; border: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.docs-render td { padding: 8px 12px; border: 1px solid var(--border); color: var(--text); vertical-align: top; }
.docs-render td:not(:first-child) { text-align: center; }
.docs-render tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.docs-render hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.docs-render a { color: var(--blurple); text-decoration: none; }
.docs-render a:hover { text-decoration: underline; }
.docs-render strong { color: var(--white); font-weight: 600; }
.docs-loading { display: flex; align-items: center; justify-content: center; flex: 1; flex-direction: column; gap: 12px; color: var(--text-muted); font-size: 13px; }
.docs-error { background: var(--red-dim); border: 1px solid var(--red); border-radius: var(--radius-sm); padding: 14px 18px; color: var(--red); font-size: 13px; margin: 20px; }

/* ── ADMIN PANEL SETTINGS ── */
.admin-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.admin-setting-row:last-of-type { border-bottom: none; }
.admin-setting-info { flex: 1; min-width: 0; }
.admin-setting-label { font-size: 13px; font-weight: 600; color: var(--white); margin-bottom: 3px; }
.admin-setting-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.admin-toggle { flex-shrink: 0; width: 52px; height: 28px; border-radius: 14px; border: none; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: .03em; transition: background .2s, color .2s; }
.admin-toggle[data-on="true"]  { background: var(--green); color: var(--white); }
.admin-toggle[data-on="false"] { background: var(--surface-2); color: var(--text-muted); }
.admin-toggle:disabled { opacity: .5; cursor: not-allowed; }

/* ── SKELETON ── */
.skeleton-row { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.skel { border-radius: 4px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0%{background-position:200%} 100%{background-position:-200%} }
@keyframes fadeRow { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

/* ── SELECTION PANEL (floating right) ── */
#sel-panel { position: fixed; right: 24px; top: 64px; width: 360px; background: var(--bg-2); border: 1px solid var(--blurple); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.55); z-index: 15; display: none; flex-direction: column; overflow: hidden; max-height: calc(100vh - 80px); }
#sel-panel.show { display: flex; }
.sel-hdr { padding: 12px 16px; background: rgba(88,101,242,.1); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sel-hdr-title { font-size: 13px; font-weight: 700; color: var(--blurple); }
.sel-hdr-count { font-size: 12px; color: var(--text-muted); background: var(--surface-2); padding: 2px 9px; border-radius: 10px; }
.sel-list { overflow-y: auto; flex: 1; }
.sel-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); }
.sel-item:last-child { border-bottom: none; }
.sel-item-cb { flex-shrink: 0; accent-color: var(--blurple); cursor: pointer; width: 14px; height: 14px; }
.sel-item-info { flex: 1; min-width: 0; }
.sel-item-name { font-size: 12px; font-weight: 500; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-item-size { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.sel-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.sel-email { width: 100%; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; padding: 8px 12px; outline: none; transition: border-color .15s; }
.sel-email:focus { border-color: var(--blurple); }
.sel-email::placeholder { color: var(--text-muted); }
.sel-btns { display: flex; gap: 8px; }
.btn-sel-clear { background: none; border: 1px solid var(--border-2); color: var(--text-muted); font-size: 13px; padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: color .15s, border-color .15s; white-space: nowrap; }
.btn-sel-clear:hover { color: var(--red); border-color: var(--red); }
.btn-sel-create { flex: 1; background: var(--blurple); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; white-space: nowrap; }
.btn-sel-create:hover { background: var(--blurple-h); }
.btn-sel-create:disabled { opacity: .4; cursor: not-allowed; }

/* ── LOG PANEL ── */
.log-panel-header { padding: 11px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; background: var(--bg-2); }
.log-panel-header-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.log-search-wrap { position: relative; }
.log-search-wrap svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.log-search-wrap input { width: 100%; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--text); font-size: 12px; padding: 5px 8px 5px 28px; outline: none; transition: border-color .15s; }
.log-search-wrap input:focus { border-color: var(--blurple); }
.log-search-wrap input::placeholder { color: var(--text-muted); }
.log-filter-tabs { display: flex; gap: 4px; }
.log-filter-tab { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; border: 1px solid transparent; cursor: pointer; transition: background .12s, color .12s, border-color .12s; color: var(--text-muted); background: none; }
.log-filter-tab:hover { color: var(--text); background: var(--surface); }
.log-filter-tab.active { background: var(--surface-2); border-color: var(--border-2); color: var(--white); }
.log-bulk-bar { display: none; align-items: center; gap: 8px; padding: 7px 14px; background: var(--bg-3); border-bottom: 1px solid var(--border); }
.log-bulk-bar.show { display: flex; }
.log-bulk-label { font-size: 12px; color: var(--text-muted); flex: 1; }
.btn-bulk-delete { font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: var(--radius-sm); border: 1px solid var(--red); color: var(--red); background: none; cursor: pointer; transition: background .15s, color .15s; }
.btn-bulk-delete:hover { background: var(--red); color: var(--white); }
.btn-bulk-cancel { font-size: 11px; padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); color: var(--text-muted); background: none; cursor: pointer; transition: color .15s; }
.btn-bulk-cancel:hover { color: var(--text); }

/* ── LOG ITEMS ── */
.log-item { border-bottom: 1px solid var(--border); }
.log-item:last-child { border-bottom: none; }
.log-item.revoked { opacity: .55; }
.log-summary { display: flex; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; transition: background .1s; user-select: none; }
.log-summary:hover { background: var(--surface); }
.log-cb { width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; accent-color: var(--blurple); display: none; }
.log-cb.show { display: block; }
.log-main { flex: 1; min-width: 0; }
.log-name { font-size: 12px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-sub  { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; flex-shrink: 0; white-space: nowrap; }
.log-badge.active    { background: var(--green-dim);  color: var(--green-text); }
.log-badge.partial   { background: var(--yellow-dim); color: var(--yellow); }
.log-badge.exhausted { background: var(--red-dim);    color: var(--red); }
.log-badge.revoked   { background: var(--surface-2);  color: var(--text-muted); }
.log-badge.expired   { background: var(--red-dim);    color: var(--red); }
.log-chevron { color: var(--text-muted); font-size: 10px; flex-shrink: 0; transition: transform .2s; }
.log-item.open .log-chevron { transform: rotate(90deg); }
.log-body { display: none; padding: 0 14px 12px; border-top: 1px solid var(--border); }
.log-item.open .log-body { display: block; }
.log-url-row { display: flex; align-items: center; gap: 6px; margin: 10px 0 8px; }
.log-url { font-size: 11px; color: var(--blurple); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: color .15s; }
.log-url:hover { color: var(--white); text-decoration: underline; }
.log-expiry { font-size: 11px; padding: 5px 8px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.log-expiry.active  { background: var(--green-dim);  color: var(--green-text); }
.log-expiry.expired { background: var(--red-dim);    color: var(--red); }
.log-expiry.none    { background: var(--surface);    color: var(--text-muted); }
.log-files-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 8px 0 4px; }
.log-files-block { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 4px; }
.log-file-row { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.log-file-row:last-child { border-bottom: none; }
.log-file-summary { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.log-file-name { flex: 1; font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-file-count { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.log-file-chevron { font-size: 9px; color: var(--text-muted); flex-shrink: 0; transition: transform .15s; }
.log-file-row.hist-open .log-file-chevron { transform: rotate(90deg); }
.log-file-hist-wrap { margin-top: 4px; }
.log-hist-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; width: fit-content; }
.log-hist-toggle:hover .log-hist-label { color: var(--white); }
.log-hist-label { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--blurple); }
.log-file-history { display: none; margin-top: 4px; padding-left: 2px; }
.log-file-row.hist-open .log-file-history { display: block; }
.log-hist-entry { font-size: 10px; color: var(--text-muted); padding: 3px 0; border-bottom: 1px solid var(--border); line-height: 1.5; }
.log-hist-entry:last-child { border-bottom: none; }
.log-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 6px; }
.btn-log.warn:hover { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-dim); }
.btn-log { font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border-2); background: none; color: var(--text-muted); transition: border-color .15s, color .15s, background .15s; white-space: nowrap; }
.btn-log:hover { border-color: var(--blurple); color: var(--white); background: var(--blurple); }
.btn-log.danger:hover { border-color: var(--red); color: var(--white); background: var(--red-dim); }
.btn-log:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.empty-state { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state .empty-icon { font-size: 28px; opacity: .5; }

/* ── ALPHABET NAV ── */
.alpha-nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; flex-shrink: 0; }
.alpha-btn { width: 22px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-radius: 3px; transition: background .1s, color .1s; user-select: none; border: none; background: none; }
.alpha-btn:hover { color: var(--white); background: var(--surface); }
.alpha-btn.has-files { color: var(--text-dim); }
.alpha-btn.active { color: var(--white); background: var(--blurple); }
.alpha-btn.dimmed { opacity: .25; cursor: default; pointer-events: none; }

/* ── ADMIN MODAL ── */
.admin-input { width:100%;background:var(--bg-3);border:1px solid var(--border-2);border-radius:var(--radius-sm);color:var(--text);font-size:13px;padding:8px 10px;outline:none;transition:border-color .15s;box-sizing:border-box; }
.admin-input:focus { border-color:var(--blurple); }
.admin-input option { background:var(--bg-2); }
.admin-user-row { display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--border); }
.admin-user-row:last-child { border-bottom:none; }
.admin-user-info { flex:1;min-width:0; }
.admin-user-email { font-size:13px;color:var(--white);font-weight:500; }
.admin-user-meta  { font-size:11px;color:var(--text-muted);margin-top:1px; }
.admin-role-badge { font-size:10px;font-weight:700;padding:2px 8px;border-radius:10px;flex-shrink:0;white-space:nowrap; }
.admin-role-badge.owner { background:var(--blurple-dim);color:var(--blurple); }
.admin-role-badge.admin { background:var(--yellow-dim);color:var(--yellow); }
.admin-role-badge.user  { background:var(--surface);color:var(--text-dim); }
.btn-admin-gear { background:none;border:none;color:var(--text-muted);font-size:15px;cursor:pointer;padding:2px 5px;border-radius:3px;transition:color .15s,transform .2s;line-height:1; }
.btn-admin-gear:hover { color:var(--white);transform:rotate(30deg); }

/* ── HIDE NUMBER SPINNERS ── */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ── UPLOAD ── */
#upload-drop.drag-over { border-color: var(--blurple); background: rgba(88,101,242,.06); }
.upload-item { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.upload-item-top { display: flex; align-items: center; gap: 10px; }
.upload-item-name { flex: 1; font-size: 12px; font-weight: 500; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item-size { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.upload-item-status { font-size: 11px; color: var(--text-muted); }
.upload-item-status.done { color: var(--green-text); }
.upload-item-status.error { color: var(--red); }
.upload-progress { height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.upload-progress-bar { height: 100%; background: var(--blurple); transition: width .2s; border-radius: 2px; }

/* ── TOAST ── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--surface-2); border: 1px solid var(--border-2); color: var(--white); font-size: 13px; font-weight: 500; padding: 10px 18px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9999; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 8px; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── EDIT MODAL ── */
.edit-search-wrap { position: relative; }
.edit-search-wrap svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.edit-search-wrap input { width: 100%; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--text); font-size: 12px; padding: 6px 8px 6px 28px; outline: none; transition: border-color .15s; }
.edit-search-wrap input:focus { border-color: var(--blurple); }
.edit-search-wrap input::placeholder { color: var(--text-muted); }
.edit-field-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.edit-file-panel { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); height: 340px; overflow-y: auto; width: 100%; min-width: 0; }
.edit-file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.edit-file-row:last-child { border-bottom: none; }
.edit-file-name { flex: 1; font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── MODALS ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 500; }
.overlay.show { display: flex; }
.modal-card { background: var(--surface); border: 1px solid var(--blurple); border-radius: 12px; padding: 28px 32px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,0.7); }
.modal-card h3 { font-size: 16px; font-weight: 700; color: var(--white); margin-bottom: 8px; }
.modal-card p  { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.modal-detail { font-size: 12px; background: var(--yellow-dim); border: 1px solid var(--yellow); color: var(--yellow); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 16px; text-align: left; line-height: 1.6; white-space: pre-line; }
.modal-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* ── CHOICE MODAL ── */
.choice-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.btn-choice { width: 100%; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); font-size: 13px; font-weight: 500; padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; transition: border-color .15s, background .15s; line-height: 1.4; }
.btn-choice:hover { border-color: var(--blurple); background: rgba(88,101,242,.1); color: var(--white); }
.btn-choice .choice-label { display: block; font-weight: 600; color: var(--white); margin-bottom: 2px; }
.btn-choice .choice-desc  { display: block; font-size: 11px; color: var(--text-muted); }
/* ── REPLACE CONFLICT MODAL ── */
.replace-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.replace-option:hover { background: rgba(88,101,242,.08); border-color: var(--blurple); }
.replace-option.selected { background: rgba(88,101,242,.14); border-color: var(--blurple); }
.replace-option input[type=radio] { margin-top: 2px; accent-color: var(--blurple); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.replace-opt-text { flex: 1; }
.replace-opt-label { font-size: 12px; font-weight: 600; color: var(--white); line-height: 1.4; }
.replace-opt-desc  { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.replace-rename-wrap { margin: 2px 0 4px 24px; display: none; }
.replace-rename-wrap.show { display: block; }
.replace-rename-input { width: 100%; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--white); font-size: 12px; padding: 7px 10px; outline: none; transition: border-color .15s; margin-top: 6px; }
.replace-rename-input:focus { border-color: var(--blurple); }
.replace-rename-input.conflict { border-color: var(--red); }
.replace-rename-msg { font-size: 11px; margin-top: 4px; min-height: 14px; }
.replace-rename-msg.ok  { color: var(--green-text); }
.replace-rename-msg.err { color: var(--red); }
.btn-modal-cancel  { background: var(--surface); border: 1px solid var(--border-2); color: var(--text); font-size: 13px; font-weight: 600; padding: 8px 20px; border-radius: var(--radius-sm); cursor: pointer; }
.btn-modal-cancel:hover { background: var(--surface-2); }
.btn-modal-ok { background: var(--red-dim); border: 1px solid var(--red); color: var(--red); font-size: 13px; font-weight: 600; padding: 8px 20px; border-radius: var(--radius-sm); cursor: pointer; }
.btn-modal-ok:hover { background: var(--red); color: var(--white); }
.btn-modal-confirm { background: var(--blurple); border: 1px solid var(--blurple); color: var(--white); font-size: 13px; font-weight: 600; padding: 8px 20px; border-radius: var(--radius-sm); cursor: pointer; }
.btn-modal-confirm:hover { background: var(--blurple-h); }
.btn-modal-confirm:disabled { opacity: .4; cursor: not-allowed; }
.btn-modal-reset { background: none; border: 1px solid var(--border-2); color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 8px 20px; border-radius: var(--radius-sm); cursor: pointer; }
.btn-modal-reset:hover { color: var(--yellow); border-color: var(--yellow); }

/* ── VIEWER ROLE BADGE ── */
.admin-role-badge.viewer { background:var(--green-dim);color:var(--green-text); }

/* ── DL-LOG ITEMS ── */
.dllog-item { display:flex; align-items:center; gap:10px; padding:9px 14px;
    border-bottom:1px solid var(--border); transition:background .1s; cursor:default; }
.dllog-item:last-child { border-bottom:none; }
.dllog-item:hover { background:var(--surface); }
.dllog-item.selected { background:rgba(88,101,242,.18); border-color:rgba(88,101,242,.3); }
.dllog-item.selected:hover { background:rgba(88,101,242,.25); }
.dllog-cb { flex-shrink:0; width:14px; height:14px; accent-color:var(--blurple);
    cursor:pointer; display:none; }
.dllog-cb.show { display:block; }
.dllog-info { flex:1; min-width:0; }
.dllog-name { font-size:12px; font-weight:500; color:var(--white);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dllog-meta { font-size:11px; color:var(--text-muted); margin-top:1px; }

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 640px) {
    .topbar { height:auto !important; flex-wrap:wrap; padding:0 10px; row-gap:0; }
    .topbar-logo  { order:1; margin:8px 0; }
    .topbar-title { order:2; flex:1; margin:8px 0; font-size:13px; }
    .topbar > div[style*="flex:1"] { display:none; }
    .status-chip { display:none; }
    .topbar-right { order:3; margin:4px 0; gap:6px; }
    .topbar-divider:first-of-type { display:none; }
    .topbar-tabs-row {
        order:4; width:100%; display:flex;
        overflow-x:auto; -webkit-overflow-scrolling:touch;
        scrollbar-width:none; border-top:1px solid var(--border);
    }
    .topbar-tabs-row::-webkit-scrollbar { display:none; }
    .topbar-tab { height:38px !important; padding:0 13px !important; font-size:11px !important; flex-shrink:0; }
    #admin-overlay .modal-card {
        max-width:100% !important; width:calc(100vw - 12px) !important;
        padding:18px 14px !important; max-height:calc(100dvh - 16px) !important; overflow-y:auto;
    }
    .admin-user-row { flex-wrap:wrap; padding:8px 10px; gap:6px; }
    .files-toolbar { padding:8px 10px; }
    .files-toolbar-top { flex-wrap:wrap; gap:6px; }
    /* File list — mobile: hide action buttons, wrap filename, keep download */
    .file-actions { display:none !important; }
    .file-name { white-space:normal !important; overflow:visible !important; text-overflow:unset !important; word-break:break-word; }
    .file-s3url { display:none !important; }
    .file-row { flex-wrap:nowrap; align-items:flex-start; padding:10px 12px; }
    .file-cb { margin-top:3px; }
    .alpha-nav { display:none; }
}

.docs-section { display:flex; flex-direction:column; gap:10px; }
.docs-table-title { font-size:14px; font-weight:700; color:var(--white); }
.docs-desc { font-size:12px; color:var(--text-muted); line-height:1.6; }
.docs-table { width:100%; border-collapse:collapse; font-size:12px; }
.docs-table th { text-align:left; padding:7px 10px; background:var(--surface); color:var(--text-muted); font-weight:600; border-bottom:1px solid var(--border); }
.docs-table td { padding:7px 10px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:top; }
.docs-table td:first-child { font-family:monospace; color:var(--blurple); white-space:nowrap; }
.docs-table td:nth-child(2) { color:var(--text-muted); white-space:nowrap; }
.docs-table code { background:var(--surface); padding:1px 5px; border-radius:3px; font-size:11px; color:var(--yellow); }
.docs-alerts { font-size:11px; color:var(--text-muted); padding:7px 10px; background:var(--surface); border-radius:5px; border-left:3px solid var(--blurple); }
.docs-badge { display:inline-block; padding:1px 7px; border-radius:10px; font-size:11px; font-weight:600; }
.docs-badge.warn  { background:var(--yellow-dim); color:var(--yellow); }
.docs-badge.error { background:rgba(237,66,69,.15); color:#ed4245; }
.docs-badge.info  { background:var(--blurple-dim); color:var(--blurple); }
