/* Shared Magic Keys interface finish. Semantic status colours and confirmation controls remain authoritative. */
:root {
  --experience-radius: 18px;
  --experience-radius-small: 11px;
  --experience-space: clamp(1rem, 2.1vw, 2rem);
  --experience-shadow: 0 6px 24px rgb(7 21 48 / 5%);
  --experience-shadow-raised: 0 12px 32px rgb(7 21 48 / 10%);
  --experience-line: color-mix(in srgb, var(--text, #101828) 12%, transparent);
  --experience-highlight: color-mix(in srgb, var(--primary, #0570db) 7%, var(--surface, #fff));
}

/* Space, hierarchy and readable rhythm throughout the full workspace. */
html#mk4s body { font-size: 16px; line-height: 1.55; }
html#mk4s body:not(.signin-mode):not(.embed) .main-shell {
  background: radial-gradient(ellipse at 92% 0%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 48%), var(--bg);
}
html#mk4s body:not(.signin-mode):not(.embed) #workspace { padding: var(--experience-space); padding-bottom: 7rem; min-width: 0; }
html#mk4s body:not(.signin-mode) .page-head { gap: 1rem; margin-bottom: 1.65rem; align-items: center; }
html#mk4s body:not(.signin-mode) .page-head h1 { font-size: clamp(1.75rem, 2.5vw, 2.65rem); line-height: 1.15; letter-spacing: -.04em; text-transform: none; }
html#mk4s body:not(.signin-mode) .page-head p { max-width: 70ch; font-size: 1rem; line-height: 1.6; }
html#mk4s body:not(.signin-mode) #workspace :is(.panel, .room-card, .gate-card) {
  border-radius: var(--experience-radius); box-shadow: var(--experience-shadow); border-color: var(--experience-line);
}
html#mk4s body:not(.signin-mode) #workspace .panel { padding: clamp(1rem, 1.6vw, 1.5rem); overflow-wrap: anywhere; }
html#mk4s body:not(.signin-mode) #workspace .panel > .panel-head {
  background: var(--surface); border: 0; border-bottom: 1px solid var(--experience-line);
  margin: -.15rem 0 1rem; padding: .1rem 0 1rem; border-radius: 0; box-shadow: none;
}
html#mk4s body:not(.signin-mode) #workspace .panel > .panel-head :is(h2, h3) { font-size: 1.05rem; text-transform: none; letter-spacing: -.02em; color: var(--text); }
html#mk4s body:not(.signin-mode) #workspace .panel > .panel-head :is(p, small) { color: var(--muted); }
html#mk4s body:not(.signin-mode) #workspace .stat-tile { border-radius: var(--experience-radius-small); padding: 1rem 1.1rem; box-shadow: var(--experience-shadow); }
html#mk4s body:not(.signin-mode) #workspace .stat-tile strong { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
html#mk4s body:not(.signin-mode) #workspace :is(.table-scroll, .scroll-box) { border: 1px solid var(--experience-line); border-radius: var(--experience-radius-small); }
html#mk4s body:not(.signin-mode) #workspace table { font-size: .875rem; border-collapse: collapse; }
html#mk4s body:not(.signin-mode) #workspace th { font-weight: 750; padding: .85rem 1rem; background: var(--experience-highlight); color: var(--text); }
html#mk4s body:not(.signin-mode) #workspace td { padding: .9rem 1rem; border-bottom-color: var(--experience-line); }
html#mk4s body:not(.signin-mode) #workspace tbody tr:hover { background: var(--experience-highlight); }
html#mk4s body:not(.signin-mode) #workspace :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-radius: var(--experience-radius-small); font: inherit; min-height: 44px;
}

/* The rail stays quietly anchored while the workspace changes. */
html#mk4s body:not(.signin-mode) .sidebar { background: linear-gradient(160deg, var(--rail), var(--rail-2, var(--rail))); }
html#mk4s body:not(.signin-mode) .sidebar .brand-card { border-radius: 12px; overflow: hidden; box-shadow: none; }
html#mk4s body:not(.signin-mode) .sidebar .nav-item { min-height: 44px; border-radius: 10px; padding-block: .65rem; font-size: .9rem; }
html#mk4s body:not(.signin-mode) .sidebar .nav-item[aria-current="page"] { box-shadow: inset 3px 0 0 var(--rail-accent); }
html#mk4s body:not(.signin-mode) .sidebar .nav-heading { letter-spacing: .09em; font-size: .9rem; }
html#mk4s body:not(.signin-mode) .topbar { min-height: 56px; padding-inline: var(--experience-space); box-shadow: none; border-bottom: 1px solid var(--experience-line); }
html#mk4s body:not(.signin-mode) .topbar .context-title { font-size: .875rem; letter-spacing: .015em; }
html#mk4s body:not(.signin-mode) .chip { border-radius: 7px; font-weight: 650; }

/* Operator console: precise data, generous controls, the same surface language. */
html#mk-console main { max-width: 1320px; padding-inline: clamp(1rem, 2.7vw, 2rem); }
html#mk-console .card { border-radius: var(--experience-radius); padding: clamp(1rem, 1.8vw, 1.5rem); box-shadow: var(--experience-shadow); }
html#mk-console :is(.topbar, .tabs) { box-shadow: none; }
html#mk-console .gate-card { overflow: hidden; }
html#mk-console .btn { min-height: 46px; border-radius: 11px; }
html#mk-console h1 { font-size: clamp(1.65rem, 2.6vw, 2.25rem); letter-spacing: -.035em; }
html#mk-console .state { font-variant-numeric: tabular-nums; }
html#mk-console .site strong { letter-spacing: -.015em; }

/* Equipment drafts work in a narrow chat panel as well as a wide console. */
.equipment-report-tool { min-width: 0; }
.equipment-report-open, .equipment-report-copy, .equipment-report-print {
  min-height: 44px; padding: .65rem .9rem; border-radius: 10px; border: 1px solid var(--border, var(--line));
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer;
}
.equipment-report-open:hover, .equipment-report-print:hover { border-color: var(--primary, var(--accent)); }
.equipment-report-open:disabled, .equipment-report-copy:disabled, .equipment-report-print:disabled { opacity: .6; cursor: wait; }
.equipment-report { display: grid; gap: .7rem; min-width: 0; margin-top: .75rem; padding: 1rem; border: 1px solid var(--border, var(--line)); border-radius: 15px; background: var(--surface); }
.equipment-report h3, .equipment-report p { margin: 0; }
.equipment-report h3 { font-size: 1.2rem; letter-spacing: -.025em; }
.equipment-report-eyebrow { font-size: .9rem; font-weight: 800; letter-spacing: .11em; color: var(--muted); }
.equipment-report-note, .equipment-report-time, .equipment-report-result { font-size: .875rem; color: var(--muted); }
.equipment-report-text { width: 100%; min-width: 0; min-height: 13rem; resize: vertical; padding: .85rem; background: var(--bg); color: var(--text); border: 1px solid var(--border, var(--line)); border-radius: 10px; font: .875rem/1.6 var(--ui-font, system-ui); }
.equipment-report-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.equipment-report-copy { background: var(--primary, var(--accent)); color: var(--on-primary, var(--on-accent)); border-color: transparent; }
.equipment-report-result:empty { display: none; }
.equipment-report-preview:empty { display: none; }
.keys-ai-report-tools { flex: 0 1 auto; max-height: 52vh; overflow: auto; padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
.equipment-print-frame { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; }

@media (prefers-reduced-motion: no-preference) {
  html#mk4s body:not(.signin-mode) :is(.nav-item, .panel, .stat-tile),
  html#mk-console .card, .equipment-report-open { transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease; }
}
@media (max-width: 700px) {
  html#mk4s body:not(.signin-mode):not(.embed) #workspace { padding: 1rem; padding-bottom: 7rem; }
  html#mk4s body:not(.signin-mode) .page-head { margin-bottom: 1.1rem; }
  html#mk4s body:not(.signin-mode) #workspace .panel { padding: 1rem; }
  html#mk4s body:not(.signin-mode) #workspace :is(th, td) { padding: .8rem; }
  .keys-ai-panel { max-height: calc(100dvh - 7rem); }
  .equipment-report-actions > button { flex: 1 1 auto; }
}
@media (forced-colors: active) {
  .equipment-report, .equipment-report-text { border-color: CanvasText; }
  .equipment-report-copy { border: 1px solid ButtonText; }
}
