/* Moje Pliki - grayscale only: white background, dark-gray text, gray lines and icons. */
:root {
    --bg: #ffffff;
    --fg: #262626;
    --muted: #6e6e6e;
    --faint: #9e9e9e;
    --line: #e4e4e4;
    --fill: #f5f5f5;
    --strong: #333333;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}

h1 { font-size: 22px; font-weight: 600; margin: 0; }

.center {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.status { font-family: var(--mono); font-size: 32px; color: var(--faint); margin: 0; }

/* Single-column pages (installer, forms) */
.page {
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 0 56px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
h2 { font-size: 17px; font-weight: 600; margin: 8px 0 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.stack { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 14px; color: var(--muted); }

.field {
    font: inherit;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    width: 100%;
}
.field:focus { outline: none; border-color: var(--fg); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 500;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 18px;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--fill); }
.btn.primary { background: var(--strong); border-color: var(--strong); color: #ffffff; }
.btn.primary:hover { background: var(--fg); }
.btn:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.error {
    border: 1px solid var(--line);
    border-left: 3px solid var(--fg);
    padding: 10px 12px;
    border-radius: 6px;
}

.checks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.checks li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checks .mark { font-family: var(--mono); font-size: 12px; width: 40px; flex-shrink: 0; color: var(--faint); padding-top: 2px; }
.checks .fail .mark { color: var(--fg); font-weight: 600; }

.code {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--fill);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0;
}

.qr { display: block; width: 220px; height: 220px; max-width: 100%; margin: 0 auto; }

.codes {
    margin: 0;
    padding: 12px 12px 12px 40px;
    background: var(--fill);
    border-radius: 6px;
    columns: 2;
    font-size: 15px;
    line-height: 1.9;
}
a { color: var(--fg); }

/* Phone login (mockup: title + one button) */
.login-screen { gap: 28px; }
.app-title { font-size: 26px; }
.btn svg { margin-right: 8px; }
.quiet-link { font-size: 13px; color: var(--faint); }

/* Admin panel */
.app { max-width: 560px; margin: 0 auto; }
.app-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 58px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.app-head h1 { font-size: 17px; }
.head-left, .head-actions { display: flex; align-items: center; gap: 2px; }
.head-actions form { display: contents; }
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--muted);
    cursor: pointer;
}
.icon-btn:hover { background: var(--fill); color: var(--fg); }
.notice { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-left: 3px solid var(--fg); border-radius: 6px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.set { padding: 20px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.set h2 { margin: 0; font-size: 15px; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rows { width: 100%; }
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; overflow-wrap: anywhere; }
.narrow-top { padding-top: 24px; }
.center-text { text-align: center; align-items: center; }
.btn.block { width: 100%; }

/* Approving a computer */
.code-in { font-family: var(--mono); font-size: 28px; letter-spacing: .12em; text-align: center; text-transform: uppercase; }
.req { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.req h2 { margin: 0; }
.req dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.req dt { color: var(--muted); }
.req dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Untrusted computer (no frame, no header: only what is needed) */
.pc { max-width: 520px; margin: 0 auto; padding: 24px 0 48px; }
.pc-login { max-width: 360px; margin: 24px auto; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.code-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.pair-code { font-family: var(--mono); font-size: 44px; letter-spacing: .08em; font-weight: 500; line-height: 1.1; }
.wait { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.pc-login hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.totp { width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.totp .row { display: flex; gap: 8px; }
.totp .field { flex: 1; letter-spacing: .2em; font-size: 17px; }
.pc-upload { display: flex; flex-direction: column; gap: 20px; }
.top-right { display: flex; justify-content: flex-end; }
.timer { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--fg); font-weight: 600; }
.slots { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.upload-foot { display: flex; flex-direction: column; }
.slots.drag { background: var(--fill); }
.slot { display: grid; grid-template-columns: 28px 1fr 34px; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 64px; }
.slot-mark { display: grid; place-items: center; color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; }
.slot-mark.ok { color: var(--fg); }
.slot-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.slot-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-sub { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--strong); transition: width .15s linear; }
.pick { display: flex; align-items: center; gap: 8px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-size: 15px; }
.pick:hover { background: var(--fill); color: var(--fg); }
.pick:focus-within { outline: 2px solid var(--fg); outline-offset: 2px; }
.icon-btn.sm { width: 34px; height: 34px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* File list (phone) */
.files { list-style: none; margin: 0; padding: 0; }
.file { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.file-info { min-width: 0; }
.file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.file-actions { display: flex; }
.list-foot { padding: 14px 0; font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* Dialogs */
dialog.sheet {
    border: 0;
    border-radius: 14px;
    padding: 24px 20px 18px;
    width: calc(100% - 32px);
    max-width: 380px;
    color: var(--fg);
    background: var(--bg);
}
dialog.sheet[open] { display: flex; flex-direction: column; gap: 14px; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .28); }
dialog.sheet h2 { margin: 0; }
.name { overflow-wrap: anywhere; }

/* Settings */
.settings { display: flex; flex-direction: column; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.set-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.num-in { width: 86px; text-align: center; font-variant-numeric: tabular-nums; }
.num-in:disabled { color: var(--faint); background: var(--fill); }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; flex-shrink: 0; margin: 0; transition: background .15s; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); transition: transform .15s; }
.switch:checked { background: var(--strong); }
.switch:checked::before { transform: translateX(18px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-family: var(--mono); font-size: 13px; border: 1px solid var(--line); background: var(--bg); color: var(--faint); border-radius: 6px; padding: 6px 10px; text-decoration: line-through; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--fill); color: var(--fg); border-color: var(--faint); text-decoration: none; }
.add-row { display: flex; gap: 8px; width: 100%; }
.blocked { display: flex; flex-direction: column; gap: 6px; width: 100%; padding-top: 4px; }
.blocked-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.add-row .field { flex: 1; }
.save-bar { padding: 20px 0; display: flex; flex-direction: column; gap: 8px; }

/* ≡ menu */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 44px; z-index: 5; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; min-width: 210px; box-shadow: 0 6px 20px rgba(0, 0, 0, .08); }
.menu-list a { padding: 10px 12px; border-radius: 6px; text-decoration: none; }
.menu-list a:hover { background: var(--fill); }

/* Event log */
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.log-head { display: flex; justify-content: space-between; gap: 12px; }
.pager { display: flex; justify-content: space-between; padding: 14px 0; }

.detail {
    max-width: 100%;
    overflow-x: auto;
    text-align: left;
    font-size: 12px;
    color: var(--muted);
    background: var(--fill);
    padding: 12px;
}
