:root {
  /* WeCom-inspired blue/white theme, with independent semantic status colors. */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f5f6f8;
  --surface-hover: #f0f5ff;
  --text: #1f2329;
  --text-secondary: #4e5969;
  --muted: #646a73;
  --text-tertiary: #7c8592;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  /* Shared component sizes; mobile changes the control token, not each page. */
  --control-height-sm: 30px;
  --control-height-md: 36px;
  --control-height-lg: 40px;
  --control-height-touch: 44px;
  --control-height: var(--control-height-md);
  --control-padding-x: 12px;
  --control-gap: 6px;
  --font-xs: 12px;
  --font-sm: 13px;
  --font-md: 14px;
  --font-lg: 16px;
  --font-section: 18px;
  --font-title: clamp(20px, 2vw, 24px);
  --font-metric: 28px;
  --line-height-body: 1.5;
  --line-height-control: 1.4;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --border-default: #e2e5eb;
  --border-subtle: #edf0f4;
  --border-focus: #2f7cf6;
  --border-on-dark: rgba(255, 255, 255, 0.3);
  --border-success: #c5e8d2;
  --border-warning: #f7dfb2;
  --border-info: #cadcff;
  --border-danger: #f4c9c7;
  --tag-height: 26px;
  --table-row-height: 44px;
  --table-padding-y: 10px;
  --table-padding-x: 12px;
  --brand: #2670e8;
  --accent: #2f7cf6;
  --accent-hover: #1b68e0;
  --accent-active: #1759c2;
  --accent-soft: #edf4ff;
  --accent-tint: #dceaff;
  --blue: #2f7cf6;
  --amber: #ad6800;
  --red: #d14343;
  --green: #21834b;
  --success-soft: #edf8f1;
  --warning-soft: #fff7e8;
  --danger-soft: #fff1f0;
  --chart-secondary: #8fb8fb;
  --disabled-color: #c5cbd4;
  --shadow: 0 2px 12px rgba(31, 35, 41, 0.035);
  --sidebar-width: 252px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Component display rules must respect the existing hidden state. */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-weight: 400;
  font-size: var(--font-md);
  line-height: var(--line-height-body);
}

strong, b, h1, h2, h3, h4 { font-weight: 600; }

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

small { font-size: var(--font-xs); }
h2, h3 { font-size: var(--font-section); }
h4 { font-size: var(--font-md); }

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  gap: 0;
  padding: 24px 16px 16px;
  border-right: 1px solid var(--border-subtle);
  background: var(--surface);
  overflow: hidden;
}

.operator-card,
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 10px 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-monogram { display: none; }

.brand-mark,
.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.brand-mark {
  border-radius: var(--radius-lg);
  background: var(--brand);
  letter-spacing: 0.5px;
}

.avatar {
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.big {
  width: 64px;
  height: 64px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--font-title);
}

.avatar.small {
  width: 34px;
  height: 34px;
  font-size: var(--font-sm);
}

.brand strong,
.operator-card strong,
.operator-info > span {
  display: block;
}

.operator-info > span,
.profile-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--font-sm);
}

.nav-list {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group > span {
  padding: 0 12px;
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 600;
}

.nav-item {
  min-height: var(--control-height);
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font-weight: 400;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.active { font-weight: 500; }

.nav-item[hidden],
.admin-only[hidden],
.debug-permissions[hidden] {
  display: none;
}

.operator-card {
  width: 100%;
  padding: 12px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.operator-card .avatar {
  width: 40px;
  height: 40px;
}

.main-frame {
  width: 100%;
  min-width: 0;
  padding: 28px clamp(16px, 2vw, 32px) 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.mobile-menu-toggle,
.nav-scrim {
  display: none;
}

.date-text {
  display: block;
  color: var(--accent);
  font-size: var(--font-sm);
  font-weight: 600;
}

h1 {
  font-size: var(--font-title);
  letter-spacing: 0;
}

.topbar-actions,
.code-line,
.card-actions,
.button-row,
.chip-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  min-height: var(--tag-height);
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  padding: 0 10px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge.ok {
  background: var(--success-soft);
  color: var(--green);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--red);
}

.badge.warn {
  background: var(--warning-soft);
  color: var(--amber);
}

.badge.info {
  background: var(--accent-soft);
  color: var(--blue);
}

.primary-action,
.danger-action,
.mini-action,
.secondary-action {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-weight: 600;
}

.primary-action {
  background: var(--accent);
  color: #ffffff;
}

.danger-action {
  background: var(--danger-soft);
  color: var(--red);
}

.secondary-action,
.mini-action {
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.mini-action {
  min-height: var(--control-height);
  font-size: var(--font-sm);
}

.wide {
  width: 100%;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
}

.toast {
  position: sticky;
  top: 16px;
  z-index: 10;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.hero-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: #ffffff;
}

.hero-band h2 {
  font-size: var(--font-metric);
}

.hero-status {
  min-width: 150px;
  padding: 18px;
  border: 1px solid var(--border-on-dark);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
}

.hero-status span,
.hero-status strong {
  display: block;
}

.hero-status strong {
  margin-top: 6px;
  font-size: var(--font-metric);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.metric-grid.compact {
  margin-top: 0;
}

.metric-card {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-left: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: var(--font-md);
  font-weight: 600;
}

.metric-card strong {
  margin-top: 10px;
  font-size: var(--font-metric);
}

.metric-card small {
  margin-top: -4px;
  color: var(--muted);
}

.metric-card.ok {
  border-left-color: var(--green);
}

.metric-card.warn {
  border-left-color: var(--border-warning);
}

.metric-card.info {
  border-left-color: var(--blue);
}

.metric-card.danger {
  border-left-color: var(--red);
}

.content-grid,
.admin-grid,
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.admin-module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-module {
  margin-top: 14px;
}

.admin-two-column,
.role-admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.admin-form {
  align-content: start;
}

.admin-list {
  max-height: 680px;
  overflow: auto;
  padding-right: 2px;
}

.admin-inline-controls {
  display: grid;
  width: 100%;
  max-width: 420px;
  min-width: 0;
  gap: 10px;
  justify-items: end;
}

.admin-inline-controls label {
  width: 100%;
}

.admin-inline-controls textarea {
  min-height: 64px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-admin-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.admin-table-wrap {
  max-height: 680px;
  overflow: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

.admin-table th,
.admin-table td {
  height: var(--table-row-height);
  padding: var(--table-padding-y) var(--table-padding-x);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: 600;
}

.admin-table td strong,
.admin-table td span {
  display: block;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.admin-table td span {
  margin-top: 4px;
  color: var(--muted);
}

.table-actions {
  display: flex;
  min-width: 168px;
  flex-wrap: wrap;
  gap: 6px;
}

.mobile-card-list {
  display: none;
}

.simple-table {
  min-width: 760px;
}


.admin-table td .avatar,
.card-title-line .avatar {
  display: grid;
  margin-top: 0;
  color: var(--accent);
}

.muted-text {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: 600;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 35, 41, 0.36);
}

.modal-panel {
  width: min(680px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

body.reservation-dialog-open { overflow: hidden; }
.reservation-action-panel { width: min(560px, 100%); }
.action-dialog-error { color: var(--red); overflow-wrap: anywhere; }

.rule-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-flow span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 10px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 600;
}

.rule-row {
  align-items: flex-start;
}

.simple-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-width: 460px;
  min-width: 0;
  justify-items: stretch;
}

.simple-controls .primary-action {
  grid-column: 1 / -1;
}

.card-title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title-line strong,
.card-title-line > div > span {
  display: block;
}

.card-title-line > div > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--font-sm);
}

.mobile-admin-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.mobile-admin-card p {
  color: var(--muted);
  font-size: var(--font-sm);
}

.debug-permissions {
  display: grid;
  gap: 12px;
}

.role-checkboxes,
.permission-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-checkboxes label,
.permission-check-grid label,
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: var(--font-sm);
}

.permission-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-top: 12px;
}

.role-card {
  align-content: start;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-head,
.page-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h3,
.page-section-head h3 {
  font-size: var(--font-section);
}

.section-head p,
.page-section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--font-sm);
}

.timeline-list,
.compact-list,
.notice-list,
.booking-list,
.report-bars,
.permission-grid,
.profile-meta {
  display: grid;
  gap: 12px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 62px 14px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 14px 0;
}

.timeline-row + .timeline-row,
.list-row + .list-row,
.approval-card + .approval-card {
  border-top: 1px solid var(--border-subtle);
}

.timeline-row time {
  font-weight: 600;
}

.timeline-row time span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 600;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-row p,
.list-row p,
.notice-list p,
.approval-card p,
.instrument-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--font-sm);
}

.list-row,
.notice-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}

.filter-panel {
  display: grid;
  gap: 14px;
}

.search-box,
.form-panel label {
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 600;
}

.search-box input,
.form-panel input,
.form-panel select,
.form-panel textarea {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}

.form-panel textarea {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 14px 0;
}

.form-section + .form-section {
  border-top: 1px solid var(--border-default);
}

.form-section h4 {
  margin: 0;
  color: var(--brand);
  font-size: var(--font-md);
  font-weight: 600;
}

.checkbox-stack {
  display: grid;
  gap: 8px;
}

.form-panel .checkbox-row {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.3;
}

.form-panel .checkbox-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-panel .checkbox-row span {
  min-width: 0;
  color: var(--text);
}

.chip,
.permission-pill {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0 14px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 600;
}

.chip.active {
  background: var(--accent);
  color: #ffffff;
}

.instrument-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.instrument-card {
  padding: 18px;
}

.asset-code,
.date-tag {
  color: var(--accent);
  font-size: var(--font-xs);
  font-weight: 600;
}

.instrument-card h3 {
  margin-top: 9px;
  font-size: var(--font-section);
}

.tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.tag {
  border-radius: var(--radius-pill);
  padding: 5px 8px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: 600;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.spec-cell {
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.spec-cell span {
  display: block;
  color: var(--muted);
  font-size: var(--font-xs);
}

.spec-cell strong {
  display: block;
  margin-top: 4px;
  font-size: var(--font-sm);
}

.usage-row,
.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.usage-track,
.report-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--border-subtle);
}

.usage-fill,
.report-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.card-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.reservation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 18px;
}

.form-panel {
  display: grid;
  gap: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.check-row span {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--accent);
  text-align: center;
}

.check-row.done span {
  border-color: var(--accent);
  background: var(--accent);
}

.cost-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: #ffffff;
}

.cost-box span,
.cost-box strong {
  display: block;
}

.cost-box strong {
  margin-top: 6px;
  font-size: var(--font-metric);
}

.schedule-panel {
  grid-column: 1 / -1;
}

.schedule-board-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.schedule-title-block {
  min-width: 0;
  text-align: center;
}

.schedule-title-block h3 {
  font-size: var(--font-title);
}

.schedule-title-block p {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--font-sm);
}

.week-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-toolbar,
.schedule-legend,
.schedule-day-head,
.schedule-day-stat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.schedule-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 16px 0;
}

.schedule-legend,
.schedule-day-stat,
.schedule-window {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: 600;
}

.schedule-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--disabled-color);
}

.legend-dot.free {
  background: var(--accent);
}

.legend-dot.busy {
  background: var(--amber);
}

.legend-dot.unavailable {
  background: var(--disabled-color);
}

.legend-dot.maintenance {
  background: var(--red);
}

.legend-dot.selected {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--brand);
}

.schedule-list {
  display: grid;
  gap: 12px;
}

.schedule-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: var(--font-sm);
}

.week-calendar {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.week-calendar-grid {
  --calendar-slot-height: 22px;
  --calendar-axis-width: clamp(44px, 4vw, 64px);
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: var(--calendar-axis-width) repeat(var(--calendar-days, 7), minmax(0, 1fr));
  grid-template-rows: 40px repeat(var(--slot-count), var(--calendar-slot-height));
}

.calendar-corner,
.calendar-day-header {
  position: sticky;
  top: 0;
  z-index: 6;
  border-bottom: 1px solid var(--border-default);
  background: #ffffff;
}

.calendar-corner {
  left: 0;
  display: grid;
  grid-column: 1;
  grid-row: 1;
  place-items: center;
  border-right: 1px solid var(--border-default);
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 600;
}

.calendar-day-header {
  display: grid;
  min-width: 0;
  padding: 2px;
  grid-row: 1;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--border-subtle);
  color: var(--text);
  text-align: center;
}

.calendar-day-header strong,
.calendar-day-header span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day-header strong {
  font-size: var(--font-sm);
}

.calendar-day-header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 600;
}

.calendar-day-header.selected {
  background: var(--accent-soft);
  color: var(--accent);
}

.calendar-day-header.today {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.calendar-time-axis {
  position: sticky;
  left: 0;
  z-index: 4;
  grid-column: 1;
  grid-row: 2 / -1;
  background: #ffffff;
  border-right: 1px solid var(--border-default);
}

.time-tick {
  position: absolute;
  top: calc(var(--slot-index) * var(--calendar-slot-height));
  left: 0;
  width: 100%;
  height: calc(2 * var(--calendar-slot-height));
  padding-right: 6px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  line-height: var(--line-height-control);
  text-align: right;
  white-space: nowrap;
}

.calendar-day-column {
  position: relative;
  grid-row: 2 / -1;
  min-height: calc(var(--slot-count) * var(--calendar-slot-height));
  border-left: 1px solid var(--border-subtle);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(2 * var(--calendar-slot-height) - 1px),
      var(--border-default) calc(2 * var(--calendar-slot-height) - 1px),
      var(--border-default) calc(2 * var(--calendar-slot-height))
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) calc(var(--calendar-slot-height) - 1px),
      rgba(47, 124, 246, 0.1) calc(var(--calendar-slot-height) - 1px),
      rgba(47, 124, 246, 0.1) var(--calendar-slot-height)
    ),
    var(--accent-soft);
}

.calendar-day-column.selected {
  box-shadow: inset 0 0 0 2px rgba(47, 124, 246, 0.25);
}

.calendar-day-column.today {
  background-color: var(--surface-hover);
}

.calendar-free-slot,
.calendar-booking,
.calendar-blocked {
  position: absolute;
  top: calc(var(--slot-top) * var(--calendar-slot-height));
  height: calc(var(--slot-span) * var(--calendar-slot-height));
  border-radius: var(--radius-sm);
}

.calendar-free-slot {
  left: 0;
  z-index: 1;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.calendar-free-slot:hover,
.calendar-free-slot:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
  background: rgba(255, 255, 255, 0.18);
}

.calendar-free-slot.selected {
  border-inline: 2px solid var(--brand);
  background: rgba(255, 255, 255, 0.42);
}

.calendar-free-slot.selection-start {
  border-top: 2px solid var(--brand);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.calendar-free-slot.selection-end {
  border-bottom: 2px solid var(--brand);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.calendar-free-slot.selection-start.selection-end {
  border-radius: var(--radius-sm);
}

.calendar-booking {
  left: 3px;
  right: 3px;
  z-index: 3;
  overflow: hidden;
  padding: 5px 6px;
  border: 1px solid var(--border-default);
  background: var(--accent);
  color: #ffffff;
  cursor: not-allowed;
  text-align: center;
  line-height: 1.25;
}

.calendar-booking strong,
.calendar-booking span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-booking strong {
  font-size: var(--font-xs);
}

.calendar-booking span {
  margin-top: 2px;
  font-size: var(--font-xs);
  font-weight: 600;
}

.calendar-booking.compact span {
  display: none;
}

.calendar-booking.warn {
  background: var(--amber);
}

.calendar-booking.info {
  background: var(--blue);
}

.calendar-booking.danger {
  background: var(--red);
}

.calendar-blocked {
  left: 4px;
  right: 4px;
  z-index: 2;
  display: grid;
  align-content: center;
  min-height: 20px;
  padding: 4px 6px;
  border: 1px solid var(--border-default);
  background: rgba(239, 241, 245, 0.94);
  color: var(--muted);
  cursor: not-allowed;
  pointer-events: auto;
}

.calendar-blocked.maintenance {
  border-color: var(--border-danger);
  background: var(--danger-soft);
  color: var(--red);
}

.calendar-blocked strong,
.calendar-blocked span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-blocked strong {
  font-size: var(--font-xs);
}

.calendar-blocked span {
  margin-top: 1px;
  font-size: var(--font-xs);
  font-weight: 600;
}

.calendar-blocked.compact span {
  display: none;
}

.approval-settings-panel {
  margin-top: 18px;
}

.approval-settings-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.45fr) auto;
  align-items: end;
  gap: 14px;
  margin-top: 16px;
}

.rule-preview {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: 600;
  line-height: 1.6;
}

.schedule-day {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.schedule-day.selected {
  border-color: var(--border-focus);
  box-shadow: inset 4px 0 0 var(--accent);
}

.schedule-day-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.schedule-date {
  display: grid;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.schedule-date strong,
.schedule-date span {
  overflow-wrap: anywhere;
}

.schedule-date span {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 600;
}

.schedule-day.selected .schedule-date strong {
  color: var(--accent);
}

.schedule-track {
  display: flex;
  min-width: 0;
  min-height: 62px;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.schedule-segment {
  display: flex;
  min-width: 76px;
  min-height: 58px;
  flex: var(--duration) 0 88px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

button.schedule-segment {
  cursor: pointer;
}

.schedule-segment strong,
.schedule-segment span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-segment strong {
  font-size: var(--font-sm);
}

.schedule-segment span {
  font-size: var(--font-xs);
  font-weight: 600;
}

.schedule-segment.compact span {
  display: none;
}

.schedule-segment.free {
  background: var(--accent-soft);
  color: var(--accent);
}

.schedule-segment.free:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.schedule-segment.busy {
  border-color: var(--border-warning);
  background: var(--warning-soft);
  color: var(--amber);
}

.schedule-segment.busy.ok {
  border-color: var(--border-success);
  background: var(--success-soft);
  color: var(--green);
}

.schedule-segment.busy.info {
  border-color: var(--border-info);
  background: var(--accent-soft);
  color: var(--blue);
}

.schedule-segment.busy.danger {
  border-color: var(--border-danger);
  background: var(--danger-soft);
  color: var(--red);
}

.booking-card,
.approval-card {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.booking-head,
.approval-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.upload-inline {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--font-sm);
}

.booking-card h3,
.booking-card p,
.approval-card h4,
.approval-card p,
.instrument-card h3,
.instrument-card p,
.list-row strong,
.list-row p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.upload-inline input[type="file"] {
  max-width: 100%;
  min-width: 0;
}

.report-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  margin-top: 0;
}

.profile-card {
  align-self: start;
}

.profile-meta {
  margin-top: 18px;
}

.profile-source-note {
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: var(--font-sm);
  line-height: 1.6;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--muted);
  font-size: var(--font-md);
}

.meta-row strong {
  color: var(--text);
  text-align: right;
}

.permission-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--border-subtle);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.empty-cta {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.empty-cta strong {
  color: var(--text);
  font-size: var(--font-section);
}

.empty-cta p {
  color: var(--muted);
}

.compact-empty {
  padding: 18px;
  background: var(--surface);
}

.booking-status-group {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.booking-status-group + .booking-status-group {
  margin-top: 14px;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(47, 124, 246, 0.06), rgba(229, 239, 255, 0.38)),
    var(--bg);
}

.auth-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  justify-items: center;
  padding: 34px 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-panel h1 {
  margin: 6px 0 0;
  font-size: var(--font-title);
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

/* Shared controls: flex centers labels, line-height only defines text metrics. */
.primary-action,
.secondary-action,
.danger-action,
.mini-action,
.chip,
.nav-item,
.badge,
.tag,
.permission-pill {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--control-gap);
  max-width: 100%;
  flex-shrink: 0;
  line-height: var(--line-height-control);
  white-space: nowrap;
}

.primary-action,
.secondary-action,
.danger-action,
.mini-action,
.chip {
  min-height: var(--control-height);
  padding: 6px var(--control-padding-x);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-md);
  text-decoration: none;
}

.nav-item {
  justify-content: flex-start;
  min-height: var(--control-height-lg);
  font-size: var(--font-md);
}

/* Neutral secondary controls and blue interactive states follow the app shell. */
.primary-action, .secondary-action, .mini-action, .chip, .nav-item {
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.primary-action, .secondary-action, .danger-action, .mini-action, .chip { font-weight: 500; }
.secondary-action { border-color: var(--border-default); background: var(--surface); }
.primary-action:hover:not(:disabled) { background: var(--accent-hover); }
.primary-action:active:not(:disabled) { background: var(--accent-active); }
.secondary-action:hover:not(:disabled), .mini-action:hover:not(:disabled) {
  border-color: var(--border-info); background: var(--surface-hover); color: var(--accent);
}
.chip:not(.active):hover { background: var(--surface-hover); color: var(--accent); }
.danger-action:hover:not(:disabled) { border-color: var(--border-danger); }
.metric-card span, .schedule-legend, .schedule-window, .calendar-booking span { font-weight: 500; }

.mobile-menu-toggle { display: none; }

/* Includes selects/inputs outside .form-panel (user roles and approval rules). */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
.search-box input,
.form-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.form-panel select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  margin: 0;
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  font-size: var(--font-md);
  font-weight: 400;
  line-height: var(--line-height-control);
}

select { padding-right: 28px; }

textarea,
.form-panel textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px var(--control-padding-x);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--font-md);
  font-weight: 400;
  line-height: var(--line-height-body);
  overflow-wrap: anywhere;
}

input[type="checkbox"], input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

input:focus, select:focus, textarea:focus { border-color: var(--border-focus); }

.badge, .tag, .permission-pill {
  min-height: var(--tag-height);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  font-weight: 600;
}

/* User-defined tags may be longer than a phone: wrap the full value. */
.tag, .permission-pill, .chip {
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.icon-button {
  width: var(--control-height);
  padding: 0;
  font-size: var(--font-title);
}

button svg, button img, .legend-dot { flex-shrink: 0; }

h1, .hero-band h2 { font-size: var(--font-title); line-height: 1.3; }
h2, h3, h4 { line-height: 1.4; }
.hero-band .date-text { color: #dceaff; }

.panel, .metric-card, .hero-band, .modal-panel, .auth-panel,
.mobile-admin-card, .booking-card, .approval-card, .booking-status-group {
  border-radius: var(--radius-lg);
}

/* One outer panel provides hierarchy; repeated reservation cards use a soft fill. */
.booking-status-group .booking-card {
  border: 0;
  background: var(--surface-muted);
}

.admin-table th { font-size: var(--font-sm); font-weight: 600; white-space: nowrap; }
.admin-table td { overflow-wrap: anywhere; }
.admin-table td > strong, .admin-table td > span:not(.badge):not(.avatar) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table td .badge {
  display: inline-flex;
  margin-top: 0;
}
.table-actions { align-items: center; }

/* Allow content to shrink inside flex/grid without hiding page overflow. */
.topbar-title > *, .topbar-actions, .section-head > div, .page-section-head > div,
.brand > div, .operator-card > div, .profile-head > div, .card-title-line > div,
.booking-head > div, .approval-head > div, .list-row > div, .notice-list article > div,
.hero-band > div, .form-panel label, .two-col > *, .spec-cell, .metric-card,
.admin-module, .admin-inline-controls, .schedule-list, .week-calendar,
.booking-status-group, .rule-row > div, .mobile-card-list,
.mobile-admin-card, .card-title-line { min-width: 0; }

.mobile-admin-card, .mobile-card-list { grid-template-columns: minmax(0, 1fr); }

.card-title-line > div { flex: 1; }
.operator-card strong, .operator-card span, .profile-head h3,
.card-title-line strong, .card-title-line > div > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

p, .meta-row strong, .spec-cell strong, .rule-preview, .empty,
.form-panel label > span, .deletion-error, .asset-code, .rule-flow span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta-row > span { flex: 0 0 auto; }
.meta-row strong { min-width: 0; }
.section-head, .page-section-head { flex-wrap: wrap; }
.section-head > button, .page-section-head > button { flex-shrink: 0; }
.booking-head .badge, .approval-head .badge, .list-row > .badge { align-self: flex-start; }
.rule-row { flex-wrap: wrap; }
.rule-row > div:first-child { flex: 1 1 180px; }
.admin-inline-controls label { display: flex; align-items: center; gap: var(--control-gap); }
.admin-inline-controls label:has(input:not([type="checkbox"])) { display: grid; }
.rule-flow span { min-height: var(--control-height-sm); padding-block: 5px; }

.calendar-booking { padding-block: 3px; }
.calendar-booking.short .calendar-booking-project { display: none; }
.calendar-day-header { align-content: center; gap: 0; }
.calendar-day-header span { margin-top: 0; line-height: 1.2; }

/* Role-aware navigation: quiet white surface, consistent outline icons and blue selection. */
.sidebar-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 16px;
  padding-left: 12px;
}
.sidebar-heading strong { font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.sidebar-heading-icon { display: inline-flex; color: var(--text); }
.nav-icon { display: block; width: 22px; height: 22px; flex: 0 0 auto; }
.sidebar-heading-icon .nav-icon { width: 25px; height: 25px; }
.sidebar-toggle {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  margin-left: auto;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary);
}
.sidebar-toggle:hover { background: var(--surface-hover); color: var(--accent); }
.sidebar-toggle .nav-icon { width: 20px; height: 20px; }
.workspace-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  margin: 0 4px 16px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-muted);
}
.workspace-option {
  display: flex;
  min-width: 0;
  min-height: 34px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.workspace-option .nav-icon { width: 16px; height: 16px; }
.workspace-option.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(31, 35, 41, .07); }
.workspace-option:hover:not(.active) { color: var(--text); }
.nav-section-label { padding: 0 14px 10px; color: var(--text-tertiary); font-size: 11px; letter-spacing: 1.5px; }
.sidebar .nav-item {
  position: relative;
  width: 100%;
  min-height: 50px;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 15px;
}
.sidebar .nav-item:hover { background: #f6f8fb; color: var(--accent); }
.sidebar .nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .nav-item.active::before {
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: '';
}
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-chevron { display: inline-flex; margin-left: auto; color: #929aa6; }
.nav-chevron .nav-icon { width: 17px; height: 17px; transition: transform 160ms ease; }
[aria-expanded="true"] > .nav-chevron .nav-icon { transform: rotate(180deg); }
.sidebar .nav-group-toggle.has-active-child { color: var(--accent); }
.nav-children { display: flex; flex-direction: column; gap: 4px; padding: 2px 0 6px 22px; }
.sidebar .nav-child { min-height: 42px; gap: 14px; padding: 10px 14px; font-size: 14px; }
.nav-child-dot { width: 5px; height: 5px; flex: 0 0 auto; border: 1px solid #b1bac7; border-radius: 50%; }
.nav-child.active .nav-child-dot { border-color: currentColor; background: currentColor; }
.sidebar-footer { flex: 0 0 auto; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.sidebar-space-note { padding: 6px 8px; color: var(--text-tertiary); font-size: 11px; letter-spacing: .4px; white-space: nowrap; }
.operator-card { gap: 10px; }
.operator-card:hover { background: var(--surface-hover); }
.operator-info { min-width: 0; flex: 1; }
.operator-info strong, .operator-info #sidebarRole { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operator-info strong { font-size: 14px; }
.operator-info #sidebarRole { margin-top: 3px; font-size: 11px; }
.operator-card .operator-more { margin: 0; color: var(--text-tertiary); font-size: 20px; }
.sidebar button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }

@media (min-width: 921px) {
  body.sidebar-collapsed { --sidebar-width: 80px; }
  body.sidebar-collapsed .sidebar { align-items: stretch; gap: 0; padding: 24px 10px 16px; }
  body.sidebar-collapsed .brand { display: grid; min-height: 63px; place-items: start center; padding: 0 0 22px; }
  body.sidebar-collapsed .brand-logo { display: none; }
  body.sidebar-collapsed .brand-monogram { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--brand); color: white; font-weight: 600; font-size: 13px; letter-spacing: 1px; }
  body.sidebar-collapsed .sidebar-heading { justify-content: center; padding: 0; }
  body.sidebar-collapsed .sidebar-heading strong,
  body.sidebar-collapsed .sidebar-heading-icon,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-chevron,
  body.sidebar-collapsed .nav-children,
  body.sidebar-collapsed .operator-info,
  body.sidebar-collapsed .operator-more,
  body.sidebar-collapsed .sidebar-space-note,
  body.sidebar-collapsed .workspace-option span { display: none; }
  body.sidebar-collapsed .sidebar-toggle { margin: 0; transform: rotate(180deg); }
  body.sidebar-collapsed .workspace-switch { gap: 2px; margin-inline: 0; padding: 3px; }
  body.sidebar-collapsed .workspace-option { min-height: 30px; padding: 3px; }
  body.sidebar-collapsed .sidebar .nav-item { justify-content: center; gap: 0; padding-inline: 0; }
  body.sidebar-collapsed .operator-card { justify-content: center; padding: 12px 0; }
  body.sidebar-collapsed .nav-list { overflow-x: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-chevron .nav-icon { transition: none !important; }
}

@media (min-width: 921px) and (max-width: 1200px) {
  .main-frame { padding: 24px; }
  .content-grid, .profile-layout, .admin-grid, .admin-two-column,
  .role-admin-grid, .reservation-layout { grid-template-columns: minmax(0, 1fr); }
  .schedule-board-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .schedule-legend { flex-wrap: wrap; }
  .sidebar { padding: 20px 12px 16px; }
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(82vw, 288px);
    height: 100dvh;
    padding: 18px 14px;
    border-right: 1px solid var(--border-default);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    overflow: hidden;
  }
  .sidebar-heading { margin-bottom: 14px; }
  .workspace-option { min-height: 40px; }
  .sidebar-toggle { width: 40px; height: 40px; }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open {
    overflow: hidden;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    background: rgba(31, 35, 41, 0.35);
  }

  .nav-scrim[hidden] {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-y: auto;
    padding-bottom: 16px;
  }

  .nav-group {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
  }

  .nav-group > span {
    align-self: initial;
    padding: 0 12px;
    white-space: nowrap;
  }

  .nav-item {
    flex: initial;
  }

  .operator-card {
    display: flex;
  }

  .main-frame {
    padding: 18px 14px 32px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .topbar,
  .hero-band,
  .booking-head,
  .approval-head,
  .list-row,
  .schedule-board-head,
  .schedule-toolbar,
  .schedule-day-head {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-board-head {
    display: flex;
  }

  .schedule-title-block {
    text-align: left;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .button-row,
  .table-actions {
    gap: 8px;
  }

  .button-row > button,
  .table-actions > button {
    min-height: var(--control-height);
  }

  .schedule-legend,
  .schedule-day-stat {
    flex-wrap: wrap;
  }

  .schedule-segment {
    flex-basis: 108px;
  }

  .week-calendar {
    max-height: 560px;
  }

  .desktop-table {
    display: none;
  }

  .mobile-card-list {
    display: grid;
    gap: 12px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    width: 100%;
    max-height: 88vh;
  }

  .simple-controls {
    grid-template-columns: 1fr;
    min-width: 0;
    justify-items: stretch;
  }

  .rule-row {
    align-items: stretch;
  }

  h1 {
    font-size: var(--font-title);
  }

  .hero-band h2 {
    font-size: var(--font-title);
  }

  .metric-grid,
  .instrument-grid,
	  .content-grid,
	  .admin-grid,
	  .admin-two-column,
	  .role-admin-grid,
	  .approval-settings-form,
	  .reservation-layout,
	  .profile-layout,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .timeline-row {
    grid-template-columns: 54px 12px minmax(0, 1fr);
  }

  .timeline-row .badge {
    grid-column: 3;
    justify-self: start;
  }

  .two-col,
  .spec-grid,
  .report-row {
    grid-template-columns: 1fr;
  }
}

/* Booking filters wrap naturally on phones and wide desktop windows. */
.booking-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}
.booking-filters label { min-width: 0; margin: 0; }
.booking-filters #bookingCount { grid-column: 1 / -1; margin: 0; }

.deletion-error { flex-basis: 100%; margin: 8px 0 0; color: var(--red); white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 920px) {
  :root {
    --control-height: var(--control-height-touch);
    --font-xs: 13px;
  }
  .sidebar { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .nav-item { min-height: var(--control-height-touch); }
  .main-frame { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .panel, .booking-status-group { padding: 16px; }
  .hero-band { padding: 20px; gap: 16px; }
  .hero-status { min-width: 0; padding: 12px 16px; }
  .metric-card { min-height: 108px; padding: 14px; }
  .metric-card strong { margin-top: 4px; }
  .metric-card small { margin-top: 0; }
  .topbar { gap: 12px; margin-bottom: 18px; }
  .topbar-title { gap: 10px; }
  .topbar-actions > .primary-action { flex: 1; }
  .modal-panel { padding: 16px; max-height: calc(100dvh - 32px); }
  .modal-backdrop { padding: 16px 10px max(16px, env(safe-area-inset-bottom)); }
  .button-row > button, .table-actions > button { min-height: var(--control-height); }
  .button-row > select { flex: 1 1 100%; }
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-toolbar { gap: 12px; }
  .schedule-legend { gap: 8px 12px; }
  .schedule-board-head > .mini-action { align-self: flex-start; }
  .admin-module-tabs { gap: 8px; }
  .admin-module-tabs .chip { flex: 1 1 96px; }
  .list-row > .badge { align-self: flex-start; }
  .rule-row > div:first-child { flex: initial; }
  .booking-filters { grid-template-columns: minmax(0, 1fr); }
  .booking-card, .approval-card { padding: 14px; }
  .permission-pill { justify-content: flex-start; text-align: left; }
}

/* The native file picker is also an interactive control. */
input[type="file"] {
  font-size: var(--font-md);
  line-height: var(--line-height-control);
  min-height: var(--control-height);
}
input[type="file"]::file-selector-button {
  min-height: var(--control-height);
  margin-right: 8px;
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
@media (max-width: 920px) {
  /* Keep every half-hour target touchable within the scrollable timetable. */
  .week-calendar-grid {
    --calendar-slot-height: var(--control-height-touch);
  }
  .calendar-booking.compact span { display: block; }
  .calendar-booking.compact .calendar-booking-project { display: none; }
}

/* Admin analytics: shared brand colors, responsive charts and actual data. */
.admin-dashboard { display: grid; gap: 20px; }
.dashboard-heading, .dashboard-heading-actions, .dashboard-card-head,
.dashboard-filter-actions, .dashboard-shortcuts, .chart-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.dashboard-heading { padding: 4px 2px 0; }
.dashboard-heading h2 { margin-top: 3px; font-size: clamp(20px, 1.6vw, 26px); letter-spacing: -.4px; }
.dashboard-heading p, .dashboard-card-head p, .dashboard-shortcuts p { margin-top: 5px; color: var(--muted); font-size: var(--font-sm); }
.dashboard-eyebrow { color: var(--accent); font-size: var(--font-xs); font-weight: 600; letter-spacing: 2px; }
.dashboard-updated { color: var(--muted); font-size: var(--font-xs); }
.dashboard-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 16px 22px; padding: 18px 22px; box-shadow: none; }
.dashboard-filters label { display: grid; min-width: 0; gap: 7px; color: var(--muted); font-size: var(--font-xs); }
.dashboard-filters > label { flex: 0 1 180px; }
.dashboard-filters select { color: var(--text); }
.dashboard-range { display: flex; align-items: end; gap: 12px; flex: 1 1 350px; max-width: 460px; }
.dashboard-range label { flex: 1; }
.dashboard-range-divider { padding-bottom: 8px; color: var(--text-tertiary); }
.dashboard-filter-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-left: auto; }
#dashboardFilterError { flex-basis: 100%; color: var(--red); font-size: var(--font-sm); }
.dashboard-unavailable { padding: 60px 24px; text-align: center; }
.dashboard-unavailable p { margin-top: 10px; color: var(--muted); }
.dashboard-chart-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr); gap: 20px; }
.admin-dashboard .panel { min-width: 0; border-radius: var(--radius-lg); box-shadow: 0 4px 20px rgba(31, 35, 41, .025); }
.monthly-panel, .dashboard-status-panel, .dashboard-overview, .dashboard-instrument-panel, .dashboard-ranking { padding: 24px; }
.dashboard-card-head { align-items: flex-start; flex-wrap: wrap; }
.dashboard-card-head h3 { font-size: 17px; letter-spacing: -.2px; }
.dashboard-section-index { display: block; margin-bottom: 7px; color: var(--text-tertiary); font-size: var(--font-xs); font-weight: 600; letter-spacing: 1.4px; }
.chart-legend { display: flex; gap: 16px; padding-top: 4px; font-size: var(--font-xs); color: var(--muted); }
.chart-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-key { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.chart-key.booked, .chart-bar.booked { background: var(--accent); }
.chart-key.used, .chart-bar.used { background: var(--chart-secondary); }
.chart-headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin: 21px 0 20px; }
.chart-headline strong { font-size: 32px; font-weight: 600; letter-spacing: -1px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.chart-headline small { margin-left: 8px; font-size: var(--font-sm); font-weight: 400; letter-spacing: 0; color: var(--muted); }
.chart-headline > span { color: var(--muted); font-size: var(--font-xs); }
.chart-headline .chart-secondary { margin-left: auto; }
.monthly-chart { display: flex; gap: 12px; height: 220px; }
.chart-y-axis { display: flex; flex-direction: column; justify-content: space-between; width: 36px; flex-shrink: 0; height: 194px; transform: translateY(-7px); color: var(--text-tertiary); font-size: var(--font-xs); text-align: right; }
.chart-plot { position: relative; flex: 1; min-width: 0; }
.chart-gridlines { position: absolute; inset: 0 0 26px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-gridlines i { display: block; border-top: 1px dashed var(--border-default); }
.chart-gridlines i:last-child { border-top-style: solid; }
.chart-columns { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(3px, .9vw, 18px); height: 100%; }
.chart-month { display: flex; flex-direction: column; min-width: 0; padding: 0 2px; border: 0; background: transparent; border-radius: 5px; color: var(--muted); }
.chart-month:hover, .chart-month:focus-visible { background: rgba(47, 124, 246, .055); color: var(--accent); }
.chart-bar-pair { display: flex; justify-content: center; align-items: end; gap: 3px; width: 100%; height: 194px; }
.chart-bar { display: block; width: 40%; max-width: 24px; border-radius: 4px 4px 0 0; }
.chart-month-label { display: block; width: 100%; padding-top: 8px; font-size: var(--font-xs); line-height: 18px; text-align: center; white-space: nowrap; }
.chart-footer { min-height: 30px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border-subtle); color: var(--muted); font-size: var(--font-xs); }
.chart-footer > :last-child { white-space: nowrap; }
.live-indicator { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: var(--font-xs); }
.live-indicator::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.dashboard-donut { display: grid; width: 166px; aspect-ratio: 1; margin: 22px auto; padding: 17px; border-radius: 50%; background: var(--donut-fill, var(--border-default)); }
.dashboard-donut > div { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); }
.dashboard-donut strong { font-size: 34px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; }
.dashboard-donut span { margin-top: 5px; color: var(--muted); font-size: var(--font-xs); }
.status-breakdown { display: grid; gap: 12px; }
.status-breakdown > div { display: grid; grid-template-columns: 1fr auto 42px; gap: 10px; align-items: center; font-size: var(--font-xs); }
.status-breakdown > div > span:first-child { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.status-breakdown > div > span:last-child { color: var(--text-tertiary); text-align: right; }
.status-breakdown strong { font-size: var(--font-md); font-weight: 600; }
.status-breakdown small { padding-left: 4px; color: var(--muted); font-weight: 400; }
.status-key { width: 8px; height: 8px; border-radius: 50%; background: var(--disabled-color); }
.status-key.available { background: var(--accent); }
.status-key.maintenance { background: var(--amber); }
.dashboard-range-tag, .dashboard-table-count { padding: 5px 10px; border-radius: 6px; background: var(--surface-muted); color: var(--muted); font-size: var(--font-xs); white-space: nowrap; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.dashboard-kpi { display: flex; align-items: flex-start; gap: 14px; padding: 20px 16px; border: 1px solid var(--border-default); border-radius: 10px; background: var(--surface-muted); }
.dashboard-kpi > div { min-width: 0; }
.dashboard-kpi-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.dashboard-kpi-icon svg { width: 22px; height: 22px; }
.dashboard-kpi div > span { color: var(--muted); font-size: var(--font-sm); }
.dashboard-kpi strong { display: block; margin-top: 7px; font-size: clamp(22px, 2vw, 30px); font-weight: 600; line-height: 1.25; letter-spacing: -.7px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-kpi strong small { margin-left: 5px; font-size: var(--font-xs); font-weight: 400; letter-spacing: 0; }
.dashboard-kpi p { margin-top: 8px; font-size: var(--font-xs); color: var(--muted); line-height: 1.4; }
.dashboard-method { margin-top: 16px; font-size: var(--font-xs); line-height: 1.8; color: var(--muted); }
.dashboard-data-note { display: block; color: var(--amber); }
.dashboard-detail-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr); gap: 20px; align-items: stretch; }
.dashboard-table-filters { display: flex; align-items: center; gap: 10px; margin: 20px 0 16px; }
.dashboard-table-filters input { flex: 1; }
.dashboard-table-filters select { flex: 0 1 154px; }
.dashboard-table-wrap { max-height: 420px; overflow: auto; }
.dashboard-table { width: 100%; border-collapse: collapse; font-size: var(--font-sm); }
.dashboard-table th { position: sticky; top: 0; z-index: 1; padding: 12px 10px; background: var(--surface-muted); color: var(--text-secondary); font-weight: 500; text-align: left; white-space: nowrap; }
.dashboard-table th:first-child { border-radius: 6px 0 0 6px; }
.dashboard-table th:last-child { border-radius: 0 6px 6px 0; }
.dashboard-table td { padding: 17px 10px; border-bottom: 1px solid var(--border-subtle); font-variant-numeric: tabular-nums; }
.dashboard-table td:not(:first-child) { white-space: nowrap; }
.dashboard-table td:first-child { min-width: 110px; max-width: 260px; }
.dashboard-table td strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.dashboard-table td span { display: block; margin-top: 4px; color: var(--text-tertiary); font-size: var(--font-xs); overflow-wrap: anywhere; }
.dashboard-table td small { margin-left: 4px; font-size: var(--font-xs); color: var(--text-tertiary); }
.dashboard-table tbody tr:hover { background: var(--surface-hover); }
.dashboard-detail-link { min-height: 30px; padding: 0; background: transparent; color: var(--accent); font-size: var(--font-xs); }
.usage-missing-dot { display: inline-block; width: 5px; height: 5px; margin-left: 5px; border-radius: 50%; background: var(--amber); vertical-align: middle; }
.dashboard-ranking { display: flex; flex-direction: column; }
.ranking-symbol { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 21px; }
.dashboard-ranking-list { flex: 1; margin-top: 8px; }
.dashboard-ranking-list article { display: flex; align-items: center; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border-subtle); }
.dashboard-ranking-list article:last-child { border-bottom: 0; }
.ranking-number { color: var(--text-tertiary); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ranking-number.first { color: var(--accent); }
.ranking-person { flex: 1; min-width: 0; }
.ranking-person > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--font-sm); }
.ranking-person strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-person span { color: var(--accent); white-space: nowrap; }
.ranking-person p { margin-top: 4px; color: var(--text-tertiary); font-size: var(--font-xs); overflow-wrap: anywhere; }
.ranking-track { height: 4px; margin-top: 9px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.ranking-track i { display: block; height: 100%; border-radius: inherit; background: var(--chart-secondary); }
.dashboard-ranking-list article:first-child .ranking-track i { background: var(--accent); }
.dashboard-ranking-note { margin-top: 14px; color: var(--muted); font-size: var(--font-xs); }
.dashboard-empty { display: grid; min-height: 140px; padding: 30px 10px; place-content: center; text-align: center; color: var(--muted); }
.dashboard-empty strong { font-weight: 500; }
.dashboard-empty p { margin-top: 8px; font-size: var(--font-xs); color: var(--text-tertiary); }
.dashboard-shortcuts { flex-wrap: wrap; }
.dashboard-shortcuts .quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dashboard-shortcuts button { gap: 10px; background: var(--surface-muted); font-weight: 500; }
.dashboard-shortcuts button > span:last-child { color: var(--text-tertiary); }
.shortcut-count { padding: 0 5px; border-radius: 4px; background: var(--accent-tint); color: var(--accent); font-size: var(--font-xs); }
@media (min-width: 921px) and (max-width: 1320px) {
  .dashboard-chart-grid, .dashboard-detail-grid { grid-template-columns: minmax(0, 1.65fr) minmax(250px, 1fr); gap: 16px; }
  .monthly-panel, .dashboard-status-panel, .dashboard-instrument-panel, .dashboard-ranking, .dashboard-overview { padding: 20px; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-table td, .dashboard-table th { padding-inline: 7px; }
  .chart-month-label > span { display: none; }
}
@media (max-width: 920px) {
  .admin-dashboard { gap: 16px; }
  .dashboard-heading { align-items: flex-start; flex-wrap: wrap; }
  .dashboard-heading-actions { flex-wrap: wrap; gap: 10px; }
  .dashboard-chart-grid, .dashboard-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .monthly-panel, .dashboard-status-panel, .dashboard-overview, .dashboard-instrument-panel, .dashboard-ranking { padding: 18px 16px; }
  .dashboard-filters { padding: 16px; gap: 14px; }
  .dashboard-filters > label { flex: 1 1 100%; }
  .dashboard-range { flex-basis: 100%; max-width: none; gap: 7px; }
  .dashboard-range-divider { padding-bottom: 12px; }
  .dashboard-filter-actions { margin-left: 0; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dashboard-kpi { flex-direction: column; padding: 14px 12px; gap: 10px; }
  .dashboard-kpi strong { font-size: 25px; }
  .dashboard-kpi p { font-size: var(--font-xs); }
  .dashboard-table-wrap { max-height: 480px; }
  .dashboard-table { min-width: 530px; }
  .chart-headline { margin-top: 18px; }
  .chart-headline .chart-secondary { flex-basis: 100%; margin-left: 0; }
  .chart-columns { gap: 2px; }
  .chart-month { padding-inline: 1px; }
  .chart-bar-pair { gap: 1px; }
  .chart-month-label > span { display: none; }
  .chart-footer { flex-wrap: wrap; gap: 5px; }
  .chart-legend { gap: 10px; }
  .chart-y-axis { width: 28px; }
  .monthly-chart { gap: 8px; }
  .dashboard-updated { font-size: var(--font-xs); }
}

.instrument-list-toolbar { flex-wrap: wrap; gap: 16px; }
.instrument-list-toolbar .button-row { flex-wrap: wrap; }
.instrument-archive-help { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 6px 0 0; }

.archive-conflict { flex-basis: 100%; min-width: 0; font-size: 13px; line-height: 1.6; }
.archive-blocking-records { margin: 8px 0; padding: 8px 12px; list-style: none; color: var(--muted); background: var(--surface-muted); border-radius: 6px; overflow-wrap: anywhere; }
.archive-blocking-records li + li { margin-top: 6px; }
.archive-conflict p { margin: 6px 0; }

.instrument-admin-metadata { min-width: 0; max-width: 300px; margin-top: 8px; font-size: var(--font-xs); color: var(--text-secondary); }
.instrument-admin-metadata .tag-line { margin: 0 0 7px; }
.admin-table td .instrument-admin-metadata .tag { display: inline-flex; max-width: 100%; margin: 0; padding: 2px 6px; color: var(--text-secondary); white-space: normal; }
.instrument-admin-metadata p + p { margin-top: 3px; }
.instrument-form-help, .instrument-training-note { margin-top: 8px; color: var(--muted); font-size: var(--font-sm); line-height: 1.7; }
.instrument-card .card-actions { flex-wrap: wrap; align-items: center; }

/* Member information stays readable; role editing has its own bounded column. */
.users-panel .user-table { min-width: 1080px; table-layout: fixed; }
.user-col-member { width: calc(24% - 52.8px); }
.user-col-department { width: calc(20% - 44px); }
.user-col-contact { width: calc(18% - 39.6px); }
.user-col-role { width: calc(14% - 30.8px); }
.user-col-activity { width: calc(24% - 52.8px); }
.user-col-actions { width: 220px; }
.users-panel .user-table td { padding-block: 14px; }
.users-panel .user-table tbody tr:last-child td { border-bottom: 0; }
.users-panel .user-table tbody tr:hover { background: #fafbfc; }
.users-panel .user-member { display: flex; align-items: flex-start; min-width: 0; gap: 10px; }
.users-panel .avatar.small { width: 34px; height: 34px; flex: 0 0 34px; }
.users-panel .user-identity { display: grid; min-width: 0; gap: 5px; align-content: start; }
.users-panel .user-identity strong, .users-panel .user-identity > span,
.users-panel .user-text-stack > span {
  max-width: none; margin: 0; overflow: visible; text-overflow: clip;
  white-space: normal; overflow-wrap: anywhere;
}
.users-panel .user-identity strong { color: var(--text); font-size: var(--font-md); }
.users-panel .user-account-id { color: var(--text-tertiary); font-size: var(--font-xs); }
.users-panel .user-identity > .badge {
  display: inline-flex; width: fit-content; max-width: 100%; min-height: 22px;
  padding: 2px 6px; font-size: var(--font-xs); line-height: 1.5;
}
.users-panel .user-text-stack { display: grid; align-content: start; justify-items: start; gap: 7px; }
.users-panel .user-text-stack > span { color: var(--text); }
.users-panel .user-text-stack > .user-detail { color: var(--muted); }
.users-panel .user-status { width: fit-content; min-height: 22px; padding: 2px 7px; font-size: var(--font-xs); }
.users-panel .user-activity { display: grid; gap: 8px; font-variant-numeric: tabular-nums; }
.users-panel .user-activity-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 8px; }
.users-panel .user-activity-item > span { margin: 0; font-size: var(--font-xs); color: var(--text-tertiary); }
.users-panel .user-activity-item time { color: var(--text-secondary); font-size: var(--font-xs); overflow-wrap: anywhere; }
.users-panel .user-actions { display: grid; min-width: 0; gap: 8px; align-content: center; }
.users-panel .user-role-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.users-panel .user-actions select { width: 100%; max-width: none; padding-left: 8px; font-size: var(--font-sm); }
.users-panel .user-actions button { min-height: 32px; padding: 4px 8px; font-size: var(--font-sm); white-space: nowrap; }
.users-panel .user-secondary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.users-panel .user-secondary-actions button { background: transparent; border-color: transparent; }
.users-panel .user-secondary-actions button:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-info); }
.users-panel .user-secondary-actions .danger-action:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--border-danger); }
.users-panel .user-card-list { gap: 14px; }
.users-panel .user-card { gap: 16px; align-content: start; }
.users-panel .user-card .card-title-line { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.users-panel .user-card-details { display: grid; gap: 8px; margin: 0; font-size: var(--font-sm); }
.users-panel .user-card-details > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
.users-panel .user-card-details dt { color: var(--text-tertiary); }
.users-panel .user-card-details dd { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; }
.users-panel .user-card .user-actions { padding-top: 12px; border-top: 1px solid var(--border-subtle); }
@media (max-width: 1340px) {
  .users-panel .desktop-table { display: none; }
  .users-panel .user-card-list { display: grid; }
}
@media (min-width: 700px) and (max-width: 1340px) {
  .users-panel .user-card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 699px) {
  .users-panel .user-actions button, .users-panel .user-actions select { min-height: 44px; }
}
