:root {
  --vh: 100vh;
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --hover: #eceae6;
  --border: #e3e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7a7974;
  --accent: #2a78d6;
  --accent-soft: #e3eefb;
  --accent-text: #fff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #008300;
  --warn: #b37a00;
  --crit: #d42f2f;
  --good-soft: #e3f3e3;
  --warn-soft: #fbf0d6;
  --crit-soft: #fbe3e3;
  --grid: #e8e6e1;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 16px rgb(0 0 0 / .06);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --hover: #2a2a28; --border: #2f2f2c;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #8e8d86;
    --accent: #3987e5; --accent-soft: #1b2b40; --series-1: #3987e5; --series-2: #d95926;
    --good: #3fb13f; --warn: #e0a400; --crit: #ef6060;
    --good-soft: #17301a; --warn-soft: #33290f; --crit-soft: #3a1b1b; --grid: #2a2a28;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --hover: #2a2a28; --border: #2f2f2c;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8e8d86;
  --accent: #3987e5; --accent-soft: #1b2b40; --series-1: #3987e5; --series-2: #d95926;
  --good: #3fb13f; --warn: #e0a400; --crit: #ef6060;
  --good-soft: #17301a; --warn-soft: #33290f; --crit-soft: #3a1b1b; --grid: #2a2a28;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
@supports (height: 100dvh) { :root { --vh: 100dvh; } }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.input {
  height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); outline: none; width: 100%;
}
.input:focus, .btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }

/* ---------- login */
.login-wrap { position: fixed; inset: 0; overflow-y: auto; display: grid; place-items: center; padding: 16px; }
.login {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.login h1 { margin: 0; font-size: 22px; }
.login p { margin: 0; color: var(--text-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand .logo svg { width: 18px; height: 18px; }
.error { color: var(--crit); font-size: 13px; min-height: 1em; }

/* ---------- layout */
/* App shell: pinned to the screen; only .main scrolls, so the sidebar never moves. */
.shell { position: fixed; inset: 0; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.side {
  background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px; height: 100%; overflow-y: auto; overscroll-behavior: contain;
}
.side .brand { padding: 0 8px 18px; }
.side .sec { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
.nav {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2);
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.nav:hover { background: var(--hover); color: var(--text); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .meta { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 400; }
.nav-share { display: block; }
.nav-share .bar { margin: 6px 0 0 28px; }
.side .foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.account { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; }
.account:hover, .account[aria-expanded="true"] { background: var(--hover); }
.account svg.i { color: var(--text-3); width: 16px; height: 16px; }
.nav .live { color: var(--good); }
.acc-menu { width: 280px; padding: 0; }
.acc-head { display: flex; gap: 10px; align-items: center; padding: 14px 14px 12px; }
.acc-sec { border-top: 1px solid var(--border); padding: 6px; }
.acc-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 6px 8px 2px; }
.acc-row { display: flex; align-items: center; gap: 6px; padding: 6px 4px 6px 8px; }
.acc-row .grow { flex: 1; min-width: 0; }
.acc-row code { font: 13px/1.4 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.term-page { display: flex; flex-direction: column; height: 100%; min-height: 360px; }
.term-wrap { flex: 1; min-height: 0; background: #111110; border-radius: var(--radius); padding: 10px 6px 6px 12px; box-shadow: var(--shadow); }
.term-host { width: 100%; height: 100%; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--text-2); }
.side .foot .who { flex: 1; min-width: 0; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.side .foot .who small { color: var(--text-3); display: block; }
.main { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 24px 28px 60px; }
.scrim { display: none; }
.main:has(.term-page) { padding-bottom: 24px; }
.topbar { display: none; }

.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn > i { background: var(--warn); }
.bar.crit > i { background: var(--crit); }
.muted { color: var(--text-3); }
.small { font-size: 12px; }

/* ---------- file browser */
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h2 { margin: 0; font-size: 22px; font-weight: 650; }
.head .grow { flex: 1; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 14px; color: var(--text-2); }
.crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: inherit; }
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs button:last-child { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--text-3); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--text-3); }
.search .input { padding-left: 34px; }
.selbar { display: flex; gap: 8px; align-items: center; padding: 6px 8px 6px 14px; background: var(--accent-soft); border-radius: 10px; margin-bottom: 12px; }
.selbar b { margin-right: auto; color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.files { overflow: hidden; }
.frow {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 110px 150px 44px; align-items: center;
  padding: 0 8px; min-height: 48px; border-bottom: 1px solid var(--border); cursor: default;
}
.frow:last-child { border-bottom: 0; }
.frow.hd { min-height: 38px; font-size: 12px; color: var(--text-3); font-weight: 600; background: var(--surface-2); }
.frow.hd button { border: 0; background: none; color: inherit; font-weight: inherit; cursor: pointer; padding: 0; text-align: left; }
.frow:not(.hd):hover { background: var(--hover); }
.frow.sel { background: var(--accent-soft); }
.frow .nm { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.frow .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .nm small { display: block; color: var(--text-3); font-size: 12px; }
.frow .sz, .frow .dt { color: var(--text-2); font-size: 13px; }
.ficon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.ficon.dir { background: var(--accent-soft); color: var(--accent); }
.ficon.img { color: #1baf7a; } .ficon.vid { color: #d55181; } .ficon.aud { color: #6250d6; }
.ficon.doc { color: #eb6834; } .ficon.zip { color: #b37a00; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.empty { padding: 56px 16px; text-align: center; color: var(--text-3); }
.empty svg { width: 40px; height: 40px; margin-bottom: 8px; }

.drop {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--accent) 14%, transparent); z-index: 50;
  display: none; place-items: center; pointer-events: none;
}
.drop.on { display: grid; }
.frow.dropon, .gtile.dropon, .crumbs button.dropon { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; position: relative; z-index: 51; }
.dragging { opacity: .45; }
.drag-ghost { position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; font-weight: 600; max-width: 260px; white-space: nowrap; overflow: hidden; }
.marquee { position: fixed; z-index: 60; pointer-events: none; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); border-radius: 3px; }
/* the file list is for picking and dragging, not for selecting text */
.files, .crumbs { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.files img { -webkit-user-drag: none; }
.drag-ghost svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.drop > div { background: var(--surface); padding: 28px 36px; border-radius: 16px; border: 2px dashed var(--accent); font-size: 16px; font-weight: 600; box-shadow: var(--shadow); }

.uploads { position: fixed; right: 20px; bottom: 20px; width: min(360px, calc(100vw - 32px)); z-index: 40; overflow: hidden; }
.uploads .uh { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.uploads .uh span { margin-right: auto; }
.uploads .ul { max-height: 260px; overflow: auto; }
.uitem { padding: 8px 14px; display: grid; gap: 4px; font-size: 13px; }
.uitem .r { display: flex; gap: 8px; } .uitem .r span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* menu & modal */
.menu { position: fixed; z-index: 68; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 170px; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--crit); }
.modal-bg { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal { width: min(420px, 100%); background: var(--surface); border-radius: 14px; padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.modal h3 { margin: 0; font-size: 17px; }
.modal p { margin: 0; color: var(--text-2); word-break: break-word; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; }
.preview { position: fixed; inset: 0; z-index: 80; background: rgb(10 10 10 / .92); display: grid; grid-template-rows: auto 1fr; color: #f0efec; }
.preview .ph { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.preview .ph b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview .ph .btn { background: rgb(255 255 255 / .08); border-color: transparent; color: inherit; }
.preview .pb { display: grid; place-items: center; min-height: 0; padding: 0 16px 16px; }
.preview img, .preview video { max-width: 100%; max-height: calc(var(--vh) - 90px); border-radius: 8px; }
.preview iframe { width: min(1000px, 100%); height: calc(var(--vh) - 90px); border: 0; border-radius: 8px; background: #fff; }
.preview pre { width: min(1000px, 100%); max-height: calc(var(--vh) - 90px); overflow: auto; background: #1a1a19; padding: 16px; border-radius: 8px; font: 13px/1.5 var(--mono); white-space: pre-wrap; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 90; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- dashboard */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { padding: 16px 18px; display: grid; gap: 6px; align-content: start; }
.tile .lbl { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile .val { font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.tile .sub { font-size: 12px; color: var(--text-3); }
.panel { padding: 16px 18px; }
.panel h4 { margin: 0 0 12px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel h4 .r { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--text-3); }
.chart { position: relative; touch-action: pan-y; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .ax { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 10px; padding: 8px 11px; font-size: 12px; white-space: nowrap; z-index: 2; display: grid; gap: 4px; min-width: 120px;
}
.chart .tip[hidden] { display: none; }
.chart .tip .when { color: var(--text-3); font-size: 11px; margin-bottom: 1px; }
.chart .tip .row { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart .tip .row b { margin-left: auto; padding-left: 14px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.panel h4 .r .now { font-size: 15px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin: -4px 0 8px; }
.legend span { display: inline-flex; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend b { margin-left: 6px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.cores div { font-size: 11px; color: var(--text-3); display: grid; gap: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.pill svg { width: 13px; height: 13px; stroke-width: 2.4; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.mute { background: var(--surface-2); color: var(--text-2); }
.list { display: grid; }
.list > div { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list > div:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.storage-row { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.storage-row:last-child { border: 0; }
.storage-row .t { display: flex; justify-content: space-between; font-size: 13px; }
.term { background: #111110; color: #d8d7d0; font: 12px/1.5 var(--mono); padding: 12px 14px; border-radius: 10px; max-height: 340px; overflow: auto; white-space: pre-wrap; margin: 12px 0 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.scroll { overflow-x: auto; }
.notice { padding: 14px 16px; border-radius: 10px; background: var(--warn-soft); color: var(--text); font-size: 13px; display: flex; gap: 10px; }
.notice code { font-family: var(--mono); background: rgb(0 0 0 / .06); padding: 1px 5px; border-radius: 4px; }

/* ---------- additions: trash, links, grid, backups, alerts, security */
.mono { font-family: var(--mono); }
.nav .badge { background: var(--crit); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 11px; font-weight: 600; line-height: 18px; }
.btn.icon.sm { width: 26px; height: 26px; }
.btn.icon.sm svg { width: 15px; height: 15px; }
svg.i.xs { width: 12px; height: 12px; vertical-align: -1px; }
.input.sm { height: 30px; padding: 0 8px; font-size: 13px; width: auto; min-width: 120px; }
select.input { cursor: pointer; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-btn { border: 0; background: none; color: var(--accent); font-weight: 650; cursor: pointer; padding: 0; filter: brightness(1.4); }
.modal.wide { width: min(560px, 100%); }
.modal small { font-size: 12px; }
.grid.tight { gap: 10px 12px; }
.uitem .r .btn { margin: -4px -6px -4px 0; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.panel h4 .r .seg { font-size: 13px; }
.panel h4 .r { display: flex; align-items: center; gap: 6px; }
.range-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.alerts { display: grid; gap: 8px; }
.notice.crit { background: var(--crit-soft); }
.notice.crit > svg { color: var(--crit); }
.notice.warn > svg, .notice > svg { color: var(--warn); flex: none; }
.notice .grow { flex: 1; min-width: 0; }
.notice { align-items: flex-start; }
.notice .btn { align-self: center; }

/* grid view */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 14px; }
.gtile { position: relative; border-radius: 10px; padding: 6px; display: grid; gap: 2px; }
.gtile:hover { background: var(--hover); }
.gtile.sel { background: var(--accent-soft); }
.gtile > input { position: absolute; top: 12px; left: 12px; z-index: 1; }
.gthumb { aspect-ratio: 1; width: 100%; border: 0; padding: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; cursor: pointer; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficon.big { width: 56px; height: 56px; border-radius: 14px; background: transparent; }
.ficon.big svg { width: 34px; height: 34px; stroke-width: 1.4; }
.gname { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 2px 0; }
.gmeta { font-size: 11px; color: var(--text-3); padding: 0 2px; }

/* gallery */
.preview .pb { position: relative; }
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgb(255 255 255 / .1); border: 0; color: #fff; }
.nav-arrow:hover { background: rgb(255 255 255 / .2); }
.nav-arrow:disabled { opacity: .2; }
.nav-arrow.l { left: 16px; } .nav-arrow.r { right: 16px; }
.preview .ph .muted { color: #a5a49c; }

/* tables in cards */
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl tr.sel td { background: var(--accent-soft); }
table.tbl tr.dim td { opacity: .55; }
.files table.tbl th, .files table.tbl td { padding-left: 14px; }
.files table.tbl th { background: var(--surface-2); }
.nmcell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nmcell b { font-weight: 500; overflow-wrap: anywhere; }
.files + .tabs, .tabs + .toolbar, .tabs + .selbar { margin-top: -8px; }

/* storage */
.drive { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.drive:last-child { border: 0; padding-bottom: 0; }
.drive:first-of-type { padding-top: 0; }
.drive-h { display: flex; align-items: center; gap: 8px; }
.drive-h .r { margin-left: auto; }
.lifebar { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px; }
.usage { display: grid; }
.urow { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; }
.urow.dir { cursor: pointer; }
.urow.dir:hover { background: var(--hover); }
.urow .ficon { width: 28px; height: 28px; }
.urow .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.urow .t { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.urow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow .bar { height: 4px; }

/* security & 2fa */
.sec-list { display: grid; }
.sec-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.sec-row:first-child { padding-top: 0; }
.sec-row:last-child { border: 0; padding-bottom: 0; }
.sec-row > .pill { flex: none; min-width: 62px; justify-content: center; margin-top: 1px; }
.sec-row .grow { flex: 1; min-width: 0; font-size: 13px; }
.sec-row .small { margin-top: 2px; line-height: 1.5; }
details summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.qr { width: 220px; height: 220px; margin: 0 auto; background: #fff; border-radius: 10px; display: grid; place-items: center; color: #555; font-size: 13px; }
.qr svg { width: 100%; height: 100%; }
code.secret { display: block; font: 14px/1.5 var(--mono); color: var(--text); margin-top: 4px; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
pre.codes { font: 15px/1.8 var(--mono); background: var(--surface-2); border-radius: 10px; padding: 12px 16px; margin: 0; columns: 2; user-select: all; }

.or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.passkey-btn { height: 40px; justify-content: center; }

.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.set-row.top { align-items: flex-start; }
.set-row:last-of-type { border-bottom: 0; padding-bottom: 4px; }
.panel h4 + .set-row { padding-top: 4px; }
.set-row .grow { flex: 1; min-width: 0; font-size: 13px; }
.set-row .grow > b { font-size: 14px; font-weight: 600; }
.set-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; flex: none; }
.set-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pk-list { display: grid; gap: 6px; margin-top: 10px; }
.pk { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.pk .grow { min-width: 0; }

/* ---------- responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 65; left: 0; top: 0; bottom: 0; height: auto; width: 260px; padding-bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 64; background: rgb(0 0 0 / .35); }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; padding-top: max(10px, env(safe-area-inset-top)); }
  .main { padding: 16px 16px 60px; }
  .main:has(.term-page) { padding-bottom: 16px; }
  .input, select.input { font-size: 16px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .frow { grid-template-columns: 32px minmax(0, 1fr) 40px; }
  .frow .sz, .frow .dt { display: none; }
  .frow .nm small.m { display: block; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar .btn span { display: none; }
  .fgrid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; padding: 10px; }
  .nav-arrow { display: none; }
  .hide-sm { display: none; }
  .set-row { flex-wrap: wrap; }
  .set-ctrl { width: 100%; justify-content: flex-start; padding-left: 48px; }
  .nmcell { min-width: 140px; }
  .sec-row { flex-direction: column; gap: 6px; }
}
@media (min-width: 801px) { .frow .nm small.m { display: none; } .show-sm { display: none; } }
@media (max-width: 480px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile .val { font-size: 22px; } }

/* guest keys */
.linkish { border: 0; background: none; padding: 0; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-self: center; }
.linkish:hover { color: var(--accent); }
.linkish svg { width: 15px; height: 15px; }
.guest-code { font-size: 26px; font-weight: 700; letter-spacing: .08em; text-align: center; padding: 14px; border-radius: 12px; background: var(--surface-2); user-select: all; -webkit-user-select: all; }
.guest-note { padding: 10px 12px; line-height: 1.6; }
.guest-note svg { vertical-align: -2px; }
.mono { font-family: var(--mono); }

/* video quality switch in the viewer (dark header) */
.qual { margin-left: auto; display: flex; align-items: center; }
.qual + .btn { margin-left: 0; }
.seg.dark { background: rgb(255 255 255 / .1); }
.seg.dark button { color: rgb(255 255 255 / .7); }
.seg.dark button:hover { color: #fff; }
.seg.dark button.on { background: rgb(255 255 255 / .2); color: #fff; box-shadow: none; }

/* users tab: admins pinned in their own card */
.admin-pin { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: linear-gradient(0deg, var(--surface), color-mix(in srgb, var(--accent) 5%, var(--surface))); }
.admin-pin h4 svg, .card h4 > svg { width: 17px; height: 17px; color: var(--accent); vertical-align: -3px; margin-right: 6px; }
.admin-pin .nmcell .avatar { width: 28px; height: 28px; font-size: 13px; flex: none; }

/* dashboard: 5 tiles, sliding bars, steady-width numbers */
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bar > i { transition: width .8s cubic-bezier(.2, .7, .2, 1); }
.num { font-variant-numeric: tabular-nums; }
.fanbar { display: inline-block; width: 46px; height: 4px; border-radius: 2px; background: var(--surface-2); margin-left: 8px; vertical-align: middle; overflow: hidden; }
.fanbar i { display: block; height: 100%; background: var(--accent); transition: width .8s cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) { .bar > i, .fanbar i { transition: none; } }
/* five narrow tiles: status pill on its own line in every tile, so they line up */
.g5 .tile .lbl > span:last-child { flex-basis: 100%; margin-left: 0 !important; }
.g5 .tile .lbl > span:last-child:empty { display: none; }

/* no blue text-selection highlight anywhere; typing fields and copyable codes still work */
html { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select, [contenteditable], .xterm, .xterm * { -webkit-user-select: text; user-select: text; }
code.secret, pre.codes, .guest-code { -webkit-user-select: all; user-select: all; }
img { -webkit-user-drag: none; }
/* fast double taps on the file list shouldn't zoom the page */
.files { touch-action: manipulation; }

/* document viewer */
.preview .docview { width: min(1000px, 100%); height: calc(var(--vh) - 90px); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding-bottom: 20px; }
.preview .docview img.page { width: 100%; height: auto; max-height: none; border-radius: 4px; background: #fff; box-shadow: 0 8px 30px -10px rgb(0 0 0 / .6); flex: none; }
.preview .doc-msg { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; color: #c9c8c2; text-align: center; padding: 20px; }
.preview .doc-end { color: #8d8c86; font-size: 12px; }
.doc-spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .15); border-top-color: #fff; animation: doc-spin .8s linear infinite; }
@keyframes doc-spin { to { transform: rotate(360deg); } }
.preview .paper { width: 100%; background: #fff; color: #1d1d1f; border-radius: 4px; padding: clamp(22px, 6vw, 64px) clamp(18px, 7vw, 72px); box-shadow: 0 8px 30px -10px rgb(0 0 0 / .6);
  font: 15px/1.75 "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "NanumGothic", system-ui, sans-serif; word-break: keep-all; overflow-wrap: anywhere; flex: none; }
.paper p { margin: 0 0 .25em; white-space: pre-wrap; }
.paper p.gap { height: .8em; margin: 0; }
.paper table { border-collapse: collapse; width: 100%; margin: .6em 0 1em; font-size: .94em; }
.paper td { border: 1px solid #b9b9b9; padding: 6px 9px; vertical-align: middle; }
.paper td p { margin: 0; }
.paper img { display: block; max-width: 100%; max-height: none; height: auto; margin: .8em auto; border-radius: 0; }
.paper .box { border: 1px solid #d6d6d6; border-radius: 6px; padding: 10px 14px; margin: .6em 0; }
.paper .obj { border: 1px dashed #c4c4c4; border-radius: 6px; padding: 18px; margin: .6em 0; color: #8a8a8a; text-align: center; font-size: 13px; }
.paper .note { color: #8a6d00; background: #fff6d6; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.paper hr.section { border: 0; border-top: 1px dashed #ccc; margin: 2em 0; }

/* selection bar: a floating pill over the bottom of the file list, so nothing below it moves */
.selbar.float { position: fixed; z-index: 45; bottom: max(20px, env(safe-area-inset-bottom)); left: calc(50% + 124px); transform: translateX(-50%);
  margin: 0; width: max-content; max-width: calc(100vw - 280px); padding: 6px 6px 6px 18px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border); box-shadow: 0 14px 40px -12px rgb(0 0 0 / .45); }
.selbar.float b { margin-right: 10px; white-space: nowrap; }
.selbar.float.enter { animation: selbar-in .28s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes selbar-in { from { opacity: 0; transform: translate(-50%, 18px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.has-selbar .toast { bottom: 88px; }
.has-selbar .main { padding-bottom: 96px; }   /* last row can still scroll out from under the bar */
[data-ui="fluid"] .selbar.float { left: calc(50% + 134px); background: color-mix(in srgb, var(--surface) 70%, transparent); }
@media (max-width: 800px) {
  .selbar.float, [data-ui="fluid"] .selbar.float { left: 50%; max-width: calc(100vw - 24px); }
  .selbar.float .btn > span { display: none; }   /* icons only on phones */
}
.notice .dismiss { align-self: flex-start; margin: -6px -8px -6px 0; flex: none; opacity: .7; }
.notice .dismiss:hover { opacity: 1; }

/* no page zoom: double-tap never zooms anywhere (pinch is handled in app.js) */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* viewer zoom (app.js viewerZoom) */
.preview .pb > img { touch-action: none; transition: transform .12s ease-out; will-change: transform; }
.preview .pb > img.zoomed { cursor: grab; }
.preview .pb > img.zoomed:active { cursor: grabbing; }
.preview .docview { --dz: 1; }
.preview .docview.zoomed { align-items: flex-start; }
.preview .docview > :is(img.page, .paper) { zoom: var(--dz); }
.preview .docview.zoomed > :is(img.page, .paper) { width: 100%; flex: none; }

/* ---- search: words found inside documents */
.frow .nm small.snip { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--text-2); margin-top: 2px; }
.snip mark { background: var(--warn-soft); color: var(--text); border-radius: 3px; padding: 0 2px; font-weight: 600; }

/* ---- photos timeline */
.pmonth { margin: 0 0 22px; }
.pmonth h3 { font-size: 15px; margin: 0 0 10px 2px; position: sticky; top: 0; z-index: 2; padding: 6px 0; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 4px; }
.ptile { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--hover); cursor: pointer; display: grid; place-items: center; }
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .3s; }
.ptile:hover img { transform: scale(1.05); }
.ptile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pbadge { position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(0 0 0 / .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pbadge svg { width: 12px; height: 12px; }
@media (max-width: 640px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px; } .ptile { border-radius: 3px; } }

/* ---- WebDAV / offsite: copyable addresses and commands */
.dav-url { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.dav-url code { background: var(--hover); padding: 4px 8px; border-radius: 6px; font-family: var(--mono); font-size: 13px; }

/* ---- previous versions, duplicates */
.versions .tbl td { vertical-align: middle; }
.versions .btn.sm, .dgroup .btn.sm { padding: 4px 10px; font-size: 13px; }
.dupes { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.dgroup { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: grid; gap: 3px; }
.dgroup .t { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dgroup a { word-break: break-all; }
.dgroup .keep a { font-weight: 600; }
.storage-row .t .btn.icon.sm { margin-left: 4px; }
.btn.sm:not(.icon) { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.lockbar { display: flex; align-items: center; gap: 14px; }
.lockbar > svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.lockbar.open > svg { color: var(--good); }
.lockbar .grow { font-size: 13px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lockbar .grow { flex: 1; min-width: 0; }
.svc-group { border-top: 1px solid var(--border); }
.svc-group:first-of-type { border-top: 0; }
.svc-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 2px; border: 0; background: none; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.svc-head .r { margin-left: auto; }
.svc-head .chev { color: var(--text-3); transition: transform .2s; transform: rotate(90deg); }
.svc-group.open .svc-head .chev { transform: rotate(180deg); }
.svc-group .tbl { margin-bottom: 8px; }

/* File checkboxes stay out of the way until something is selected, then all of them
   ease in (a slight top-to-bottom stagger); hovering a row still shows its own one. */
.frow > div:first-child > input, .gtile > input {
  opacity: 0; transform: scale(.5);
  transition: opacity .18s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.files.selecting .frow > div:first-child > input, .files.selecting .gtile > input {
  opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 16ms);
}
.frow:hover > div:first-child > input, .gtile:hover > input, .frow > div:first-child > input:focus-visible, .gtile > input:focus-visible {
  opacity: 1; transform: none; transition-delay: 0s;
}
@media (prefers-reduced-motion: reduce) { .frow > div:first-child > input, .gtile > input { transition: opacity .15s; transform: none; } }
/* keyboard cursor: only drawn while the keyboard is being used */
.kbd .frow.cur, .kbd .gtile.cur { box-shadow: inset 0 0 0 2px var(--accent); }
@media (hover: none) { .kbd-only { display: none; } }
kbd { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); white-space: nowrap; justify-self: start; }
