/* m34-dev-box — macOS-style desktop */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Monaco, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --accent: #0a84ff;
  --accent-soft: rgb(10 132 255 / .22);
  --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a; --green: #32d74b; --teal: #64d2ff;
  --radius-win: 10px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --win-bg: #1e1e1e;
  --chrome: #262628;
  --toolbar: #2a2a2c;
  --sidebar: rgb(44 44 46 / .72);
  --sidebar-solid: #2b2b2d;
  --pane-bg: #1e1e1e;
  --group-bg: #2c2c2e;
  --group-border: rgb(255 255 255 / .05);
  --text: rgb(255 255 255 / .88);
  --text-2: rgb(255 255 255 / .55);
  --text-3: rgb(255 255 255 / .28);
  --sep: rgb(255 255 255 / .08);
  --sep-strong: rgb(0 0 0 / .55);
  --hover: rgb(255 255 255 / .07);
  --press: rgb(255 255 255 / .12);
  --ctl: rgb(255 255 255 / .1);
  --ctl-hi: rgb(255 255 255 / .16);
  --ctl-border: rgb(255 255 255 / .06);
  --field: rgb(255 255 255 / .06);
  --stripe: rgb(255 255 255 / .03);
  --sel-inactive: rgb(255 255 255 / .1);
  --menu: rgb(38 38 40 / .8);
  --menu-solid: #2a2a2c;
  --menubar: rgb(22 22 24 / .32);
  --menubar-solid: #1c1c1e;
  --menubar-text: rgb(255 255 255 / .92);
  --win-inner: rgb(255 255 255 / .13);
  --win-outer: rgb(0 0 0 / .85);
  --win-shadow: 0 22px 70px rgb(0 0 0 / .55), 0 0 1px rgb(0 0 0 / .9);
  --tl-inactive: #4a4a4d;
  --graph-bg: #0b0b0c;
  --graph-grid: rgb(255 255 255 / .06);
  --cc-mod: rgb(255 255 255 / .08);
  --term-bg: #1e1e1e;
  --term-fg: #e8e8e8;
  --switch-off: rgb(255 255 255 / .16);
  --thumb-border: rgb(255 255 255 / .12);
  --scroll-thumb: rgb(255 255 255 / .22);
}

body[data-theme="light"] {
  color-scheme: light;
  --win-bg: #ffffff;
  --chrome: #f4f4f5;
  --toolbar: #f6f6f6;
  --sidebar: rgb(232 232 236 / .72);
  --sidebar-solid: #e8e8ea;
  --pane-bg: #f2f2f4;
  --group-bg: #ffffff;
  --group-border: rgb(0 0 0 / .07);
  --text: rgb(0 0 0 / .85);
  --text-2: rgb(0 0 0 / .5);
  --text-3: rgb(0 0 0 / .26);
  --sep: rgb(0 0 0 / .08);
  --sep-strong: rgb(0 0 0 / .12);
  --hover: rgb(0 0 0 / .05);
  --press: rgb(0 0 0 / .09);
  --ctl: rgb(0 0 0 / .05);
  --ctl-hi: #ffffff;
  --ctl-border: rgb(0 0 0 / .1);
  --field: rgb(0 0 0 / .05);
  --stripe: rgb(0 0 0 / .028);
  --sel-inactive: rgb(0 0 0 / .08);
  --menu: rgb(242 242 244 / .82);
  --menu-solid: #f2f2f4;
  --menubar: rgb(246 246 248 / .55);
  --menubar-solid: #ececee;
  --menubar-text: rgb(0 0 0 / .86);
  --win-inner: rgb(255 255 255 / .5);
  --win-outer: rgb(0 0 0 / .22);
  --win-shadow: 0 22px 70px rgb(0 0 0 / .28), 0 0 1px rgb(0 0 0 / .4);
  --tl-inactive: #d0d0d2;
  --graph-bg: #ffffff;
  --graph-grid: rgb(0 0 0 / .07);
  --cc-mod: rgb(255 255 255 / .55);
  --term-bg: #ffffff;
  --term-fg: #1d1d1f;
  --switch-off: rgb(0 0 0 / .12);
  --thumb-border: rgb(0 0 0 / .12);
  --scroll-thumb: rgb(0 0 0 / .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  background: #1b1d22;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--text-2); }
.ic { display: block; flex: none; }
i[data-icon] { display: inline-flex; align-items: center; justify-content: center; font-style: normal; flex: none; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Wallpaper ---------- */
.wallpaper { position: fixed; inset: 0; z-index: 0; background: var(--wall, #2a2d33); transition: background .4s; }
.wallpaper::after {
  content: ""; position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; height: 24px; z-index: 9000;
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
  background: var(--menubar);
  backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  color: var(--menubar-text);
  font-size: 13px;
  box-shadow: 0 .5px 0 rgb(0 0 0 / .2);
}
.mb-left, .mb-right, .mb-app-menus { display: flex; align-items: center; height: 100%; }
.mb-item {
  height: 22px; padding: 0 9px; border-radius: 4px; display: flex; align-items: center; gap: 5px;
  color: inherit; white-space: nowrap; font-weight: 400;
}
.mb-item:hover, .mb-item.open { background: rgb(255 255 255 / .18); }
body[data-theme="light"] .mb-item:hover, body[data-theme="light"] .mb-item.open { background: rgb(0 0 0 / .1); }
.mb-apple { padding: 0 11px 0 9px; }
.mb-apple svg { margin-top: -2px; }
.mb-appname { font-weight: 700; }
.mb-status { padding: 0 7px; font-variant-numeric: tabular-nums; }
.mb-status .ic { opacity: .95; }
.mb-bat-pct { font-size: 12px; }
.mb-bat-icon { display: flex; }
#mb-thermal.warm { color: var(--orange); }
#mb-thermal.hot { color: var(--red); }
#mb-wifi.offline { opacity: .4; }
.mb-clock { gap: 7px; font-variant-numeric: tabular-nums; }

/* ---------- Menus (dropdown + context) ---------- */
.menu, .ctx {
  position: fixed; z-index: 9500; min-width: 220px; padding: 5px;
  background: var(--menu);
  backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 7px;
  box-shadow: 0 0 0 .5px var(--win-outer), inset 0 0 0 .5px var(--win-inner), 0 10px 32px rgb(0 0 0 / .35);
  color: var(--text); font-size: 13px;
}
.mi { display: flex; align-items: center; height: 22px; padding: 0 10px 0 6px; border-radius: 4px; gap: 6px; white-space: nowrap; }
.mi .mi-check { width: 14px; display: flex; justify-content: center; }
.mi .mi-label { flex: 1; }
.mi .mi-key { color: var(--text-2); padding-left: 24px; letter-spacing: .5px; }
.mi:not(.disabled):not(.info):hover { background: var(--accent); color: #fff; }
.mi:not(.disabled):not(.info):hover .mi-key { color: rgb(255 255 255 / .85); }
.mi.disabled { color: var(--text-3); }
.mi.info { color: var(--text-2); }
.mi.head { font-weight: 600; color: var(--text); }
.mi.head .mi-key { color: var(--text); font-weight: 600; }
.msep { height: 1px; margin: 5px 8px; background: var(--sep); }
.mcustom { padding: 4px 10px 6px 26px; }
.menu-meter { height: 5px; border-radius: 3px; background: var(--ctl); overflow: hidden; margin-top: 5px; width: 190px; }
.menu-meter > span { display: block; height: 100%; background: var(--text-2); border-radius: 3px; }

/* ---------- Control Center ---------- */
.cc {
  position: fixed; top: 30px; right: 8px; z-index: 9400; width: 330px; padding: 10px;
  border-radius: 16px;
  background: var(--menu);
  backdrop-filter: blur(50px) saturate(180%); -webkit-backdrop-filter: blur(50px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--win-outer), inset 0 0 0 .5px var(--win-inner), 0 18px 50px rgb(0 0 0 / .4);
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.cc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-mod {
  background: var(--cc-mod); border-radius: 12px;
  box-shadow: inset 0 0 0 .5px var(--win-inner), 0 1px 2px rgb(0 0 0 / .12);
}
.cc-list { padding: 8px 6px; display: flex; flex-direction: column; gap: 4px; }
.cc-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 8px; text-align: left; }
.cc-row:hover { background: var(--hover); }
.cc-circle {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--ctl-hi); color: var(--text);
}
body[data-theme="dark"] .cc-circle { background: rgb(255 255 255 / .14); }
.on > .cc-circle, .cc-row.on .cc-circle, .cc-tile.on .cc-circle { background: var(--accent); color: #fff; }
.cc-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cc-txt b { font-weight: 600; font-size: 12px; }
.cc-txt small { font-size: 11px; color: var(--text-2); }
.cc-col { display: grid; grid-template-rows: 1fr 1fr; gap: 10px; }
.cc-tile { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; padding: 9px 10px; text-align: left; }
.cc-stat { gap: 0; }
.cc-stat-label { font-size: 11px; font-weight: 600; color: var(--text-2); }
.cc-stat-val { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.cc-stat small { font-size: 11px; color: var(--text-2); }
.cc-wide { grid-column: span 2; padding: 9px 11px 10px; }
.cc-label { font-size: 12px; font-weight: 600; margin-bottom: 7px; }
.cc-meter {
  position: relative; height: 24px; border-radius: 12px; overflow: hidden; background: var(--ctl);
  display: flex; align-items: center; padding-left: 9px; gap: 6px;
  box-shadow: inset 0 0 0 .5px var(--ctl-border);
}
.cc-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgb(255 255 255 / .92); transition: width .5s ease; border-radius: 12px; min-width: 24px; }
body[data-theme="light"] .cc-meter-fill { background: #fff; box-shadow: 0 0 0 .5px rgb(0 0 0 / .1); }
.cc-meter .ic { position: relative; color: #3a3a3c; }
.cc-meter-val { position: relative; margin-left: auto; margin-right: 10px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.cc-meter.warm .cc-meter-fill { background: #ffd28a; }
.cc-meter.hot .cc-meter-fill { background: #ff9d94; }
.cc-note { margin-top: 6px; font-size: 11px; color: var(--text-2); }
.cc-batt-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
.cc-batt-txt { display: flex; flex-direction: column; line-height: 1.2; }
.cc-batt-txt b { font-size: 12px; }
.cc-batt-txt small { font-size: 11px; color: var(--text-2); }
.cc-footer { display: block; width: 100%; margin-top: 10px; padding: 6px 10px; border-radius: 8px; text-align: left; font-size: 12px; color: var(--text); background: var(--cc-mod); box-shadow: inset 0 0 0 .5px var(--win-inner); }
.cc-footer:hover { background: var(--hover); }

/* ---------- Desktop & windows ---------- */
.desktop { position: fixed; top: 24px; left: 0; right: 0; bottom: 0; z-index: 1; }
.window {
  position: absolute; display: flex; flex-direction: row;
  border-radius: var(--radius-win);
  box-shadow: 0 0 0 .5px var(--win-outer), var(--win-shadow);
  min-width: 440px; min-height: 280px;
  overflow: hidden;
  transition: opacity .18s ease, transform .22s cubic-bezier(.3,.7,.4,1);
}
.window::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 60;
  box-shadow: inset 0 0 0 .5px var(--win-inner);
}
.window.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 78px) !important; border-radius: 0; }
.window.minimizing { opacity: 0; transform: translateY(60vh) scale(.12); }
.window.opening { animation: winopen .2s cubic-bezier(.2,.8,.3,1); }
@keyframes winopen { from { opacity: 0; transform: scale(.96); } }
body.dragging, body.dragging * { cursor: default !important; }
body.dragging iframe { pointer-events: none; }

.resize-handle { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 70; }

/* Traffic lights */
.traffic { display: flex; gap: 8px; align-items: center; }
.tl {
  width: 12px; height: 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 .5px rgb(0 0 0 / .2);
}
.tl-close { background: #ff5f57; }
.tl-min { background: #febc2e; }
.tl-max { background: #28c840; }
.tl svg { opacity: 0; color: rgb(0 0 0 / .55); }
.traffic:hover .tl svg { opacity: 1; }
.tl:active { filter: brightness(.82); }
.window:not(.focused) .traffic:not(:hover) .tl { background: var(--tl-inactive); box-shadow: inset 0 0 0 .5px rgb(0 0 0 / .1); }

/* Shared toolbar */
.toolbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px 0 10px;
  background: var(--toolbar);
  border-bottom: 1px solid var(--sep-strong);
}
body[data-theme="light"] .toolbar { border-bottom-color: rgb(0 0 0 / .1); }
.tb-nav { display: flex; gap: 2px; margin-right: 6px; }
.tb-btn {
  height: 28px; min-width: 30px; padding: 0 6px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-2);
}
.tb-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.tb-btn:active:not(:disabled) { background: var(--press); }
.tb-btn:disabled { opacity: .35; }
.tb-btn.active { background: var(--press); color: var(--text); }
.tb-title { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 40px; max-width: 260px; }
.window:not(.focused) .tb-title, .window:not(.focused) .titlebar-title { color: var(--text-2); }
.tb-spacer { flex: 1; min-width: 8px; }
.tb-divider { width: 1px; height: 18px; background: var(--sep); margin: 0 6px; }
.tb-seg { display: flex; padding: 2px; border-radius: 7px; gap: 1px; }
.tb-seg button { height: 24px; width: 32px; border-radius: 5px; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.tb-seg button:hover { background: var(--hover); color: var(--text); }
.tb-seg button.active { background: var(--press); color: var(--text); }
.tb-search {
  display: flex; align-items: center; gap: 5px; height: 28px; width: 170px; padding: 0 8px; margin-left: 6px;
  border-radius: 7px; background: var(--field); color: var(--text-2);
  box-shadow: inset 0 0 0 .5px var(--ctl-border);
}
.tb-search:focus-within { box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
.tb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.tb-search input::placeholder { color: var(--text-3); }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }

/* Segmented control with text */
.seg-text { display: flex; padding: 2px; border-radius: 7px; background: var(--ctl); box-shadow: inset 0 0 0 .5px var(--ctl-border); }
.seg-text button { padding: 3px 12px; border-radius: 5px; font-size: 12px; color: var(--text); white-space: nowrap; }
.seg-text button.active { background: var(--ctl-hi); box-shadow: 0 1px 2px rgb(0 0 0 / .2), inset 0 .5px 0 rgb(255 255 255 / .12); }
body[data-theme="dark"] .seg-text button.active { background: rgb(255 255 255 / .2); }
.seg-sm button { padding: 2px 9px; font-size: 11px; }

/* Buttons */
.btn {
  height: 22px; padding: 0 10px; border-radius: 6px; font-size: 13px;
  background: var(--ctl); color: var(--text);
  box-shadow: inset 0 0 0 .5px var(--ctl-border), 0 .5px 1px rgb(0 0 0 / .15);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
body[data-theme="light"] .btn { background: #fff; box-shadow: 0 0 0 .5px rgb(0 0 0 / .14), 0 .5px 1.5px rgb(0 0 0 / .12); }
.btn:active { filter: brightness(1.15); }
body[data-theme="light"] .btn:active { filter: brightness(.94); }
.btn-primary, body[data-theme="light"] .btn-primary { background: var(--accent); color: #fff; box-shadow: inset 0 .5px 0 rgb(255 255 255 / .25); }
.btn-sm { height: 20px; font-size: 12px; padding: 0 9px; }
.btn:disabled { opacity: .45; }

/* Sidebars */
.sidebar {
  width: 210px; flex: none; display: flex; flex-direction: column;
  background: var(--sidebar);
  backdrop-filter: blur(40px) saturate(170%); -webkit-backdrop-filter: blur(40px) saturate(170%);
  border-right: 1px solid var(--sep-strong);
}
body[data-theme="light"] .sidebar { border-right-color: rgb(0 0 0 / .1); }
.sb-top { height: 52px; flex: none; display: flex; align-items: center; padding-left: 16px; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; }
.sb-section { font-size: 11px; font-weight: 700; color: var(--text-3); padding: 12px 8px 4px; }
.sb-item {
  width: 100%; display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 8px;
  border-radius: 6px; text-align: left; color: var(--text); font-size: 13px;
}
.sb-item i { color: var(--accent); width: 18px; }
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: var(--press); }
.sb-item > span:not(.sb-badge) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-badge { font-size: 9.5px; font-weight: 600; color: var(--text-2); border: 1px solid var(--sep); padding: 0 4px; border-radius: 4px; letter-spacing: .3px; }
.sb-disk { height: auto; padding: 5px 8px; align-items: flex-start; }
.sb-disk i { color: var(--text-2); margin-top: 1px; }
.sb-disk-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sb-disk-bar { height: 4px; border-radius: 2px; background: var(--ctl); overflow: hidden; }
.sb-disk-bar span { display: block; height: 100%; width: 0; background: var(--text-2); border-radius: 2px; }
.sb-disk-meta { font-size: 11px; color: var(--text-2); }

/* ---------- Finder ---------- */
.win-finder { background: transparent; }
.f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--win-bg); position: relative; }
.f-content { flex: 1; overflow: auto; outline: none; position: relative; }
.f-pathbar {
  height: 24px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 10px;
  border-top: 1px solid var(--sep); font-size: 11.5px; color: var(--text-2); overflow: hidden; white-space: nowrap;
}
.pb-seg { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px; border-radius: 4px; }
.pb-seg:hover { background: var(--hover); color: var(--text); }
.pb-seg svg.fi { width: 14px; height: auto; }
.pb-seg .ic { color: var(--text-2); }
.pb-chev { color: var(--text-3); display: inline-flex; }
.f-statusbar {
  height: 24px; flex: none; display: flex; align-items: center; justify-content: center; position: relative;
  border-top: 1px solid var(--sep); font-size: 11px; color: var(--text-2); background: var(--chrome);
}
body[data-theme="light"] .f-statusbar { background: #f7f7f7; }
.f-iconsize { position: absolute; right: 12px; width: 90px; accent-color: var(--text-2); height: 12px; }
.drop-hint {
  position: absolute; inset: 52px 0 48px 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; pointer-events: none;
}
.f-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 13px; pointer-events: none; }

/* Icon view */
.iv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--icon) + 40px), 1fr)); gap: 6px 4px; padding: 14px 16px; align-content: start; }
.iv-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px; }
.iv-icon { width: calc(var(--icon) + 12px); height: calc(var(--icon) + 8px); display: flex; align-items: center; justify-content: center; border-radius: 6px; padding: 4px; }
.iv-icon svg.fi { width: var(--icon); height: var(--icon); filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / .25)); }
.iv-icon .thumb { max-width: var(--icon); max-height: var(--icon); display: flex; }
.thumb img { max-width: 100%; max-height: var(--icon); object-fit: contain; border: 2px solid #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .4); background: #fff; display: block; }
.iv-name { max-width: calc(var(--icon) + 40px); text-align: center; font-size: 12px; line-height: 1.25; }
.iv-name span { padding: 1px 4px; border-radius: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.iv-item.selected .iv-icon { background: var(--sel-inactive); }
.iv-item.selected .iv-name span { background: var(--accent); color: #fff; }
.window:not(.focused) .iv-item.selected .iv-name span { background: var(--sel-inactive); color: var(--text); }
.iv-item.dotfile { opacity: .55; }

/* List view */
.mac-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.mac-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2);
  height: 26px; padding: 0 10px; background: var(--win-bg); border-bottom: 1px solid var(--sep); white-space: nowrap;
}
.mac-table th + th { border-left: 1px solid var(--sep); }
.mac-table th.num, .mac-table td.num { text-align: right; }
.mac-table td { height: 24px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mac-table tbody tr:nth-child(even) td { background: var(--stripe); }
.lv th[data-sort] { cursor: default; }
.lv th[data-sort]:hover { background: var(--hover); }
.lv th.sorted { color: var(--text); font-weight: 600; }
.lv th .sort-ind { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--text-2); }
.lv .c-name { width: 46%; }
.lv .c-date { width: 24%; color: var(--text-2); }
.lv .c-size { width: 11%; color: var(--text-2); text-align: right; }
.lv .c-kind { width: 19%; color: var(--text-2); }
.lv td.c-name { color: var(--text); }
.lv-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lv-name svg.fi { width: 16px; height: 16px; flex: none; }
.lv-name span { overflow: hidden; text-overflow: ellipsis; }
.lv tbody tr.selected td { background: var(--accent) !important; color: #fff !important; }
.window:not(.focused) .lv tbody tr.selected td { background: var(--sel-inactive) !important; color: var(--text) !important; }
.lv tbody tr.dotfile td.c-name { opacity: .6; }

/* Column view */
.cv { display: flex; height: 100%; min-width: min-content; }
.cv-col { width: 220px; flex: none; overflow-y: auto; border-right: 1px solid var(--sep); padding: 2px 0; }
.cv-row { display: flex; align-items: center; gap: 6px; height: 22px; margin: 0 4px; padding: 0 6px; border-radius: 4px; }
.cv-row svg.fi { width: 16px; height: 16px; flex: none; }
.cv-row .cv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-row .cv-chev { color: var(--text-3); }
.cv-row.trail { background: var(--sel-inactive); }
.cv-row.selected { background: var(--accent); color: #fff; }
.cv-row.selected .cv-chev { color: rgb(255 255 255 / .8); }
.window:not(.focused) .cv-row.selected { background: var(--sel-inactive); color: var(--text); }
.cv-row.dotfile .cv-name { opacity: .6; }
.cv-preview { width: 280px; flex: none; padding: 18px 18px; display: flex; flex-direction: column; align-items: center; overflow-y: auto; }
.cv-preview-icon { height: 140px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.cv-preview-icon svg.fi { width: 112px; height: 112px; filter: drop-shadow(0 2px 4px rgb(0 0 0 / .3)); }
.cv-preview-icon .thumb img { max-width: 220px; max-height: 140px; }
.cv-preview-name { font-weight: 600; font-size: 14px; text-align: center; word-break: break-word; }
.cv-preview-kind { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.cv-info { width: 100%; margin-top: 14px; border-top: 1px solid var(--sep); padding-top: 10px; font-size: 12px; }
.cv-info-title { font-weight: 600; margin-bottom: 6px; }
.cv-info div.kv { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.cv-info div.kv span:first-child { color: var(--text-2); }
.cv-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Folder/document icons */
svg.fi { display: block; overflow: visible; }

/* ---------- Quick Look ---------- */
.ql {
  position: fixed; z-index: 8000; width: 760px; height: 560px; min-width: 360px; min-height: 240px;
  display: flex; flex-direction: column; border-radius: 12px; overflow: hidden;
  background: var(--chrome);
  box-shadow: 0 0 0 .5px var(--win-outer), inset 0 0 0 .5px var(--win-inner), 0 30px 90px rgb(0 0 0 / .55);
  animation: qlin .18s cubic-bezier(.2,.8,.3,1);
}
@keyframes qlin { from { opacity: 0; transform: scale(.94); } }
.ql.zoomed { left: 2vw !important; top: 32px !important; width: 96vw !important; height: calc(100vh - 44px) !important; }
.ql-head { height: 40px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--sep-strong); background: var(--toolbar); }
.ql-btn { width: 28px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.ql-btn:hover { background: var(--hover); color: var(--text); }
.ql-title { flex: 1; text-align: center; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px; }
.ql-tools { display: flex; align-items: center; gap: 6px; }
.ql-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: var(--win-bg); position: relative; }
.ql-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.ql-body img, .ql-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.ql-body.ql-media { background: #000; }
.ql-editor {
  width: 100%; height: 100%; border: 0; outline: 0; resize: none; padding: 14px 16px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; tab-size: 2;
  background: var(--win-bg); color: var(--text); user-select: text; -webkit-user-select: text; white-space: pre;
}
.ql-info { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); text-align: center; padding: 20px; }
.ql-info svg.fi { width: 128px; height: 128px; margin-bottom: 10px; filter: drop-shadow(0 2px 5px rgb(0 0 0 / .35)); }
.ql-info b { color: var(--text); font-size: 15px; }
.ql-loading { color: var(--text-3); }

/* ---------- Alerts ---------- */
.alert-layer { position: fixed; inset: 0; z-index: 9800; display: flex; align-items: flex-start; justify-content: center; padding-top: 18vh; background: rgb(0 0 0 / .12); }
.alert {
  width: 260px; padding: 20px 16px 16px; border-radius: 12px; text-align: center;
  background: var(--menu);
  backdrop-filter: blur(50px) saturate(180%); -webkit-backdrop-filter: blur(50px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--win-outer), inset 0 0 0 .5px var(--win-inner), 0 24px 60px rgb(0 0 0 / .45);
  animation: pop .16s ease-out;
}
.alert-icon { width: 56px; height: 56px; margin: 0 auto 10px; }
.alert-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; word-break: break-word; }
.alert-msg { font-size: 11px; color: var(--text); opacity: .85; margin-bottom: 12px; word-break: break-word; }
.alert-input {
  width: 100%; height: 24px; padding: 0 7px; margin-bottom: 12px; border-radius: 5px; outline: 0; font-size: 13px;
  border: 0; background: var(--field); box-shadow: inset 0 0 0 .5px var(--ctl-border); user-select: text; -webkit-user-select: text;
}
.alert-input:focus { box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
.alert-btns { display: flex; gap: 8px; }
.alert-btns .btn { flex: 1; justify-content: center; height: 26px; }
.alert-btns .btn-danger { color: var(--red); }

/* ---------- Notifications ---------- */
.notif-stack { position: fixed; top: 32px; right: 12px; z-index: 9700; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.notif {
  pointer-events: auto; width: 340px; display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 14px;
  background: var(--menu);
  backdrop-filter: blur(50px) saturate(180%); -webkit-backdrop-filter: blur(50px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--win-outer), inset 0 0 0 .5px var(--win-inner), 0 10px 30px rgb(0 0 0 / .3);
  animation: slidein .3s cubic-bezier(.2,.9,.3,1);
  transition: opacity .25s, transform .25s;
}
.notif.out { opacity: 0; transform: translateX(30px); }
@keyframes slidein { from { opacity: 0; transform: translateX(40px); } }
.notif-icon { width: 34px; height: 34px; flex: none; }
.notif-txt { min-width: 0; flex: 1; }
.notif-txt b { display: block; font-size: 13px; font-weight: 600; }
.notif-txt span { display: block; font-size: 12px; color: var(--text); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { align-self: flex-start; font-size: 11px; color: var(--text-2); }

/* ---------- Activity Monitor ---------- */
.win-activity { flex-direction: column; background: var(--win-bg); }
.am-toolbar { gap: 10px; padding-left: 16px; }
.am-titles { margin-left: 10px; line-height: 1.2; min-width: 0; }
.am-title { font-weight: 700; font-size: 13px; }
.am-subtitle { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.am-live { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); }
.am-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.am-live.offline .am-live-dot { background: var(--text-3); }
.am-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.am-tab { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.am-table-wrap { flex: 1; overflow: auto; }
.mac-table .group-row td { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--chrome) !important; height: 22px; }
.mac-table td.dim { color: var(--text-3); }
.am-usage-col { width: 34%; }
.usage { display: flex; align-items: center; gap: 8px; }
.usage-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--ctl); overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s ease; }
.usage-bar.perf span { background: var(--orange); }
.usage-bar.temp span { background: linear-gradient(90deg, var(--green), var(--yellow) 60%, var(--red)); }
.usage-val { width: 38px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12px; }
.core-kind { display: inline-flex; align-items: center; gap: 6px; }
.core-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.core-dot.perf { background: var(--orange); }
.state { display: inline-flex; align-items: center; gap: 6px; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.state.warm::before { background: var(--orange); }
.state.hot::before { background: var(--red); }
.state.off::before { background: var(--text-3); }
.am-bottom {
  height: 132px; flex: none; display: flex; gap: 16px; align-items: stretch; padding: 12px 16px;
  border-top: 1px solid var(--sep-strong); background: var(--chrome); font-size: 12px;
}
body[data-theme="light"] .am-bottom { border-top-color: rgb(0 0 0 / .1); }
.am-bottom-note { height: auto; align-items: center; color: var(--text-2); gap: 8px; }
.am-stats { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 5px; min-width: 0; }
.am-stats div { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.am-stats span { color: var(--text-2); }
.am-stats b { font-weight: 500; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.am-graph-box { width: 220px; flex: none; display: flex; flex-direction: column; gap: 4px; }
.am-graph-label { font-size: 10px; font-weight: 600; color: var(--text-2); text-align: center; letter-spacing: .3px; }
.am-graph { flex: 1; width: 100%; background: var(--graph-bg); border-radius: 3px; box-shadow: inset 0 0 0 1px var(--sep); }

/* ---------- System Settings ---------- */
.win-settings { background: transparent; }
.s-sidebar { width: 220px; }
.s-search {
  display: flex; align-items: center; gap: 5px; height: 26px; margin: 0 10px 8px; padding: 0 8px;
  border-radius: 7px; background: var(--field); color: var(--text-2); box-shadow: inset 0 0 0 .5px var(--ctl-border);
}
.s-search:focus-within { box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
.s-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; }
.s-search input::placeholder { color: var(--text-3); }
.s-account { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; text-align: left; margin-bottom: 8px; }
.s-account:hover { background: var(--hover); }
.s-account.active { background: var(--press); }
.s-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  background: linear-gradient(#a3a3aa, #6f6f76); color: #fff; font-weight: 600; font-size: 15px;
}
.s-account b { display: block; font-size: 13px; font-weight: 600; }
.s-account small { display: block; font-size: 11px; color: var(--text-2); }
.s-item { width: 100%; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; border-radius: 6px; text-align: left; font-size: 13px; }
.s-item:hover { background: var(--hover); }
.s-item.active { background: var(--accent); color: #fff; }
.window:not(.focused) .s-item.active { background: var(--press); color: var(--text); }
.s-gap { height: 10px; }
.sicon {
  width: 20px; height: 20px; border-radius: 5px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(var(--c1), var(--c2));
  box-shadow: inset 0 0 0 .5px rgb(255 255 255 / .15), 0 .5px 1px rgb(0 0 0 / .25);
}
.sicon-lg { width: 52px; height: 52px; border-radius: 12px; }
.s-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--pane-bg); }
.s-main .toolbar { background: var(--pane-bg); border-bottom-color: transparent; }
.s-main .toolbar.scrolled { border-bottom-color: var(--sep-strong); }
.s-pane-wrap { flex: 1; overflow-y: auto; padding: 4px 26px 30px; }
.pane { max-width: 600px; margin: 0 auto; }
.pane-hero { display: flex; gap: 14px; align-items: center; padding: 4px 4px 8px; margin-bottom: 4px; }
.pane-hero h2 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.pane-hero p { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.4; }
.group {
  background: var(--group-bg); border-radius: 10px; margin: 0 0 18px;
  box-shadow: inset 0 0 0 .5px var(--group-border);
  overflow: hidden;
}
body[data-theme="dark"] .group { background: rgb(255 255 255 / .045); }
.group-pad { padding: 14px; }
.group-title { font-size: 13px; font-weight: 700; margin: 4px 4px 8px; }
.group-foot { font-size: 11.5px; color: var(--text-2); margin: -10px 6px 12px; line-height: 1.45; }
.group-foot b { color: var(--text); font-weight: 600; }
.group-foot + .group-title { margin-top: 18px; }
.row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 40px; padding: 8px 12px; text-align: left; font-size: 13px; position: relative;
}
.row + .row::before, .row + .log-box::before { content: ""; position: absolute; top: 0; left: 12px; right: 12px; height: 1px; background: var(--sep); }
.row-l { min-width: 0; }
.row-r { color: var(--text-2); text-align: right; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.row-stack { display: flex; flex-direction: column; gap: 2px; }
.row-stack small { font-size: 11px; color: var(--text-2); line-height: 1.35; }
.row-col { flex-direction: column; align-items: stretch; }
.row-head { font-size: 13px; margin-bottom: 12px; }
.row-link:hover { background: var(--hover); }
.row-chev { color: var(--text-3); margin-left: -4px; }
.svc-name { display: flex; align-items: center; gap: 10px; }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.svc-dot.up { background: var(--green); }
.pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: rgb(50 215 75 / .16); color: var(--green); }
.pill.warm { background: rgb(255 159 10 / .18); color: var(--orange); }
.pill.hot { background: rgb(255 69 58 / .18); color: var(--red); }
.pill:empty { display: none; }
.mini-bar { width: 80px; height: 5px; border-radius: 3px; background: var(--ctl); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .5s; }

.about { display: flex; flex-direction: column; align-items: center; padding: 14px 0 20px; }
.about-device { filter: drop-shadow(0 6px 14px rgb(0 0 0 / .35)); }
.about-name { font-size: 20px; font-weight: 700; margin-top: 14px; }
.about-model { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.storage-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.storage-head span { color: var(--text-2); }
.storage-bar { height: 16px; border-radius: 4px; background: var(--ctl); overflow: hidden; box-shadow: inset 0 0 0 .5px var(--ctl-border); }
.storage-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8e8e93, #a8a8ad); }

/* Switch */
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--switch-off); transition: background .18s; box-shadow: inset 0 0 0 .5px var(--ctl-border); }
.switch span::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 0 0 .5px rgb(0 0 0 / .05); transition: transform .18s cubic-bezier(.3,.7,.4,1);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

/* CPU mode picker */
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px; border-radius: 10px; }
.mode-art {
  width: 100%; max-width: 190px; aspect-ratio: 16 / 9; border-radius: 8px; margin-bottom: 6px;
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1.4fr 1fr 1fr; gap: 5px; padding: 10px;
  background: var(--win-bg); box-shadow: inset 0 0 0 1px var(--sep);
}
.mode-card.active .mode-art { box-shadow: 0 0 0 3px var(--accent); }
.core { border-radius: 3px; background: var(--ctl); box-shadow: inset 0 0 0 .5px var(--ctl-border); }
.core.big { grid-column: span 2; }
.core.on { background: linear-gradient(#5fb0ff, #2f86e8); box-shadow: inset 0 .5px 0 rgb(255 255 255 / .3); }
.core.big.on { background: linear-gradient(#ffb45c, #f08a24); }
.mode-name { font-size: 13px; font-weight: 500; }
.mode-sub { font-size: 11px; color: var(--text-2); }
.mode-card.active .mode-name { font-weight: 700; }

/* Popup button (select) */
.popup { position: relative; display: inline-flex; align-items: center; }
.popup select {
  appearance: none; -webkit-appearance: none; height: 22px; padding: 0 24px 0 9px; border-radius: 6px; border: 0; outline: 0; font-size: 13px;
  background: var(--ctl); color: var(--text); box-shadow: inset 0 0 0 .5px var(--ctl-border), 0 .5px 1px rgb(0 0 0 / .15);
}
body[data-theme="light"] .popup select { background: #fff; box-shadow: 0 0 0 .5px rgb(0 0 0 / .14), 0 .5px 1.5px rgb(0 0 0 / .12); }
.popup i { position: absolute; right: 4px; pointer-events: none; width: 15px; height: 15px; border-radius: 4px; background: var(--accent); color: #fff; }
.log-box {
  margin: 0; position: relative; padding: 10px 12px; height: 260px; overflow: auto;
  font-family: var(--mono); font-size: 11px; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
  color: var(--text); background: var(--graph-bg); user-select: text; -webkit-user-select: text;
}

/* Appearance */
.appearance-picker { display: flex; gap: 22px; }
.appearance-picker button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }
.ap-thumb { width: 74px; height: 48px; border-radius: 7px; position: relative; overflow: hidden; box-shadow: 0 0 0 1px var(--thumb-border); }
.appearance-picker button.active .ap-thumb { box-shadow: 0 0 0 3px var(--accent); }
.appearance-picker button.active > span:last-child { font-weight: 600; }
.ap-thumb span { position: absolute; left: 12px; top: 10px; right: 0; bottom: 0; border-radius: 5px 0 0 0; }
.ap-light { background: linear-gradient(135deg, #a8c0de, #7c97bf); }
.ap-light span { background: #f5f5f7; box-shadow: inset 0 9px 0 #e2e2e6; }
.ap-dark { background: linear-gradient(135deg, #39445a, #1b2130); }
.ap-dark span { background: #1e1e1e; box-shadow: inset 0 9px 0 #2e2e30; }
.ap-auto { background: linear-gradient(90deg, #a8c0de 50%, #1b2130 50%); }
.ap-auto span { background: linear-gradient(90deg, #f5f5f7 50%, #1e1e1e 50%); }
.accent-row { gap: 8px; }
.accent-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 .5px rgb(0 0 0 / .2); display: flex; align-items: center; justify-content: center; }
.accent-dot.active::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }
.wall-opt { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 11.5px; color: var(--text-2); }
.wall-thumb { width: 100%; aspect-ratio: 16 / 10; border-radius: 7px; box-shadow: 0 0 0 1px var(--thumb-border); }
.wall-opt.active .wall-thumb { box-shadow: 0 0 0 3px var(--accent); }
.wall-opt.active { color: var(--text); font-weight: 600; }

/* ---------- Terminal ---------- */
.win-terminal { flex-direction: column; background: var(--term-bg); }
.titlebar {
  height: 28px; flex: none; display: flex; align-items: center; position: relative; padding: 0 10px;
  background: var(--toolbar); border-bottom: 1px solid var(--sep-strong);
}
.titlebar-title {
  position: absolute; left: 80px; right: 80px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.term-body {
  flex: 1; overflow-y: auto; padding: 5px 6px 10px; cursor: text;
  font-family: var(--mono); font-size: 12px; line-height: 1.38; color: var(--term-fg); background: var(--term-bg);
  user-select: text; -webkit-user-select: text;
}
.term-output { white-space: pre-wrap; word-break: break-all; }
.term-output .t-err { color: #ff6b62; }
body[data-theme="light"] .term-output .t-err { color: #c4271d; }
.term-output .t-dim { color: var(--text-2); }
.term-line { display: flex; align-items: baseline; margin: 0; }
.term-prompt { white-space: pre; }
#term-input {
  flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; margin: 0; background: transparent;
  font-family: var(--mono); font-size: 12px; line-height: 1.38; color: var(--term-fg); caret-color: var(--term-fg);
}
.term-line.busy { visibility: hidden; height: 0; }

/* ---------- Dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 8500;
  display: flex; align-items: flex-end; gap: 4px; padding: 5px 6px 4px; height: 64px;
  border-radius: 18px;
  background: rgb(60 60 66 / .32);
  backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 0 0 .5px rgb(0 0 0 / .35), inset 0 0 0 .5px rgb(255 255 255 / .2), 0 10px 30px rgb(0 0 0 / .25);
}
body[data-theme="light"] .dock { background: rgb(255 255 255 / .3); box-shadow: 0 0 0 .5px rgb(0 0 0 / .15), inset 0 0 0 .5px rgb(255 255 255 / .5), 0 10px 30px rgb(0 0 0 / .15); }
body.solid .dock { background: var(--menubar-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
.dock-item { position: relative; width: 52px; height: 52px; display: flex; justify-content: center; align-items: flex-end; transform-origin: bottom center; transition: width .12s ease-out; }
.dock-icon { width: 52px; height: 52px; display: block; transform-origin: bottom center; transition: transform .12s ease-out; }
.dock-icon svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .3)); }
.dock-item:active .dock-icon { filter: brightness(.7); }
.dock-item.bounce .dock-icon { animation: bounce .55s cubic-bezier(.3,.6,.4,1) 2; }
@keyframes bounce { 50% { transform: translateY(-18px); } }
.dock-dot { position: absolute; bottom: -4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgb(255 255 255 / .75); opacity: 0; }
body[data-theme="light"] .dock-dot { background: rgb(0 0 0 / .7); }
.dock-item.running .dock-dot { opacity: 1; }
.dock-sep { width: 1px; height: 46px; align-self: center; margin: 0 5px; background: rgb(255 255 255 / .22); }
body[data-theme="light"] .dock-sep { background: rgb(0 0 0 / .15); }
.dock-tip {
  position: fixed; z-index: 8600; padding: 3px 10px; border-radius: 6px; font-size: 13px; pointer-events: none; white-space: nowrap;
  background: var(--menu); color: var(--text); transform: translateX(-50%);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 0 0 .5px var(--win-outer), inset 0 0 0 .5px var(--win-inner), 0 4px 14px rgb(0 0 0 / .25);
}

/* ---------- Reduce transparency ---------- */
body.solid .menubar { background: var(--menubar-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.solid .sidebar { background: var(--sidebar-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.solid .menu, body.solid .ctx, body.solid .cc, body.solid .alert, body.solid .notif, body.solid .dock-tip { background: var(--menu-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }


/* ---------- Action sheet (phones) ---------- */
.sheet-layer {
  position: fixed; inset: 0; z-index: 9600; display: flex; align-items: flex-end; justify-content: center;
  background: rgb(0 0 0 / .32); animation: fadein .18s ease-out;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 480px; max-height: 100%; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  animation: sheetup .3s cubic-bezier(.2,.9,.25,1);
}
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } }
.sh-group { border-radius: 14px; overflow-y: auto; overscroll-behavior: contain; max-height: calc(100dvh - 110px); background: var(--menu-solid); }
.sh-title { padding: 13px 18px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-2); word-break: break-word; border-bottom: 1px solid var(--sep); }
.sh-sec + .sh-sec { border-top: 7px solid rgb(0 0 0 / .16); }
body[data-theme="light"] .sh-sec + .sh-sec { border-top-color: rgb(0 0 0 / .06); }
.sh-row {
  position: relative; width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 18px; font-size: 17px; color: var(--accent); text-align: left;
}
.sh-row + .sh-row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 1px; background: var(--sep); }
.sh-row:active:not(:disabled) { background: var(--press); }
.sh-row:disabled { color: var(--text-3); }
.sh-row.danger { color: var(--red); }
.sh-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-check { color: var(--accent); display: flex; }
.sh-head { display: flex; justify-content: space-between; padding: 14px 18px 4px; font-size: 15px; font-weight: 600; }
.sh-info { padding: 4px 18px 10px; font-size: 14px; color: var(--text-2); }
.sh-custom { padding: 6px 18px 14px; font-size: 14px; }
.sh-custom > div:first-child { font-size: 14px !important; }
.sh-custom .menu-meter { width: 100%; height: 6px; margin-top: 10px; }
.sh-cancel {
  min-height: 56px; border-radius: 14px; font-size: 17px; font-weight: 600; color: var(--accent);
  background: var(--menu-solid);
}
.sh-cancel:active { background: var(--press); }

/* ---------- Media Server (POCO) ---------- */
.win-media { flex-direction: column; background: var(--pane-bg); }
.md-link { cursor: default; }
.md-link[aria-disabled="true"], .md-hero-links [aria-disabled="true"] { opacity: .45; pointer-events: none; }
.md-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 22px 26px; container-type: inline-size; }
.md-inner { max-width: 920px; margin: 0 auto; }
.md-hero { display: flex; align-items: center; gap: 14px; padding: 4px 4px 16px; }
.md-device { flex: none; filter: drop-shadow(0 4px 10px rgb(0 0 0 / .3)); }
.md-hero-txt { flex: 1; min-width: 0; }
.md-hero-name { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.md-hero-name .pill { font-size: 11px; }
.md-hero-model { margin-top: 2px; font-size: 12px; color: var(--text-2); }
.md-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.md-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 11.5px; background: var(--ctl); box-shadow: inset 0 0 0 .5px var(--ctl-border); font-variant-numeric: tabular-nums;
}
.md-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-chip .ic { color: var(--text-2); }
.md-hero-links { display: none; }
.pill.off { background: var(--ctl); color: var(--text-2); }
.md-banner {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; margin: 0 0 18px; border-radius: 10px;
  background: rgb(255 159 10 / .12); box-shadow: inset 0 0 0 .5px rgb(255 159 10 / .4);
}
.md-banner > .ic { color: var(--orange); margin-top: 1px; }
.md-banner-txt { flex: 1; min-width: 0; }
.md-banner-txt b { display: block; font-size: 13px; margin-bottom: 3px; }
.md-banner-txt p { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.md-banner .btn { flex: none; }
.md-live-sections { transition: opacity .2s; }
.md-live-sections.stale { opacity: .5; }
.md-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.md-card {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 11px 12px 12px; border-radius: 10px;
  background: var(--group-bg); box-shadow: inset 0 0 0 .5px var(--group-border);
}
body[data-theme="dark"] .md-card { background: rgb(255 255 255 / .045); }
.md-card-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--text-2); }
.md-card-val { font-size: 20px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-card-sub { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.md-card .usage-bar { flex: none; margin-top: 7px; }
.usage-bar.warn span { background: var(--orange); }
.usage-bar.crit span { background: var(--red); }
.md-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
.md-col { min-width: 0; }
.md-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.md-title-meta { font-size: 12px; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }
.md-svc .row-stack small { font-variant-numeric: tabular-nums; }
.md-svc-btns { display: flex; gap: 6px; flex: none; }
.svc-dot.busy { background: var(--orange); }
.md-url { color: var(--accent); user-select: text; -webkit-user-select: text; }
.md-url:hover { text-decoration: underline; }
.md-sess-ic { width: 28px; height: 28px; flex: none; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(#9b6cf6, #4b32c8); }
.md-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-sess .row-stack { min-width: 0; }
.md-pills { display: flex; gap: 5px; flex: none; }
.md-dl { gap: 6px; }
.md-dl-head { display: flex; justify-content: space-between; gap: 10px; }
.md-dl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.md-dl-pct { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.md-dl .usage-bar { flex: none; }
.md-dl-sub { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.md-empty { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 22px 16px; text-align: center; font-size: 12px; color: var(--text-2); }
.md-empty .ic { color: var(--text-3); margin-bottom: 2px; }
.md-empty b { font-size: 13px; font-weight: 600; color: var(--text); }
#md-logs-title { scroll-margin-top: 12px; }
@container (max-width: 700px) {
  .md-grid { grid-template-columns: minmax(0, 1fr); }
  .md-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Control Center summary */
.cc-media { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 10px; text-align: left; }
.cc-media:hover { background: var(--hover); }
.cc-media .cc-txt { flex: 1; }
.md-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--text-3); }
.md-dot.up { background: var(--green); }

/* ---------- Desktop: phone-only controls stay out of the way ---------- */
@media (min-width: 769px) {
  .m-only { display: none !important; }
}

/* ---------- Phones and tablets (<= 768px) ---------- */
@media (max-width: 768px) {
  :root { --top: calc(44px + env(safe-area-inset-top)); --dock-h: calc(62px + env(safe-area-inset-bottom)); }
  body { overscroll-behavior: none; }

  /* Status bar */
  .menubar {
    height: var(--top); padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    background: var(--toolbar); backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: 0 .5px 0 var(--sep-strong); font-size: 15px;
  }
  body[data-theme="light"] .menubar { box-shadow: 0 .5px 0 rgb(0 0 0 / .12); }
  .mb-left { flex: 1; min-width: 0; }
  .mb-right { flex: none; gap: 2px; }
  .mb-apple, .mb-app-menus, #mb-wifi, .mb-clock { display: none; }
  .mb-item { height: 38px; border-radius: 10px; }
  .mb-item:hover:not(.open) { background: transparent; }
  .mb-appname { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.2px; padding: 0 6px; line-height: 38px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .mb-status { padding: 0 8px; gap: 4px; font-size: 15px; font-weight: 500; }
  .mb-bat-pct { font-size: 14px; }
  #mb-cc { width: 42px; justify-content: center; padding: 0; }
  #mb-cc .ic { width: 19px; height: 19px; }

  /* Control Center */
  .cc {
    top: calc(var(--top) + 6px); left: auto; right: 8px; width: min(400px, calc(100vw - 16px));
    max-height: calc(100% - var(--top) - 16px); overflow-y: auto; overscroll-behavior: contain;
    padding: 12px; border-radius: 22px;
  }
  .cc-grid { gap: 10px; }
  .cc-mod { border-radius: 16px; }
  .cc-list { padding: 6px; gap: 2px; }
  .cc-row { min-height: 46px; padding: 4px 6px; gap: 10px; }
  .cc-circle { width: 34px; height: 34px; }
  .cc-txt b { font-size: 13px; }
  .cc-txt small { font-size: 12px; }
  .cc-tile { min-height: 72px; padding: 10px 12px; }
  .cc-stat-val { font-size: 22px; }
  .cc-wide { padding: 11px 13px 12px; }
  .cc-label { font-size: 13px; }
  .cc-meter { height: 30px; border-radius: 15px; }
  .cc-meter-fill { border-radius: 15px; min-width: 30px; }
  .cc-meter-val { font-size: 12px; }
  .cc-note { font-size: 12px; }
  .cc-footer { min-height: 46px; padding: 0 14px; font-size: 14px; border-radius: 14px; }

  /* One full-screen app at a time */
  .desktop { top: var(--top); bottom: var(--dock-h); }
  .window, .window.maximized {
    left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important;
    min-width: 0; min-height: 0; border-radius: 0; box-shadow: none; background: var(--win-bg);
  }
  .window::after, .traffic, .resize-handle, .sb-top { display: none; }
  .window:not(.focused) { visibility: hidden; }
  .window.opening { animation: winfade .18s ease-out; }
  @keyframes winfade { from { opacity: 0; } }
  .window.minimizing { transform: none; }
  body.is-mobile:has(.window input:focus, .window textarea:focus) .dock { display: none; }
  body.is-mobile:has(.window input:focus, .window textarea:focus) .desktop { bottom: var(--kb, 0px); }

  /* Shared toolbar controls */
  .toolbar { height: auto; min-height: 52px; padding: 6px 8px; gap: 2px; }
  .tb-btn { height: 40px; min-width: 40px; padding: 0 8px; border-radius: 10px; color: var(--accent); }
  .tb-btn:hover:not(:disabled) { background: transparent; color: var(--accent); }
  .tb-btn:active:not(:disabled) { background: var(--press); }
  .tb-btn:disabled { color: var(--text-3); opacity: 1; }
  .tb-nav { margin-right: 0; gap: 0; }
  .btn { height: 34px; padding: 0 14px; font-size: 15px; border-radius: 9px; }
  .btn-sm { height: 30px; padding: 0 12px; font-size: 14px; }
  .switch { width: 51px; height: 31px; }
  .switch span { border-radius: 16px; }
  .switch span::after { width: 27px; height: 27px; top: 2px; left: 2px; }
  .switch input:checked + span::after { transform: translateX(20px); }
  .popup select { height: 36px; font-size: 16px; padding: 0 32px 0 12px; border-radius: 9px; }
  .popup i { right: 8px; width: 18px; height: 18px; border-radius: 5px; }

  /* Finder */
  .win-finder { background: var(--win-bg); }
  .f-sidebar {
    position: absolute; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 84%);
    background: var(--sidebar-solid); backdrop-filter: none; -webkit-backdrop-filter: none; border-right: 0;
    transform: translateX(-102%); transition: transform .28s cubic-bezier(.3,.7,.2,1);
    box-shadow: 0 0 40px rgb(0 0 0 / .35); padding-left: env(safe-area-inset-left);
  }
  .win-finder.sb-open .f-sidebar { transform: none; }
  .f-scrim { display: block; position: absolute; inset: 0; z-index: 39; background: rgb(0 0 0 / .38); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .win-finder.sb-open .f-scrim { opacity: 1; pointer-events: auto; }
  .sb-mhead { display: flex; align-items: center; justify-content: space-between; height: 56px; flex: none; padding: 0 12px 0 20px; font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
  .sb-mclose { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ctl); color: var(--text-2); }
  .f-sidebar .sb-scroll { padding: 0 10px 20px; }
  .sb-section { font-size: 13px; padding: 14px 12px 6px; }
  .sb-item { height: 46px; gap: 12px; padding: 0 12px; border-radius: 10px; font-size: 16px; }
  .sb-item i { width: 22px; }
  .sb-item i .ic { width: 20px; height: 20px; }
  .sb-item.active { background: var(--accent); color: #fff; }
  .sb-item.active i { color: #fff; }
  .sb-disk { height: auto; padding: 10px 12px; }
  .sb-disk-meta { font-size: 12px; }

  .win-finder .toolbar { flex-wrap: wrap; row-gap: 6px; }
  .win-finder .tb-spacer, #finder-fwd, #finder-up, .win-finder .tb-divider, #finder-view-seg,
  .win-finder .tb-btn[data-action="finder-mkdir"], .win-finder .tb-btn[data-action="finder-upload"], #finder-hidden-btn { display: none; }
  #finder-title { flex: 1; max-width: none; min-width: 0; padding: 0 4px; font-size: 17px; font-weight: 600; }
  .tb-search {
    display: none; order: 10; flex: 1 0 100%; width: 100%; height: 38px; margin: 0 2px 2px; padding: 0 0 0 10px;
    border-radius: 10px; gap: 6px;
  }
  .f-main.searching .tb-search { display: flex; }
  .f-main.searching #finder-search-btn { color: var(--text); background: var(--press); }
  .tb-search input { font-size: 16px; height: 100%; }
  .tb-search-cancel { flex: none; height: 100%; padding: 0 12px; font-size: 15px; color: var(--accent); }
  .f-pathbar, .f-iconsize { display: none !important; }
  .f-statusbar { height: 30px; font-size: 12px; }
  .f-content { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .drop-hint { inset: 0; }

  .ml { padding: 2px 0 12px; }
  .ml-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 2px 0 16px; }
  .ml-row + .ml-row::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; height: 1px; background: var(--sep); }
  .ml-row:active, .ml-row.selected { background: var(--sel-inactive); }
  .ml-icon { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center; }
  .ml-icon svg.fi { width: 32px; height: 32px; }
  .ml-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .ml-name { font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ml-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  .ml-chev { color: var(--text-3); display: flex; flex: none; }
  .ml-row.dotfile .ml-txt, .ml-row.dotfile .ml-icon { opacity: .55; }
  .item-more {
    width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; color: var(--text-2);
  }
  .item-more:active { background: var(--press); }

  .iv-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px 4px; padding: 10px 8px 16px; }
  .iv-item { position: relative; padding: 10px 2px 8px; border-radius: 14px; }
  .iv-item:active { background: var(--sel-inactive); }
  .iv-item .item-more { position: absolute; top: 0; right: 0; width: 36px; height: 36px; color: var(--text-3); z-index: 1; }
  .iv-name { max-width: 100%; font-size: 13px; }

  /* Quick Look: full-screen sheet */
  .ql, .ql.zoomed {
    left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important;
    min-width: 0; min-height: 0; border-radius: 0; z-index: 9100; box-shadow: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    animation: qlup .3s cubic-bezier(.2,.9,.25,1);
  }
  @keyframes qlup { from { opacity: 0; transform: translateY(32px); } }
  .ql-head { height: auto; flex-wrap: wrap; padding: 2px 6px 4px; gap: 0 4px; }
  .ql-dclose, .ql-dzoom { display: none; }
  .ql-back { display: flex; align-items: center; height: 44px; padding: 0 10px 0 2px; flex: none; font-size: 17px; color: var(--accent); border-radius: 10px; }
  .ql-back:active { background: var(--press); }
  .ql-title { flex: 1; min-width: 0; font-size: 16px; padding: 0 4px; margin-right: 82px; }
  .ql-tools { order: 2; flex: 1 0 100%; height: 44px; gap: 6px; justify-content: flex-end; padding: 0 2px; }
  #ql-html-seg { margin-right: auto; }
  .seg-text.seg-sm button { padding: 6px 16px; font-size: 14px; border-radius: 7px; }
  .ql-tools .btn-sm { height: 34px; padding: 0 18px; font-size: 15px; border-radius: 9px; }
  .ql-btn { width: 44px; height: 40px; border-radius: 10px; color: var(--accent); }
  .ql-btn:hover { background: transparent; color: var(--accent); }
  .ql-btn:active { background: var(--press); }
  .ql-body { padding-bottom: env(safe-area-inset-bottom); }
  .ql-editor { padding: 12px 14px; font-size: 13px; }
  .ql-info { padding: 24px; }
  .ql-info svg.fi { width: 104px; height: 104px; }
  .ql-float {
    display: inline-flex; position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    align-items: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 21px;
    background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 6px 20px rgb(0 0 0 / .3);
  }

  /* Activity Monitor */
  .am-toolbar { min-height: 52px; padding: 7px 10px; gap: 8px; }
  .am-titles, .am-toolbar .tb-spacer { display: none; }
  #am-tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  #am-tabs::-webkit-scrollbar { display: none; }
  #am-tabs button { flex: 1 0 auto; padding: 7px 12px; font-size: 13px; border-radius: 7px; }
  .am-live { flex: none; padding-right: 2px; }
  .am-tab { overflow-y: auto; overscroll-behavior: contain; }
  .am-table-wrap { flex: none; overflow: visible; }
  .am-tab[data-tab="cpu"] .am-table-wrap { display: none; }
  .am-cards { display: block; padding: 12px 12px 0; }
  .am-cards-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 2px 4px 8px; }
  .am-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  .am-card, .am-stats div {
    min-width: 0; border-radius: 12px; background: var(--group-bg); box-shadow: inset 0 0 0 .5px var(--group-border);
  }
  body[data-theme="dark"] .am-card, body[data-theme="dark"] .am-stats div { background: rgb(255 255 255 / .05); }
  .am-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
  .am-card.unused { opacity: .5; }
  .am-card .usage-bar { flex: none; height: 6px; }
  .am-card-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
  .am-card-head b { font-weight: 600; font-variant-numeric: tabular-nums; }
  .am-card-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .am-bottom { height: auto; flex: none; flex-direction: column; gap: 10px; padding: 12px; border-top: 0; background: transparent; font-size: 13px; }
  .am-graph-box { order: -1; width: 100%; gap: 6px; }
  .am-graph-label { text-align: left; padding-left: 4px; font-size: 11px; }
  .am-graph { flex: none; height: 92px; border-radius: 10px; }
  .am-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .am-stats div { flex-direction: column; justify-content: flex-start; gap: 3px; padding: 10px 12px; white-space: normal; }
  .am-stats span { font-size: 12px; }
  .am-stats b { font-size: 15px; font-weight: 600; white-space: nowrap; }
  .am-bottom.am-bottom-note { flex-direction: row; align-items: flex-start; gap: 8px; color: var(--text-2); line-height: 1.4; }
  .am-tab .mac-table { font-size: 14px; }
  .am-tab .mac-table th { height: 32px; }
  .am-tab .mac-table td { height: 46px; }
  .am-tab .mac-table td:first-child { white-space: normal; line-height: 1.25; padding-top: 6px; padding-bottom: 6px; }
  .am-tab .mac-table td:first-child .muted { display: block; font-size: 12px; }
  .am-tab[data-tab="mem"] th:nth-child(1) { width: 40%; }
  .am-tab[data-tab="thermal"] th:nth-child(4), #am-temp-rows td:nth-child(4) { display: none; }
  .am-tab[data-tab="thermal"] th:nth-child(1) { width: 50%; }
  .am-tab[data-tab="svc"] th:nth-child(3), .am-tab[data-tab="svc"] th:nth-child(4),
  #am-svc-rows td:nth-child(3), #am-svc-rows td:nth-child(4) { display: none; }
  .am-tab[data-tab="svc"] th:nth-child(1) { width: 46%; }
  .am-tab[data-tab="svc"] th:nth-child(5) { width: 96px; }

  /* System Settings: list, then detail */
  .win-settings { background: var(--pane-bg); }
  .s-sidebar {
    position: absolute; inset: 0; z-index: 2; width: 100%; border-right: 0;
    background: var(--pane-bg); backdrop-filter: none; -webkit-backdrop-filter: none;
    transition: transform .3s cubic-bezier(.3,.7,.2,1);
  }
  .s-main { position: absolute; inset: 0; z-index: 3; transform: translateX(100%); transition: transform .3s cubic-bezier(.3,.7,.2,1); box-shadow: -10px 0 30px rgb(0 0 0 / .2); }
  .win-settings.show-detail .s-main { transform: none; }
  .win-settings.show-detail .s-sidebar { transform: translateX(-28%); }
  .win-settings:not(.show-detail) .s-main { visibility: hidden; transition: transform .3s cubic-bezier(.3,.7,.2,1), visibility 0s .3s; }
  .s-large-title { display: block; padding: 12px 18px 10px; font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
  .s-search { height: 38px; margin: 0 16px 14px; padding: 0 10px; border-radius: 10px; gap: 6px; }
  .s-search input { font-size: 16px; height: 100%; }
  .s-sidebar .sb-scroll { padding: 0 16px 28px; }
  .s-account { min-height: 68px; padding: 12px 14px; margin-bottom: 22px; border-radius: 12px; background: var(--group-bg); box-shadow: inset 0 0 0 .5px var(--group-border); }
  body[data-theme="dark"] .s-account, body[data-theme="dark"] .s-item { background: rgb(255 255 255 / .06); }
  .s-account.active, .s-account:hover { background: var(--group-bg); }
  .s-avatar { width: 46px; height: 46px; font-size: 19px; }
  .s-account b { font-size: 17px; }
  .s-account small { font-size: 13px; }
  .s-item { position: relative; height: 50px; gap: 14px; padding: 0 14px; border-radius: 0; font-size: 16px; background: var(--group-bg); }
  .s-item > span:last-child { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .s-item::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-top: 2px solid var(--text-3); border-right: 2px solid var(--text-3); transform: rotate(45deg); }
  .s-item + .s-item::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--sep); }
  .s-item.active, .s-item:hover { color: var(--text); }
  body[data-theme="light"] .s-item.active, body[data-theme="light"] .s-item:hover { background: var(--group-bg); }
  body[data-theme="dark"] .s-item.active, body[data-theme="dark"] .s-item:hover { background: rgb(255 255 255 / .06); }
  .s-item:active { background: var(--press) !important; }
  .s-nav > .s-item:first-child, .s-gap + .s-item { border-top-left-radius: 12px; border-top-right-radius: 12px; }
  .s-nav > .s-item:last-child, .s-item:has(+ .s-gap) { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
  .s-gap { height: 22px; }
  .s-item .sicon { width: 30px; height: 30px; border-radius: 8px; }
  .s-item .sicon .ic { width: 18px; height: 18px; }

  .s-main .toolbar { position: relative; height: 50px; min-height: 50px; justify-content: center; padding: 0 8px; }
  .s-main .tb-nav { display: none; }
  .s-mback { display: flex; position: absolute; left: 2px; top: 3px; bottom: 3px; align-items: center; padding: 0 10px 0 2px; border-radius: 10px; font-size: 17px; color: var(--accent); }
  .s-mback:active { background: var(--press); }
  #settings-title { font-size: 17px; font-weight: 600; max-width: calc(100% - 220px); }
  .s-pane-wrap { padding: 6px 16px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .pane-hero { gap: 12px; padding: 4px 2px 12px; }
  .pane-hero .sicon-lg { width: 48px; height: 48px; }
  .pane-hero h2 { font-size: 18px; }
  .pane-hero p { font-size: 13px; }
  .group { border-radius: 12px; }
  .group-title { font-size: 14px; margin: 4px 6px 8px; }
  .group-foot { font-size: 13px; margin: -10px 8px 14px; }
  .row { min-height: 50px; padding: 10px 14px; font-size: 15px; gap: 10px; }
  .row + .row::before, .row + .log-box::before { left: 14px; right: 0; }
  .row-l { flex: 0 0 auto; max-width: 52%; }
  .row-l.row-stack, .row-l.svc-name, .row-l.muted { flex: 1 1 auto; max-width: none; }
  .row-r { min-width: 0; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; }
  .row-stack small { font-size: 12.5px; }
  .row:has(#log-select), .row:has(#accent-picker) { flex-wrap: wrap; }
  .row:has(#log-select) .row-r { flex: 1 0 100%; flex-wrap: nowrap; }
  .row:has(#log-select) .popup { flex: 1; min-width: 0; }
  .row:has(#log-select) select { width: 100%; }
  .row:has(#accent-picker) .row-r { flex: 1 0 100%; justify-content: flex-start; }
  .accent-row { gap: 12px; }
  .accent-dot { width: 30px; height: 30px; }
  .accent-dot.active::after { width: 10px; height: 10px; }
  .log-box { height: 46vh; font-size: 11.5px; }
  .mode-picker { gap: 10px; }
  .mode-card { padding: 6px 2px; }
  .mode-art { padding: 8px; gap: 4px; }
  .mode-name { font-size: 15px; }
  .mode-sub { font-size: 12px; }
  .appearance-picker { justify-content: space-around; gap: 8px; }
  .appearance-picker button { font-size: 13px; }
  .wall-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
  .about-name { font-size: 22px; }
  .about-model { font-size: 13px; }

  /* Terminal */
  .win-terminal .titlebar { display: none; }
  .term-body { display: flex; flex-direction: column; padding: 0; overflow: hidden; font-size: 12.5px; }
  .term-output { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .term-keys {
    display: flex; flex: none; gap: 6px; padding: 7px 8px; overflow-x: auto; scrollbar-width: none;
    background: var(--toolbar); border-top: 1px solid var(--sep); font-family: var(--font);
  }
  .term-keys::-webkit-scrollbar { display: none; }
  .term-keys button {
    flex: 1 0 auto; min-width: 46px; height: 36px; padding: 0 12px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; color: var(--text);
    background: var(--ctl); box-shadow: inset 0 0 0 .5px var(--ctl-border), 0 .5px 1px rgb(0 0 0 / .15);
  }
  body[data-theme="light"] .term-keys button { background: #fff; }
  .term-keys button:active { background: var(--press); }
  .term-line { flex: none; align-items: center; gap: 8px; padding: 2px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--toolbar); }
  body.is-mobile:has(#term-input:focus) .term-line { padding-bottom: 8px; }
  .term-prompt { flex: none; max-width: 42%; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--text-2); }
  #term-input {
    height: 40px; padding: 0 12px; border-radius: 10px; font-size: 16px;
    background: var(--field); box-shadow: inset 0 0 0 .5px var(--ctl-border);
  }
  #term-input:focus { box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
  .term-line.busy { visibility: visible; height: auto; opacity: .45; pointer-events: none; }

  /* Dock becomes a tab bar */
  .dock, body[data-theme="light"] .dock {
    left: 0; right: 0; bottom: 0; transform: none; height: var(--dock-h);
    padding: 5px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
    border-radius: 0; gap: 4px; align-items: center; justify-content: space-around;
    background: var(--toolbar); backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: 0 -.5px 0 var(--sep-strong);
  }
  body[data-theme="light"] .dock { box-shadow: 0 -.5px 0 rgb(0 0 0 / .12); }
  .dock-sep, .dock-item[data-folder], .dock-tip, .dock-dot { display: none !important; }
  .dock-item {
    flex: 1 1 0; max-width: 110px; min-width: 0; width: auto !important; height: 54px;
    flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; transition: none;
  }
  .dock-item::after {
    content: attr(data-label); max-width: 100%; padding: 0 2px; font-size: 10.5px; font-weight: 500; color: var(--text-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .dock-icon { width: 32px !important; height: 32px !important; transform: none !important; flex: none; }
  .dock-item.active { background: var(--press); }
  .dock-item.active::after { color: var(--text); font-weight: 600; }
  .dock-item:active .dock-icon { filter: brightness(.75); }
  .dock-item.bounce .dock-icon { animation: none; }
  body.kb-open .dock { display: none; }


  /* Media Server */
  .win-media .am-toolbar { display: none; }
  .md-body { padding: 10px 16px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  /* Device art + name side by side, chips and links full width underneath */
  .md-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 14px; padding: 6px 2px 16px; }
  .md-device { grid-row: 1 / span 2; }
  .md-hero-txt { display: contents; }
  .md-hero-name { grid-column: 2; align-self: end; font-size: 22px; flex-wrap: wrap; }
  .md-hero-model { grid-column: 2; align-self: start; }
  .md-chips { grid-column: 1 / -1; margin-top: 14px; }
  .md-hero-links { grid-column: 1 / -1; margin-top: 12px; }
  .md-hero-name .pill { font-size: 12px; }
  .md-hero-model { font-size: 13px; }
  .md-chip { height: 28px; padding: 0 11px; border-radius: 14px; font-size: 13px; }
  .md-hero-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .md-hero-links .btn { height: 44px; justify-content: center; gap: 6px; padding: 0 10px; font-size: 15px; font-weight: 500; border-radius: 12px; }
  .md-banner { flex-wrap: wrap; border-radius: 12px; padding: 14px; }
  .md-banner-txt b { font-size: 15px; }
  .md-banner-txt p { font-size: 13px; }
  .md-banner .btn { width: 100%; height: 44px; justify-content: center; border-radius: 12px; }
  .md-stats { gap: 8px; }
  .md-card { padding: 12px 13px 13px; border-radius: 12px; }
  .md-card-label { font-size: 12px; }
  .md-card-val { font-size: 22px; }
  .md-card-sub { font-size: 12px; white-space: normal; line-height: 1.3; }
  .md-title-meta { font-size: 13px; }
  .md-title-row .btn { height: 36px; }
  .md-svc { flex-wrap: wrap; row-gap: 8px; }
  .md-svc .row-l.svc-name { flex: 1 1 200px; }
  .md-svc-btns { margin-left: auto; gap: 8px; }
  .md-svc-btns .btn { height: 38px; padding: 0 14px; }
  .md-sess { flex-wrap: wrap; row-gap: 6px; }
  .md-sess .row-l.svc-name { flex: 1 1 200px; }
  .md-pills { margin-left: auto; }
  .md-pills .pill { font-size: 12px; padding: 2px 8px; }
  .md-dl-sub { font-size: 12.5px; }
  .md-empty { font-size: 13px; padding: 26px 18px; }
  .md-empty b { font-size: 15px; }
  .cc-media { min-height: 58px; padding: 8px 14px 8px 10px; }
  .row:has(#md-log-select) { flex-wrap: wrap; }
  .row:has(#md-log-select) .row-r { flex: 1 0 100%; flex-wrap: nowrap; }
  .row:has(#md-log-select) .popup { flex: 1; min-width: 0; }
  .row:has(#md-log-select) select { width: 100%; }

  /* Alerts, notifications, menus */
  .alert-layer { padding: calc(var(--top) + 9vh) 20px 0; }
  .alert { width: min(320px, 100%); padding: 22px 18px 16px; border-radius: 18px; }
  .alert-title { font-size: 16px; }
  .alert-msg { font-size: 13px; }
  .alert-input { height: 40px; font-size: 16px; border-radius: 10px; padding: 0 10px; }
  .alert-btns .btn { height: 44px; font-size: 16px; border-radius: 12px; }
  .notif-stack { top: calc(var(--top) + 6px); left: auto; right: 8px; width: min(400px, calc(100vw - 16px)); }
  .notif { width: 100%; }
  .menu, .ctx { max-width: calc(100vw - 12px); }
  .mi { height: 40px; font-size: 15px; }
}

/* Narrow phones: five tabs, so use short labels where the full name would be cut off */
@media (max-width: 480px) {
  .dock-item[data-short]::after { content: attr(data-short); }
}
