/* Local macOS-style refinement. Screenshot icons stay unmodified. */
:root {
  --surface: #f7f7f9;
  --surface-card: #fff;
  --win-bg: var(--surface);
  --text-primary: #202124;
  --text-secondary: #66666c;
  --hairline: rgba(0, 0, 0, .08);
  --selection: #007aff;
  --hover-fill: rgba(0, 0, 0, .045);
}
html[data-theme="dark"] {
  --surface: #242426;
  --surface-card: #303033;
  --text-primary: #f5f5f7;
  --text-secondary: #b2b2b8;
  --hairline: rgba(255, 255, 255, .1);
  --hover-fill: rgba(255, 255, 255, .075);
}

/* A quiet, consistent window frame and visible keyboard feedback. */
.window {
  color: var(--text-primary);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22), 0 1px 8px rgba(0, 0, 0, .13);
}
.window.focused {
  box-shadow: 0 24px 64px rgba(0, 0, 0, .3), 0 2px 12px rgba(0, 0, 0, .15);
}
.window .tl { border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer; }
:is(button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.window :is(input, textarea, select):focus-visible { outline-offset: -2px; }
.window :is(button, [role="button"], [role="switch"]) { touch-action: manipulation; }
.window .tb-btn { border-radius: 7px; transition: background-color .12s; }
.window .tb-btn:hover { background: var(--hover-fill); }
.window :is(button, [role="button"]):active { filter: brightness(.96); }
.d-icon.app-icon .lb, html[data-theme="dark"] .d-icon.app-icon .lb {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .85), 0 2px 8px rgba(0, 0, 0, .3);
}
#dock { bottom: calc(8px + env(safe-area-inset-bottom)); }

/* System Settings follows the narrow sidebar + grouped rows reference. */
.settings-side {
  width: 228px;
  flex-basis: 228px;
  padding: 16px 10px 20px;
  background: #ededf0;
  border-color: var(--hairline);
}
.settings-main {
  min-width: 0;
  padding: 0 24px 24px;
  background: #fff;
  scrollbar-gutter: stable;
}
.settings-profile { padding: 6px 7px 10px; }
.settings-profile .avatar { overflow: hidden; flex: 0 0 38px; box-shadow: none; }
.settings-profile .avatar img { width: 100%; height: 100%; object-fit: cover; }
.settings-profile .name { font-size: 14px; }
.settings-profile .sub, .settings-group-label { color: var(--text-secondary); }
.settings-search { margin-bottom: 12px; }
.settings-side .side-item { min-height: 34px; padding: 6px 8px; gap: 9px; border-radius: 7px; }
.settings-side .side-item.sel { background: var(--selection); color: #fff; }
.settings-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px; width: 22px; height: 22px; }
.settings-icon:has(> svg) { border-radius: 5px; background: #8e8e93; color: #fff; }
.settings-side .settings-icon > svg { width: 16px; height: 16px; flex-basis: 16px; }
.settings-side :is([data-section="wifi"], [data-section="bt"], [data-section="net"], [data-section="vpn"], [data-section="airdrop"], [data-section="language"], [data-section="display"]) .settings-icon:has(> svg) { background: #008aff; }
.settings-side [data-section="battery"] .settings-icon:has(> svg) { background: #34c759; }
.settings-side [data-section="noti"] .settings-icon:has(> svg) { background: #ff453a; }
.settings-side [data-section="focus"] .settings-icon:has(> svg) { background: #6654f0; }
.settings-topbar { height: 48px; background: var(--surface-card); }
.settings-nav { width: 30px; height: 30px; border: 1px solid var(--hairline); color: var(--text-primary); background: transparent; }
.set-title { font-size: 22px; font-weight: 650; margin: 8px 0 18px; }
.settings-main[data-tab="general"] > .set-title { display: none; }
.settings-hero {
  padding: 20px 20px 18px;
  border-radius: 13px;
  background: #f7f7f8;
  border: 0;
  margin: 8px 0 16px;
}
.settings-hero .hero-icon { width: 48px; height: 48px; margin-bottom: 10px; }
.settings-hero h1 { font-size: 22px; font-weight: 650; margin-bottom: 6px; }
.settings-hero p { color: var(--text-secondary); line-height: 1.6; font-size: 12px; }
.set-card { gap: 12px; padding: 12px; border-color: var(--hairline); border-radius: 11px; background: #f7f7f8; }
.set-card .info { min-width: 0; }
.set-card .info .t { font-size: 13px; font-weight: 500; }
.set-card .info .d { color: var(--text-secondary); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.set-card .ic { width: 24px; height: 24px; flex: 0 0 24px; }
.settings-card-group { border-radius: 11px; overflow: hidden; background: #f7f7f8; margin-bottom: 14px; }
.settings-card-group .set-card { border: 0; border-radius: 0; margin: 0; min-height: 58px; background: transparent; position: relative; }
.settings-card-group .set-card + .set-card::before { content: ''; position: absolute; left: 12px; right: 12px; top: 0; height: 1px; background: var(--hairline); }
.settings-link:hover { background: var(--hover-fill); }
.settings-link::after { font-size: 20px; color: var(--text-secondary); }
.settings-main .slider { flex-shrink: 0; max-width: 38%; }
.settings-main .switch { flex-shrink: 0; }
.settings-sheet-desc { color: var(--text-secondary); }
html[data-theme="dark"] .settings-side { background: #29292c; }
html[data-theme="dark"] .settings-main, html[data-theme="dark"] .settings-topbar { background: #202022; }
html[data-theme="dark"] :is(.settings-hero, .settings-card-group, .set-card) { background: var(--surface-card); }
html[data-theme="dark"] .settings-card-group .set-card { background: transparent; }
html[data-theme="dark"] .settings-nav { background: transparent; color: var(--text-primary); }
html[data-theme="dark"] .settings-nav:hover, html[data-theme="dark"] .settings-link:hover { background: var(--hover-fill); }

/* App interiors share the same calm sidebar, spacing and readable captions. */
.finder-side { border-right-color: var(--hairline); }
.finder-side .side-item { min-height: 30px; border-radius: 6px; }
.finder-toolbar { gap: 8px; }
.finder-item .lb { line-height: 1.45; }
.notes-side { flex-basis: 210px; width: 210px; }
.notes-item { margin-bottom: 3px; padding: 10px 12px; }
.notes-item .p { opacity: .8; margin-top: 4px; }
.notes-count, .finder-status { color: var(--text-secondary); }
.mail-read { padding: 24px; line-height: 1.65; }
.mail-list { width: 270px; flex-basis: 270px; }
.mail-side .side-item .ref-icon { width: 17px; height: 17px; flex: 0 0 17px; }
.store-scroll { padding: 24px; }
.store-hero { padding: 24px; border-radius: 14px; }
.store-hero h1 { font-size: 26px; line-height: 1.25; }
.store-hero-art { width: 104px; height: 104px; flex: 0 0 104px; transform: none; }
.store-cards { gap: 12px; }
.store-card { padding: 14px; border-radius: 12px; background: var(--surface-card); border-color: var(--hairline); }
.store-card-copy span, .store-card-copy small, .store-side-foot { color: var(--text-secondary); }
.store-get { border-radius: 20px; font-weight: 600; }
.store-hero-button { color: #333; }
.ctx-menu { border-radius: 10px; }
.ctx-menu .menu-item { line-height: 1.4; }

@media (hover: none) and (pointer: coarse) {
  /* Larger hit areas without inflating the authentic 12px traffic-light dots. */
  .window .win-titlebar .traffic { gap: 8px; }
  .window .win-titlebar .tl { box-sizing: content-box; padding: 16px; background-clip: content-box; }
  .settings-side .side-item { min-height: 40px; }
  .settings-nav { width: 36px; height: 36px; }
}
@media (max-width: 900px) {
  .mail-side { width: 140px; flex-basis: 140px; }
  .mail-list { width: 220px; flex-basis: 220px; }
  .mail-read { padding: 18px; }
  .store-side { width: 160px; flex-basis: 160px; }
  .store-scroll { padding: 18px; }
  .store-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 640px) {
  #dock { bottom: calc(4px + env(safe-area-inset-bottom)); }
  .settings-side { width: 100%; height: 178px; padding: 10px; }
  .settings-main { height: calc(100% - 178px); padding: 0 14px 20px; }
  .settings-profile { padding-bottom: 6px; }
  .settings-search { font-size: 16px; }
  .settings-hero { padding: 14px; }
  .settings-hero .hero-icon { width: 40px; height: 40px; }
  .settings-card-group .set-card { min-height: 60px; }
  .notes-side { width: 132px; flex-basis: 132px; }
  .notes-editor { padding: 14px; }
  .mail-body { flex-wrap: wrap; overflow-y: auto; }
  .mail-side { width: 110px; flex-basis: 110px; max-height: 180px; }
  .mail-list { flex: 1; width: auto; min-width: 0; max-height: 180px; }
  .mail-read { flex: 0 0 100%; overflow: visible; padding: 16px; }
  .store-side { width: 110px; flex-basis: 110px; padding: 12px 6px; }
  .store-scroll { padding: 12px; }
  .store-hero { padding: 16px; min-height: 150px; }
  .store-hero h1 { font-size: 20px; }
  .store-hero-art { display: none; }
  .store-cards { grid-template-columns: minmax(0, 1fr); }
  .store-card { padding: 10px; gap: 8px; flex-wrap: wrap; }
  .store-card-icon { width: 38px; height: 38px; flex-basis: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
