:root {
    color-scheme: light;
    --canvas: #f6f7fb;
    --surface: #fff;
    --ink: #17213a;
    --muted: #56637c;
    --line: #e0e5ef;
    --accent: #244ec6;
    --accent-dark: #193ba2;
    --soft: #edf2ff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #5a7de7; outline-offset: 3px; }
button, a, input { transition: background-color .15s, border-color .15s, color .15s; }
p { margin: 0; }
h1 { margin: 0 0 8px; font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.08; letter-spacing: -.055em; }
h2 { margin: 0 0 8px; font-size: 1.25rem; letter-spacing: -.025em; }
svg { display: block; width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); line-height: 1.5; }
.shell { width: min(1100px, 100% - 64px); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; min-height: 72px; align-items: center; gap: 36px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 750; letter-spacing: -.06em; }
.brand-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: #254fc6; color: white; box-shadow: 0 3px 8px #244ec62c; }
.topbar nav { display: flex; align-items: center; gap: 5px; }
.topbar nav a, .quiet { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; border: 0; border-radius: 8px; padding: 0 12px; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.topbar nav a:hover, .quiet:hover { background: var(--canvas); color: var(--ink); }
.topbar nav [aria-current="page"] { color: var(--accent-dark); background: var(--soft); }
.account { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--accent-dark); background: var(--soft); font-weight: 700; }
.content { padding-block: 54px 60px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 27px; }
.live { display: inline-flex; align-items: center; flex: none; gap: 7px; padding: 6px 10px; border: 1px solid #d4e8de; border-radius: 30px; color: #235941; background: #eff9f3; font-size: .82rem; font-weight: 650; }
.live span { width: 7px; height: 7px; border-radius: 50%; background: #298357; }
.live.disconnected { color: #794909; border-color: #ead9b7; background: #fff6e4; }
.live.disconnected span { background: #a0600c; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 5px 24px #1b2e5108; }
.panel-bar { display: flex; align-items: center; gap: 9px; min-height: 59px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.count { border-radius: 20px; background: var(--soft); padding: 2px 8px; color: var(--accent-dark); font-weight: 650; font-size: .8rem; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { padding: 12px 0; color: var(--muted); font-weight: 600; font-size: .84rem; text-align: left; background: #fafbfe; }
th:first-child { width: 43%; }
th:nth-child(2) { width: 11%; }
th:nth-child(3) { width: 18%; }
th:nth-child(4) { width: 12%; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 16px; }
td { height: 66px; border-top: 1px solid #edf0f6; padding-right: 12px; }
tr:hover td { background: #fafbff; }
.filename { display: flex; align-items: center; gap: 11px; min-width: 0; font-weight: 650; }
.filename:hover span:last-child { color: var(--accent); text-decoration: underline; }
.filename span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { flex: none; display: grid; width: 34px; height: 36px; place-items: center; border-radius: 9px; background: var(--soft); color: var(--accent); }
.file-icon.image { background: #e8f7f3; color: #16715b; }
.file-icon.video { background: #f1ebff; color: #6542a3; }
.size-cell, .date-cell { color: var(--muted); font-size: .86rem; }
.expiry { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: #374b7b; font-size: .83rem; }
.expiry svg { width: 16px; height: 16px; }
.row-actions { display: flex; justify-content: end; gap: 3px; align-items: center; }
.icon-button { display: grid; width: 32px; height: 36px; padding: 0; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--soft); color: var(--accent-dark); }
.icon-button svg { width: 17px; height: 17px; }
.danger:hover { background: #fff0f1; color: #a12d3d; }
.empty { text-align: center; display: grid; justify-items: center; padding: 69px 20px 76px; }
.empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 18px; background: var(--soft); color: var(--accent); border-radius: 18px; }
.empty-icon svg { width: 29px; height: 29px; }
.empty p { max-width: 330px; color: var(--muted); line-height: 1.6; }
.login { width: min(410px, 100% - 36px); min-height: 100svh; margin-inline: auto; display: grid; place-content: center stretch; gap: 23px; padding-block: 36px; }
.login .brand { justify-self: center; }
.login-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: clamp(22px, 6vw, 32px); box-shadow: 0 12px 38px #24375c10; }
.login-card h1 { font-size: 2rem; }
.login-card form { margin-top: 24px; display: grid; gap: 9px; }
label { display: block; font-weight: 650; margin-bottom: 3px; }
input:not([type=checkbox]) { min-width: 0; width: 100%; border: 1px solid #ccd5e5; border-radius: 8px; min-height: 44px; padding: 8px 12px; background: #fff; color: var(--ink); }
.login-card input:not([type=checkbox]) { margin-bottom: 8px; }
.checkbox { display: flex; align-items: center; gap: 7px; font-size: .88rem; margin: 0 0 8px; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }
.primary { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; border: 0; border-radius: 8px; padding: 0 16px; color: #fff; background: var(--accent); font-weight: 650; white-space: nowrap; }
.primary:hover { background: var(--accent-dark); }
.form-error { border-radius: 8px; padding: 10px 12px; background: #fff0f1; color: #9a2639; }
.login-card .form-error { margin-top: 14px; }
.settings + .settings { margin-top: 16px; }
.key-form { display: flex; align-items: end; padding: 20px 22px; gap: 12px; }
.key-form div { width: min(350px, 100%); }
.key-message { margin: 15px 22px; }
.secret { background: #f3f6ff; border-radius: 10px; padding: 15px; margin: 0 22px 20px; }
.secret label { margin-bottom: 8px; }
.secret div { display: flex; gap: 8px; }
.secret input { font-family: ui-monospace, monospace; }
.keys { margin: 0; padding: 0; list-style: none; }
.keys li { display: flex; align-items: center; gap: 12px; min-height: 69px; padding: 10px 22px; }
.keys li + li { border-top: 1px solid var(--line); }
.keys li div { min-width: 0; overflow-wrap: anywhere; }
.keys time { display: block; margin-top: 3px; font-size: .84rem; color: var(--muted); }
.keys form { margin-left: auto; }
dialog { width: min(790px, 100% - 32px); max-height: 90dvh; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #18243b99; }
.dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.dialog-bar strong { overflow-wrap: anywhere; }
dialog img, dialog video { display: block; width: 100%; max-height: 62dvh; object-fit: contain; border-radius: 10px; background: #101828; }
#preview-download { margin-top: 12px; }
.error-page { padding-top: 55px; }
.error-page h1 { font-size: 1.8rem; }
.error-page a { color: var(--accent); text-decoration: underline; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }

@media (max-width: 850px) {
    .shell { width: calc(100% - 36px); }
    th:first-child { width: 36%; }
    th:nth-child(4) { width: 14%; }
}
@media (max-width: 640px) {
    .topbar-inner { flex-wrap: wrap; min-height: auto; gap: 0 10px; padding-top: 12px; }
    .topbar nav { order: 3; width: 100%; padding-block: 8px; }
    .content { padding-top: 31px; }
    .heading { align-items: start; }
    .live { font-size: 0; padding: 7px; }
    th:first-child, td:first-child { padding-left: 12px; }
    th:last-child, td:last-child { padding-right: 8px; }
    table, tbody { display: block; }
    thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
    tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
    tbody tr:last-child { border-bottom: 0; }
    td, td:first-child, td:last-child { display: block; height: auto; border: 0; padding: 0; }
    .name-cell { grid-area: 1 / 1 / 2 / 3; min-width: 0; }
    .size-cell { grid-row: 2; margin-left: 45px; }
    .date-cell { grid-row: 3; margin-left: 45px; }
    .expiry-cell { grid-area: 2 / 2 / 3 / 4; justify-self: end; }
    .actions-cell { grid-area: 1 / 3; }
    .row-actions { gap: 0; }
    .icon-button { width: 30px; }
    .key-form { align-items: stretch; flex-direction: column; }
    .key-form div { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
