/* CrewDash remote UI. Values come from tokens.css (docs/designs/macos/final/tokens.css, unchanged):
   glass only on navigation (top bar, machine switcher, menu, toast), opaque paper for content,
   system blue for actions and selection, amber only for "needs you", status as shape plus colour. */

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--solid-win);
  color: var(--label);
  font: var(--fs-body)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.link { color: var(--accent-ink); text-decoration: none; font-size: var(--fs-callout); }
.link:hover { text-decoration: underline; }

/* --- top bar (navigation: glass) --- */
.bar {
  position: sticky; top: 0; z-index: 10;
  height: var(--toolbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 16px;
  background: var(--win-bg);
  -webkit-backdrop-filter: var(--win-filter); backdrop-filter: var(--win-filter);
  box-shadow: 0 .5px 0 var(--sep);
}
.brand { font-size: var(--fs-title); font-weight: 600; color: var(--label); text-decoration: none; }
.acct { position: relative; min-width: 0; }
.glass-btn {
  display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 60vw;
  height: 34px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--glass-ctl);
  -webkit-backdrop-filter: var(--ctl-filter); backdrop-filter: var(--ctl-filter);
  box-shadow: var(--glass-edge), var(--glass-spec);
}
.acct-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-provider { color: var(--label-2); font-size: var(--fs-sub); flex: none; }
.menu {
  position: absolute; right: 0; top: 40px; min-width: 210px; padding: 5px;
  display: flex; flex-direction: column;
  background: var(--menu-bg);
  -webkit-backdrop-filter: var(--menu-filter); backdrop-filter: var(--menu-filter);
  border-radius: var(--r-inner);
  box-shadow: var(--glass-edge), var(--lift);
}
.menu-item {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 5px; background: none;
  text-align: left; cursor: pointer; color: var(--label); text-decoration: none; font-size: var(--fs-body);
}
.menu-item:hover { background: var(--accent-fill); color: var(--on-accent); }

/* --- controls --- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ctl-bg); box-shadow: var(--ctl-shadow); color: var(--label);
  transition: background var(--t-hover) var(--ease-std);
}
.btn:hover { background: var(--fill-2); }
.btn.default { background: var(--def-bg); box-shadow: var(--def-edge); color: var(--on-accent); font-weight: 500; }
.btn.default:hover { background: var(--accent-fill); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 28px; padding: 4px 12px; font-size: var(--fs-callout); }
.btn.small::after { content: ""; position: absolute; inset: -8px -2px; }
.btn.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.field { display: block; margin-top: 12px; font-size: var(--fs-callout); color: var(--label-2); }
.field input {
  display: block; width: 100%; height: 34px; margin-top: 4px; padding: 0 10px;
  border: 0; border-radius: var(--r-ctl);
  background: var(--field-bg); box-shadow: var(--field-ring);
  color: var(--label); font: var(--fs-body) var(--font);
}
.field input:focus { outline: 3px solid var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent); }

/* --- paper --- */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--card-shadow); padding: 16px; }
.title { font-size: var(--fs-title); font-weight: 600; }
.sub { font-size: var(--fs-sub); font-weight: 600; color: var(--label-2); margin-top: 20px; }
.hint { font-size: var(--fs-callout); color: var(--label-2); margin-top: 8px; }
.sline { margin-top: 6px; color: var(--label-2); overflow-wrap: anywhere; }
.error-line { margin-top: 10px; color: var(--error-ink); font-size: var(--fs-callout); }

/* --- status shapes (spec row 6): the shape is the rule, the colour follows --- */
.shape { display: inline-block; flex: none; width: 8px; height: 8px; }
.shape.working { border-radius: 50%; background: var(--working); }
.shape.starting { border-radius: 50%; background: var(--working); opacity: .5; }
.shape.needs { width: 7px; height: 7px; margin: 0 1px; transform: rotate(45deg); background: var(--needs); box-shadow: 0 0 0 1px var(--needs-edge); }
.shape.idle { border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--idle); }
.shape.proposed { border-radius: 50%; border: 1.5px dashed var(--idle); }
.shape.error { background: var(--error); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--label-2); font-size: var(--fs-callout); white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
  background: var(--fill); color: var(--label-2); font-size: var(--fs-sub); font-weight: 600; white-space: nowrap;
}
.pill.needs { background: var(--needs-wash); color: var(--needs-ink); }
.pill.level.act { background: var(--accent-wash); color: var(--accent-ink); }
.badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--needs); color: var(--on-needs); font-size: var(--fs-foot); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* --- signed out --- */
.signin { max-width: 400px; margin: 32px auto; padding: 0 16px; }
.signin .title { margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* --- shell: switcher + one machine --- */
.shell {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 8px; align-items: start;
  max-width: 1120px; margin: 0 auto; padding: 8px;
}
.side {
  position: sticky; top: calc(var(--toolbar-h) + 8px);
  padding: 8px;
  background: var(--sb-bg);
  -webkit-backdrop-filter: var(--sb-wall-filter); backdrop-filter: var(--sb-wall-filter);
  border-radius: var(--r-sidebar);
  box-shadow: var(--glass-edge), var(--lift);
}
.side-head { font-size: var(--fs-sub); font-weight: 600; color: var(--label-2); padding: 4px 8px 6px; }
.mlist { display: flex; flex-direction: column; gap: 2px; }
.mrow {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 8px;
  border: 0; border-radius: var(--r-inner); background: none; cursor: pointer; text-align: left;
}
.mrow:hover { background: var(--fill); }
.mrow.on { background: var(--accent-wash); }
.mrow.on .mname { color: var(--accent-ink); }
.mtext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msub { font-size: var(--fs-sub); color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add { display: block; padding: 10px 8px 4px; }

.content { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.machine { display: flex; flex-direction: column; gap: 8px; }
.mtitle { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mh1 { font-size: var(--fs-title); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mword { color: var(--label-2); font-size: var(--fs-callout); white-space: nowrap; }
.mmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.mmeta .btn { margin-left: auto; }
.meta { font-size: var(--fs-callout); color: var(--label-2); }
.mnote {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding: 8px 10px; border-radius: var(--r-inner); background: var(--inset);
  font-size: var(--fs-callout); color: var(--label-2);
}
.state .stitle { font-size: var(--fs-title); font-weight: 600; }

.projects { display: flex; flex-direction: column; gap: 8px; }
.phead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.pname { font-size: var(--fs-title); font-weight: 600; min-width: 0; overflow-wrap: anywhere; margin-right: auto; }
.goal { margin-top: 8px; overflow-wrap: anywhere; }
.report { margin-top: 6px; color: var(--label-2); font-size: var(--fs-callout); overflow-wrap: anywhere; }
.plan { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--fs-callout); color: var(--label-2); }
.plan progress { -webkit-appearance: none; appearance: none; width: 120px; height: 4px; border: 0; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.plan progress::-webkit-progress-bar { background: var(--fill-2); border-radius: 2px; }
.plan progress::-webkit-progress-value { background: var(--label-2); border-radius: 2px; }
.plan progress::-moz-progress-bar { background: var(--label-2); }
.agents { list-style: none; margin: 10px 0 0; padding: 0; border-top: .5px solid var(--sep); }
.agent { display: flex; align-items: center; gap: 8px; min-height: 30px; border-bottom: .5px solid var(--sep); }
.aname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: var(--fs-foot); font-weight: 600; color: var(--label-2); background: var(--fill); padding: 1px 5px; border-radius: 4px; }
.agent .status { margin-left: auto; }

/* --- Needs-you cards --- */
.needs-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.need { padding: 12px; border-radius: var(--r-inner); background: var(--inset); box-shadow: inset 0 0 0 .5px var(--sep); }
.nhead { display: flex; align-items: center; gap: 6px; font-size: var(--fs-callout); color: var(--label-2); min-width: 0; }
.who { font-weight: 600; color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { margin-left: auto; white-space: nowrap; }
.ntitle { margin-top: 6px; overflow-wrap: anywhere; white-space: pre-wrap; }
.nsum {
  display: block; margin-top: 8px; padding: 6px 8px; border-radius: 6px; background: var(--term);
  box-shadow: inset 0 0 0 .5px var(--sep);
  font: var(--fs-mono)/18px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.ndetail { margin-top: 6px; color: var(--label-2); font-size: var(--fs-callout); overflow-wrap: anywhere; white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.btn.opt { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 0; border-radius: 17px; text-align: left; }
.otext { overflow-wrap: anywhere; }
.onote { font-size: var(--fs-sub); color: var(--label-2); overflow-wrap: anywhere; }
.opt-text { display: flex; flex-direction: column; padding: 6px 10px; border-radius: var(--r-inner); box-shadow: inset 0 0 0 .5px var(--sep); }
.nnote, .ndone { margin-top: 10px; font-size: var(--fs-callout); color: var(--label-2); }
.ndone { font-weight: 600; color: var(--label); }

/* --- device approval --- */
.device { max-width: 460px; margin: 32px auto; padding: 0 16px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 14px 0 0; }
.facts dt { color: var(--label-2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.warn { box-shadow: var(--card-shadow), 0 0 0 1.5px var(--error); }
.warn-head { display: flex; align-items: center; gap: 8px; }

/* --- toast (navigation layer: glass) --- */
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 20; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 9px 16px; border-radius: 999px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: var(--menu-filter); backdrop-filter: var(--menu-filter);
  box-shadow: var(--glass-edge), var(--lift);
  font-weight: 500;
}

/* --- phone: the switcher becomes a strip of chips above the machine --- */
@media (max-width: 700px) {
  .bar { padding: 0 12px; }
  .shell { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .side { position: static; padding: 6px; }
  .side-head { display: none; }
  .mlist { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .mrow { width: auto; flex: none; max-width: 70%; }
  .add { padding: 8px 8px 2px; }
  .card { padding: 14px; }
  .actions .btn { flex: 1; }
  .mmeta .btn { flex: none; }
}

/* Account fingerprint (compared with the Mac's confirm dialog). */
.menu-note { margin: 4px 10px 6px; font-size: 12px; color: var(--label-2); }
.note { color: var(--label-2); font-size: 13px; margin: 12px 0 0; }
.menu-note code, .note code { font-family: "SF Mono", ui-monospace, monospace; color: var(--label, inherit); letter-spacing: 0.06em; }
