/* Facsimiles of the Locals UI, rebuilt from the app's SwiftUI views.
   Everything in here is scoped under .mac and uses the system font, so it reads as macOS. */

.mac {
  /* macOS light appearance */
  --m-ink-rgb: 29, 29, 31;
  --m-bg: #fbfbf9;
  --m-card: #ffffff;
  --m-list: #ffffff;
  --m-control: #ffffff;
  --m-menu: #ffffff;
  --m-badge: #ffffff;
  --m-titlebar: #f1f0ec;
  --m-sidebar: #ece9e2;
  --m-menubar: rgba(255, 255, 255, 0.72);
  --m-text: #1d1d1f;
  --m-sec: rgba(29, 29, 31, 0.56);
  --m-ter: rgba(29, 29, 31, 0.38);
  --m-line: rgba(29, 29, 31, 0.1);
  --m-hover: rgba(29, 29, 31, 0.06);
  --m-accent: #2b2f31;
  --m-accent-fg: #ffffff;
  --m-link: #0a63c9;
  --m-green: #1e6b34;
  --m-green-bg: rgba(52, 199, 89, 0.18);
  --m-amber: #8a4b08;
  --m-amber-bg: rgba(255, 149, 0, 0.18);
  --m-red: #b42318;
  --m-red-bg: rgba(255, 59, 48, 0.16);
  --m-control-ring: 0 0 0 0.5px rgba(29, 29, 31, 0.22), 0 1px 1px rgba(0, 0, 0, 0.06);
  --m-shadow: 0 1px 2px rgba(40, 43, 45, 0.08), 0 14px 36px rgba(40, 43, 45, 0.16);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.3;
  color: var(--m-text);
  -webkit-font-smoothing: antialiased;
  text-align: left;
  letter-spacing: 0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mac {
    /* macOS dark appearance, using the app's own adaptive colours for the pills */
    --m-ink-rgb: 255, 255, 255;
    --m-bg: #29292b;
    --m-card: #323234;
    --m-list: #232325;
    --m-control: #48484b;
    --m-menu: #323234;
    --m-badge: #3a3a3c;
    --m-titlebar: #303032;
    --m-sidebar: #2b2b2e;
    --m-menubar: rgba(40, 40, 42, 0.8);
    --m-text: #f2f2f0;
    --m-sec: rgba(235, 235, 245, 0.6);
    --m-ter: rgba(235, 235, 245, 0.34);
    --m-line: rgba(255, 255, 255, 0.1);
    --m-hover: rgba(255, 255, 255, 0.08);
    --m-accent: rgba(242, 242, 240, 0.88);
    --m-accent-fg: #1d1d1f;
    --m-link: #5ab0ff;
    --m-green: #8fe3a6;
    --m-green-bg: rgba(52, 199, 89, 0.2);
    --m-amber: #ffc27a;
    --m-amber-bg: rgba(255, 149, 0, 0.2);
    --m-red: #ff9c94;
    --m-red-bg: rgba(255, 69, 58, 0.2);
    --m-control-ring: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 1px 1px rgba(0, 0, 0, 0.3);
    --m-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.6), 0 18px 44px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] .mac, [data-appearance="dark"] .mac {
  /* macOS dark appearance, using the app's own adaptive colours for the pills */
  --m-ink-rgb: 255, 255, 255;
  --m-bg: #29292b;
  --m-card: #323234;
  --m-list: #232325;
  --m-control: #48484b;
  --m-menu: #323234;
  --m-badge: #3a3a3c;
  --m-titlebar: #303032;
  --m-sidebar: #2b2b2e;
  --m-menubar: rgba(40, 40, 42, 0.8);
  --m-text: #f2f2f0;
  --m-sec: rgba(235, 235, 245, 0.6);
  --m-ter: rgba(235, 235, 245, 0.34);
  --m-line: rgba(255, 255, 255, 0.1);
  --m-hover: rgba(255, 255, 255, 0.08);
  --m-accent: rgba(242, 242, 240, 0.88);
  --m-accent-fg: #1d1d1f;
  --m-link: #5ab0ff;
  --m-green: #8fe3a6;
  --m-green-bg: rgba(52, 199, 89, 0.2);
  --m-amber: #ffc27a;
  --m-amber-bg: rgba(255, 149, 0, 0.2);
  --m-red: #ff9c94;
  --m-red-bg: rgba(255, 69, 58, 0.2);
  --m-control-ring: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 1px 1px rgba(0, 0, 0, 0.3);
  --m-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.6), 0 18px 44px rgba(0, 0, 0, 0.5);
}

.mac *, .mac *::before, .mac *::after { box-sizing: border-box; }
.mac p, .mac h1, .mac h2, .mac h3, .mac ul { margin: 0; }
.mac ul { padding: 0; list-style: none; }
.mac .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.mac .sec { color: var(--m-sec); }
.mac .tnum { font-variant-numeric: tabular-nums; }
.mac .trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- Menu bar strip ---- */
.menubar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  height: 28px;
  padding: 0 12px;
  background: var(--m-menubar);
  border: 1px solid var(--m-line);
  border-bottom-color: rgba(var(--m-ink-rgb), 0.08);
  border-radius: 10px 10px 0 0;
  font-size: 12px;
  color: var(--m-text);
  backdrop-filter: blur(20px);
}
.menubar svg { width: 16px; height: 16px; display: block; }
.menubar .mb-item { display: flex; align-items: center; gap: 5px; }
.menubar .mb-locals {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(var(--m-ink-rgb), 0.1);
}
.menubar .mb-locals svg { width: 14px; height: 14px; }
.menubar .mb-locals .count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.menubar .mb-time { font-variant-numeric: tabular-nums; }

/* ---- Panel ---- */
.panel {
  width: 420px;
  max-width: 100%;
  background: var(--m-bg);
  border: 1px solid var(--m-line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: var(--m-shadow);
  overflow: hidden;
}
.panel.standalone { border-top: 1px solid var(--m-line); border-radius: 12px; }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 8px;
}
.panel-head .title { font-size: 15px; font-weight: 600; }
.panel-head .net { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--m-sec); font-size: 12px; }
.panel-head .net svg { width: 13px; height: 13px; color: #34c759; }
.panel-head .plus { width: 16px; height: 16px; color: var(--m-sec); }
.panel-head .plus svg { width: 100%; height: 100%; }

.rows { padding: 4px 6px; display: flex; flex-direction: column; gap: 1px; }
.row {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px;
  border-radius: 8px;
  min-height: 46px;
}
.row.hover { background: var(--m-hover); }
.row .text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.row .name { font-size: 13px; font-weight: 600; }
.row .sub { font-size: 11.5px; color: var(--m-sec); }
.row .port { font-size: 12px; color: var(--m-sec); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .end { min-width: 84px; display: flex; justify-content: flex-end; align-items: center; }
.row.dim .tile { filter: saturate(0); opacity: 0.6; }
.row.dim .name { color: var(--m-sec); }

/* Framework tile with launcher badge */
.tile { position: relative; width: 34px; height: 34px; flex: 0 0 auto; }
.tile .logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--tint-bg, rgba(var(--m-ink-rgb), 0.08));
  display: grid; place-items: center;
  color: var(--m-text);
}
.tile .logo svg { width: 17.4px; height: 17.4px; display: block; }
.tile.lg { width: 56px; height: 56px; }
.tile.lg .logo { width: 52px; height: 52px; border-radius: 14px; }
.tile.lg .logo svg { width: 30px; height: 30px; }
.tile.lg .badge { width: 20px; height: 20px; right: 0; bottom: 0; }
.tile.sm { width: 30px; height: 30px; }
.tile.sm .logo { width: 26px; height: 26px; border-radius: 7px; }
.tile.sm .logo svg { width: 15px; height: 15px; }
.badge {
  position: absolute; right: 0; bottom: 0;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--m-badge);
  box-shadow: 0 0 0 0.5px rgba(var(--m-ink-rgb), 0.15);
  display: grid; place-items: center;
  overflow: hidden;
}
.badge svg { width: 10px; height: 10px; display: block; }
.badge.b-terminal { background: #2b2b2d; color: #fff; }
.badge.b-vscode { background: #2f80ed; color: #fff; }
.badge.b-cursor { background: #111; color: #fff; }
.badge.b-t3 { background: #7c3aed; color: #fff; font: 600 6.5px/1 -apple-system, system-ui, sans-serif; letter-spacing: -0.2px; }
.badge.b-claude { color: #d97757; }
.badge.b-codex { color: var(--m-text); }
.badge.b-locals { color: var(--m-text); }
.badge.b-ghostty { background: #1a1b26; color: #8be9fd; }
.badge.b-zed { background: #084ccf; color: #fff; }
.badge.b-warp { background: #01a4ff; color: #fff; }
.badge.b-xcode { background: #1e8ffa; color: #fff; }

/* Status pill */
.pill {
  font-size: 10.5px; font-weight: 600;
  padding: 2.5px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill.local { background: var(--m-amber-bg); color: var(--m-amber); }
.pill.network, .pill.shared { background: var(--m-green-bg); color: var(--m-green); }
.pill.busy, .pill.erroring { background: var(--m-red-bg); color: var(--m-red); }
.pill.slow { background: rgba(255, 204, 0, 0.22); color: var(--m-amber); }
.pill.none { background: rgba(var(--m-ink-rgb), 0.08); color: var(--m-sec); }

/* Row actions (hover state) */
.actions { display: flex; align-items: center; gap: 8px; color: var(--m-text); }
.actions svg { width: 14px; height: 14px; display: block; }

.section-title {
  position: relative;
  padding: 10px 14px 2px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--m-sec);
  display: flex; align-items: center;
}
.section-title::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--m-line); }
.section-title .clear { margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 11px; }

.panel-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--m-line);
  font-size: 13px;
}
.panel-foot .spacer { flex: 1; }
.panel-foot svg { width: 14px; height: 14px; color: var(--m-sec); }
.disclosure { display: flex; align-items: center; gap: 6px; padding: 6px 14px; color: var(--m-sec); font-size: 12px; border-top: 1px solid var(--m-line); margin: 0 12px; padding-left: 2px; }
.disclosure svg { width: 9px; height: 9px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font: 500 12px/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  padding: 4px 10px;
  min-height: 22px;
  border-radius: 6px;
  background: var(--m-control);
  color: var(--m-text);
  box-shadow: var(--m-control-ring);
  white-space: nowrap;
}
.btn.primary { background: var(--m-accent); color: var(--m-accent-fg); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.1); }
.btn.small { font-size: 11px; padding: 2px 8px; min-height: 18px; border-radius: 5px; }
.btn.large { font-size: 13px; padding: 6px 12px; min-height: 28px; border-radius: 7px; }
.btn.plain { background: transparent; box-shadow: none; padding: 0; }
.btn.danger { color: var(--m-red); }
.btn svg { width: 13px; height: 13px; }
.menu-btn::after { content: ""; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 4px solid currentColor; margin-left: 2px; opacity: 0.7; }

/* ---- Popover (share) ---- */
.popover {
  position: relative;
  width: 290px; max-width: 100%;
  padding: 16px;
  background: var(--m-bg);
  border: 1px solid var(--m-line);
  border-radius: 12px;
  box-shadow: var(--m-shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.popover .who { display: flex; align-items: center; gap: 10px; }
.popover .who .h { font-size: 13px; font-weight: 600; }
.popover .who .c { font-size: 11px; color: var(--m-sec); }
.popover .qr { align-self: center; width: 216px; height: 216px; padding: 8px; background: #fff; border-radius: 10px; }
.popover .qr svg { width: 100%; height: 100%; display: block; }
.popover .links { display: flex; flex-direction: column; gap: 4px; }
.popover .links .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popover .buttons { display: flex; gap: 8px; }
.popover .note { font-size: 11px; color: var(--m-sec); }
.popover .callout { font-size: 13px; font-weight: 500; }
.popover .body { font-size: 13px; color: var(--m-sec); }
.popover .tip { font-size: 11px; color: var(--m-sec); }

/* ---- Window chrome ---- */
.window {
  background: var(--m-bg);
  border: 1px solid var(--m-line);
  border-radius: 12px;
  box-shadow: var(--m-shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.titlebar {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  background: var(--m-titlebar);
  border-bottom: 1px solid var(--m-line);
  font-weight: 600; font-size: 13px;
}
.titlebar .lights { display: flex; gap: 8px; margin-right: 6px; }
.titlebar .lights i { width: 12px; height: 12px; border-radius: 50%; background: rgba(var(--m-ink-rgb), 0.18); box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12); }
.titlebar .lights i:nth-child(1) { background: #ff5f57; }
.titlebar .lights i:nth-child(2) { background: #febc2e; }
.titlebar .lights i:nth-child(3) { background: #28c840; }
.titlebar .t { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
.titlebar .tools { margin-left: auto; display: flex; gap: 10px; color: var(--m-sec); }
.titlebar .tools svg { width: 15px; height: 15px; }

.window-body { display: grid; grid-template-columns: 210px 300px 1fr; min-height: 560px; }
.sidebar { background: var(--m-sidebar); border-right: 1px solid var(--m-line); padding: 8px 10px; display: flex; flex-direction: column; font-size: 13px; }
.sidebar .grp { font-size: 11px; font-weight: 600; color: var(--m-ter); padding: 10px 8px 4px; }
.sidebar .item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; }
.sidebar .item svg { width: 15px; height: 15px; color: var(--m-sec); flex: 0 0 auto; }
.sidebar .item.on { background: rgba(var(--m-ink-rgb), 0.12); }
.sidebar .item .n { margin-left: auto; color: var(--m-sec); font-size: 12px; font-variant-numeric: tabular-nums; }
.sidebar .foot { margin-top: auto; display: flex; gap: 8px; align-items: center; padding: 8px 2px 2px; }
.sidebar .foot svg { width: 14px; height: 14px; color: #34c759; }
.sidebar .foot .a { font-size: 11px; font-weight: 600; }
.sidebar .foot .b { font-size: 10px; color: var(--m-sec); }

.list { border-right: 1px solid var(--m-line); padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--m-list); }
.list .row { min-height: 54px; gap: 10px; }
.list .row.on { background: rgba(var(--m-ink-rgb), 0.08); }
.list .row .end { flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.list .row .sub { font-size: 11px; }

.inspector { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.insp-head { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--tint-head, rgba(var(--m-ink-rgb), 0.05)); }
.insp-head .h1 { font-size: 17px; font-weight: 600; }
.insp-head .h2 { font-size: 13px; color: var(--m-sec); margin-top: 2px; }
.insp-head .chips { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.insp-head .chip { font-size: 11px; padding: 2px 6px; border-radius: 999px; background: rgba(var(--m-ink-rgb), 0.07); font-variant-numeric: tabular-nums; }
.insp-head .buttons { margin-left: auto; display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.card { padding: 14px; border-radius: 12px; background: var(--m-card); box-shadow: inset 0 0 0 1px rgba(var(--m-ink-rgb), 0.07); display: flex; flex-direction: column; gap: 10px; }
.card .ct { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--m-sec); }
.kv { display: grid; grid-template-columns: max-content 1fr; column-gap: 14px; row-gap: 8px; font-size: 13px; align-items: center; }
.kv .k { color: var(--m-sec); }
.kv .v { display: flex; align-items: center; gap: 6px; min-width: 0; }
.linkrow { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.linkrow .k { font-size: 11px; color: var(--m-sec); width: 84px; flex: 0 0 auto; }
.linkrow .u { color: var(--m-link); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.linkrow svg { width: 13px; height: 13px; color: var(--m-sec); flex: 0 0 auto; }
.sparkline { width: 120px; height: 24px; border-radius: 3px; background: rgba(var(--m-ink-rgb), 0.05); }
.sparkline svg { width: 100%; height: 100%; display: block; }
.sparkline path { fill: none; stroke: var(--m-text); stroke-width: 1.5; stroke-linejoin: round; }
.output { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; color: var(--m-sec); white-space: pre; overflow: hidden; line-height: 1.45; }

/* ---- Doctor window ---- */
.doctor { width: 620px; max-width: 100%; }
.doctor .d-head { display: flex; gap: 12px; align-items: center; padding: 20px; border-bottom: 1px solid var(--m-line); }
.doctor .d-head svg { width: 30px; height: 30px; flex: 0 0 34px; color: var(--m-red); }
.doctor .d-head .h { font-size: 15px; font-weight: 600; }
.doctor .d-head .c { font-size: 12px; color: var(--m-sec); margin-top: 3px; }
.doctor .d-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.finding { padding: 14px; border-radius: 10px; background: var(--m-card); box-shadow: inset 0 0 0 1px rgba(var(--m-ink-rgb), 0.08); display: flex; flex-direction: column; gap: 10px; }
.finding .ft { display: flex; gap: 8px; align-items: baseline; font-size: 13px; font-weight: 600; }
.finding .ft svg { width: 13px; height: 13px; align-self: center; flex: 0 0 auto; }
.finding .ft.block svg { color: var(--m-red); }
.finding .ft.warn svg { color: #f29a1f; }
.finding .fd { font-size: 13px; color: var(--m-sec); }
.fix { display: flex; flex-direction: column; gap: 4px; }
.fix .line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fix .cmd { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; color: var(--m-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fix .tags { display: flex; gap: 10px; font-size: 10px; color: var(--m-sec); }
.fix .tags span { display: inline-flex; gap: 3px; align-items: center; }
.fix .tags svg { width: 10px; height: 10px; }
.doctor .d-foot { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--m-line); }
.doctor .d-foot .spacer { flex: 1; }

/* ---- Small popovers: start, port busy ---- */
.mini-menu { background: var(--m-menu); border-radius: 8px; box-shadow: 0 0 0 0.5px rgba(0,0,0,.15), 0 10px 28px rgba(40,43,45,.2); padding: 5px; width: max-content; max-width: 100%; }
.mini-menu .mi { padding: 4px 10px 4px 24px; font-size: 13px; border-radius: 5px; position: relative; }
.mini-menu .mi.on { background: #2f6fde; color: #fff; }
.mini-menu .sep { height: 1px; background: var(--m-line); margin: 4px 10px; }

.start { width: 360px; max-width: 100%; padding: 10px; }
.start .search { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; background: var(--m-control); box-shadow: inset 0 0 0 1px rgba(var(--m-ink-rgb), .14); font-size: 13px; color: var(--m-ter); margin-bottom: 6px; }
.start .search svg { width: 12px; height: 12px; }
.start .row { min-height: 44px; }
.start .row .end { min-width: 0; }

/* Log window */
.logwin { width: 100%; }
.logwin .log { padding: 10px 14px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; line-height: 1.55; white-space: pre; overflow: hidden; color: var(--m-text); background: var(--m-list); min-height: 180px; }
.logwin .log .dim { color: var(--m-ter); }
.logwin .log .ok { color: var(--m-green); }

/* Settings-ish check row */
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check svg { width: 14px; height: 14px; color: #34c759; }

@media (max-width: 1100px) {
  .window-body { grid-template-columns: 190px 1fr; }
  .window-body .inspector { grid-column: 1 / -1; border-top: 1px solid var(--m-line); }
}
@media (max-width: 640px) {
  .window-body { grid-template-columns: 1fr; min-height: 0; }
  .sidebar { display: none; }
  .list { border-right: 0; }
  .insp-head .buttons { display: none; }
}
