:root,
[data-theme="classic"] {
  --bg: #efe6d4;
  --surface: #fffaf1;
  --surface-soft: #f8f1e2;
  --surface-muted: #eee1c9;
  --text: #2b1f18; /* darker for better contrast */
  --text-soft: #5c4638;
  --border: #d6c7aa;
  --border-strong: #b99a76;
  --accent: #8d5a3b;
  --accent-dark: #4a2e22;
  --accent-soft: #f2e6c8;
  --danger: #9b453a;
  --danger-soft: #f8e7dc;
  --warning: #80561e;
  --warning-soft: #f7e9c8;
  --radius: 13px;
  --shadow: 0 20px 48px rgb(76 49 31 / 15%);
  --shadow-soft: 0 1px 2px rgb(76 49 31 / 5%), 0 7px 20px rgb(76 49 31 / 6%);
  --shadow-control: 0 1px 3px rgb(76 49 31 / 8%);
  --focus-outline: rgba(148,97,63,0.36);
  font-family: Inter, Aptos, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  --board-scale: 1; /* controlled by JS for zoom/fit */
  --header-height: 78px;
  --cursor-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath fill='%231e293b' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round' d='M2 2l6.5 17 2.5-6.5 6.5-2.5L2 2z'/%3E%3C/svg%3E") 2 2, default;
  --cursor-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%231e293b' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round' d='M8 2v10.5l-2.5-2.5a1.5 1.5 0 0 0-2.1 2.1l5.5 5.5a6 6 0 0 0 4.2 1.9h2.9a5 5 0 0 0 5-5v-6a1.5 1.5 0 0 0-3 0v1h-1v-2a1.5 1.5 0 0 0-3 0v1h-1V6a1.5 1.5 0 0 0-3 0v6.5'/%3E%3C/svg%3E") 8 2, pointer;
  --cursor-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%231e293b' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round' d='M9 2a1 1 0 0 1 1 1v6h1V1.5a1 1 0 0 1 2 0v7.5h1V1a1 1 0 0 1 2 0v8h1V2.5a1 1 0 0 1 2 0V12c0 5-3.5 8-8 8s-8-3-8-8V8a1 1 0 0 1 2 0v3h1V3a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") 10 10, grab;
  --cursor-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%231e293b' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round' d='M8 6h8a3 3 0 0 1 3 3v4c0 4.5-3 7-7 7s-7-2.5-7-7V9a3 3 0 0 1 3-3z'/%3E%3C/svg%3E") 10 10, grabbing;
}

body,
.workspace,
.classroom,
.groups-grid,
.group-card {
  cursor: var(--cursor-default);
}

button,
.btn,
.group-lock-button,
.group-drop-zone {
  cursor: var(--cursor-pointer);
}

[data-theme="modern"] {
  --bg: #eaf1f8;
  --surface: #ffffff;
  --surface-soft: #f1f6fb;
  --surface-muted: #e2ebf4;
  --text: #172b3d;
  --text-soft: #4d667e;
  --border: #c8d8e7;
  --border-strong: #96afc7;
  --accent: #1e5a8a;
  --accent-dark: #103856;
  --accent-soft: #e2eef7;
  --danger: #b3392b;
  --danger-soft: #fae8e6;
  --warning: #c27d0e;
  --warning-soft: #fef4e5;
  --radius: 13px;
  --shadow: 0 20px 48px rgb(18 50 77 / 12%);
  --shadow-soft: 0 1px 2px rgb(18 50 77 / 4%), 0 7px 20px rgb(18 50 77 / 6%);
  --shadow-control: 0 1px 3px rgb(18 50 77 / 7%);
  --focus-outline: rgba(30, 90, 138, 0.36);
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 16% 10%, rgb(255 250 231 / 42%) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 78%, rgb(105 70 45 / 4%) 0 1px, transparent 2px),
    var(--bg);
  background-size: 24px 24px, 31px 31px, auto;
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 96px;
  padding: 0 28px;
  border-top: 1px solid rgba(76,49,31,0.10);
  border-bottom: 1px solid rgba(76,49,31,0.08);
  background:
    linear-gradient(90deg, rgb(255 249 229 / 97%), rgb(244 220 177 / 96%)),
    var(--surface);
  box-shadow: inset 0 -1px rgba(201,157,101,0.18), 0 4px 12px rgb(76 49 31 / 10%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  color: var(--text);
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: radial-gradient(circle at 38% 28%, #fff1c8, #c68e5b 72%);
  box-shadow: inset 0 0 0 1px rgb(255 236 196 / 70%), 0 4px 10px rgb(76 49 31 / 15%);
  transform: rotate(-1deg);
}

.brand-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: contrast(1.08) saturate(1.12) drop-shadow(0 3px 2px rgb(58 35 24 / 22%));
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-title {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.brand-copy strong {
  font-size: 22px;
  line-height: 1.05;
}

.brand-copy small {
  color: #74543e;
  font-family: Inter, Aptos, ui-sans-serif, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(270px, 22vw, 340px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.control-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border-right: 1px solid var(--border-strong);
  position: relative;
  z-index: 10;
  background:
    linear-gradient(rgb(255 250 235 / 96%), rgb(248 230 195 / 94%)),
    repeating-linear-gradient(6deg, rgb(118 76 45 / 3%) 0 1px, transparent 1px 11px);
  box-shadow: 3px 0 20px rgb(76 49 31 / 5%);
  overflow: hidden;
}

.sidebar-brand {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--header-height);
  min-height: var(--header-height);
  max-height: var(--header-height);
  padding: 0 18px;
  border-bottom: 1px solid var(--border-strong);
  border-right: none;
  background: linear-gradient(135deg, #fffcf5, #f5e2bf);
  box-shadow: 0 2px 8px rgb(76 49 31 / 6%);
  width: 100%;
  box-sizing: border-box;
}

.sidebar-brand .brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 13px;
  width: 100%;
  text-decoration: none;
}

.sidebar-brand .brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 13px;
  border: 1.2px solid var(--border-strong);
  background: radial-gradient(circle at 38% 28%, #fff4d2, #ca925f 74%);
  box-shadow: inset 0 0 0 1px rgb(255 240 205 / 80%), 0 2px 6px rgb(76 49 31 / 14%);
  transform: rotate(-1deg);
  display: grid;
  place-items: center;
}

.sidebar-brand .brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: contrast(1.08) saturate(1.15) drop-shadow(0 2px 2px rgb(58 35 24 / 20%));
}

.sidebar-brand .brand-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.sidebar-brand .brand-copy strong {
  font-size: 21px;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.sidebar-brand .brand-copy small {
  color: #74543e;
  font-family: Inter, Aptos, ui-sans-serif, sans-serif;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Panel stack inside the control panel: clean single-scroll container with balanced spacing */
.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 90, 59, 0.3) transparent;
}

.panel-stack::-webkit-scrollbar {
  width: 5px;
}

.panel-stack::-webkit-scrollbar-track {
  background: transparent;
}

.panel-stack::-webkit-scrollbar-thumb {
  background: rgba(141, 90, 59, 0.25);
  border-radius: 6px;
}

.panel-stack::-webkit-scrollbar-thumb:hover {
  background: rgba(141, 90, 59, 0.45);
}

/* Ensure panel-section border colors inside the control-panel use the unified variable */
.control-panel .panel-section {
  border-color: var(--border);
}

.class-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.panel-section + .panel-section {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.class-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
}

.class-select-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.class-select-wrap .select {
  width: 100%;
  font-weight: 700;
  font-size: 13.5px;
  min-height: 36px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 8px;
  background: #ecdcc6;
  color: #523522;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.section-heading,
.dialog-heading,
.label-row,
.dialog-actions,
.room-editor-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 14px;
}

#newClassButton {
  flex-shrink: 0;
  gap: 6px;
  min-height: 36px;
  padding: 0 11px 0 8px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(#fffaf0, #f1d9b1);
  color: #5b3c2a;
  box-shadow: inset 0 1px rgb(255 255 255 / 70%), 0 2px 5px rgb(76 49 31 / 9%);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

#newClassButton:hover:not(:disabled) {
  border-color: #80563b;
  background: linear-gradient(#fffdf7, #e8c794);
  box-shadow: inset 0 1px rgb(255 255 255 / 90%), 0 4px 8px rgb(76 49 31 / 16%);
  transform: translateY(-1px);
}

#newClassButton:focus-visible {
  outline: 3px solid rgb(148 97 63 / 28%);
  outline-offset: 2px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #85684f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: -0.032em;
}

h1,
h2 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.16;
}

h3 {
  font-size: 16px;
}

.field-label {
  display: block;
  margin: 8px 0 3px;
  color: #584233;
  font-size: 11.5px;
  font-weight: 680;
}

.label-row .field-label {
  margin-bottom: 3px;
}

.field-meta,
.field-help {
  color: var(--text-soft);
  font-size: 11.5px;
}

.label-row .field-meta {
  margin-top: 8px;
}

.field-help {
  margin: 4px 0 0;
  line-height: 1.35;
}

#nameHelp {
  display: none;
}

.inline-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.field-help.has-warning {
  color: var(--warning);
}

.text-input,
.name-input,
.select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgb(92 57 35 / 5%), 0 1px 2px rgb(76 49 31 / 3%);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.text-input,
.select {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.class-actions {
  position: relative;
}

.class-actions > summary {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: linear-gradient(#fffaf0, #f4e2c4);
  color: #5d402f;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  list-style: none;
  cursor: pointer;
  box-shadow: var(--shadow-control);
}

.class-actions > summary::-webkit-details-marker {
  display: none;
}

.class-actions > summary:hover,
.class-actions[open] > summary {
  border-color: #765038;
  background: #f0d8b3;
}

.class-action-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 12;
  display: grid;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff8e8;
  box-shadow: 0 12px 28px rgb(76 49 31 / 22%);
}

.class-action-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 680;
  text-align: left;
  box-shadow: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.class-action-button:hover {
  background: #f2dfbd;
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.class-action-button.is-danger:hover {
  border-color: #d4a39f;
  background: var(--danger-soft);
  color: var(--danger);
}

.class-action-button.is-danger {
  color: #875b57;
}

.class-action-button::after {
  display: none;
}

.class-action-button:hover::after,
.class-action-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.class-action-svg {
  flex-shrink: 0;
  display: block;
  color: var(--accent-dark);
  transition: transform 120ms ease;
}

.class-action-button:hover .class-action-svg {
  transform: scale(1.1);
}

.class-action-button.is-danger .class-action-svg,
.class-action-svg.is-danger {
  color: var(--danger);
}

.student-count-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button-tiny {
  min-height: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(148, 97, 63, 0.08);
  border: 1px solid rgba(148, 97, 63, 0.18);
  cursor: pointer;
  transition: all 130ms ease;
}

.button-tiny:hover {
  background: rgba(148, 97, 63, 0.16);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.student-tags-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 4px;
  min-height: 34px;
  max-height: 44px;
  padding: 3px 6px;
  border: 1px solid #d4c0a1;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffefb 0%, #faf3e5 100%);
  box-shadow: inset 0 1px 2px rgba(76, 49, 31, 0.06);
  overflow-y: auto;
  cursor: text;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.student-tags-container:hover {
  border-color: #ba976c;
}

.student-tags-container:focus-within {
  border-color: var(--accent);
  background: #fffefc;
  box-shadow: inset 0 1px 3px rgba(76, 49, 31, 0.04), 0 0 0 3px rgb(148 97 63 / 16%);
  outline: none;
}

.student-tags-list {
  display: contents;
}

.student-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 5px 2px 7px;
  border: 1px solid #d2b38c;
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff 0%, #f6ecdc 100%);
  color: #3b2516;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.07);
  user-select: none;
  animation: tagAppear 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.student-tag:hover {
  border-color: #b58d5e;
  box-shadow: 0 2px 4px rgba(76, 49, 31, 0.12);
  transform: translateY(-1px);
}

@keyframes tagAppear {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.student-tag-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(76, 49, 31, 0.08);
  color: #7b583f;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transition: all 120ms ease;
}

.student-tag-remove:hover {
  background: #e85338;
  color: #ffffff;
}

.student-tag-input,
.student-tag-input:focus,
.student-tag-input:focus-visible {
  flex: 1 1 90px;
  min-width: 75px;
  height: 24px;
  padding: 1px 4px;
  border: none !important;
  background: transparent !important;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  outline: none !important;
  box-shadow: none !important;
}

.student-tag-input::placeholder {
  color: #8c725c;
  opacity: 0.85;
}

.name-input {
  height: 88px;
  min-height: 76px;
  max-height: 220px;
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 13px;
  resize: vertical;
  transition: height 160ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.name-input:focus {
  height: 130px;
}

.text-input:hover,
.name-input:hover,
.select:hover {
  border-color: #b59670;
}

.text-input:focus,
.text-input:focus-visible,
.guide-text-input:focus,
.guide-text-input:focus-visible,
.name-input:focus,
.name-input:focus-visible,
.select:focus,
.select:focus-visible {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgb(148 97 63 / 16%) !important;
  outline: none !important;
}

.segmented-control,
.mini-segments {
  display: grid;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ead9ba;
  box-shadow: inset 0 1px rgb(255 247 225 / 62%), 0 1px 3px rgb(76 49 31 / 6%);
}

.segmented-control {
  grid-template-columns: repeat(3, 1fr);
}

.mini-segments {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 8px;
}

.segment,
.mini-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segment-icon {
  flex-shrink: 0;
  display: block;
  opacity: 0.8;
  transition: transform 140ms ease, opacity 140ms ease;
}

.segment:hover,
.mini-segment:hover {
  color: var(--text);
}

.segment:hover .segment-icon {
  opacity: 1;
}

.segment.is-active,
.mini-segment.is-active {
  border: 1px solid var(--border);
  background: #fffaf1;
  color: var(--accent-dark);
  box-shadow: 0 2px 5px rgb(76 49 31 / 10%), inset 0 -2px #b47a52;
}

.segment.is-active .segment-icon {
  opacity: 1;
  transform: scale(1.08);
}

.mode-options {
  margin-top: 15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.autosave-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9b6b45;
  box-shadow: 0 0 0 3px rgb(155 107 69 / 14%);
}

.mode-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
}

.mode-explanation {
  min-height: 34px;
  margin: 9px 2px 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.mode-note {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 12px;
}

.mode-note p {
  margin: 0;
}

.text-action {
  margin: 9px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: rgb(91 57 40 / 35%);
  text-underline-offset: 3px;
}

.room-summary-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 11px;
  gap: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-control);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.room-summary-button:hover {
  border-color: #a78662;
  box-shadow: 0 7px 18px rgb(76 49 31 / 10%);
  transform: translateY(-1px);
}

.room-summary-button > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.room-summary-button strong {
  font-size: 13px;
}

.room-summary-button small {
  color: var(--text-soft);
  font-size: 11px;
}

.room-summary-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 18px;
}

.room-summary-action {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.student-summary-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 52px;
  margin-top: 0;
  padding: 8px 11px;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-control);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.student-summary-button:hover {
  border-color: #b99b76;
  background: var(--surface-soft);
  box-shadow: 0 6px 16px rgb(76 49 31 / 9%);
  transform: translateY(-1px);
}

.student-summary-button:focus-visible {
  outline: 3px solid rgb(148 97 63 / 28%);
  outline-offset: 2px;
}

.student-summary-button > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.student-summary-button strong {
  font-size: 13px;
}

.student-summary-button small {
  color: var(--text-soft);
  font-size: 11px;
}

.student-summary-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.gender-summary-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 58px;
  margin-top: 0;
  padding: 9px 11px;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-control);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.gender-summary-button:hover {
  border-color: #b99b76;
  background: var(--surface-soft);
  box-shadow: 0 6px 16px rgb(76 49 31 / 9%);
  transform: translateY(-1px);
}

.gender-summary-button > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.gender-summary-button strong {
  font-size: 13px;
}

.gender-summary-button small {
  color: var(--text-soft);
  font-size: 11px;
}

.gender-summary-icon {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.gender-summary-icon i {
  position: absolute;
  top: 13px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--accent-soft);
  transition: inset 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.gender-summary-icon i:first-child {
  left: 6px;
}

.gender-summary-icon i:last-child {
  right: 6px;
}

.gender-summary-icon::after {
  position: absolute;
  top: 16px;
  left: 13px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
  transform-origin: center;
}

.gender-summary-icon.is-mixed i:first-child {
  top: 8px;
}

.gender-summary-icon.is-mixed i:last-child {
  top: 18px;
}

.gender-summary-icon.is-mixed::after {
  transform: rotate(32deg);
}

.gender-summary-icon.is-off {
  background: #edf1ee;
  color: #718078;
}

.gender-summary-icon.is-off i {
  background: #edf1ee;
  opacity: 0.65;
}

.gender-summary-icon.is-off::after {
  opacity: 0;
}

.summary-action {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.optional-label {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 99px;
  background: #edf1ee;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}

.planning-label {
  margin-top: 6px;
  margin-bottom: 2px;
}

.planning-options {
  display: grid;
  gap: 8px;
}

.planning-options .rules-summary {
  margin-top: 0;
}

.mode-options .field-label:first-child {
  margin-top: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:disabled {
  cursor: default;
  opacity: 0.46;
}

.button-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 7px rgb(76 49 31 / 22%);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  box-shadow: 0 4px 12px rgb(76 49 31 / 24%);
  transform: translateY(-1px);
}

.button-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-control);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: #b99b76;
}

.button:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(0);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-soft);
}

.button-small {
  min-height: 32px;
  padding: 0 9px;
}

.button-full {
  width: 100%;
  margin-top: 10px;
}

.generate-dock {
  margin-top: auto;
  padding: 14px 0 2px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: transparent;
  box-shadow: none;
}

#generateButton {
  min-height: 38px;
  margin-top: 0;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}

#generateButton .btn-icon {
  flex-shrink: 0;
  display: inline-block;
  transition: transform 160ms ease;
}

#generateButton:hover:not(:disabled) .btn-icon {
  transform: scale(1.12);
}

.compact-action {
  min-height: 34px;
  margin-top: 10px;
}

.button-danger {
  border-color: #d7aaa6;
  background: white;
  color: var(--danger);
}

.button-danger:hover {
  background: var(--danger-soft);
}

.rules-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 6px 10px;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-control);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

/* Saved arrangements archive */
.saved-setups-section {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft, rgba(246, 240, 230, 0.6));
}

.saved-setups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.saved-setups-header .field-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.saved-setups-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.saved-setup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-control);
  transition: all 140ms ease;
}

.saved-setup-card:hover {
  border-color: var(--border-strong);
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(76, 49, 31, 0.06);
}

.saved-setup-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft, #f0f7f3);
  box-shadow: 0 0 0 1px var(--accent);
}

.saved-setup-select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.saved-setup-indicator {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.saved-setup-card.is-active .saved-setup-indicator {
  color: var(--accent-dark, #235942);
}

.saved-setup-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.saved-setup-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-setup-card.is-active .saved-setup-name {
  color: var(--accent-dark, #235942);
}

.saved-setup-date {
  font-size: 10.5px;
  color: var(--text-soft);
}

.saved-setup-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.saved-setup-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  transition: all 120ms ease;
}

.saved-setup-action-btn:hover {
  background: rgba(76, 49, 31, 0.08);
  color: var(--text);
}

.saved-setup-action-btn.delete-btn:hover {
  background: var(--danger-soft, #fdeded);
  color: var(--danger, #c0392b);
}

.saved-setups-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-control);
  transition: all 140ms ease;
}

.saved-setups-toggle-btn:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(76, 49, 31, 0.08);
}

[data-theme="modern"] .saved-setups-toggle-btn {
  color: var(--accent);
  border-color: var(--border-strong);
  background: #ffffff;
}

[data-theme="modern"] .saved-setups-toggle-btn:hover {
  background: #f0f6fb;
  border-color: #1e5a8a;
  box-shadow: 0 2px 6px rgba(18, 50, 77, 0.1);
}

.rules-summary:hover {
  border-color: #b99b76;
  background: var(--surface-soft);
  box-shadow: 0 6px 16px rgb(76 49 31 / 9%);
  transform: translateY(-1px);
}

.rules-summary strong,
.setting-summary strong {
  font-size: 13px;
}

.rules-summary small,
.setting-summary small {
  color: var(--text-soft);
  font-size: 12px;
}

.distribution-summary {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 680;
}

.settings-label {
  margin-top: 18px;
}

.setting-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 5px 9px;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-control);
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.setting-summary:hover,
.setting-summary.is-active {
  background: #fff5df;
  box-shadow: inset 0 0 0 1px #c4a47d, 0 4px 12px rgb(76 49 31 / 8%);
}

.setting-summary:hover {
  transform: translateY(-1px);
}

.setting-summary-copy {
  display: grid;
  gap: 1px;
}

.setting-summary-icon {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--accent-dark);
}

.people-icon::before,
.considerations-icon::before {
  width: 19px;
  height: 19px;
  background: currentColor;
  content: "";
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.people-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='9' r='2.4'/%3E%3Cpath d='M3.5 19c.4-3.6 2.2-5.4 5.5-5.4s5.1 1.8 5.5 5.4M14.2 14.2c3.6-.7 5.7.9 6.3 4.2'/%3E%3C/g%3E%3C/svg%3E");
}

.considerations-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7h14M5 12h14M5 17h14'/%3E%3Ccircle cx='9' cy='7' r='2' fill='white'/%3E%3Ccircle cx='15' cy='12' r='2' fill='white'/%3E%3Ccircle cx='11' cy='17' r='2' fill='white'/%3E%3C/g%3E%3C/svg%3E");
}

.setting-summary-action {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 720;
}

.generation-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}

.generate-dock .form-error {
  margin: 0;
}

.count-badge {
  display: grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.form-error {
  margin: 12px 0 -2px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--header-height);
  min-height: var(--header-height);
  max-height: var(--header-height);
  padding: 8px 18px;
  border-bottom: 1px solid var(--border-strong);
  background: #fafcf9;
  box-shadow: 0 2px 10px rgb(76 49 31 / 4%);
  box-sizing: border-box;
  position: relative;
  z-index: 5;
}

.workspace-heading {
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  flex-shrink: 0;
  overflow: hidden;
}

.workspace-heading h2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-summary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-actions,
.settings-actions,
.room-control-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.workspace-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 3px;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgb(255 255 255 / 90%);
  box-shadow: var(--shadow-control);
  min-width: 0;
}

.toolbar-action-group {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
}

.toolbar-action-group + .toolbar-action-group {
  padding-left: 3px;
  margin-left: 1px;
  border-left: 1px solid var(--border);
}

.toolbar-action-group[hidden],
.toolbar-action-subgroup[hidden],
.result-view-toggle[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.toolbar-view-group {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 164px;
  min-width: 164px;
  max-width: 164px;
  flex-shrink: 0;
  gap: 3px;
}

.toolbar-view-group .result-view-toggle {
  border-right: 0;
  padding-right: 0;
  margin-right: 0;
}

.toolbar-action-subgroup {
  display: flex;
  align-items: center;
}

.toolbar-view-group > *:not([hidden]) + *:not([hidden]) {
  margin-left: 2px;
  padding-left: 3px;
  border-left: 1px solid var(--border);
}

.workspace-toolbar h2 {
  font-size: clamp(16px, 1.8vw, 22px);
}

.workspace-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}
  font-size: 13px;
}

.workspace-meta-row {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-top: 5px;
  gap: 8px;
}

.generation-feedback {
  display: none !important;
}

.result-view-toggle {
  display: flex;
  gap: 2px;
  padding-right: 4px;
  margin-right: 3px;
  border-right: 1px solid var(--border);
}

.view-button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.view-button:hover,
.view-button.is-active {
  background: var(--surface-muted);
  color: var(--accent-dark);
}

.workspace-toolbar .toolbar-actions .button {
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 7px;
  color: #46564d;
  white-space: nowrap;
}

.workspace-toolbar .toolbar-actions .button svg {
  flex-shrink: 0;
}

#shuffleButton {
  border-color: #c7aa84;
  background: #f0e2c9;
  color: var(--accent-dark);
  box-shadow: none;
}

#shuffleButton:hover:not(:disabled) {
  border-color: #ad8963;
  background: var(--accent-soft);
}

.workspace-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(8px, 1.8vh, 18px) clamp(10px, 1.8vw, 22px);
  overflow: auto;
  background: var(--bg);
}

/* Apply board scale (zoom) to the classroom; transform-origin kept top center for predictable behavior */
.workspace-body .classroom,
.workspace-body .groups-grid {
  transform: scale(var(--board-scale, 1));
  transform-origin: top center;
}

/* Map Student Search Box */
.toolbar-search-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.map-search-box {
  display: flex;
  align-items: center;
  position: relative;
  width: 210px;
  min-height: 32px;
  height: 32px;
  padding: 0 8px 0 10px;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #ffffff;
  color: #2f211a;
  box-shadow: inset 0 1px 2px rgba(76, 49, 31, 0.04), 0 1px 2px rgba(76, 49, 31, 0.04);
  transition: border-color 140ms ease, box-shadow 140ms ease, width 180ms ease, background-color 140ms ease;
  box-sizing: border-box;
}

.map-search-box:hover {
  border-color: #b59575;
  background: #fffdfa;
}

.map-search-box:focus-within {
  width: 250px;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 114, 90, 0.18), 0 2px 6px rgba(47, 114, 90, 0.08);
}

.map-search-icon {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: #8c7b6e;
  pointer-events: none;
  transition: color 140ms ease, transform 140ms ease;
}

.map-search-box:focus-within .map-search-icon {
  color: var(--accent);
  transform: scale(1.05);
}

.map-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-style: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  line-height: normal;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

/* Remove default Chrome/Safari/Edge clear search 'x' button to prevent double icon */
.map-search-input::-webkit-search-decoration,
.map-search-input::-webkit-search-cancel-button,
.map-search-input::-webkit-search-results-button,
.map-search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.map-search-input::placeholder {
  color: #9c8b7e;
  font-weight: 450;
  transition: color 140ms ease;
}

.map-search-box:focus-within .map-search-input::placeholder {
  color: #bfaea2;
}

.map-search-clear {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #e8ded2;
  color: #634b3d;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.map-search-clear:hover {
  background: #d4c4b2;
  color: #2f211a;
  transform: scale(1.1);
}

.map-search-badge {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: badgePop 140ms ease-out;
}

@keyframes badgePop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Search Highlights & Dimming on Map Desks */
.student-card.is-search-match {
  z-index: 10 !important;
  outline: 3px solid #2f725a !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 6px rgba(47, 114, 90, 0.22), 0 8px 18px rgba(0, 0, 0, 0.16) !important;
  animation: searchCardPulse 1.6s ease-in-out infinite alternate !important;
}

@keyframes searchCardPulse {
  0% {
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(47, 114, 90, 0.22), 0 6px 14px rgba(0, 0, 0, 0.14);
  }
  100% {
    transform: scale(1.06);
    box-shadow: 0 0 0 8px rgba(47, 114, 90, 0.36), 0 10px 22px rgba(0, 0, 0, 0.22);
  }
}

.student-card.is-search-dimmed,
.empty-seat.is-search-dimmed,
.spatial-desk.is-search-dimmed {
  opacity: 0.22 !important;
  filter: grayscale(0.5) blur(0.2px) !important;
  transition: opacity 160ms ease, filter 160ms ease !important;
}

/* Modern Theme search styling overrides */
[data-theme="modern"] .map-search-box {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #172b3d;
  box-shadow: inset 0 1px 2px rgba(18, 50, 77, 0.04), 0 1px 2px rgba(18, 50, 77, 0.04);
}

[data-theme="modern"] .map-search-box:hover {
  border-color: #9bb7d4;
  background: #f8fbfe;
}

[data-theme="modern"] .map-search-box:focus-within {
  border-color: #1e5a8a;
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.18), 0 2px 8px rgba(18, 50, 77, 0.08);
}

[data-theme="modern"] .map-search-icon {
  color: #718ba4;
}

[data-theme="modern"] .map-search-box:focus-within .map-search-icon {
  color: #1e5a8a;
}

[data-theme="modern"] .map-search-input {
  color: #103856;
}

[data-theme="modern"] .map-search-input::placeholder {
  color: #8da4ba;
}

[data-theme="modern"] .map-search-clear {
  background: #dbe7f2;
  color: #1e5a8a;
}

[data-theme="modern"] .map-search-clear:hover {
  background: #c3d9ec;
  color: #0d2c45;
}

[data-theme="modern"] .map-search-badge {
  background: #e2eef7;
  color: #1e5a8a;
}

[data-map-theme="modern"] .student-card.is-search-match,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .student-card.is-search-match {
  outline-color: #1e5a8a !important;
  box-shadow: 0 0 0 6px rgba(30, 90, 138, 0.25), 0 8px 18px rgba(18, 50, 77, 0.18) !important;
}

.zoom-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.zoom-fit-button {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
  color: #46564d;
  background: rgba(141, 90, 59, 0.08);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.zoom-fit-button:hover {
  background: white;
  border-color: var(--border-strong);
  color: var(--accent-dark);
}

.zoom-slider-container {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 8px;
  background: rgba(141, 90, 59, 0.08);
  border: 1px solid var(--border);
}

.zoom-step-button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.zoom-step-button:hover {
  background: white;
  color: var(--text);
}

.zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 76px;
  height: 4px;
  border-radius: 2px;
  background: #c6b297;
  outline: none;
  cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--accent-dark);
}

.zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  cursor: pointer;
}

.zoom-value {
  min-width: 38px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 700;
  color: #5c4638;
  font-variant-numeric: tabular-nums;
}


.workspace-guide {
  display: none !important;
}

.empty-state {
  display: grid;
  align-content: center;
  justify-items: center;
  flex: 1;
  min-height: 430px;
  color: var(--text-soft);
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 7px;
  font-size: 18px;
}

.empty-step {
  margin: 0 0 9px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state .button {
  margin-top: 20px;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 14px;
}

.empty-diagram {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  gap: 9px 18px;
  margin-bottom: 25px;
}

.empty-diagram span {
  width: 44px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #e7ede8;
  box-shadow: 0 4px 10px rgb(30 45 37 / 4%);
}

.result-stage {
  display: flex;
  flex: 1;
  align-items: flex-start;
  width: 100%;
  min-width: min-content;
}

.classroom {
  position: relative;
  display: flex;
  flex-direction: column;
  /* refined classroom dimensions: 12x12 spatial grid */
  width: clamp(720px, 95%, 1350px);
  max-width: 100%;
  min-height: 480px;
  margin: 0 auto;
  padding: 12px 18px;
  border: 1px solid var(--border-strong);
  border-color: #ccb793;
  border-radius: 20px;
  background:
    linear-gradient(110deg, rgb(255 255 255 / 20%), transparent 44%),
    repeating-linear-gradient(4deg, rgb(118 76 45 / 2%) 0 1px, transparent 1px 9px),
    #fff5dc;
  box-shadow: 0 1px 3px rgb(76 49 31 / 5%), 0 16px 40px rgb(76 49 31 / 8%);
}


#flipViewButton[aria-pressed="true"] {
  border-color: #9e7552;
  background: #f1debd;
  color: #593b2a;
}

.room-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 2px auto 10px;
}

.board {
  position: relative;
  /* Width dynamically controlled by --board-panes (1 to 6) */
  width: calc(105px * var(--board-panes, 3) + 24px);
  min-width: 140px;
  max-width: min(92%, 640px);
  margin: 0 auto;
  left: calc(var(--board-pos, 50%) - 50%);
  padding: 8px 14px 10px;
  box-sizing: border-box;
  border-radius: 7px;
  user-select: none;
  touch-action: none;
  transition: left 60ms linear, width 180ms ease, box-shadow 150ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 10;
}

/* Blackboard / Krittavle styling */
.board.is-blackboard,
.board:not(.is-whiteboard) {
  background: linear-gradient(180deg, #364d3c 0%, #25382b 100%);
  border: 2.5px solid #8b6237; /* Wooden frame */
  box-shadow: inset 0 0 0 1px #593e22, 0 3px 8px rgba(0, 0, 0, 0.22);
  color: #f7fee7;
}

/* Whiteboard styling */
.board.is-whiteboard {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 2.5px solid #94a3b8; /* Brushed aluminum frame */
  box-shadow: inset 0 0 0 1px #cbd5e1, 0 3px 8px rgba(15, 23, 42, 0.15);
  color: #1e293b;
}

/* Surface & Panels */
.board-surface {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}

.board-surface .board-panel {
  flex: 1;
  height: 20px;
  border-right: 1px dashed rgba(255, 255, 255, 0.18);
}
.board.is-whiteboard .board-surface .board-panel {
  border-right: 1px dashed rgba(100, 116, 139, 0.28);
}
.board-surface .board-panel:last-child {
  border-right: none;
}

.board-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}
.board.is-blackboard .board-title,
.board:not(.is-whiteboard) .board-title {
  color: #fef08a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.board.is-whiteboard .board-title {
  color: #1e293b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Bottom Trays: Chalk Tray & Marker Tray */
.board-tray {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: calc(100% - 10px);
  height: 5px;
  border-radius: 2px;
  margin-top: 2px;
  position: relative;
}
.board.is-blackboard .board-tray,
.board:not(.is-whiteboard) .board-tray {
  background: #6e4e2c;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4);
}
.board.is-whiteboard .board-tray {
  background: #94a3b8;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.25);
}

/* Chalk sticks and eraser */
.chalk-stick {
  width: 12px;
  height: 3px;
  border-radius: 1px;
  display: inline-block;
}
.chalk-white { background: #fefce8; }
.chalk-yellow { background: #fde047; }
.chalk-eraser {
  width: 16px;
  height: 4px;
  background: #451a03;
  border-radius: 1px;
  display: inline-block;
}

/* Whiteboard markers and felt eraser */
.marker {
  width: 10px;
  height: 3px;
  border-radius: 1px;
  display: inline-block;
}
.marker-black { background: #0f172a; }
.marker-blue { background: #2563eb; }
.marker-red { background: #dc2626; }
.whiteboard-felt-eraser {
  width: 16px;
  height: 4px;
  background: #0284c7;
  border-radius: 1px;
  display: inline-block;
}

/* Selected state & drag state */
.board.is-selected {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 3px;
}
.board.is-dragging {
  opacity: 0.75;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Board controls overlay */
.board .board-controls {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 3px 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 100;
  white-space: nowrap;
}

.classroom.is-board-bottom .board .board-controls {
  bottom: auto;
  top: calc(100% + 8px);
}

.board:hover .board-controls,
.board:focus-within .board-controls,
.board.is-selected .board-controls {
  opacity: 1;
  pointer-events: auto;
}

/* Remove button on board */
.board .board-remove-btn {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 101;
  padding: 0;
}
.board .board-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}
.board:hover .board-remove-btn,
.board.is-selected .board-remove-btn {
  opacity: 1;
}

.board-type-toggle-btn {
  width: auto !important;
  min-width: 86px !important;
  height: 20px !important;
  border-radius: 5px !important;
  font-size: 10.5px !important;
  font-weight: 700;
  padding: 0 8px !important;
  white-space: nowrap;
}

.teacher-station {
  position: relative;
  width: 108px;
  height: 68px;
  left: calc(var(--teacher-pos-x, 50%) - 50%);
  background: url("./teacher-desk-chair.svg") center / contain no-repeat;
  filter: drop-shadow(0 4px 4px rgb(76 49 31 / 18%));
  transition: left 60ms linear;
  user-select: none;
  touch-action: none;
}

.board.is-draggable,
.teacher-station.is-draggable {
  cursor: grab;
}

.board.is-draggable:active,
.teacher-station.is-draggable:active {
  cursor: grabbing;
}

.board.is-draggable:hover,
.teacher-station.is-draggable:hover {
  outline: 2px dashed #94613f;
  outline-offset: 3px;
  border-radius: 6px;
}

.board.is-dragging,
.teacher-station.is-dragging {
  opacity: 0.65;
}

.classroom.is-flipped {
  display: flex;
  flex-direction: column;
}

.classroom.is-flipped .room-front {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
  margin-bottom: 0;
  order: 2;
}

.classroom.is-flipped .teacher-station {
  background-image: url("./teacher-desk-chair-flipped.svg");
  transform: none;
}

.desk-layout,
.room-editor-grid {
  display: grid;
  align-items: start;
  justify-content: center;
  gap: clamp(10px, 1.8vh, 20px) clamp(12px, 1.8vw, 24px);
}

.desk-layout.is-spatial-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(36px, 1fr));
  gap: clamp(3px, 0.8vh, 7px) clamp(3px, 0.8vw, 7px);
  width: 100%;
  max-width: 100%;
  position: relative;
  padding: 24px 10px 24px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 50%, rgba(141, 90, 59, 0.05) 1px, transparent 1px),
    rgba(255, 253, 248, 0.4);
  background-size: 20px 20px, 100% 100%;
  align-items: stretch;
  justify-content: stretch;
}

.spatial-desk {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.spatial-desk > .student-card-shell,
.spatial-desk > .student-card {
  width: 100%;
  height: 100%;
  min-height: clamp(32px, 4vh, 42px);
}

.spatial-drop-cell {
  position: relative;
  min-height: clamp(32px, 4vh, 42px);
  border: 1px dashed transparent;
  border-radius: 7px;
  transition: border-color 120ms ease, background-color 120ms ease;
  pointer-events: none;
}

.desk-layout.is-spatial-grid.is-dragging-active .spatial-drop-cell,
.result-stage.is-moving-student .spatial-drop-cell,
.desk-layout.is-spatial-grid.has-selected-student .spatial-drop-cell {
  pointer-events: auto;
  border-color: rgba(141, 90, 59, 0.22);
  background: rgba(255, 250, 240, 0.45);
  cursor: pointer;
}

.desk-layout.is-spatial-grid.has-selected-student .spatial-drop-cell:hover {
  border-color: var(--accent);
  background: rgba(141, 90, 59, 0.16) !important;
  box-shadow: 0 0 0 2px rgba(141, 90, 59, 0.22);
}

.spatial-drop-cell.is-drag-over {
  border-color: var(--accent);
  background: rgba(141, 90, 59, 0.16) !important;
  box-shadow: 0 0 0 2px rgba(141, 90, 59, 0.22);
}

.spatial-desk.is-paired-left .student-card {
  border-top-right-radius: 3px !important;
  border-bottom-right-radius: 3px !important;
}

.spatial-desk.is-paired-right .student-card {
  border-top-left-radius: 3px !important;
  border-bottom-left-radius: 3px !important;
}

/* ==========================================================================
   SEAT EDITING MODE (16x12 Canvas Grid Unit Activation)
   ========================================================================== */
.desk-layout.is-spatial-grid.is-editing-seats {
  background:
    radial-gradient(circle at 50% 50%, rgba(141, 90, 59, 0.09) 1.5px, transparent 1.5px),
    rgba(255, 250, 240, 0.55);
  background-size: 20px 20px, 100% 100%;
  box-shadow: inset 0 0 0 2px rgba(141, 90, 59, 0.2);
}

.spatial-grid-unit.is-inactive {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(32px, 4vh, 42px);
  border: 1.5px dashed rgba(141, 90, 59, 0.28);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.45);
  cursor: pointer;
  user-select: none;
  transition: all 130ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.spatial-grid-unit.is-inactive:hover {
  border-color: var(--accent);
  background: rgba(141, 90, 59, 0.14);
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(141, 90, 59, 0.16);
}

.spatial-grid-unit.is-inactive .unit-plus-icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 750;
  color: var(--accent);
  opacity: 0.65;
  transition: transform 120ms ease, opacity 120ms ease, color 120ms ease;
  pointer-events: none;
}

.spatial-grid-unit.is-inactive:hover .unit-plus-icon {
  opacity: 1;
  transform: scale(1.25);
  color: var(--accent-dark);
}

.spatial-desk.is-editable-seat {
  cursor: pointer;
}

.spatial-desk.is-editable-seat:hover {
  transform: scale(0.97);
}

.spatial-desk.is-editable-seat:hover > .student-card-shell .student-card,
.spatial-desk.is-editable-seat:hover > .student-card {
  box-shadow: 0 0 0 2px #dc3545, 0 3px 8px rgba(220, 53, 69, 0.2);
}

.seat-deactivate-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc3545;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
  transition: opacity 120ms ease, transform 120ms ease;
}

.spatial-desk.is-editable-seat:hover .seat-deactivate-badge {
  opacity: 1;
  transform: scale(1);
}

[data-theme="modern"] .desk-layout.is-spatial-grid.is-editing-seats {
  background:
    radial-gradient(circle at 50% 50%, rgba(30, 90, 138, 0.08) 1.5px, transparent 1.5px),
    rgba(240, 246, 251, 0.55);
  background-size: 20px 20px, 100% 100%;
  box-shadow: inset 0 0 0 2px rgba(30, 90, 138, 0.18);
}

[data-theme="modern"] .spatial-grid-unit.is-inactive {
  border-color: rgba(30, 90, 138, 0.26);
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="modern"] .spatial-grid-unit.is-inactive:hover {
  border-color: #1e5a8a;
  background: rgba(30, 90, 138, 0.12);
  box-shadow: 0 2px 8px rgba(30, 90, 138, 0.16);
}

[data-theme="modern"] .spatial-grid-unit.is-inactive .unit-plus-icon {
  color: #1e5a8a;
}

.classroom > .desk-layout {
  width: 100%;
}

.desk-layout.is-horseshoe {
  gap: 14px;
}

.desk-unit,
.room-editor-unit {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--seat-columns, 2), minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ead7b6;
  box-shadow: 0 2px 5px rgb(76 49 31 / 7%);
}

.desk-unit.is-table,
.room-editor-unit.is-table {
  gap: 4px;
  padding: 5px;
  background: #dfc093;
}

.student-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: clamp(38px, 4.5vh, 48px);
  padding: 4px 6px 4px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: clamp(11.5px, 1.1vw, 13.5px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  user-select: none;
  box-shadow: 0 1px 2px rgb(76 49 31 / 5%), inset 0 1px rgb(255 255 255 / 72%);
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.student-card-shell {
  position: relative;
  min-width: 0;
}

.student-card-shell .student-card {
  width: 100%;
  height: 100%;
  padding: 4px 8px;
}

.spatial-desk .student-card,
.spatial-desk .student-card-shell .student-card {
  padding: 3px 6px;
  min-height: clamp(32px, 3.8vh, 42px);
}

.student-card.is-interactive,
.student-card.is-interactive * {
  cursor: var(--cursor-grab);
}

.student-card.is-interactive:active,
.student-card.is-interactive:active *,
.student-card.is-dragging,
.is-moving-student * {
  cursor: var(--cursor-grabbing) !important;
}

.student-card.is-interactive:hover {
  border-color: #5c7e6f;
  background: #f4ede2;
  box-shadow: 0 6px 16px rgb(47 114 90 / 14%), 0 1px 3px rgb(0 0 0 / 8%);
  transform: translateY(-2px);
}

[data-theme="modern"] .student-card.is-interactive:hover,
[data-map-theme="modern"] .student-card.is-interactive:hover {
  background: #eaf2fb;
  border-color: #5b93c5;
  box-shadow: 0 6px 16px rgba(14, 116, 144, 0.15), 0 1px 3px rgba(15, 23, 42, 0.08);
}

.student-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgb(47 114 90 / 25%), 0 8px 17px rgb(30 45 37 / 12%);
  transform: translateY(-2px);
}

.spatial-desk.is-selected .student-card,
.spatial-desk.is-selected .empty-seat {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent), 0 6px 14px rgba(47, 114, 90, 0.18) !important;
}

/* Selection Floating Bar */
.selection-floating-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
  color: var(--text);
  user-select: none;
  animation: slideUpFade 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.selection-count-badge {
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

.selection-drag-hint {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 8px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.selection-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Selection Marquee Box */
.selection-marquee {
  position: fixed;
  border: 1.5px dashed var(--accent);
  background: rgba(47, 114, 90, 0.12);
  pointer-events: none;
  z-index: 9999;
  border-radius: 4px;
}

/* Group Drag Target Footprint */
.spatial-drop-cell.is-group-target,
.spatial-desk.is-group-target .student-card,
.spatial-desk.is-group-target .empty-seat {
  border-color: var(--accent) !important;
  background: rgba(47, 114, 90, 0.15) !important;
  box-shadow: 0 0 0 2px rgba(47, 114, 90, 0.28) !important;
}

/* Lock All Button */
#toggleLockAllButton {
  min-width: 108px;
  justify-content: center;
}

#toggleLockAllButton.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.student-drag-handle {
  position: absolute;
  left: 7px;
  top: 50%;
  color: #8b9a91;
  font-size: 15px;
  line-height: 1;
  opacity: 0.62;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

.student-card:hover .student-drag-handle,
.student-card.is-selected .student-drag-handle {
  color: var(--accent);
  opacity: 1;
}

.student-card.is-dragging,
.desk-unit.is-dragging,
.room-editor-unit.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.student-card.is-drop-target,
.desk-unit.is-drop-target,
.room-editor-unit.is-drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgb(47 114 90 / 14%);
}

.student-card.is-drop-target::after,
.empty-seat.is-drop-target::after {
  position: absolute;
  inset: 3px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgb(223 238 231 / 96%);
  color: var(--accent-dark);
  content: "Bytt hit";
  font-size: 11px;
  font-weight: 750;
}

.empty-seat.is-drop-target::after {
  content: "Flytt hit";
}

.result-stage.is-moving-student [data-position-kind] {
  border-color: #8caf9f;
}

.student-card.was-moved {
  animation: moved-card 420ms ease-out;
}

@keyframes moved-card {
  0% { box-shadow: 0 0 0 4px rgb(47 114 90 / 24%); transform: scale(0.96); }
  70% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

.student-card.is-locked {
  border-color: #cabd94;
  background: #faf7ed;
}

.student-name-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

.student-gender-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1;
  user-select: none;
}

.student-gender-badge.is-female {
  background: #fde8f1;
  color: #b82361;
  border: 1px solid #f6b3cf;
  box-shadow: 0 1px 2px rgb(184 35 97 / 12%);
}

.student-gender-badge.is-male {
  background: #e2f0fb;
  color: #17659e;
  border: 1px solid #aed2ee;
  box-shadow: 0 1px 2px rgb(23 101 158 / 12%);
}

.student-gender-badge svg {
  display: block;
  width: 12px;
  height: 12px;
}

.lock-button,
.group-lock-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7b837d;
  font-size: 15px;
}

.lock-button::before,
.group-lock-button::before {
  width: 17px;
  height: 17px;
  background: currentColor;
  content: "";
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='8' width='12' height='9' rx='2'/%3E%3Cpath d='M7 8V6a3 3 0 0 1 5.7-1.3'/%3E%3C/g%3E%3C/svg%3E");
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.lock-button.is-locked::before,
.group-lock-button.is-locked::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='8' width='12' height='9' rx='2'/%3E%3Cpath d='M7 8V6a3 3 0 0 1 6 0v2'/%3E%3C/g%3E%3C/svg%3E");
}

.student-card-shell > .lock-button {
  position: absolute;
  top: 3px;
  right: 3px;
}

.lock-button:hover,
.group-lock-button:hover {
  background: #e8ede9;
  color: var(--text);
}

.is-locked .lock-button,
.group-card.is-locked .group-lock-button {
  color: var(--accent-dark);
}

.student-card-shell:has(.student-card.is-locked) > .lock-button {
  color: var(--accent-dark);
}

.room-group-unit.is-locked {
  background: #f8f6ef;
}

.room-group-label {
  grid-column: 1 / -1;
  padding: 2px 30px 3px 2px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.room-group-unit > .group-lock-button {
  position: absolute;
  top: 2px;
  right: 2px;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 20px;
  width: min(100%, 1320px);
  margin: 16px auto 0;
}

.group-card {
  position: relative;
  min-height: 210px;
  padding: 17px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.group-card.is-locked {
  background: #f8f6ef;
}

.group-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 38px;
  margin-bottom: 13px;
}

.group-card h3 {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.group-name-input {
  width: 100%;
  min-width: 0;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #4f3526;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.group-name-input:hover {
  border-color: var(--border);
  background: var(--surface-soft);
}

.group-name-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgb(47 114 90 / 12%);
  outline: none;
}

.group-member-count {
  color: #738078;
  font-size: 11px;
  white-space: nowrap;
}

.group-lock-button {
  position: absolute;
  top: 7px;
  right: 7px;
}

.group-members {
  display: grid;
  gap: 8px;
  min-height: 100px;
}

.group-members .student-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 48px;
  padding: 8px 14px 8px 10px;
  font-size: 14.5px;
  text-align: left;
  box-sizing: border-box;
  width: 100%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(76, 49, 31, 0.08);
}

.group-members .student-card:hover {
  background: #ede3d4 !important;
  border-color: #3b6b55 !important;
  box-shadow: 0 6px 16px rgba(47, 114, 90, 0.16), 0 2px 4px rgba(0, 0, 0, 0.08);
}

[data-theme="modern"] .group-members .student-card:hover,
[data-map-theme="modern"] .group-members .student-card:hover {
  background: #e2eefa !important;
  border-color: #1e5a8a !important;
  box-shadow: 0 6px 16px rgba(30, 90, 138, 0.16), 0 2px 4px rgba(0, 0, 0, 0.08);
}

.group-members .student-card .student-drag-handle {
  position: static;
  margin-right: 8px;
  flex-shrink: 0;
  font-size: 15px;
  opacity: 0.5;
}

.group-members .student-card .student-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
}

.group-members .student-card .student-name {
  font-size: 14.5px !important;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: normal !important;
  text-align: left !important;
}

.group-members .student-card.has-long-name .student-name {
  font-size: 14px !important;
}

.group-members .student-card.has-very-long-name .student-name {
  font-size: 13.5px !important;
}

.group-members .student-card.has-extra-long-name .student-name {
  font-size: 13px !important;
}

/* In group members, place class badge on far right edge */
.group-members .student-card .student-class-badge {
  position: static !important;
  margin-left: auto;
  font-size: 10.5px !important;
  font-weight: 750;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* Group drop target & drop zone */
.group-card.is-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft) !important;
}

.group-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  background: rgba(141, 90, 59, 0.04);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
  cursor: var(--cursor-pointer);
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
  min-height: 32px;
  user-select: none;
  text-align: center;
  margin-top: 4px;
}

.is-moving-student .group-drop-zone,
.is-moving-group .group-drop-zone,
.groups-grid.has-selected-student .group-drop-zone {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.group-drop-zone:hover,
.group-drop-zone.is-drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  transform: scale(1.02);
}

[data-theme="modern"] .group-drop-zone,
[data-map-theme="modern"] .group-drop-zone {
  border-color: var(--border-strong);
  background: rgba(30, 90, 138, 0.04);
}

[data-theme="modern"] .group-drop-zone:hover,
[data-map-theme="modern"] .group-drop-zone:hover,
[data-theme="modern"] .group-drop-zone.is-drop-target,
[data-map-theme="modern"] .group-drop-zone.is-drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-seat {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 56px;
  padding: 0;
  place-items: center;
  border: 1px dashed #bfb6a0; /* stronger dashed border */
  border-radius: 7px;
  background: rgba(255,255,255,0.6); /* slightly more opaque */
  color: #7b746b; /* darker muted text */
  cursor: pointer;
  font-family: inherit;
  font-size: 13px; /* increase legibility */
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.empty-seat:hover,
.empty-seat.is-attention {
  border-color: #81a393;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.empty-seat.is-attention {
  box-shadow: 0 0 0 3px rgb(47 114 90 / 16%);
}

.empty-seat.is-print-hidden {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Illustrated classroom furniture, derived from the logo's warm wood-and-parchment style. */
.classroom .desk-unit {
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.classroom .desk-unit.is-table,
.classroom .desk-unit.is-groups6 {
  padding: 9px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: linear-gradient(#ca9462, #a96f49);
  box-shadow: inset 0 0 0 1px #e5b67e, 0 4px 8px rgb(76 49 31 / 12%);
}

.classroom .desk-unit.is-triplets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.classroom .desk-unit.is-groups6 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.classroom .student-card,
.classroom .empty-seat {
  min-height: 58px;
  padding: 8px 27px 13px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: linear-gradient(to bottom, #fffaf0 0 calc(100% - 8px), #9c6847 calc(100% - 8px));
  color: #2f211a;
  box-shadow: inset 0 1px rgb(255 255 255 / 82%), 0 2px 5px rgb(76 49 31 / 10%);
}

.room-editor-canvas {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 420px;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px 24px;
  border: 1px solid #d4c0a1;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffcf6 0%, #faf3e5 100%);
  box-shadow: inset 0 2px 5px rgba(76, 49, 31, 0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 90, 59, 0.3) transparent;
}

.room-editor-grid {
  display: grid;
  grid-template-columns: repeat(var(--room-columns, 3), minmax(0, 1fr));
  align-items: start;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 16px);
  width: 100%;
}

.room-editor-grid.is-compact-grid {
  gap: 8px 10px;
}

.room-editor-grid.is-compact-grid .room-editor-unit {
  padding: 4px;
  gap: 3px;
}

.room-editor-grid.is-compact-grid .room-unit-number {
  font-size: 11px;
}

.room-editor-grid.is-compact-grid .room-seat {
  min-height: 44px;
  padding: 4px 6px 8px;
  font-size: 11.5px;
}

.room-editor-grid.is-dense-grid {
  gap: 6px 8px;
}

.room-editor-grid.is-dense-grid .room-editor-unit {
  padding: 3px;
  gap: 2px;
}

.room-editor-grid.is-dense-grid .room-unit-number {
  font-size: 10px;
}

.room-editor-grid.is-dense-grid .room-seat {
  min-height: 36px;
  padding: 3px 4px 6px;
  font-size: 10.5px;
}

.room-editor-canvas .room-seat {
  min-height: 54px;
  padding: 8px 12px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: linear-gradient(to bottom, #fffaf0 0 calc(100% - 8px), #9c6847 calc(100% - 8px));
  color: #2f211a;
  box-shadow: inset 0 1px rgb(255 255 255 / 82%), 0 2px 5px rgb(76 49 31 / 10%);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 140ms ease;
}

.room-editor-canvas .room-seat:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 114, 90, 0.2);
}

.room-editor-canvas .room-seat.is-inactive {
  opacity: 0.35;
  background: #f0e6d6;
  border-style: dashed;
}

.classroom .desk-unit .student-card-shell .student-card {
  min-height: 48px;
  padding-left: 12px;
  padding-right: 24px;
}

.classroom .spatial-desk .student-card-shell .student-card,
.classroom .spatial-desk .student-card {
  min-height: clamp(32px, 3.8vh, 44px);
  padding: 3px 6px;
  box-sizing: border-box;
}

.classroom .spatial-desk .student-card-shell .student-card {
  padding-left: 6px;
  padding-right: 18px; /* Dedicated safe clearance for lock button */
}

.classroom .student-name-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
}

.classroom .student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.005em;
  transition: font-size 120ms ease;
}

.classroom .student-card.has-long-name .student-name {
  font-size: 11.5px;
  letter-spacing: -0.015em;
}

.classroom .student-card.has-very-long-name .student-name {
  font-size: 10.5px;
  letter-spacing: -0.02em;
}

.classroom .student-card.has-extra-long-name .student-name {
  font-size: 10px;
  letter-spacing: -0.025em;
}

.classroom .student-drag-handle {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  color: #70462f;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.classroom .student-card:hover .student-drag-handle,
.classroom .student-card:focus-visible .student-drag-handle,
.classroom .student-card.is-selected .student-drag-handle {
  opacity: 0.78;
}

.classroom .student-card.is-interactive:hover,
.classroom .student-card.is-selected,
.classroom .student-card.is-drop-target,
.classroom .empty-seat:hover,
.classroom .empty-seat.is-attention {
  background-color: #fff4dc;
  filter: brightness(1.02) saturate(1.03);
  outline: 2px solid rgb(148 97 63 / 34%);
  outline-offset: 1px;
  box-shadow: 0 8px 11px rgb(76 49 31 / 14%);
}

.classroom .student-card.is-locked {
  background: linear-gradient(to bottom, #f7e4b9 0 calc(100% - 8px), #865638 calc(100% - 8px));
  filter: none;
}

.classroom .empty-seat {
  border-style: dashed;
  border-color: #8f7f63; /* stronger color */
  background: rgba(255,250,240,0.6);
  color: #6b5b48; /* darker muted */
  filter: none;
  box-shadow: none;
}

.classroom .empty-seat:hover,
.classroom .empty-seat.is-attention {
  color: var(--accent-dark);
  filter: none;
}

.classroom .student-card-shell > .lock-button {
  position: absolute;
  top: 50%;
  right: 1px;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  min-width: 17px;
  min-height: 17px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid transparent;
  color: #62402e;
  background: transparent;
  opacity: 0;
  z-index: 5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.classroom .student-card-shell > .lock-button::before {
  width: 11px;
  height: 11px;
}

.classroom .student-card-shell:hover > .lock-button,
.classroom .student-card-shell:focus-within > .lock-button {
  opacity: 0.85;
}

.classroom .student-card-shell:hover > .lock-button:hover {
  opacity: 1;
  background: rgba(141, 90, 59, 0.15);
  transform: translateY(-50%) scale(1.08);
}

.classroom .student-card-shell > .lock-button.is-locked {
  opacity: 1;
  color: #5c381e;
  background: #ecd9b8;
  border-color: #c4a57b;
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.12);
}

.classroom .student-card-shell > .lock-button.is-locked:hover {
  background: #dfc8a3;
}

.workspace-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-height: 48px;
  padding: 10px 28px;
  border-top: 1px solid var(--border);
  background: #fbfcfa;
  color: var(--text-soft);
  font-size: 12px;
}

.workspace-footer p {
  margin: 0;
}

.workspace-footer .copyright {
  text-align: center;
  white-space: nowrap;
}

#saveStatus {
  text-align: right;
}

.dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.dialog[open] {
  animation: dialogFadeIn 110ms ease-out;
}

@keyframes dialogFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  animation: backdropFadeIn 110ms ease-out;
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.dialog-room {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}

.dialog-rules {
  width: min(640px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 48px));
  height: min(760px, calc(100dvh - 48px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
}

.room-settings-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px;
  overflow-y: auto;
}

.room-settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(141, 90, 59, 0.04);
  border: 1px solid var(--border);
}

[data-theme="modern"] .room-settings-section {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.room-settings-section-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.room-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 520px) {
  .room-settings-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.room-setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-setting-item .field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.room-setting-item .field-help {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

.room-settings-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.room-settings-section-actions .field-help {
  font-size: 0.76rem;
  color: var(--muted);
}

.dialog-wide {
  width: min(1020px, calc(100vw - 32px));
}

.dialog-print {
  width: min(1180px, calc(100vw - 24px));
  height: min(860px, calc(100vh - 32px));
  height: min(860px, calc(100dvh - 32px));
}

.dialog-gender {
  width: min(720px, calc(100vw - 32px));
}

.dialog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  margin: 0;
  background: var(--surface) !important;
  color: var(--text);
  overflow: hidden;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.dialog-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px;
  min-height: 0;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 90, 59, 0.3) transparent;
}

.dialog-body::-webkit-scrollbar {
  width: 6px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -4px 12px rgb(76 49 31 / 4%);
}

.dialog-print .print-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 24px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px;
  min-height: 0;
}

.dialog-copy {
  margin: 19px 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.dialog-students {
  width: min(640px, calc(100vw - 32px));
  max-height: min(840px, calc(100vh - 32px));
}

.students-dialog-card {
  max-width: 640px;
  width: 100%;
  max-height: min(840px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
}

.students-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px;
  overflow-y: auto;
}

.dialog-compound-toolbar {
  margin-bottom: 2px;
}

.dialog-compound-help {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.students-dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.students-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.05);
  transition: all 130ms ease;
  cursor: pointer;
}

.toolbar-action-btn:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.toolbar-action-btn.is-danger-text {
  color: var(--danger, #a83232);
}

.toolbar-action-btn.is-danger-text:hover {
  background: var(--danger-soft, #fdeded);
  border-color: #e5b4b4;
}

.dialog-tags-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-tags-container {
  min-height: 220px;
  max-height: 320px;
  padding: 10px 12px;
  gap: 6px;
  border: 1.5px solid #d4c0a1;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffcf6 0%, #faf3e5 100%);
  box-shadow: inset 0 2px 4px rgba(76, 49, 31, 0.05);
  overflow-y: auto;
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 90, 59, 0.3) transparent;
  transition: all 160ms ease;
}

.modal-tags-container:focus-within,
.modal-tags-container:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 2px 4px rgba(76, 49, 31, 0.03), 0 0 0 3.5px rgb(148 97 63 / 18%);
  outline: none;
}

.modal-tag-input {
  min-width: 140px;
  height: 28px;
  font-size: 13px;
  font-weight: 550;
  padding: 2px 6px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.modal-tags-container .student-tag {
  font-size: 12px;
  padding: 4px 8px 4px 10px;
  border-radius: 7px;
  border: 1px solid #cfb188;
  background: linear-gradient(180deg, #ffffff 0%, #f4e8d4 100%);
  gap: 6px;
  box-shadow: 0 1px 3px rgba(76, 49, 31, 0.08);
}

.modal-tags-container .student-tag:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(76, 49, 31, 0.14);
}

.modal-tags-container .student-tag-remove {
  width: 16px;
  height: 16px;
  font-size: 12px;
}

.dialog-tags-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 20px;
  color: var(--text-soft);
  gap: 8px;
}

.dialog-tags-empty .empty-tag-icon {
  font-size: 28px;
  opacity: 0.7;
}

.dialog-tags-empty p {
  margin: 0;
  font-size: 13px;
  max-width: 320px;
  line-height: 1.45;
}

.students-dialog-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.students-dialog-footer-row .count-pill {
  font-size: 11.5px;
  padding: 2px 9px;
  font-weight: 750;
}

.students-dialog-footer-row .field-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

/* ==========================================================================
   THEME SELECTOR & DUAL THEME SYSTEM
   ========================================================================== */

.settings-theme-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.theme-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.theme-card-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-control);
  transition: all 140ms ease;
}

.theme-card-option:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 49, 31, 0.08);
}

.theme-card-option.is-active {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 4px 12px rgba(76, 49, 31, 0.1);
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.swatch-stripe {
  flex: 1;
  width: 100%;
}

.classic-swatch .swatch-paper { background: #efe6d4; }
.classic-swatch .swatch-wood { background: #d8aa72; }
.classic-swatch .swatch-accent { background: #8d5a3b; }

.modern-swatch .swatch-navy { background: #1e5a8a; }
.modern-swatch .swatch-mint { background: #43aa8b; }
.modern-swatch .swatch-gold { background: #f39c12; }

.theme-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.theme-info strong {
  font-size: 13px;
  font-weight: 700;
}

.theme-info small {
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.3;
  margin-top: 2px;
}

/* ==========================================================================
   GLOBAL UI MODERN THEME OVERRIDES (Full UI transformation)
   ========================================================================== */

[data-theme="modern"] html,
[data-theme="modern"] body {
  background:
    radial-gradient(circle at 16% 10%, rgb(255 255 255 / 80%) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 78%, rgb(30 90 138 / 5%) 0 1px, transparent 2px),
    #eaf1f8;
  background-size: 24px 24px, 31px 31px, auto;
  color: #172b3d;
}

/* Sidebar & Brand */
[data-theme="modern"] .control-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f3f7fb 100%);
  border-right: 1px solid #96afc7;
  box-shadow: 3px 0 20px rgba(18, 50, 77, 0.05);
}

[data-theme="modern"] .sidebar-brand {
  background: linear-gradient(180deg, #ffffff 0%, #edf4fa 100%);
  border-bottom: 1px solid #96afc7;
  border-right: none;
  width: 100%;
  box-shadow: 0 2px 8px rgba(18, 50, 77, 0.04);
}

[data-theme="modern"] .sidebar-brand .brand-mark {
  background: radial-gradient(circle at 38% 28%, #e0f2fe, #1e5a8a 85%);
  border-color: #96afc7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(18, 50, 77, 0.15);
}

[data-theme="modern"] .sidebar-brand .brand-copy strong {
  color: #103856;
}

[data-theme="modern"] .sidebar-brand .brand-copy small {
  color: #4d667e;
}

[data-theme="modern"] .panel-stack {
  scrollbar-color: rgba(30, 90, 138, 0.25) transparent;
}

[data-theme="modern"] .panel-stack::-webkit-scrollbar-thumb {
  background: rgba(30, 90, 138, 0.2);
}

[data-theme="modern"] .panel-stack::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 90, 138, 0.4);
}

[data-theme="modern"] .panel-section {
  border-color: #c8d8e7;
}

[data-theme="modern"] .panel-section + .panel-section {
  border-top-color: #c8d8e7;
}

/* Class Actions Dropdown */
[data-theme="modern"] .class-actions > summary {
  background: linear-gradient(#ffffff, #f0f5fa);
  border-color: #c8d8e7;
  color: #172b3d;
  box-shadow: 0 1px 3px rgba(18, 50, 77, 0.06);
}

[data-theme="modern"] .class-actions > summary:hover,
[data-theme="modern"] .class-actions[open] > summary {
  border-color: #1e5a8a;
  background: #e2eef7;
}

[data-theme="modern"] .class-action-menu {
  background: #ffffff;
  border: 1px solid #c8d8e7;
  box-shadow: 0 12px 28px rgba(18, 50, 77, 0.16);
}

[data-theme="modern"] .class-action-button {
  color: #172b3d;
}

[data-theme="modern"] .class-action-button .class-action-svg {
  color: #1e5a8a;
}

[data-theme="modern"] .class-action-button:hover {
  background: #f0f6fb;
  color: #1e5a8a;
}

[data-theme="modern"] .class-action-button.is-danger {
  color: var(--danger);
}

[data-theme="modern"] .class-action-button.is-danger .class-action-svg {
  color: var(--danger);
}

[data-theme="modern"] .class-action-button.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* New Class Button */
[data-theme="modern"] #newClassButton {
  background: linear-gradient(#ffffff, #edf4fa);
  color: #1e5a8a;
  border-color: #b8cde0;
  box-shadow: inset 0 1px rgb(255 255 255 / 80%), 0 2px 5px rgb(18 50 77 / 06%);
}

[data-theme="modern"] #newClassButton:hover:not(:disabled) {
  background: linear-gradient(#f0f6fb, #dbedf7);
  border-color: #1e5a8a;
  box-shadow: inset 0 1px rgb(255 255 255 / 90%), 0 4px 8px rgb(18 50 77 / 10%);
}

[data-theme="modern"] #newClassButton:focus-visible {
  outline-color: rgba(30, 90, 138, 0.28);
}

/* Text Input (base class) */
[data-theme="modern"] .text-input {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #172b3d;
  box-shadow: inset 0 1px 2px rgb(18 50 77 / 03%), 0 1px 2px rgb(18 50 77 / 03%);
}

[data-theme="modern"] .text-input:focus {
  border-color: #1e5a8a;
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.18);
}

/* Room Feature row inside room editor */
[data-theme="modern"] .room-feature-and-help-row {
  background: linear-gradient(105deg, #f0f6fb, #e2eef7);
  border-color: #c8d8e7;
}

/* Room seat inside room-editor-canvas */
[data-theme="modern"] .room-editor-canvas .room-seat {
  background: linear-gradient(to bottom, #ffffff 0 calc(100% - 8px), #1e5a8a calc(100% - 8px));
  color: #172b3d;
  box-shadow: inset 0 1px rgb(255 255 255 / 80%), 0 2px 5px rgb(18 50 77 / 07%);
}

/* Segmented Controls */
[data-theme="modern"] .segmented-control,
[data-theme="modern"] .mini-segments {
  background: #e2ebf4;
  border-color: #c8d8e7;
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="modern"] .segment,
[data-theme="modern"] .mini-segment {
  color: #4d667e;
}

[data-theme="modern"] .segment:hover,
[data-theme="modern"] .mini-segment:hover {
  color: #172b3d;
}

[data-theme="modern"] .segment.is-active,
[data-theme="modern"] .mini-segment.is-active {
  background: #ffffff;
  color: #1e5a8a;
  border-color: #b8cde0;
  box-shadow: 0 2px 6px rgba(23, 43, 61, 0.08), inset 0 -2px #1e5a8a;
}

[data-theme="modern"] .room-mode-tab.is-active {
  background: #ffffff;
  color: #1e5a8a;
  border-color: #b8cde0;
}

/* Setting Summaries / Rules / Gender Buttons */
[data-theme="modern"] .setting-summary,
[data-theme="modern"] .rules-summary,
[data-theme="modern"] .gender-summary-button,
[data-theme="modern"] .room-summary-button,
[data-theme="modern"] .student-summary-button {
  background: #ffffff;
  border-color: #c8d8e7;
  box-shadow: inset 0 0 0 1px #c8d8e7, 0 1px 3px rgba(18, 50, 77, 0.06);
}

[data-theme="modern"] .setting-summary:hover,
[data-theme="modern"] .setting-summary.is-active,
[data-theme="modern"] .rules-summary:hover,
[data-theme="modern"] .gender-summary-button:hover,
[data-theme="modern"] .room-summary-button:hover,
[data-theme="modern"] .student-summary-button:hover {
  background: #f0f6fb;
  box-shadow: inset 0 0 0 1px #1e5a8a, 0 4px 12px rgba(18, 50, 77, 0.08);
  border-color: #1e5a8a;
}

[data-theme="modern"] .setting-summary-icon,
[data-theme="modern"] .room-summary-icon,
[data-theme="modern"] .student-summary-icon {
  background: #e2eef7;
  color: #1e5a8a;
}

[data-theme="modern"] .room-summary-action,
[data-theme="modern"] .student-summary-action,
[data-theme="modern"] .summary-action {
  color: #1e5a8a;
}

[data-theme="modern"] .empty-diagram span {
  background: #ffffff;
  border-color: #c8d8e7;
  box-shadow: 0 4px 10px rgba(18, 50, 77, 0.05);
}

[data-theme="modern"] .empty-step {
  color: #1e5a8a;
}

[data-theme="modern"] .room-editor-toolbar {
  background: #f0f6fb;
  border-color: #c8d8e7;
}

[data-theme="modern"] .room-capacity-badge {
  background: #e2eef7;
  color: #1e5a8a;
}

[data-theme="modern"] .count-badge {
  background: #e2eef7;
  color: #1e5a8a;
}

[data-theme="modern"] .optional-label {
  background: #e2ebf4;
  color: #4d667e;
}

[data-theme="modern"] .rules-summary strong,
[data-theme="modern"] .setting-summary strong {
  color: #103856;
}

[data-theme="modern"] .rules-summary small,
[data-theme="modern"] .setting-summary small {
  color: #4d667e;
}

[data-theme="modern"] .setting-summary-action {
  color: #1e5a8a;
}

[data-theme="modern"] .planning-label {
  color: #172b3d;
}

[data-theme="modern"] .distribution-summary,
[data-theme="modern"] .generation-summary {
  color: #4d667e;
}

[data-theme="modern"] .text-action {
  color: #1e5a8a;
}

/* Saved Setups Section */
[data-theme="modern"] .saved-setups-section {
  background: #f1f6fb;
  border: 1px solid #c8d8e7;
}

[data-theme="modern"] .saved-setups-header .field-label {
  color: #4d667e;
}

[data-theme="modern"] .saved-setup-card {
  background: #ffffff;
  border-color: #c8d8e7;
}

[data-theme="modern"] .saved-setup-name {
  color: #172b3d;
}

[data-theme="modern"] .saved-setup-date {
  color: #64748b;
}

[data-theme="modern"] .saved-setup-action-btn {
  color: #64748b;
}

[data-theme="modern"] .saved-setup-action-btn:hover {
  background: #e2eef7;
  color: #103856;
}

[data-theme="modern"] .saved-setup-action-btn.delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

[data-theme="modern"] .saved-setup-card:hover {
  background: #f8fbff;
  border-color: #1e5a8a;
  box-shadow: 0 2px 6px rgba(18, 50, 77, 0.08);
}

[data-theme="modern"] .saved-setup-card.is-active {
  background: #eef6fc;
  border-color: #1e5a8a;
  box-shadow: 0 0 0 1.5px #1e5a8a;
}

[data-theme="modern"] .saved-setup-card.is-active .saved-setup-indicator,
[data-theme="modern"] .saved-setup-card.is-active .saved-setup-name {
  color: #103856;
}

[data-theme="modern"] .saved-setups-toggle-btn {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #1e5a8a;
}

[data-theme="modern"] .saved-setups-toggle-btn:hover {
  background: #f0f6fb;
  border-color: #1e5a8a;
  box-shadow: 0 2px 6px rgba(18, 50, 77, 0.1);
}

/* Inputs & Form Controls */
[data-theme="modern"] .input,
[data-theme="modern"] .select,
[data-theme="modern"] .textarea,
[data-theme="modern"] .name-input {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #172b3d;
}

[data-theme="modern"] .input:focus,
[data-theme="modern"] .select:focus,
[data-theme="modern"] .textarea:focus,
[data-theme="modern"] .name-input:focus {
  border-color: #1e5a8a;
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.18);
}

[data-theme="modern"] .student-tags-container {
  background: #ffffff;
  border-color: #c8d8e7;
  box-shadow: inset 0 1px 2px rgba(18, 50, 77, 0.04);
}

[data-theme="modern"] .student-tags-container:hover {
  border-color: #96afc7;
}

[data-theme="modern"] .student-tags-container:focus-within {
  border-color: #1e5a8a;
  background: #ffffff;
  box-shadow: inset 0 1px 3px rgba(18, 50, 77, 0.04), 0 0 0 3px rgba(30, 90, 138, 0.18);
}

/* Buttons */
[data-theme="modern"] .button-primary {
  background: #1e5a8a;
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(18, 50, 77, 0.22);
}

[data-theme="modern"] .button-primary:hover:not(:disabled) {
  background: #103856;
  box-shadow: 0 4px 12px rgba(18, 50, 77, 0.26);
}

[data-theme="modern"] .button-secondary {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #172b3d;
  box-shadow: 0 1px 3px rgba(18, 50, 77, 0.06);
}

[data-theme="modern"] .button-secondary:hover:not(:disabled) {
  background: #f0f6fb;
  border-color: #1e5a8a;
  color: #103856;
}

[data-theme="modern"] .button-quiet {
  color: #4d667e;
}

[data-theme="modern"] .button-quiet:hover:not(:disabled) {
  background: #f0f6fb;
  color: #172b3d;
}

[data-theme="modern"] .button-tiny {
  background: rgba(30, 90, 138, 0.08);
  border-color: rgba(30, 90, 138, 0.2);
  color: #1e5a8a;
}

[data-theme="modern"] .button-tiny:hover {
  background: rgba(30, 90, 138, 0.16);
}

[data-theme="modern"] .generate-dock {
  border-top-color: #c8d8e7;
}

/* Topbar (full-width header used on landing/classroom pages) */
[data-theme="modern"] .topbar {
  border-top-color: rgba(18, 50, 77, 0.06);
  border-bottom-color: rgba(18, 50, 77, 0.08);
  background:
    linear-gradient(90deg, rgb(255 255 255 / 97%), rgb(230 242 252 / 96%)),
    var(--surface);
  box-shadow: inset 0 -1px rgba(30, 90, 138, 0.10), 0 4px 12px rgb(18 50 77 / 06%);
}

[data-theme="modern"] .brand-mark {
  background: radial-gradient(circle at 38% 28%, #e0f2fe, #1e5a8a 85%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 4px 10px rgba(18, 50, 77, 0.15);
}

[data-theme="modern"] .brand-copy small {
  color: #4d667e;
}

[data-theme="modern"] .workspace {
  background: #eaf1f8;
}

[data-theme="modern"] .workspace-toolbar {
  background: #ffffff;
  border-bottom: 1px solid #96afc7;
  box-shadow: 0 2px 10px rgba(18, 50, 77, 0.04);
}



[data-theme="modern"] .zoom-fit-button,
[data-theme="modern"] .zoom-slider-container {
  background: #f0f6fb;
  border: 1px solid #c8d8e7;
  color: #1e5a8a;
}

[data-theme="modern"] .zoom-fit-button:hover {
  background: #e2eef7;
}

[data-theme="modern"] .zoom-value {
  color: #1e5a8a;
}

[data-theme="modern"] .workspace-toolbar .toolbar-actions {
  background: #ffffff;
  border: 1px solid #c8d8e7;
  box-shadow: 0 1px 4px rgba(18, 50, 77, 0.05);
}

[data-theme="modern"] .toolbar-action-group + .toolbar-action-group {
  border-left: 1px solid #e0ecf6;
}

[data-theme="modern"] .toolbar-view-group > *:not([hidden]) + *:not([hidden]) {
  border-left: 1px solid #e0ecf6;
}

[data-theme="modern"] .workspace-toolbar .toolbar-actions .button {
  color: #24415c;
}

[data-theme="modern"] .workspace-toolbar .toolbar-actions .button:hover:not(:disabled) {
  background: #f0f6fb;
  color: #103856;
}

[data-theme="modern"] .workspace-toolbar .toolbar-actions .button:disabled {
  color: #94a3b8;
  opacity: 0.55;
}

[data-theme="modern"] #shuffleButton {
  border: 1px solid #b8cde0;
  background: #ffffff;
  color: #1e5a8a;
  box-shadow: 0 1px 3px rgba(18, 50, 77, 0.06);
}

[data-theme="modern"] #shuffleButton:hover:not(:disabled) {
  background: #f0f6fb;
  border-color: #1e5a8a;
  color: #103856;
}

[data-theme="modern"] #flipViewButton[aria-pressed="true"] {
  border: 1px solid #1e5a8a;
  background: #e2eef7;
  color: #103856;
}

[data-theme="modern"] .workspace-settings-button {
  background: #ffffff;
  border: 1px solid #c8d8e7;
  color: #24415c;
  box-shadow: 0 1px 3px rgba(18, 50, 77, 0.06);
}

[data-theme="modern"] .workspace-settings-button:hover {
  background: #f0f6fb;
  border-color: #96afc7;
  color: #103856;
  box-shadow: 0 2px 6px rgba(18, 50, 77, 0.09);
}

[data-theme="modern"] .workspace-settings-button .sync-badge {
  background: #f1f6fa;
  border: 1px solid #d4e2ed;
  color: #334e68;
}

[data-theme="modern"] .workspace-settings-button:hover .sync-badge {
  background: #ffffff;
  border-color: #bad3e8;
}

[data-theme="modern"] .workspace-settings-button .sync-badge.is-connected {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

[data-theme="modern"] .workspace-settings-button .sync-badge.is-syncing {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

[data-theme="modern"] .workspace-settings-button .sync-badge.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

[data-theme="modern"] .settings-btn-divider {
  background: #d8e4f0;
}

/* Dialogs & Modals */
[data-theme="modern"] .dialog-card {
  background: #ffffff;
  border: 1px solid #c8d8e7;
  box-shadow: 0 20px 48px rgba(18, 50, 77, 0.18);
}

[data-theme="modern"] .dialog-heading {
  border-bottom: 1px solid #e2ebf4;
  background: #f8fafc;
}

[data-theme="modern"] .dialog-actions {
  border-top: 1px solid #e2ebf4;
  background: #f8fafc;
}

[data-theme="modern"] .students-manager-panel,
[data-theme="modern"] .gender-step {
  background: #f8fafc;
  border-color: #c8d8e7;
}

[data-theme="modern"] .students-editor-card,
[data-theme="modern"] .dialog-tags-container {
  background: #ffffff;
  border-color: #c8d8e7;
}

[data-theme="modern"] .gender-row {
  background: #ffffff;
  border-color: #e2ebf4;
}

[data-theme="modern"] .sync-badge {
  background: #f0f6fb;
  border-color: #c8d8e7;
  color: #172b3d;
}

[data-theme="modern"] .sync-badge:hover {
  background: #e2eef7;
  border-color: #1e5a8a;
}

[data-theme="modern"] .sync-card {
  background: #ffffff;
  border-color: #c8d8e7;
  box-shadow: 0 1px 4px rgba(15, 41, 64, 0.06);
}

[data-theme="modern"] .sync-indicator-icon {
  background: #e0f2fe;
  border-color: #bae6fd;
}

[data-theme="modern"] .sync-file-details strong {
  color: #0f2942;
}

[data-theme="modern"] .sync-file-details small,
[data-theme="modern"] .sync-disconnected-text {
  color: #475569;
}

[data-theme="modern"] .privacy-note-card {
  background: #f0f6fb;
  border-color: #c8d8e7;
}

[data-theme="modern"] .privacy-note-card strong {
  color: #103856;
}

[data-theme="modern"] .privacy-note-card p {
  color: #334155;
}

[data-theme="modern"] .dialog-copy {
  color: #475569;
}

[data-theme="modern"] .danger-zone {
  border-top-color: #e2ebf4;
}

[data-theme="modern"] .danger-zone strong {
  color: #172b3d;
}

[data-theme="modern"] .danger-zone p {
  color: #64748b;
}

[data-theme="modern"] .button-danger {
  border: 1.2px solid #fca5a5;
  background: #ffffff;
  color: #dc2626;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.08);
}

[data-theme="modern"] .button-danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

[data-theme="modern"] .settings-about {
  border-top-color: #e2ebf4;
  color: #94a3b8;
}

[data-theme="modern"] .theme-card-option {
  background: #ffffff;
  border-color: #c8d8e7;
}

[data-theme="modern"] .theme-card-option:hover {
  border-color: #1e5a8a;
  background: #f8fbff;
}

[data-theme="modern"] .theme-card-option.is-active {
  border-color: #1e5a8a;
  background: #eef6fc;
  box-shadow: 0 0 0 1.5px #1e5a8a;
}

[data-theme="modern"] .preset-summary-card,
[data-theme="modern"] .room-editor-preset-section {
  background: #f8fafc;
  border-color: #c8d8e7;
}

[data-theme="modern"] .preset-sub-field {
  background: #ffffff;
  border-color: #c8d8e7;
}

/* Room Editor — remaining parchment colours that need modern-theme overrides */
[data-theme="modern"] .room-editor-unit {
  border-color: #96afc7;
  background: #f0f6fb;
  box-shadow: inset 0 1px rgb(255 255 255 / 80%), 0 3px 8px rgb(18 50 77 / 06%);
}

[data-theme="modern"] .room-drag-handle {
  color: #4d667e;
}

[data-theme="modern"] .room-unit-number {
  color: #172b3d;
}

[data-theme="modern"] .room-seat {
  color: #172b3d;
}

[data-theme="modern"] .room-seat:hover {
  outline-color: rgb(30 90 138 / 30%);
}

/* Modern Eyebrows, Labels & Headers */
[data-theme="modern"] .eyebrow,
[data-theme="modern"] #workspaceType,
[data-theme="modern"] .dialog-eyebrow,
[data-theme="modern"] .panel-eyebrow,
[data-theme="modern"] .empty-step {
  color: #1e5a8a;
}


/* Modern Zoom Slider */
[data-theme="modern"] .zoom-slider {
  background: #c8d8e7;
}

[data-theme="modern"] .zoom-slider::-webkit-slider-thumb {
  background: #1e5a8a;
  border-color: #ffffff;
}

[data-theme="modern"] .zoom-slider::-webkit-slider-thumb:hover {
  background: #103856;
}

[data-theme="modern"] .zoom-slider::-moz-range-thumb {
  background: #1e5a8a;
  border-color: #ffffff;
}

/* Modern Capacity Badge / Pill */
[data-theme="modern"] .room-editor-capacity-pill {
  background: #e2eef7;
  border-color: #96afc7;
  color: #103856;
}

/* Modern Room Painter Tools */
[data-theme="modern"] .painter-tool-label {
  color: #1e5a8a;
}

[data-theme="modern"] .field-label,
[data-theme="modern"] .panel-field-label,
[data-theme="modern"] .sub-field-label {
  color: #172b3d;
}

[data-theme="modern"] .field-meta,
[data-theme="modern"] .field-help {
  color: #4d667e;
}

[data-theme="modern"] .toast {
  background: #103856;
  border-color: #1e5a8a;
  color: #f8fafc;
  box-shadow: 0 4px 16px rgba(18, 50, 77, 0.25);
}

[data-theme="modern"] .toast button {
  border-color: rgba(255, 255, 255, 0.4);
  color: #f8fafc;
}

[data-theme="modern"] .painter-brush-btn {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #4d667e;
}

[data-theme="modern"] .painter-brush-btn .brush-svg {
  color: #1e5a8a;
}

[data-theme="modern"] .painter-brush-btn:hover {
  background: #f0f6fb;
  border-color: #96afc7;
  color: #172b3d;
}

[data-theme="modern"] .painter-brush-btn.is-active {
  background: #e2eef7;
  border-color: #1e5a8a;
  color: #103856;
  box-shadow: 0 0 0 2px rgba(30, 90, 138, 0.2);
}

[data-theme="modern"] .painter-brush-btn.is-active .brush-svg {
  color: #103856;
}

[data-theme="modern"] .painter-cell {
  border-color: rgba(30, 90, 138, 0.22);
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="modern"] .painter-cell:hover,
[data-theme="modern"] .painter-cell.is-brush-hover {
  border-color: #1e5a8a;
  background: rgba(30, 90, 138, 0.14);
}

/* Modern Scrollbars */
[data-theme="modern"] * {
  scrollbar-color: rgba(30, 90, 138, 0.25) transparent;
}

[data-theme="modern"] *::-webkit-scrollbar-thumb {
  background: rgba(30, 90, 138, 0.25);
}

[data-theme="modern"] *::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 90, 138, 0.45);
}


/* ==========================================================================
   INDEPENDENT MAP THEME SYSTEM (Modern & Classic Map Styling)
   ========================================================================== */

/* Modern Map Theme */
[data-map-theme="modern"] .classroom,
.classroom[data-map-theme="modern"],
.print-classroom[data-map-theme="modern"],
[data-map-theme="modern"].classroom,
[data-map-theme="modern"] .room-editor-canvas,
.room-editor-canvas[data-map-theme="modern"],
[data-theme="modern"] .classroom:not([data-map-theme="classic"]),
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]),
[data-theme="modern"] .print-result:not([data-map-theme="classic"]) .classroom {
  background:
    radial-gradient(circle at 16% 10%, rgb(255 255 255 / 85%) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 78%, rgb(30 90 138 / 6%) 0 1px, transparent 2px),
    #f3f7fb;
  border-color: #b0c6dc;
  box-shadow: 0 2px 4px rgb(18 50 77 / 5%), 0 18px 44px rgb(18 50 77 / 10%);
}

/* Modern Teacher Workstation */
[data-map-theme="modern"] .teacher-station,
.classroom[data-map-theme="modern"] .teacher-station,
.room-editor-canvas[data-map-theme="modern"] .teacher-station,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .teacher-station,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .teacher-station {
  background: url("./teacher-desk-chair-modern.svg") center / contain no-repeat;
  filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.12));
}

[data-map-theme="modern"] .classroom.is-flipped .teacher-station,
.classroom.is-flipped[data-map-theme="modern"] .teacher-station,
[data-theme="modern"] .classroom.is-flipped:not([data-map-theme="classic"]) .teacher-station {
  background-image: url("./teacher-desk-chair-modern-flipped.svg");
  transform: none;
}

/* Modern Smartboard / Digital Display */
[data-map-theme="modern"] .room-board,
[data-map-theme="modern"] .board,
[data-map-theme="modern"] .board-surface,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-board,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .board,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .board-surface,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .board {
  background: linear-gradient(180deg, #18232f 0%, #0d1520 100%);
  border: 1.5px solid #475569;
  border-radius: 8px;
  color: #f1f5f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 3px 12px rgba(15, 23, 42, 0.22);
  letter-spacing: 0.14em;
  font-weight: 800;
  position: relative;
}

[data-map-theme="modern"] .board::before,
.classroom[data-map-theme="modern"] .board::before,
.room-editor-canvas[data-map-theme="modern"] .board::before,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .board::before,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .board::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

[data-map-theme="modern"] .board.is-whiteboard,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .board.is-whiteboard {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 2px solid #64748b !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 3px 12px rgba(15, 23, 42, 0.14) !important;
}

[data-map-theme="modern"] .board.is-whiteboard::before,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .board.is-whiteboard::before {
  display: none !important;
}

/* Modern Student Desks & Units */
[data-map-theme="modern"] .desk,
[data-map-theme="modern"] .painter-desk,
[data-map-theme="modern"] .room-unit,
[data-map-theme="modern"] .desk-unit,
[data-map-theme="modern"] .room-editor-unit,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .desk,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .painter-desk,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-unit,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .desk-unit,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-editor-unit,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .painter-desk {
  background: linear-gradient(180deg, #ffffff 0%, #edf3f9 100%);
  border: 1.5px solid #b8cde0;
  border-radius: 9px;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
}

[data-map-theme="modern"] .desk-unit.is-table,
[data-map-theme="modern"] .room-editor-unit.is-table,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .desk-unit.is-table,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-editor-unit.is-table {
  background: linear-gradient(180deg, #f8fafc 0%, #e2eaf2 100%);
  border-color: #9ab4cc;
}

[data-map-theme="modern"] .desk:hover,
[data-map-theme="modern"] .painter-desk:hover,
[data-map-theme="modern"] .room-unit:hover,
[data-map-theme="modern"] .room-editor-unit:hover,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .desk:hover,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .painter-desk:hover,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-unit:hover,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-editor-unit:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.14);
}

[data-map-theme="modern"] .desk-wood-edge,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .desk-wood-edge {
  background: linear-gradient(90deg, #94a3b8, #cbd5e1, #94a3b8);
  height: 3px;
  border-radius: 2px;
}

[data-map-theme="modern"] .student-tag,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .student-tag {
  background: linear-gradient(180deg, #ffffff 0%, #eef5fb 100%);
  border-color: #bfd3e6;
  color: #172b3d;
}

[data-map-theme="modern"] .student-tag:hover,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .student-tag:hover {
  border-color: #1e5a8a;
  box-shadow: 0 2px 5px rgba(30, 90, 138, 0.15);
}

/* Modern Student Card */
[data-map-theme="modern"] .student-card,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .student-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  color: #0f172a;
  font-weight: 750;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(30, 90, 138, 0.04);
  transition: all 140ms ease;
}

[data-map-theme="modern"] .student-card:hover,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .student-card:hover {
  border-color: #2563eb;
  background: #f8fbff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.14);
}

/* Modern Spatial Grid Canvas */
[data-map-theme="modern"] .desk-layout.is-spatial-grid,
[data-map-theme="modern"] .room-painter-grid,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .desk-layout.is-spatial-grid,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-painter-grid {
  background:
    radial-gradient(circle at 50% 50%, rgba(30, 90, 138, 0.07) 1px, transparent 1px),
    rgba(255, 255, 255, 0.7);
  border: 1px solid #d0e0ef;
}

[data-map-theme="modern"] .group-card,
[data-theme="modern"] .groups-grid:not([data-map-theme="classic"]) .group-card {
  background: #ffffff;
  border: 1.5px solid #ccd8e6;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(18, 50, 77, 0.07);
}

/* Modern Architectural Features (Doors, Windows, Radiators, Storage) */
[data-map-theme="modern"] .room-feature-door .door-jamb,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-door .door-jamb,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-door .door-jamb {
  fill: #1e293b;
  stroke: #0f172a;
}

[data-map-theme="modern"] .room-feature-door .door-leaf,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-door .door-leaf,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-door .door-leaf {
  fill: #e2e8f0;
  stroke: #334155;
}

[data-map-theme="modern"] .room-feature-door .door-knob,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-door .door-knob,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-door .door-knob {
  fill: #38bdf8;
  stroke: #0284c7;
}

[data-map-theme="modern"] .room-feature-door .door-arc,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-door .door-arc,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-door .door-arc {
  stroke: #38bdf8;
  fill: rgba(56, 189, 248, 0.08);
}

[data-map-theme="modern"] .room-feature-window .window-sill,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-window .window-sill,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-window .window-sill {
  fill: #f8fafc;
  stroke: #334155;
}

[data-map-theme="modern"] .room-feature-window .window-pane,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-window .window-pane,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-window .window-pane {
  fill: #bae6fd;
  stroke: #0284c7;
}

[data-map-theme="modern"] .room-feature-glasswall .glasswall-frame,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-glasswall .glasswall-frame,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-glasswall .glasswall-frame {
  fill: #f8fafc;
  stroke: #334155;
}

[data-map-theme="modern"] .room-feature-glasswall .glasswall-pane,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-glasswall .glasswall-pane,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-glasswall .glasswall-pane {
  fill: #bae6fd;
  stroke: #0284c7;
}

[data-map-theme="modern"] .room-feature-radiator rect,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-radiator rect,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-radiator rect {
  fill: #ffffff;
  stroke: #475569;
}

[data-map-theme="modern"] .room-feature-radiator path,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-radiator path,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-radiator path {
  stroke: #94a3b8;
}

[data-map-theme="modern"] .room-feature-storage rect:first-child,
[data-theme="modern"] .classroom:not([data-map-theme="classic"]) .room-feature-storage rect:first-child,
[data-theme="modern"] .room-editor-canvas:not([data-map-theme="classic"]) .room-feature-storage rect:first-child {
  fill: #e2e8f0;
  stroke: #334155;
}

/* Explicit Classic Map Theme Overrides (When Map is Classic even if UI is Modern) */
[data-map-theme="classic"] .classroom,
.classroom[data-map-theme="classic"],
.print-classroom[data-map-theme="classic"],
[data-map-theme="classic"].classroom,
[data-map-theme="classic"] .room-editor-canvas,
.room-editor-canvas[data-map-theme="classic"],
[data-map-theme="classic"] .print-result .classroom {
  background:
    linear-gradient(110deg, rgb(255 255 255 / 20%), transparent 44%),
    repeating-linear-gradient(4deg, rgb(118 76 45 / 2%) 0 1px, transparent 1px 9px),
    #fff5dc !important;
  border-color: #ccb793 !important;
  box-shadow: 0 1px 3px rgb(76 49 31 / 5%), 0 16px 40px rgb(76 49 31 / 8%) !important;
}

[data-map-theme="classic"] .desk,
[data-map-theme="classic"] .painter-desk,
[data-map-theme="classic"] .room-unit,
[data-map-theme="classic"] .desk-unit,
[data-map-theme="classic"] .room-editor-unit,
[data-map-theme="classic"] .room-editor-grid .room-editor-unit {
  background: #ead7b6 !important;
  border-color: var(--border) !important;
  box-shadow: 0 2px 5px rgb(76 49 31 / 7%) !important;
}

[data-map-theme="classic"] .desk-wood-edge {
  background: #d8aa72 !important;
}

[data-map-theme="classic"] .student-tag {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-map-theme="classic"] .student-card {
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  box-shadow: 0 1px 2px rgb(76 49 31 / 5%), inset 0 1px rgb(255 255 255 / 72%) !important;
}

[data-map-theme="classic"] .room-board,
[data-map-theme="classic"] .board,
[data-map-theme="classic"] .board-surface {
  background: #6f7354 !important;
  border-color: var(--border-strong) !important;
  color: #fff4d3 !important;
  box-shadow: inset 0 0 0 1px #b58a59, 0 2px 0 #3f2a20, 0 3px 6px rgba(76, 49, 31, 0.15) !important;
}

[data-map-theme="classic"] .desk-layout.is-spatial-grid,
[data-map-theme="classic"] .room-painter-grid {
  background:
    radial-gradient(circle at 50% 50%, rgba(141, 90, 59, 0.05) 1px, transparent 1px),
    rgba(255, 253, 248, 0.4) !important;
}

[data-map-theme="classic"] .group-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}


.gender-step {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.gender-step-heading,
.gender-step-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gender-step-heading > div {
  justify-content: flex-start;
}

.gender-step-heading h3,
.gender-step-heading p {
  margin: 0;
}

.gender-step-heading h3 {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.gender-step-heading p {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
}

.step-number {
  display: inline-grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 750;
}

.gender-step .text-action {
  margin: 0;
}

.gender-student-list {
  display: grid;
  max-height: min(310px, 38vh);
  margin-top: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow-y: auto;
}

.gender-student-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 51px;
  padding: 7px 9px 7px 13px;
}

.gender-student-row + .gender-student-row {
  border-top: 1px solid #e8ece9;
}

.gender-student-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.gender-choice {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: #edf1ee;
}

.gender-choice button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.gender-choice button:hover {
  color: var(--text);
}

.gender-choice button.is-active {
  background: white;
  color: var(--accent-dark);
  box-shadow: 0 1px 3px rgb(30 45 37 / 14%);
}

.gender-empty {
  margin: 0;
  padding: 24px 12px;
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

.gender-feasibility {
  min-height: 18px;
  margin: 10px 2px 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.gender-strategy {
  min-width: 0;
}

.gender-strategy legend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.gender-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.gender-option {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 92px;
  padding: 12px;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.gender-option:hover {
  border-color: #9cad9f;
}

.gender-option:has(input:checked) {
  border-color: var(--accent);
  background: #f1f8f4;
  box-shadow: 0 0 0 2px rgb(47 114 90 / 9%);
}

.gender-option input {
  flex: 0 0 auto;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.gender-option span {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.gender-option strong {
  font-size: 12px;
  line-height: 1.3;
}

.gender-option small {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.4;
}

.gender-rule-note {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
}
.dialog-actions {
  align-items: center;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.file-button {
  cursor: pointer;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.danger-zone p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

/* --- Live File System Sync & Settings Integrated Button --- */
.workspace-settings-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 3px 12px 3px 5px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgb(255 250 240 / 62%);
  color: #604331;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  cursor: pointer;
  box-shadow: 0 1px 3px rgb(76 49 31 / 4%);
}

.workspace-settings-button:hover {
  background: rgb(255 250 240 / 92%);
  border-color: var(--border-strong);
  box-shadow: 0 2px 6px rgb(76 49 31 / 8%);
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(118, 76, 45, 0.16);
  background: rgba(255, 255, 255, 0.7);
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  pointer-events: none;
  box-sizing: border-box;
}

.sync-label {
  display: none;
}

.workspace-settings-button:hover .sync-badge {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(118, 76, 45, 0.25);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
  transition: background-color 200ms ease, box-shadow 200ms ease;
}

.sync-badge.is-connected .sync-dot {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.sync-badge.is-syncing .sync-dot {
  background: #f59e0b;
  animation: syncPulse 1s infinite alternate;
}

.sync-badge.is-error .sync-dot {
  background: #ef4444;
}

.sync-badge.is-connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
  color: #065f46;
}

.sync-badge.is-syncing {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: #92400e;
}

.sync-badge.is-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #991b1b;
}

.settings-btn-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  opacity: 0.75;
  flex-shrink: 0;
}

.settings-btn-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
}

.settings-btn-icon {
  flex-shrink: 0;
  opacity: 0.82;
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.workspace-settings-button:hover .settings-btn-icon {
  transform: rotate(35deg);
  opacity: 1;
}

@keyframes syncPulse {
  0% { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.2); }
}

.sync-settings-section {
  margin: 14px 0 16px;
}

.sync-card {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffdfa;
  box-shadow: 0 1px 3px rgba(76, 49, 31, 0.04);
}

.sync-connected-view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sync-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-indicator-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  font-size: 18px;
  flex-shrink: 0;
}

.sync-file-details strong {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: var(--text-main, #382417);
}

.sync-file-details small {
  display: block;
  font-size: 11.5px;
  color: var(--text-soft, #7a5c43);
  margin-top: 2px;
}

.sync-file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-disconnected-text {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-soft, #7a5c43);
  line-height: 1.45;
}

.sync-connect-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-connect-buttons .button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sync-unsupported-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff8e6;
  border: 1px solid #fed7aa;
  font-size: 12px;
  line-height: 1.4;
  color: #9a3412;
}

.privacy-note-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #edf7f2;
  border: 1px solid #c2e2d3;
}

.privacy-note-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.privacy-note-card strong {
  display: block;
  font-size: 13px;
  font-weight: 750;
  color: #1b6045;
  margin-bottom: 3px;
}

.privacy-note-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #2c5946;
}

.app-permanent-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: #fdfaf3;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.settings-about {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
  text-align: center;
}

.advanced-options {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgb(255 255 255 / 62%);
}

.advanced-options summary {
  padding: 10px 11px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}

.advanced-options[open] summary {
  border-bottom: 1px solid var(--border);
}

.advanced-options > label,
.advanced-options > .button {
  margin: 11px;
}

.room-editor-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.room-editor-capacity-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f4ede0;
  border: 1px solid var(--border);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Room mode panel (preset & painter toolbars) ───────────────── */
.room-mode-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  box-shadow: 0 1px 4px rgba(76, 49, 31, 0.05);
  box-sizing: border-box;
}

/* Main row: primary controls in a flex wrap so they breathe */
.room-panel-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.room-panel-row-main {
  flex-wrap: wrap;
  gap: 14px;
}

/* Each labelled field block */
.preset-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 90px;
}

.preset-field-wrap .field-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Action buttons aligned to end */
.preset-action-buttons,
.painter-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  align-self: flex-end;
}

/* Sub-row: secondary selects with clearer labels */
.room-panel-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.preset-sub-field {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
}

.sub-field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Compact select used in main row */
select.select-compact {
  min-height: 34px;
  height: 34px;
  padding: 2px 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

/* Tiny select used in sub-row — bigger than before for readability */
select.select-tiny {
  min-height: 30px;
  height: 30px;
  padding: 1px 8px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.painter-guide-hint {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}

/* ── Room details / feature-add row ─────────────────────────────── */
.room-feature-and-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(105deg, #fffaf0, #f6ead4);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.room-feature-builder {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.room-feature-heading strong {
  font-size: 12px;
  font-weight: 750;
  color: var(--accent-dark);
  white-space: nowrap;
}

.room-feature-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.room-feature-buttons .button {
  min-height: 30px;
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
}

.room-instruction-hint {
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
  text-align: right;
}

#roomDimensionHelp {
  flex: 1 1 420px;
}

.room-editor-canvas {
  display: flex;
  position: relative;
  flex-direction: column;
  min-height: 430px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    repeating-linear-gradient(5deg, rgb(118 76 45 / 2%) 0 1px, transparent 1px 10px),
    #fff4dc;
  box-shadow: inset 0 1px 3px rgb(76 49 31 / 7%);
}

.room-feature {
  position: absolute;
  z-index: 6;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  user-select: none;
  transition: box-shadow 120ms ease;
}

.room-feature-svg {
  display: block;
  filter: drop-shadow(0 2px 5px rgba(76, 49, 31, 0.22));
}

.room-feature-door .room-feature-svg {
  width: 48px;
  height: 48px;
}

.room-feature-window .room-feature-svg {
  width: 60px;
  height: 18px;
}

.room-feature-radiator .room-feature-svg {
  width: 52px;
  height: 16px;
}

.room-feature-storage .room-feature-svg {
  width: 52px;
  height: 24px;
}

.room-feature-glasswall {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.room-feature-glasswall .room-feature-svg {
  display: block;
  transform: none !important;
}

.room-feature-glasswall.is-wall-left,
.room-feature-glasswall.is-wall-right {
  width: 16px;
  height: auto;
  transform: translateY(-50%);
}

.room-feature-glasswall.is-wall-top,
.room-feature-glasswall.is-wall-bottom {
  width: auto;
  height: 16px;
  transform: translateX(-50%);
}

.room-feature-screen {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 12;
}

.room-feature-screen .room-feature-svg {
  display: block;
  transform: none !important;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  transition: filter 140ms ease;
}

.room-feature-screen:hover .room-feature-svg {
  filter: drop-shadow(0 4px 10px rgba(56, 189, 248, 0.45));
}

.room-feature-screen.is-wall-left,
.room-feature-screen.is-wall-right {
  width: 18px;
  height: auto;
  transform: translateY(-50%);
}

.room-feature-screen.is-wall-top,
.room-feature-screen.is-wall-bottom {
  width: auto;
  height: 18px;
  transform: translateX(-50%);
}

.map-quick-add-board-btn {
  background: #385141;
  color: #f7fee7;
  border: 1px solid #593e22;
  font-weight: 700;
}
.map-quick-add-board-btn:hover {
  background: #283618;
  color: #ffffff;
}

/* Inward Wall Alignments & Rotations */
.room-feature.is-wall-left {
  left: 2px !important;
  right: auto !important;
  transform: translateY(-50%);
}

.room-feature.is-wall-right {
  left: auto !important;
  right: 2px !important;
  transform: translateY(-50%);
}

.room-feature.is-wall-top {
  top: 2px !important;
  bottom: auto !important;
  transform: translateX(-50%);
}

.room-feature.is-wall-bottom {
  top: auto !important;
  bottom: 2px !important;
  transform: translateX(-50%);
}

.room-feature-door.is-wall-left .room-feature-svg {
  transform: rotate(0deg);
}

.room-feature-door.is-wall-right .room-feature-svg {
  transform: scaleX(-1);
}

.room-feature-door.is-wall-top .room-feature-svg {
  transform: rotate(90deg);
}

.room-feature-door.is-wall-bottom .room-feature-svg {
  transform: rotate(-90deg);
}

.room-feature-window.is-wall-left .room-feature-svg,
.room-feature-radiator.is-wall-left .room-feature-svg,
.room-feature-storage.is-wall-left .room-feature-svg {
  transform: rotate(90deg);
}

.room-feature-window.is-wall-right .room-feature-svg,
.room-feature-radiator.is-wall-right .room-feature-svg,
.room-feature-storage.is-wall-right .room-feature-svg {
  transform: rotate(-90deg);
}

.room-feature-window.is-wall-top .room-feature-svg,
.room-feature-radiator.is-wall-top .room-feature-svg,
.room-feature-storage.is-wall-top .room-feature-svg {
  transform: rotate(0deg);
}

.room-feature-window.is-wall-bottom .room-feature-svg,
.room-feature-radiator.is-wall-bottom .room-feature-svg,
.room-feature-storage.is-wall-bottom .room-feature-svg {
  transform: rotate(180deg);
}

.room-feature-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(47, 33, 26, 0.85);
  color: #fffaf0;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
}

.room-feature:hover .room-feature-label,
.room-feature.is-editable:hover .room-feature-label,
.room-feature.is-editable:focus-visible .room-feature-label {
  opacity: 1;
}

.room-feature.is-editable {
  z-index: 9;
  pointer-events: auto;
  cursor: grab;
}

.room-feature.is-editable:active {
  cursor: grabbing;
}

.room-feature.is-editable:focus-visible,
.room-feature.is-editable:hover {
  outline: 2px dashed #94613f;
  outline-offset: 4px;
  border-radius: 6px;
}

.room-feature.is-selected {
  outline: 2px solid var(--accent, #94613f) !important;
  outline-offset: 4px;
  border-radius: 6px;
  z-index: 20 !important;
}

.room-feature.is-selected .room-feature-controls,
.room-feature.is-selected .room-feature-remove,
.room-feature.is-selected .room-feature-label {
  opacity: 1 !important;
}

.room-feature.is-dragging {
  opacity: 0.55;
}

.room-feature-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #c0392b;
  border-radius: 50%;
  background: #ffffff;
  color: #c0392b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
  opacity: 0.7;
}

.room-feature-remove:hover,
.room-feature:hover .room-feature-remove,
.room-feature.is-selected .room-feature-remove {
  transform: scale(1.15);
  background: #fdeded;
  opacity: 1;
}

.room-feature-controls {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

.room-feature.is-wall-top .room-feature-controls {
  top: calc(100% + 8px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
}

.room-feature.is-wall-bottom .room-feature-controls {
  top: auto;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
}

.room-feature.is-wall-left .room-feature-controls {
  top: 50%;
  left: calc(100% + 8px);
  right: auto;
  transform: translateY(-50%);
}

.room-feature.is-wall-right .room-feature-controls {
  top: 50%;
  left: auto;
  right: calc(100% + 8px);
  transform: translateY(-50%);
}

.room-feature:hover .room-feature-controls,
.room-feature.is-selected .room-feature-controls,
.room-feature.is-editable:hover .room-feature-controls,
.room-feature.is-editable.is-selected .room-feature-controls,
.room-feature.is-editable:focus-within .room-feature-controls,
.room-feature.is-editable:focus-visible .room-feature-controls {
  opacity: 1;
}

.room-feature-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.room-feature-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.45);
  transform: scale(1.15);
}

.room-feature-ctrl-btn:active {
  transform: scale(0.95);
}

.room-feature-rotate-btn {
  font-size: 15px;
  line-height: 1;
}

.room-feature-size-label {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  min-width: 14px;
  text-align: center;
  user-select: none;
}

.room-editor-canvas .room-front {
  margin-top: 2px;
  margin-bottom: 10px;
}

.room-editor-canvas.is-board-bottom .room-front {
  margin-top: 10px;
  margin-bottom: 2px;
}

.room-editor-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  width: fit-content;
}

.room-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 650;
  transition: all 140ms ease;
}

.room-mode-tab:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
}

.room-mode-tab.is-active {
  background: white;
  color: var(--accent-dark);
  border-color: var(--border);
  box-shadow: 0 2px 6px rgb(76 49 31 / 9%);
  font-weight: 750;
}



.painter-brush-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.painter-tool-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-tab-svg {
  display: block;
  flex-shrink: 0;
  opacity: 0.85;
}

.room-mode-tab:hover .mode-tab-svg,
.room-mode-tab.is-active .mode-tab-svg {
  opacity: 1;
}

.painter-brush-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 650;
  transition: all 130ms ease;
}

.painter-brush-btn .brush-svg {
  display: block;
  flex-shrink: 0;
  color: var(--accent-dark);
  opacity: 0.85;
  transition: transform 120ms ease, opacity 120ms ease;
}

.painter-brush-btn:hover {
  background: white;
  border-color: var(--border-strong);
  color: var(--text);
}

.painter-brush-btn:hover .brush-svg {
  opacity: 1;
  transform: scale(1.08);
}

.painter-brush-btn.is-active {
  background: #ecd5b1;
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: 0 0 0 2px rgba(141, 90, 59, 0.18);
  font-weight: 750;
}

.painter-brush-btn.is-active .brush-svg {
  opacity: 1;
  color: var(--accent-dark);
}

.painter-brush-btn.is-eraser .brush-svg {
  color: var(--danger);
}

.painter-brush-btn.is-eraser.is-active {
  background: #fde8e5;
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 0 0 2px rgba(155, 69, 58, 0.18);
}

.painter-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.painter-brush-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.painter-tool-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.room-painter-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(36px, 1fr));
  gap: 5px;
  width: 100%;
  min-height: 440px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 50%, rgba(141, 90, 59, 0.07) 1px, transparent 1px),
    rgba(255, 253, 248, 0.5);
  background-size: 20px 20px, 100% 100%;
  position: relative;
}

.painter-cell {
  position: relative;
  min-height: 38px;
  border: 1px dashed rgba(141, 90, 59, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 110ms ease, border-color 110ms ease, transform 110ms ease;
  user-select: none;
}

.painter-cell:hover,
.painter-cell.is-brush-hover {
  border-color: var(--accent);
  background: rgba(141, 90, 59, 0.14);
}

.painter-cell.is-eraser-hover {
  border-color: var(--danger);
  background: rgba(155, 69, 58, 0.15);
}

.painter-cell.is-drag-target {
  border-color: var(--accent);
  background: rgba(141, 90, 59, 0.25);
  box-shadow: 0 0 0 2px var(--accent);
}

.painter-desk {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 38px;
  padding: 2px 4px;
  border: 1.5px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(76 49 31 / 9%), inset 0 1px rgba(255, 255, 255, 0.8);
  cursor: grab;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  transition: all 120ms ease;
  box-sizing: border-box;
}

.painter-desk:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgb(76 49 31 / 14%);
  transform: translateY(-1px);
}

.painter-desk:active {
  cursor: grabbing;
}

.painter-desk.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.painter-desk.is-paired-left {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
}

.painter-desk.is-paired-right {
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
}

.painter-desk .desk-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.painter-desk .desk-remove-btn {
  position: absolute;
  top: 1px;
  right: 1px;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(155, 69, 58, 0.18);
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
  transition: opacity 120ms ease, transform 100ms ease, background-color 100ms ease;
  z-index: 5;
}

.painter-desk:hover .desk-remove-btn,
.painter-desk:focus-within .desk-remove-btn {
  opacity: 1;
}

.painter-desk .desk-remove-btn:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.18);
}

.room-editor-grid {
  grid-template-columns: repeat(var(--room-columns, 3), minmax(100px, 170px));
}

.room-editor-unit {
  cursor: grab;
  border-width: 1px;
  border-color: #a27e5e;
  background: #f3e2c1;
  box-shadow: inset 0 1px rgb(255 250 231 / 62%), 0 3px 8px rgb(76 49 31 / 8%);
}

.room-unit-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.room-drag-handle {
  margin-right: auto;
  color: #75513a;
  font-size: 16px;
}

.room-editor-unit:hover .room-drag-handle,
.room-editor-grid.is-reordering .room-drag-handle {
  color: var(--accent);
}

.room-unit-number {
  align-self: center;
  color: #4b3023;
  font-size: 11px;
  font-weight: 700;
}

.room-unit-actions button {
  display: grid;
  width: 32px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
}

.room-unit-actions button:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

.room-unit-actions button:disabled {
  opacity: 0.25;
}

.room-seat {
  color: #4f382b;
  font-size: 11px;
  font-weight: 700;
}

.room-seat:hover {
  filter: brightness(1.06);
  outline: 3px solid rgb(148 97 63 / 30%);
  outline-offset: 1px;
}

.room-seat.is-inactive {
  background-color: transparent;
  color: #9a9f9a;
  filter: grayscale(1) opacity(0.42);
  text-decoration: line-through;
}

/* Rules Dialog Styling */
.rules-dialog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.rules-dialog-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 16px 22px 18px;
  gap: 12px;
}

.rules-dialog-body .dialog-copy {
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.4;
  flex: 0 0 auto;
}

.rule-builder-section {
  flex: 0 0 auto;
}

.rule-builder {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  box-shadow: inset 0 1px 2px rgb(30 45 37 / 2%);
}

.rule-type-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule-type-label .field-label {
  margin: 0;
}

.rule-targets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 58px;
  align-items: start;
}

.rule-target-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rule-target-field .field-label {
  margin: 0;
}

.rule-target-placeholder {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule-placeholder-badge {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

.rule-builder-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.rule-builder-actions .rule-advanced {
  align-self: flex-start;
  margin: 0;
}

.rule-builder-actions .rule-advanced summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-soft);
  padding: 6px 0;
  user-select: none;
}

.rule-builder-actions .rule-advanced label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.rule-builder-actions .rule-advanced .field-label {
  margin: 0;
  font-size: 12px;
}

.rule-builder-actions #addRuleButton {
  margin-left: auto;
  flex-shrink: 0;
}

.rule-builder .form-error {
  margin: 2px 0 0;
  font-size: 12px;
}

.rule-list-section {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 140px;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.rule-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.rule-list-header .field-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.rule-list-header .count-badge {
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-subtle, rgba(0, 0, 0, 0.06));
  color: var(--text-soft);
  text-align: center;
}

.rule-list-scrollable {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 6px 16px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 90, 59, 0.28) transparent;
  scrollbar-gutter: stable;
}

[data-theme="modern"] .rule-list-scrollable {
  scrollbar-color: rgba(30, 90, 138, 0.28) transparent;
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-control);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rule-item-just-added {
  animation: ruleItemHighlight 1.5s ease-out;
}

@keyframes ruleItemHighlight {
  0% { background: #e0f2fe; border-color: #38bdf8; }
  60% { background: #e0f2fe; border-color: #38bdf8; }
  100% { background: var(--surface); border-color: var(--border); }
}

.rule-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.rule-item small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-soft);
}

.rule-item .button-quiet {
  flex-shrink: 0;
}

.empty-list {
  padding: 24px 12px;
  color: var(--text-soft);
  text-align: center;
  font-size: 13px;
}

.print-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  margin-top: 18px;
}

.print-options .field-label {
  margin-top: 0;
}

.print-options .field-help {
  display: block;
}

.print-options label + label {
  display: block;
  margin-top: 14px;
}

.print-paper-options {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.print-paper-options > .field-label {
  margin: 0 0 8px;
}

.print-paper-options > label {
  display: block;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.mobile-result-button {
  display: none;
}

.print-status {
  margin-top: 16px;
  padding: 10px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1.45;
}

.print-preview-wrap {
  min-width: 0;
  max-height: 100%;
  height: 100%;
  padding: 24px 16px;
  background: #edf0eb;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  border-radius: 12px;
}

.print-preview-page {
  width: min(100%, 540px);
  min-width: 0;
  aspect-ratio: 210 / 297;
  margin: 0 auto;
  padding: 20px 24px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.print-preview-page.is-landscape {
  width: min(100%, 760px);
  aspect-ratio: 297 / 210;
  min-height: calc(min(100%, 760px) * 210 / 297);
}

.print-preview-page-footer {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
}

.print-page-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 760px;
  margin: 4px 0;
  position: relative;
  flex-shrink: 0;
}

.print-page-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #cbd5e1;
}

.print-page-divider span {
  position: relative;
  z-index: 2;
  padding: 3px 14px;
  background: #475569;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 10px;
}

.print-preview-page-break,
.preview-page-break-badge {
  display: none !important;
}

.print-document-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #bfc3bd;
}

.print-document-header h1 {
  margin: 0;
  font-size: 20px;
}

.print-document-header p {
  margin: 2px 0 0;
  color: #5e645f;
  font-size: 10.5px;
}

.print-document-meta {
  text-align: right;
}

.print-result .classroom {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  padding: 6px 10px;
  border-color: #aeb3ad;
  box-sizing: border-box;
}

.print-result .board {
  padding: 3px 16px;
  font-size: 11px;
}

.print-result .board .board-controls,
.print-result .board .board-remove-btn {
  display: none !important;
}

.print-result .board.is-whiteboard {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1.5px solid #64748b !important;
}

.print-result .board.is-whiteboard .board-title {
  color: #000000 !important;
  text-shadow: none !important;
}

.print-result .room-front {
  margin-bottom: 4px !important;
  margin-top: 0 !important;
  gap: 4px !important;
}

.print-result .classroom.is-flipped .room-front,
.print-result .classroom.is-board-bottom .room-front {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
}

.print-result .teacher-station {
  width: 54px !important;
  height: 32px !important;
}

.print-result .desk-layout:not(.is-spatial-grid) {
  gap: 10px 12px !important;
}

.print-preview-page .desk-layout:not(.is-spatial-grid) {
  grid-template-columns: repeat(var(--print-columns, 3), minmax(0, 1fr)) !important;
  width: 100%;
  min-width: 0;
}

/* Spatial grid in print preview and print result */
.print-result .desk-layout.is-spatial-grid,
.print-preview-page .desk-layout.is-spatial-grid {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(10, minmax(0, 1fr)) !important;
  gap: 3px 2px !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 6px 8px !important;
  box-sizing: border-box !important;
}

.print-result .spatial-desk,
.print-preview-page .spatial-desk {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.print-result .spatial-desk .student-card,
.print-preview-page .spatial-desk .student-card {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 22px !important;
  padding: 1px 2px !important;
  font-size: 9.5px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  box-sizing: border-box !important;
  border-radius: 4px !important;
}

.print-result .spatial-desk .student-name,
.print-preview-page .spatial-desk .student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  letter-spacing: -0.015em;
}

.print-preview-page .desk-unit {
  min-width: 0;
}

.print-preview-page .student-card {
  min-width: 0;
  box-sizing: border-box;
}

.print-preview-page .student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.print-preview-page .classroom .student-card.has-long-name .student-name,
.print-result .classroom .student-card.has-long-name .student-name {
  font-size: 10px !important;
  letter-spacing: -0.015em;
}

.print-preview-page .classroom .student-card.has-very-long-name .student-name,
.print-result .classroom .student-card.has-very-long-name .student-name {
  font-size: 9px !important;
  letter-spacing: -0.025em;
}

.print-preview-page .classroom .student-card.has-extra-long-name .student-name,
.print-result .classroom .student-card.has-extra-long-name .student-name {
  font-size: 8px !important;
  letter-spacing: -0.035em;
}

/* Classic theme cards in print preview */
.print-preview-page .print-result:not([data-map-theme="modern"]) .classroom {
  border: 1.5px solid #c9b49b;
  border-radius: 10px;
  background: #faf6ee;
}

.print-preview-page .print-result:not([data-map-theme="modern"]) .board,
.print-result:not([data-map-theme="modern"]) .board {
  padding: 3px 20px;
  border-radius: 6px;
  background: #6f7354;
  color: #fff4d3;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-align: center;
  border: 1px solid #48533c;
  box-shadow: inset 0 0 0 1px #b58a59, 0 1px 0 #3f2a20;
}

.print-preview-page .print-result:not([data-map-theme="modern"]) .teacher-station,
.print-result:not([data-map-theme="modern"]) .teacher-station {
  width: 54px !important;
  height: 32px !important;
  background-image: url("./teacher-desk-chair.svg") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  background-color: transparent !important;
}

.print-preview-page .print-result:not([data-map-theme="modern"]) .classroom.is-flipped .teacher-station,
.print-result:not([data-map-theme="modern"]) .classroom.is-flipped .teacher-station,
.print-preview-page .print-result:not([data-map-theme="modern"]) .classroom.is-board-bottom .teacher-station,
.print-result:not([data-map-theme="modern"]) .classroom.is-board-bottom .teacher-station {
  background-image: url("./teacher-desk-chair-flipped.svg") !important;
}

.print-preview-page .print-result:not([data-map-theme="modern"]) .student-card {
  border: 1.2px solid #c9b49b;
  border-radius: 4px;
  background: #fffdf8;
  color: #1a1a1a;
  box-shadow: 0 1px 0 #9c6c44;
}

.print-preview-page .print-result:not([data-map-theme="modern"]) .student-card.is-locked {
  background: #fff6e0;
  border-color: #95613f;
}

.print-preview-page .print-result:not([data-map-theme="modern"]) .empty-seat {
  border: 1.5px dashed #c2ad97;
  border-radius: 4px;
  background: rgba(255, 253, 248, 0.6);
  color: #8c7865;
}

/* Modern theme cards in print preview */
.print-preview-page .print-result[data-map-theme="modern"] .classroom {
  border: 1.5px solid #b0c6dc;
  border-radius: 10px;
  background: #f3f7fb;
}

.print-preview-page .print-result[data-map-theme="modern"] .board,
.print-result[data-map-theme="modern"] .board {
  padding: 3px 20px;
  border-radius: 6px;
  background: #1e5a8a;
  color: #e0f2fe;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-align: center;
  border: 1px solid #103856;
  box-shadow: inset 0 0 0 1px #4a90c4, 0 1px 0 #0a2640;
}

.print-preview-page .print-result[data-map-theme="modern"] .teacher-station,
.print-result[data-map-theme="modern"] .teacher-station {
  width: 54px !important;
  height: 32px !important;
  background-image: url("./teacher-desk-chair-modern.svg") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  background-color: transparent !important;
}

.print-preview-page .print-result[data-map-theme="modern"] .classroom.is-flipped .teacher-station,
.print-result[data-map-theme="modern"] .classroom.is-flipped .teacher-station,
.print-preview-page .print-result[data-map-theme="modern"] .classroom.is-board-bottom .teacher-station,
.print-result[data-map-theme="modern"] .classroom.is-board-bottom .teacher-station {
  background-image: url("./teacher-desk-chair-modern-flipped.svg") !important;
}

.print-preview-page .print-result[data-map-theme="modern"] .student-card {
  border: 1.2px solid #96afc7;
  border-radius: 4px;
  background: #ffffff;
  color: #172b3d;
  box-shadow: 0 1px 0 #1e5a8a;
}

.print-preview-page .print-result[data-map-theme="modern"] .student-card.is-locked {
  background: #e2eef7;
  border-color: #1e5a8a;
}

.print-preview-page .print-result[data-map-theme="modern"] .empty-seat {
  border: 1.5px dashed #96afc7;
  border-radius: 4px;
  background: rgba(240, 246, 251, 0.6);
  color: #4d667e;
}

/* Paired desk corners */
.print-preview-page .spatial-desk.is-paired-left .student-card {
  border-top-right-radius: 2px !important;
  border-bottom-right-radius: 2px !important;
}

.print-preview-page .spatial-desk.is-paired-right .student-card {
  border-top-left-radius: 2px !important;
  border-bottom-left-radius: 2px !important;
}

.print-result .student-card {
  min-height: 48px;
  padding: 5px 8px;
  font-size: 12px;
}

.print-result .student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

.print-result .classroom .student-card.has-long-name .student-name {
  font-size: 10px !important;
  letter-spacing: -0.015em;
}

.print-result .classroom .student-card.has-very-long-name .student-name {
  font-size: 9px !important;
  letter-spacing: -0.025em;
}

.print-result .classroom .student-card.has-extra-long-name .student-name {
  font-size: 8px !important;
  letter-spacing: -0.035em;
}

.print-result.is-dense-room .desk-unit {
  gap: 3px;
  padding: 3px;
}

.print-result.is-dense-room .student-card {
  min-height: 38px;
  padding: 2px 2px;
  font-size: 9.5px;
}

.print-result.is-dense-room .student-card.has-long-name .student-name {
  font-size: 8px !important;
  letter-spacing: -0.025em;
}

.print-result.is-dense-room .student-card.has-very-long-name .student-name {
  font-size: 7px !important;
  letter-spacing: -0.035em;
}


.print-result .groups-grid {
  gap: 10px;
}

.print-preview-page .groups-grid {
  grid-template-columns: repeat(var(--print-group-columns, 3), minmax(0, 1fr));
  width: 100%;
}

.print-result .group-card {
  min-height: 0;
  padding: 10px;
  break-inside: avoid;
}

.print-result .group-members {
  min-height: 0;
}

.print-result .group-members .student-card {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 42px !important;
  padding: 6px 12px 6px 10px !important;
  font-size: 14px !important;
  text-align: left !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.print-preview-page .group-card {
  padding: 8px 10px !important;
}

.print-preview-page .group-card-header {
  margin-bottom: 6px !important;
  padding-bottom: 4px !important;
}

.print-preview-page .group-card-header h3 {
  font-size: 12px !important;
}

.print-preview-page .group-members {
  gap: 4px !important;
}

.print-preview-page .group-members .student-card {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 30px !important;
  padding: 3px 8px !important;
  font-size: 12px !important;
  text-align: left !important;
  box-sizing: border-box !important;
  width: 100% !important;
  border-radius: 6px !important;
}

.print-result .group-members .student-card .student-drag-handle,
.print-preview-page .group-members .student-card .student-drag-handle {
  display: none !important;
}

.print-result .group-members .student-card .student-name-wrap,
.print-preview-page .group-members .student-card .student-name-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  justify-content: flex-start !important;
}

.print-result .group-members .student-card .student-name {
  font-size: 14px !important;
  font-weight: 750 !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  letter-spacing: normal !important;
  text-align: left !important;
}

.print-preview-page .group-members .student-card .student-name {
  font-size: 12px !important;
  font-weight: 750 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  letter-spacing: normal !important;
  text-align: left !important;
}

.print-result .group-members .student-card.has-long-name .student-name,
.print-preview-page .group-members .student-card.has-long-name .student-name {
  font-size: 13.5px !important;
}

.print-result .group-members .student-card.has-very-long-name .student-name,
.print-preview-page .group-members .student-card.has-very-long-name .student-name {
  font-size: 12.5px !important;
}

.print-result .group-members .student-card.has-extra-long-name .student-name,
.print-preview-page .group-members .student-card.has-extra-long-name .student-name {
  font-size: 11.5px !important;
}

.print-result .group-members .student-card .student-class-badge,
.print-preview-page .group-members .student-card .student-class-badge,
.print-sheet .group-members .student-card .student-class-badge {
  position: static !important;
  margin-left: auto !important;
  font-size: 10px !important;
  font-weight: 750 !important;
  padding: 2.5px 7px !important;
  border-radius: 4px !important;
  letter-spacing: 0.03em !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
}

.print-sheet {
  display: none;
}

.toast {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 14px;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #4b3023;
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast button {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 4px;
  background: transparent;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

/* Shared parchment-and-wood identity, kept quiet enough for dense planning work. */
/* NOTE: parchment-specific colour rules are scoped to classic theme to avoid
   bleeding through into the modern theme cascade. Theme-neutral rules
   (border-radius, layout, transparent backgrounds) are left unscoped. */
.button {
  border-radius: 10px;
}

.workspace-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 8px;
  min-width: 0;
}

.workspace-body {
  background: transparent;
}

.dialog-heading {
  border-color: var(--border-strong);
}

/* Classic-theme parchment colours — not applied when modern theme is active */
:root:not([data-theme="modern"]),
[data-theme="classic"] {
  .button-primary {
    border: 1px solid var(--border-strong);
    background: linear-gradient(#a86f49, #87573c);
    color: #fff8e7;
    box-shadow: inset 0 1px rgb(230 174 119 / 72%), 0 3px 7px rgb(76 49 31 / 18%);
  }

  .button-primary:hover:not(:disabled) {
    background: linear-gradient(#9c6544, #68402e);
  }

  .button-secondary {
    border: 1px solid var(--border);
    background: linear-gradient(#fffaf0, #f7ead4);
  }

  .room-summary-button,
  .rules-summary,
  .setting-summary {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(105deg, #fffaf0, #f8ecd8);
    box-shadow: inset 0 1px rgb(255 255 255 / 72%), 0 2px 5px rgb(76 49 31 / 6%);
  }

  .workspace {
    background:
      radial-gradient(circle at 18% 14%, rgb(255 249 228 / 20%) 0 1px, transparent 2px),
      #ece3d1;
    background-size: 30px 30px, auto;
  }

  .workspace-toolbar {
    border-bottom: 1px solid var(--border-strong);
    background: linear-gradient(100deg, #fffaf1, #f6e6c9);
    box-shadow: 0 4px 15px rgb(76 49 31 / 5%);
  }

  .workspace-settings-button {
    min-height: 36px;
    border: 1px solid var(--border);
    background: rgb(255 250 240 / 62%);
    color: #604331;
  }

  .workspace-toolbar .toolbar-actions {
    border: 1px solid var(--border);
    background: rgb(255 250 240 / 76%);
  }

  #shuffleButton {
    border-color: var(--border-strong);
    background: #f1e3ca;
  }



  .dialog {
    border: 1px solid var(--border);
    background:
      repeating-linear-gradient(6deg, rgb(118 76 45 / 1%) 0 1px, transparent 1px 11px),
      #fff9ed;
    box-shadow: var(--shadow);
  }

  .group-card {
    border: 1px solid var(--border);
    background: linear-gradient(120deg, #fffaf0, #f8ecd9);
  }
}

@media (max-height: 900px) and (min-width: 721px) {
  .panel-section + .panel-section {
    margin-top: 16px;
    padding-top: 16px;
  }

  .section-heading {
    margin-bottom: 11px;
  }

  .field-label {
    margin-top: 9px;
    margin-bottom: 4px;
  }

  .label-row .field-meta {
    margin-top: 9px;
  }

  .name-input {
    height: clamp(112px, 22vh, 150px);
    min-height: 112px;
  }

  .field-help {
    margin-top: 4px;
    line-height: 1.35;
  }

  .button-full {
    margin-top: 10px;
  }

  .mode-options,
  .rules-summary {
    margin-top: 10px;
  }

}

@media (max-height: 700px) and (min-width: 721px) {
  .panel-section + .panel-section {
    margin-top: 12px;
    padding-top: 12px;
  }

  .section-heading {
    margin-bottom: 8px;
  }

  .name-input {
    height: 112px;
  }

  .text-input,
  .select {
    min-height: 36px;
  }

  .segment,
  .mini-segment {
    min-height: 33px;
  }

  .button {
    min-height: 35px;
  }

  .button-small {
    min-height: 30px;
  }

  .compact-action {
    min-height: 32px;
  }

  .rules-summary {
    min-height: 52px;
  }

}

@media (max-width: 1360px) {
  .workspace-heading {
    min-width: 100px;
    max-width: 260px;
  }
  .workspace-heading h2 {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .workspace-meta-row {
    margin-top: 2px;
  }
  .workspace-summary {
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .workspace-toolbar {
    gap: 8px;
    padding: 6px 12px;
  }
  .workspace-toolbar .toolbar-actions .button {
    padding: 0 6px;
    font-size: 11.5px;
    gap: 3px;
  }
  .zoom-slider {
    width: 44px;
  }
  .zoom-slider-container {
    padding: 2px 5px 2px 4px;
    gap: 2px;
  }
  .zoom-fit-button {
    padding: 0 6px;
    font-size: 11.5px;
  }
  .workspace-settings-button {
    padding: 0 8px;
    font-size: 12px;
  }
}

.app-shell {
  overflow-x: hidden;
  max-width: 100vw;
}

.workspace {
  overflow-x: hidden;
  min-width: 0;
}

.workspace-toolbar {
  overflow: hidden;
  max-width: 100%;
}

.workspace-header-actions {
  min-width: 0;
  flex-shrink: 1;
}

.toolbar-actions {
  min-width: 0;
  flex-shrink: 1;
}

.toolbar-btn-text {
  display: inline;
}

.btn-text-short {
  display: none;
}

.btn-text-full {
  display: inline;
}

@media (max-width: 1720px) {
  .btn-text-short {
    display: inline;
  }
  .btn-text-full {
    display: none;
  }
  .toolbar-print-group .toolbar-btn-text,
  .toolbar-viewpoint-group .toolbar-btn-text {
    display: none;
  }
  .toolbar-print-group .button,
  .toolbar-viewpoint-group .button {
    padding: 5px 8px;
  }
  .workspace-settings-button .sync-label,
  .workspace-settings-button .settings-btn-divider {
    display: none;
  }
  .workspace-settings-button {
    padding: 0 10px;
    font-size: 12px;
  }
  .map-search-input {
    width: 105px;
  }
  .map-search-input:focus {
    width: 150px;
  }
  .zoom-slider-container {
    display: none;
  }
  .zoom-fit-button {
    padding: 0 6px;
    font-size: 11.5px;
  }
  .toolbar-actions .button {
    padding: 4px 7px;
    font-size: 12px;
  }
  .toolbar-action-group {
    gap: 2px;
  }
  .workspace-toolbar {
    padding: 6px 14px;
    gap: 8px;
  }
}

@media (max-width: 1300px) {
  #toggleLockAllButton {
    min-width: unset;
  }
  #toggleLockAllLabel {
    display: none;
  }
}

@media (max-width: 1100px) {
  .toolbar-actions .button {
    padding-right: 7px;
    padding-left: 7px;
  }

  .room-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-control-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 950px) {
  .app-shell {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .workspace-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-toolbar .toolbar-actions {
    flex-wrap: wrap;
  }

  .rule-targets-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 58px;
    padding: 0 15px;
  }

  .autosave-status {
    display: none;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .sidebar-toggle {
    display: none !important;
  }

  .sidebar-brand {
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    margin: 0;
    width: 100%;
  }

  .sidebar-brand .brand {
    max-width: 100%;
  }

  .sidebar-brand .brand-mark {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
  }

  .sidebar-brand .brand-logo {
    width: 44px;
    height: 44px;
  }

  .generate-dock {
    position: static;
    margin: 18px 0 0;
    padding: 14px 0 0;
    background: transparent;
    box-shadow: none;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .mobile-result-button:not([hidden]) {
    display: inline-flex;
    margin-top: 8px;
  }

  .mode-section {
    display: block;
  }

  .workspace-toolbar,
  .workspace-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .workspace-meta-row {
    align-items: flex-start;
    flex-direction: column;
  }


  .workspace-body {
    min-height: 480px;
    padding: 18px;
  }

  .classroom {
    min-height: 480px;
    padding: 18px 14px;
  }

  .classroom .room-front {
    position: relative;
    left: auto;
    z-index: 1;
    width: 100%;
    margin-right: auto;
    margin-left: auto;
  }



  .workspace-footer,
  .danger-zone,
  .room-editor-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  #roomDimensionHelp {
    flex: none;
  }

  .workspace-footer {
    grid-template-columns: 1fr;
  }

  .workspace-footer .copyright,
  #saveStatus {
    width: 100%;
    text-align: center;
  }

  .room-controls,
  .rule-targets-row,
  .print-layout,
  .gender-options {
    grid-template-columns: 1fr;
  }

  .gender-option {
    min-height: 0;
  }

  .gender-student-row {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px;
  }

  .gender-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-advanced[open] {
    grid-template-columns: 1fr;
  }

  .room-advanced summary {
    grid-column: auto;
  }

  .room-control-actions {
    grid-column: auto;
  }

  .room-editor-canvas {
    padding: 14px;
    overflow: auto;
  }

  .room-editor-grid {
    grid-template-columns: repeat(var(--room-columns, 3), minmax(110px, 1fr));
    justify-content: start;
  }

  .print-preview-wrap {
    max-height: none;
    padding: 10px;
  }

  .print-preview-page,
  .print-preview-page.is-landscape {
    min-width: 620px;
  }
}

@media (pointer: coarse) {
  .button,
  .segment,
  .mini-segment {
    min-height: 44px;
  }

  .lock-button,
  .group-lock-button,
  .class-action-button {
    width: 44px;
    height: 44px;
  }

  .student-drag-handle {
    display: none;
  }

  .student-card,
  .student-card-shell .student-card {
    padding-left: 10px;
  }
}

/* Responsive scaling for low resolutions and browser zoom simulation */
@media (max-width: 1080px), (max-height: 760px) {
  :root {
    --header-height: 70px;
  }
  .sidebar-brand {
    padding: 0 14px;
  }
  .sidebar-brand .brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 11px;
  }
  .sidebar-brand .brand-logo {
    width: 38px;
    height: 38px;
  }
  .sidebar-brand .brand-copy strong {
    font-size: 19px;
  }
  .sidebar-brand .brand-copy small {
    font-size: 9.5px;
  }
  .workspace-toolbar {
    padding: 6px 14px;
  }
  .workspace-body {
    padding: 8px 12px;
  }
  .student-card {
    min-height: 36px;
    font-size: 11px;
    padding: 3px 5px 3px 18px;
  }
  .spatial-drop-cell {
    min-height: 36px;
  }
  .board {
    padding: 5px 22px;
    font-size: 11.5px;
  }
  .teacher-station {
    width: 60px;
    height: 36px;
  }
}

@media (max-height: 640px) {
  .panel-stack {
    gap: 6px;
    padding: 6px 10px 10px;
  }
  .field-label {
    margin: 4px 0 2px;
    font-size: 10.5px;
  }
  .setting-summary,
  .rules-summary {
    min-height: 40px;
    padding: 4px 8px;
  }
  .setting-summary-icon {
    width: 24px;
    height: 24px;
  }
  .workspace-toolbar {
    min-height: 44px;
    padding: 4px 10px;
  }
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  html,
  body {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  body > :not(.print-sheet) {
    display: none !important;
  }

  .print-sheet {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #1a1a1a;
    background: white;
    box-sizing: border-box !important;
    page-break-before: auto !important;
    break-before: auto !important;
    page-break-after: auto !important;
    break-after: auto !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  .print-sheet * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print-sheet .print-document-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    margin-bottom: 2mm !important;
    padding-bottom: 1.5mm !important;
    border-bottom: 1.5px solid #333 !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-sheet .print-document-header h1 {
    font-size: 15pt !important;
    font-weight: 800 !important;
    margin: 0 !important;
    color: #111 !important;
  }

  .print-sheet .print-document-header p {
    margin: 1px 0 0 !important;
    font-size: 9pt !important;
    color: #555 !important;
  }

  .print-sheet .print-document-meta {
    text-align: right !important;
    font-size: 8.5pt !important;
    color: #666 !important;
  }

  .print-sheet .print-result {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* Classic map theme print styles */
  .print-sheet .print-result[data-map-theme="classic"] .classroom,
  .print-sheet .print-result:not([data-map-theme="modern"]) .classroom {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 8px 12px !important;
    border: 1.5px solid #d4c2a5 !important;
    border-radius: 10px !important;
    background: #faf4e7 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* Modern map theme print styles */
  .print-sheet .print-result[data-map-theme="modern"] .classroom {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 8px 12px !important;
    border: 1.5px solid #b0c6dc !important;
    border-radius: 10px !important;
    background: #f3f7fb !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  .print-sheet .room-front {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 auto 6px !important;
    gap: 4px !important;
  }

  .print-sheet .classroom.is-flipped .room-front {
    flex-direction: column-reverse !important;
    margin-top: 6px !important;
    margin-bottom: 0 !important;
  }

  /* Classic board */
  .print-sheet .print-result:not([data-map-theme="modern"]) .board {
    padding: 3px 24px !important;
    border-radius: 6px !important;
    background: #6f7354 !important;
    color: #fff4d3 !important;
    font-weight: 700 !important;
    font-size: 9pt !important;
    letter-spacing: 0.08em !important;
    text-align: center !important;
    border: 1px solid #48533c !important;
    box-shadow: inset 0 0 0 1px #b58a59, 0 1px 0 #3f2a20 !important;
  }

  /* Modern board */
  .print-sheet .print-result[data-map-theme="modern"] .board {
    padding: 3px 24px !important;
    border-radius: 6px !important;
    background: #1e5a8a !important;
    color: #e0f2fe !important;
    font-weight: 700 !important;
    font-size: 9pt !important;
    letter-spacing: 0.08em !important;
    text-align: center !important;
    border: 1px solid #103856 !important;
    box-shadow: inset 0 0 0 1px #4a90c4, 0 1px 0 #0a2640 !important;
  }

  /* Classic teacher desk SVG */
  .print-sheet .print-result:not([data-map-theme="modern"]) .teacher-station {
    width: 68px !important;
    height: 40px !important;
    background-image: url("./teacher-desk-chair.svg") !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    background-color: transparent !important;
  }

  .print-sheet .print-result:not([data-map-theme="modern"]) .classroom.is-flipped .teacher-station {
    background-image: url("./teacher-desk-chair-flipped.svg") !important;
  }

  /* Modern teacher desk SVG */
  .print-sheet .print-result[data-map-theme="modern"] .teacher-station {
    width: 68px !important;
    height: 40px !important;
    background-image: url("./teacher-desk-chair-modern.svg") !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    background-color: transparent !important;
  }

  .print-sheet .print-result[data-map-theme="modern"] .classroom.is-flipped .teacher-station {
    background-image: url("./teacher-desk-chair-modern-flipped.svg") !important;
  }

  .print-sheet .desk-layout:not(.is-spatial-grid) {
    gap: 10px 14px !important;
  }

  .print-sheet .desk-layout.is-spatial-grid {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(10, minmax(32px, 1fr)) !important;
    gap: 3px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 4px 6px !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-sheet .spatial-desk {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 36px !important;
  }

  .print-sheet .desk-unit {
    border: 0;
    background: transparent;
    box-shadow: none;
    break-inside: avoid;
  }

  /* Classic table/groups desk */
  .print-sheet .print-result:not([data-map-theme="modern"]) .desk-unit.is-table,
  .print-sheet .print-result:not([data-map-theme="modern"]) .desk-unit.is-groups6 {
    padding: 6px;
    border: 1.5px solid #8d623d !important;
    border-radius: 10px;
    background: #e8cca6 !important;
  }

  /* Modern table/groups desk */
  .print-sheet .print-result[data-map-theme="modern"] .desk-unit.is-table,
  .print-sheet .print-result[data-map-theme="modern"] .desk-unit.is-groups6 {
    padding: 6px;
    border: 1.5px solid #96afc7 !important;
    border-radius: 10px;
    background: #deeaf5 !important;
  }

  /* Classic student cards */
  .print-sheet .print-result:not([data-map-theme="modern"]) .student-card {
    min-height: 34px;
    padding: 2px 4px;
    border: 1.2px solid #c9b49b !important;
    border-radius: 4px;
    background: #fffdf8 !important;
    color: #1a1a1a !important;
    font-weight: 700;
    font-size: 9.5pt;
    box-shadow: 0 1px 0 #9c6c44 !important;
  }

  .print-sheet .print-result:not([data-map-theme="modern"]) .student-card.is-locked {
    background: #fff6e0 !important;
    border-color: #95613f !important;
  }

  /* Modern student cards */
  .print-sheet .print-result[data-map-theme="modern"] .student-card {
    min-height: 34px;
    padding: 2px 4px;
    border: 1.2px solid #96afc7 !important;
    border-radius: 4px;
    background: #ffffff !important;
    color: #172b3d !important;
    font-weight: 700;
    font-size: 9.5pt;
    box-shadow: 0 1px 0 #1e5a8a !important;
  }

  .print-sheet .print-result[data-map-theme="modern"] .student-card.is-locked {
    background: #e2eef7 !important;
    border-color: #1e5a8a !important;
  }

  .print-sheet .spatial-desk .student-card {
    width: 100% !important;
    height: 100% !important;
    min-height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  .print-sheet .spatial-desk .empty-seat {
    width: 100% !important;
    height: 100% !important;
    min-height: 34px !important;
    padding: 2px 4px !important;
    font-size: 8.5pt !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
    border-radius: 4px !important;
  }

  .print-sheet .spatial-desk .student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

  .print-sheet .print-result[data-map-theme="modern"] .student-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

  /* Classic empty seats */
  .print-sheet .print-result:not([data-map-theme="modern"]) .empty-seat {
    min-height: 38px;
    border: 1.5px dashed #c2ad97 !important;
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.6) !important;
    color: #8c7865 !important;
    font-size: 10pt;
  }

  /* Modern empty seats */
  .print-sheet .print-result[data-map-theme="modern"] .empty-seat {
    min-height: 38px;
    border: 1.5px dashed #96afc7 !important;
    border-radius: 8px;
    background: rgba(240, 246, 251, 0.6) !important;
    color: #4d667e !important;
    font-size: 10pt;
  }

  .print-sheet .empty-seat.is-print-hidden {
    visibility: hidden !important;
    opacity: 0 !important;
  }

  .print-sheet .group-card {
    border: 1.5px solid #7a5538 !important;
    border-radius: 10px;
    background: #ffffff !important;
    box-shadow: none;
    break-inside: avoid;
    padding: 12px;
  }

  .print-sheet .group-lock-button,
  .print-sheet .lock-button,
  .print-sheet .student-drag-handle,
  .print-sheet .student-gender-icon,
  .print-sheet .student-gender-badge {
    display: none !important;
  }

  .print-sheet .groups-grid {
    grid-template-columns: repeat(var(--print-group-columns, 3), minmax(0, 1fr));
    gap: 16px;
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .print-sheet .student-name {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
  }

  .print-sheet .room-feature,
  .print-preview-page .room-feature,
  .print-result .room-feature {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .print-sheet .room-feature-label,
  .print-sheet .room-feature-remove,
  .print-preview-page .room-feature-label,
  .print-preview-page .room-feature-remove,
  .print-result .room-feature-label,
  .print-result .room-feature-remove {
    display: none !important;
  }
}

/* Board at bottom styles (both for boardSide='bottom' and camera-flipped views) */
.classroom.is-board-bottom,
.room-editor-canvas.is-board-bottom {
  display: flex !important;
  flex-direction: column !important;
}

.classroom.is-board-bottom .room-front,
.room-editor-canvas.is-board-bottom .room-front {
  display: flex !important;
  flex-direction: column-reverse !important;
  align-items: center !important;
  width: 100% !important;
  margin-top: 10px !important;
  margin-bottom: 2px !important;
  gap: 4px !important;
  order: 2 !important;
}

/* Breathing space at the wall opposite to the blackboard / teacher desk */
.classroom.is-board-bottom > .desk-layout,
.room-editor-canvas.is-board-bottom > .desk-layout {
  padding-top: 40px !important;
}

.classroom:not(.is-board-bottom) > .desk-layout,
.room-editor-canvas:not(.is-board-bottom) > .desk-layout {
  padding-bottom: 40px !important;
}

#resultStage .classroom.is-board-bottom .teacher-station,
.room-editor-canvas.is-board-bottom .teacher-station {
  background-image: url("./teacher-desk-chair-flipped.svg") !important;
}

[data-map-theme="modern"] #resultStage .classroom.is-board-bottom .teacher-station,
[data-map-theme="modern"] .room-editor-canvas.is-board-bottom .teacher-station,
[data-theme="modern"] #resultStage .classroom.is-board-bottom:not([data-map-theme="classic"]) .teacher-station {
  background-image: url("./teacher-desk-chair-modern-flipped.svg") !important;
}

#resultStage .classroom:not(.is-board-bottom) .room-front,
.room-editor-canvas:not(.is-board-bottom) .room-front {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  margin-top: 2px !important;
  margin-bottom: 10px !important;
  gap: 4px !important;
  order: 0 !important;
}

#resultStage .classroom:not(.is-board-bottom) .teacher-station,
.room-editor-canvas:not(.is-board-bottom) .teacher-station {
  background-image: url("./teacher-desk-chair.svg") !important;
}

[data-map-theme="modern"] #resultStage .classroom:not(.is-board-bottom) .teacher-station,
[data-map-theme="modern"] .room-editor-canvas:not(.is-board-bottom) .teacher-station,
[data-theme="modern"] #resultStage .classroom:not(.is-board-bottom):not([data-map-theme="classic"]) .teacher-station {
  background-image: url("./teacher-desk-chair-modern.svg") !important;
}

/* Sizing in spatial grid on interactive workspace */
#resultStage .spatial-desk {
  width: 100%;
  min-width: 0;
}

#resultStage .spatial-desk .student-card,
#resultStage .spatial-desk .empty-seat {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* ==========================================================================
   Map Student Search Toolbar & Card Highlighting
   ========================================================================== */

.toolbar-search-wrap {
  display: inline-flex;
  align-items: center;
}

.map-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  gap: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.05);
  transition: all 180ms ease;
}

.map-search-box:focus-within {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 114, 90, 0.16), 0 2px 8px rgba(76, 49, 31, 0.08);
}

.map-search-icon {
  color: var(--text-soft);
  flex-shrink: 0;
  transition: color 150ms ease;
}

.map-search-box:focus-within .map-search-icon {
  color: var(--accent);
}

.map-search-input {
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  width: 145px;
  transition: width 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.map-search-input::placeholder {
  color: var(--text-soft);
  opacity: 0.85;
}

.map-search-input:focus {
  width: 185px;
}

.map-search-input::-webkit-search-cancel-button {
  display: none;
}

.map-search-clear {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(141, 90, 59, 0.12);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 120ms ease;
}

.map-search-clear:hover {
  background: var(--danger-subtle, #fee2e2);
  color: var(--danger, #b91c1c);
  transform: scale(1.1);
}

.map-search-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(47, 114, 90, 0.12);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.map-search-badge.is-empty {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

/* Student card search highlight */
@keyframes searchMatchPulse {
  0% {
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.5), 0 4px 14px rgba(217, 119, 6, 0.25);
  }
  100% {
    box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.2), 0 8px 24px rgba(217, 119, 6, 0.35);
  }
}

@keyframes searchMatchPulseModern {
  0% {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.55), 0 4px 14px rgba(14, 165, 233, 0.28);
  }
  100% {
    box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.2), 0 8px 24px rgba(14, 165, 233, 0.4);
  }
}

.student-card.is-search-match,
.group-card.is-search-match {
  border-color: #d97706 !important;
  background: #fffbeb !important;
  color: #78350f !important;
  font-weight: 800 !important;
  z-index: 20 !important;
  opacity: 1 !important;
  filter: none !important;
  transform: translateY(-2px) scale(1.05);
  animation: searchMatchPulse 1.6s infinite alternate ease-in-out;
}

.student-card.is-search-match .student-name {
  color: #78350f !important;
  font-weight: 800 !important;
}

/* Prevent parent containers from being dimmed or greyed out when they contain search matches */
.group-card:has(.is-search-match),
.spatial-desk:has(.is-search-match),
.desk-unit:has(.is-search-match) {
  opacity: 1 !important;
  filter: none !important;
}

/* Dim unmatched items during search */
.student-card.is-search-dimmed,
.empty-seat.is-search-dimmed,
.group-card.is-search-dimmed {
  opacity: 0.22 !important;
  filter: grayscale(45%) !important;
  transform: scale(0.97);
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

/* Modern Theme overrides for search highlight */
[data-theme="modern"] .map-search-box:focus-within,
[data-map-theme="modern"] .map-search-box:focus-within {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(15, 23, 42, 0.08);
}

[data-theme="modern"] .map-search-box:focus-within .map-search-icon,
[data-map-theme="modern"] .map-search-box:focus-within .map-search-icon {
  color: #0ea5e9;
}

[data-theme="modern"] .student-card.is-search-match,
[data-map-theme="modern"] .student-card.is-search-match,
[data-theme="modern"] .group-card.is-search-match,
[data-map-theme="modern"] .group-card.is-search-match {
  border-color: #0284c7 !important;
  background: #f0f9ff !important;
  color: #0369a1 !important;
  animation: searchMatchPulseModern 1.6s infinite alternate ease-in-out;
}

[data-theme="modern"] .student-card.is-search-match .student-name,
[data-map-theme="modern"] .student-card.is-search-match .student-name {
  color: #0369a1 !important;
}

/* ==========================================================================
   Room Capacity / Place Count Modifier Controls
   ========================================================================== */

.room-capacity-modifier-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.capacity-stepper-box {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.capacity-stepper-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 114, 90, 0.16);
}

.capacity-step-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(141, 90, 59, 0.06);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.capacity-step-btn:hover {
  background: rgba(141, 90, 59, 0.15);
  color: var(--accent-dark);
}

.capacity-step-btn:active {
  background: rgba(141, 90, 59, 0.22);
}

.capacity-number-input {
  width: 48px;
  height: 100%;
  padding: 0 2px;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 750;
  color: var(--text);
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.capacity-number-input::-webkit-outer-spin-button,
.capacity-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.capacity-quick-chips {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.capacity-chip {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 130ms ease;
}

.capacity-chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.capacity-chip.is-active,
.capacity-chip.is-featured {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 750;
}

.capacity-chip.is-featured {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}

[data-theme="modern"] .capacity-chip.is-featured {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
}

/* ==========================================================================
   MAP QUICK TOOLBAR (Live Controls above resultStage)
   ========================================================================== */
.map-quick-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 8px 16px;
  margin: 0 auto 12px;
  width: 100%;
  max-width: 1100px;
  min-height: 46px;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-control);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
  z-index: 10;
}

.map-quick-toolbar.is-seat-editing {
  border-color: var(--accent);
  background: rgba(141, 90, 59, 0.04);
}

[data-theme="modern"] .map-quick-toolbar.is-seat-editing {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.05);
}

.map-quick-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-quick-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.map-quick-stepper {
  display: inline-flex;
  align-items: center;
  height: 30px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(76, 49, 31, 0.05);
}

.map-quick-step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.map-quick-step-btn:hover {
  background: rgba(141, 90, 59, 0.14);
  color: var(--accent-dark);
}

[data-theme="modern"] .map-quick-step-btn:hover {
  background: rgba(30, 90, 138, 0.12);
  color: var(--accent);
}

.map-quick-step-btn:active {
  background: rgba(141, 90, 59, 0.22);
}

.map-quick-number-input {
  width: 44px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.map-quick-number-input::-webkit-outer-spin-button,
.map-quick-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.map-quick-val {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
}

.map-quick-obj-buttons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.map-quick-obj-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.04);
  transition: all 130ms ease;
}

.map-quick-obj-btn:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(76, 49, 31, 0.08);
}

.map-quick-editor-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 130ms ease;
}

.map-quick-editor-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(76, 49, 31, 0.14);
}

.map-quick-seat-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.map-quick-toolbar.is-seat-editing .map-quick-seat-actions {
  flex: 1;
  width: 100%;
}

.map-quick-edit-seats-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.05);
  transition: all 130ms ease;
  white-space: nowrap;
}

.map-quick-edit-seats-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.map-quick-edit-seats-btn.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-dark);
  box-shadow: 0 2px 6px rgba(141, 90, 59, 0.28);
}

.map-quick-edit-seats-btn.is-active svg {
  stroke: #ffffff;
}

.map-quick-seat-edit-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 1;
  width: 100%;
}

.map-quick-seat-edit-controls .map-quick-active-badge {
  margin-left: auto;
}

.map-quick-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.04);
  transition: all 120ms ease;
}

.map-quick-btn:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.map-quick-btn.map-quick-done-btn {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent-dark) !important;
  font-weight: 750;
  box-shadow: 0 1px 4px rgba(141, 90, 59, 0.22);
}

.map-quick-btn.map-quick-done-btn:hover {
  background: var(--accent-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(141, 90, 59, 0.32);
}

.map-quick-active-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(141, 90, 59, 0.1);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(141, 90, 59, 0.2);
  white-space: nowrap;
}

[data-theme="modern"] .map-quick-edit-seats-btn.is-active {
  background: #1e5a8a;
  border-color: #123652;
}

[data-theme="modern"] .map-quick-active-badge {
  color: #1e5a8a;
  background: rgba(30, 90, 138, 0.08);
  border-color: rgba(30, 90, 138, 0.2);
}

[data-theme="modern"] .map-quick-btn.map-quick-done-btn {
  background: #1e5a8a !important;
  border-color: #123652 !important;
}

[data-theme="modern"] .map-quick-toolbar {
  background: #ffffff;
  border-color: #c8d8e7;
  box-shadow: 0 2px 10px rgba(18, 50, 77, 0.05);
}

[data-theme="modern"] .map-quick-stepper {
  background: #f0f6fb;
  border-color: #c8d8e7;
  box-shadow: inset 0 1px 2px rgba(18, 50, 77, 0.04);
}

[data-theme="modern"] .map-quick-obj-btn {
  background: #ffffff;
  border-color: #c8d8e7;
  color: #172b3d;
  box-shadow: 0 1px 2px rgba(18, 50, 77, 0.04);
}

[data-theme="modern"] .map-quick-obj-btn:hover {
  background: #f0f6fb;
  border-color: #1e5a8a;
  color: #1e5a8a;
}

[data-theme="modern"] .map-quick-editor-btn {
  background: #e2eef7;
  border-color: #1e5a8a;
  color: #103856;
}

[data-theme="modern"] .map-quick-editor-btn:hover {
  background: #1e5a8a;
  color: #ffffff;
}

/* ==========================================================================
   UNIVERSAL MODERN SCROLLBARS
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 90, 59, 0.35) transparent;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(141, 90, 59, 0.3);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(141, 90, 59, 0.55);
}

[data-theme="modern"] * {
  scrollbar-color: rgba(30, 90, 138, 0.35) transparent;
}

[data-theme="modern"] ::-webkit-scrollbar-thumb {
  background-color: rgba(30, 90, 138, 0.3);
}

[data-theme="modern"] ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(30, 90, 138, 0.55);
}

/* ==========================================================================
   CUSTOM FORM CONTROLS: CHECKBOXES, RADIOS, NUMBER INPUTS
   ========================================================================== */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  margin: 0;
  transition: all 140ms ease;
  box-shadow: inset 0 1px 2px rgba(76, 49, 31, 0.06);
  flex-shrink: 0;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 120ms ease-in-out;
  box-shadow: inset 1em 1em var(--accent);
  transform-origin: center;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--surface-soft);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(141, 90, 59, 0.2);
}

[data-theme="modern"] input[type="checkbox"]:checked::before {
  box-shadow: inset 1em 1em #1e5a8a;
}

[data-theme="modern"] input[type="checkbox"]:checked {
  border-color: #1e5a8a;
  background: #f0f6fb;
}

[data-theme="modern"] input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.25);
}

/* Custom Radio Buttons */
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  margin: 0;
  transition: all 140ms ease;
  flex-shrink: 0;
}

input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 120ms ease-in-out;
  background-color: var(--accent);
}

input[type="radio"]:checked {
  border-color: var(--accent);
}

input[type="radio"]:checked::before {
  transform: scale(1);
}

input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(141, 90, 59, 0.2);
}

[data-theme="modern"] input[type="radio"]::before {
  background-color: #1e5a8a;
}

[data-theme="modern"] input[type="radio"]:checked {
  border-color: #1e5a8a;
}

[data-theme="modern"] input[type="radio"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.25);
}

/* Number inputs: eliminate default browser spin arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ==========================================================================
   CUSTOM SELECT DROPDOWN COMPONENT
   ========================================================================== */
.custom-select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  vertical-align: middle;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  height: auto !important;
  min-height: 0 !important;
}

.custom-select-wrap.select-compact,
.custom-select-wrap.select-tiny {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  height: auto !important;
  min-height: 0 !important;
}

.is-native-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  user-select: none;
  box-shadow: inset 0 1px 2px rgb(92 57 35 / 5%), 0 1px 2px rgb(76 49 31 / 3%);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.custom-select-wrap.class-select .custom-select-trigger {
  font-size: 13.5px;
  font-weight: 750;
  min-height: 36px;
}

.custom-select-wrap.select-compact .custom-select-trigger {
  min-height: 36px;
  font-size: 13px;
  padding: 0 10px;
  border-radius: 9px;
}

.custom-select-wrap.select-tiny .custom-select-trigger {
  min-height: 28px;
  font-size: 11px;
  padding: 0 7px;
}

.custom-select-trigger:hover {
  border-color: var(--accent);
  background: #ffffff;
}

.custom-select-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(141, 90, 59, 0.2);
}

.custom-select-wrap.is-open .custom-select-trigger {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(141, 90, 59, 0.15);
}

.custom-select-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  flex-shrink: 0;
  color: var(--text-soft);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), color 140ms ease;
}

.custom-select-wrap.is-open .custom-select-arrow {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Custom Dropdown Menu Popover */
.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1200;
  max-height: 240px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fffdfa;
  box-shadow: 0 10px 28px -4px rgba(76, 49, 31, 0.2), 0 4px 10px rgba(76, 49, 31, 0.08);
  animation: customSelectMenuFade 120ms ease-out;
}

@keyframes customSelectMenuFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background-color 90ms ease, color 90ms ease;
}

.custom-select-wrap.select-compact .custom-select-option {
  font-size: 12px;
  padding: 5px 8px;
}

.custom-select-wrap.select-tiny .custom-select-option {
  font-size: 11px;
  padding: 4px 6px;
}

.custom-select-option:hover,
.custom-select-option.is-highlighted {
  background: rgba(141, 90, 59, 0.09);
  color: var(--accent-dark);
}

.custom-select-option.is-selected {
  background: rgba(141, 90, 59, 0.14);
  color: var(--accent-dark);
  font-weight: 700;
}

.custom-option-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-option-check {
  display: none;
  color: var(--accent);
  flex-shrink: 0;
}

.custom-select-option.is-selected .custom-option-check {
  display: block;
}

/* Modern Theme Custom Select */
[data-theme="modern"] .custom-select-trigger {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-color: rgba(30, 90, 138, 0.22);
  color: #102a43;
  box-shadow: 0 1px 3px rgba(18, 50, 77, 0.04);
}

[data-theme="modern"] .custom-select-trigger:hover {
  background: #ffffff;
  border-color: #1e5a8a;
  box-shadow: 0 2px 8px rgba(30, 90, 138, 0.12);
}

[data-theme="modern"] .custom-select-trigger:focus-visible,
[data-theme="modern"] .custom-select-wrap.is-open .custom-select-trigger {
  border-color: #1e5a8a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.18);
}

[data-theme="modern"] .custom-select-arrow {
  color: #486581;
}

[data-theme="modern"] .custom-select-wrap.is-open .custom-select-arrow {
  color: #1e5a8a;
}

[data-theme="modern"] .custom-select-menu {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-color: rgba(30, 90, 138, 0.25);
  box-shadow: 0 12px 32px -4px rgba(16, 42, 67, 0.18), 0 4px 12px rgba(16, 42, 67, 0.08);
}

[data-theme="modern"] .custom-select-option:hover,
[data-theme="modern"] .custom-select-option.is-highlighted {
  background: rgba(30, 90, 138, 0.08);
  color: #103856;
}

[data-theme="modern"] .custom-select-option.is-selected {
  background: rgba(30, 90, 138, 0.14);
  color: #0d283f;
}

[data-theme="modern"] .custom-option-check {
  color: #1e5a8a;
}

/* ==========================================================================
   SIDEBAR MINI STEP BADGES & CREATE CTA
   ========================================================================== */
.step-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  margin-right: 4px;
}

.create-class-cta {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 750;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(141, 90, 59, 0.2);
  transition: all 140ms ease;
}

.create-class-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(141, 90, 59, 0.28);
}

/* ==========================================================================
   STEP-BY-STEP NEW CLASS CREATION WIZARD (EMPTY STATE HERO)
   ========================================================================== */
/* ==========================================================================
   LANDING PAGE MODE (Ren, sentrert landingsside når ingen klasser er opprettet)
   ========================================================================== */
.app-shell.is-landing-mode {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  padding: 44px 20px 36px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* Skjul sidepanel og toolbar-innhold i landingsmodus */
.app-shell.is-landing-mode .control-panel {
  display: none !important;
}

.app-shell.is-landing-mode .workspace-toolbar {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: auto !important;
  min-height: auto !important;
  padding: 18px 24px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  justify-content: flex-end !important;
  pointer-events: none !important;
}

.app-shell.is-landing-mode .workspace-toolbar .workspace-heading,
.app-shell.is-landing-mode .workspace-toolbar #resultActions {
  display: none !important;
}

.app-shell.is-landing-mode .workspace-toolbar .workspace-header-actions {
  pointer-events: auto !important;
}

.app-shell.is-landing-mode .workspace {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 680px !important;
  min-height: auto !important;
  background: transparent !important;
  overflow: visible !important;
}

.app-shell.is-landing-mode .workspace-body {
  width: 100% !important;
  max-width: 100% !important;
  min-height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding: 0 !important;
  background: transparent !important;
}

/* Sentrert merkevare-header (Logo og tittel) */
.landing-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
  animation: landingFadeInDown 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-shell:not(.is-landing-mode) .landing-brand {
  display: none !important;
}

.landing-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  margin-bottom: 12px;
  border-radius: 24px;
  background: radial-gradient(circle at 35% 30%, #fff7eb, #ebd2ab 85%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 16px rgb(76 49 31 / 10%), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 180ms ease;
}

[data-theme="modern"] .landing-brand-mark {
  background: radial-gradient(circle at 38% 28%, #e0f2fe, #1e5a8a 85%);
  border-color: #96afc7;
  box-shadow: 0 4px 16px rgb(18 50 77 / 12%), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.landing-brand-mark:hover {
  transform: translateY(-2px) scale(1.03);
}

.landing-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(76, 49, 31, 0.15));
}

.landing-title {
  margin: 0;
  font-family: Fraunces, Aptos, Georgia, serif;
  font-size: clamp(32px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

[data-theme="modern"] .landing-title {
  font-family: Inter, Aptos, ui-sans-serif, sans-serif;
  color: #103856;
}

.landing-tagline {
  margin: 6px 0 0;
  font-size: clamp(14px, 1.5vw, 15.5px);
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

/* Veiviser-kort i landingsmodus */
.app-shell.is-landing-mode .empty-state.guide-stepper-card {
  width: 100% !important;
  max-width: 640px !important;
  margin: 0 auto !important;
  box-shadow: 0 14px 40px rgba(76, 49, 31, 0.11), 0 1px 3px rgba(76, 49, 31, 0.06) !important;
  animation: landingFadeInUp 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="modern"] .app-shell.is-landing-mode .empty-state.guide-stepper-card {
  box-shadow: 0 14px 40px rgba(18, 50, 77, 0.11), 0 1px 3px rgba(18, 50, 77, 0.06) !important;
}

@keyframes landingFadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes landingFadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Preset Infobox */
.wizard-preset-infobox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--muted-strong);
  line-height: 1.45;
  margin-bottom: 14px;
  text-align: left;
}

.wizard-preset-infobox .infobox-icon {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 2px;
}

/* ==========================================================================
   STEP-BASED ONBOARDING GUIDE
   ========================================================================== */
.empty-state.guide-stepper-card[hidden],
.empty-state.class-wizard-card[hidden] {
  display: none !important;
}

.empty-state.guide-stepper-card:not([hidden]),
.empty-state.class-wizard-card:not([hidden]) {
  display: flex !important;
  flex-direction: column !important;
  align-content: stretch !important;
  justify-items: stretch !important;
  width: min(100%, 580px);
  min-height: auto;
  margin: 28px auto 36px;
  padding: 24px 28px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow:
    0 16px 40px -8px rgba(76, 49, 31, 0.12),
    0 4px 12px rgba(76, 49, 31, 0.05),
    inset 0 1px rgba(255, 255, 255, 0.9);
  text-align: left;
  gap: 16px;
  animation: guideCardFadeIn 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes guideCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* STEPPER PROGRESS NAVIGATION */
.guide-stepper-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  transition: all 140ms ease;
  padding: 4px 8px;
  border-radius: 8px;
}

.stepper-step:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.stepper-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  color: var(--text-soft);
  flex-shrink: 0;
  transition: all 140ms ease;
}

.stepper-label {
  letter-spacing: -0.01em;
}

.stepper-step.is-active {
  color: var(--text);
  font-weight: 800;
}

.stepper-step.is-active .stepper-num {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(141, 90, 59, 0.35);
}

.stepper-step.is-completed {
  color: var(--accent-dark);
}

.stepper-step.is-completed .stepper-num {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.stepper-divider {
  flex: 1 1 20px;
  height: 1.5px;
  background: var(--border);
  border-radius: 1px;
}

/* STEP PANELS */
.guide-step-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.guide-step-panel.is-active {
  display: flex !important;
  animation: guidePanelFadeIn 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes guidePanelFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.guide-panel-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.guide-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
  margin-bottom: 2px;
}

.guide-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.guide-panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.guide-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
}

.guide-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.45;
}

.guide-panel-actions {
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}

.guide-panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-input-wrap {
  width: 100%;
}

.guide-text-input {
  font-size: 15px;
  font-weight: 600;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 9px;
  width: 100%;
  box-sizing: border-box;
}

.guide-nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.guide-nav-single {
  justify-content: flex-end !important;
}

.guide-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  width: fit-content;
}

.guide-summary-icon {
  display: flex;
  align-items: center;
  color: var(--accent);
}

/* WIZARD QUICK SUGGESTIONS */
.wizard-quick-suggestions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.quick-suggest-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  margin-right: 2px;
}

.wizard-pill-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(76, 49, 31, 0.04);
  transition: all 120ms ease;
}

.wizard-pill-btn:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.wizard-tags-box {
  min-height: 52px;
  max-height: 120px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffaf0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 5px;
  cursor: text;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.wizard-tags-box:hover {
  border-color: #ba976c;
}

.wizard-tags-box:focus-within {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: inset 0 1px 3px rgba(76, 49, 31, 0.04), 0 0 0 3px rgb(148 97 63 / 16%);
  outline: none;
}

.wizard-tag-input,
.wizard-tag-input:focus,
.wizard-tag-input:focus-visible {
  flex: 1 1 140px;
  min-width: 140px;
  border: none !important;
  background: transparent !important;
  font-size: 12.5px;
  color: var(--text);
  padding: 3px;
  outline: none !important;
  box-shadow: none !important;
}

.wizard-student-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.wizard-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 6px;
}

/* WIZARD LAYOUT CARDS WITH BESPOKE SVGs */
.wizard-layout-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.wizard-layout-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 6px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  gap: 4px;
  transition: all 140ms ease;
}

.wizard-layout-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(76, 49, 31, 0.08);
}

.wizard-layout-card.is-selected {
  border-color: var(--accent);
  background: var(--surface-soft);
  box-shadow: 0 0 0 2px rgba(141, 90, 59, 0.2);
}

.layout-card-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  color: var(--text-soft);
  transition: color 140ms ease;
}

.wizard-layout-card.is-selected .layout-card-icon-wrap {
  color: var(--accent);
}

.layout-card-svg {
  display: block;
}

.layout-card-title {
  font-size: 12px;
  font-weight: 750;
  color: var(--text);
}

.layout-card-desc {
  font-size: 10.5px;
  color: var(--text-soft);
  line-height: 1.25;
}

.wizard-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 22px;
  font-size: 13.5px;
  font-weight: 800;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(141, 90, 59, 0.25);
  transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.wizard-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(141, 90, 59, 0.32);
}

.wizard-submit-btn:active {
  transform: translateY(0);
}

/* Modern Theme Guide Overrides */
[data-theme="modern"] .guide-stepper-card,
[data-theme="modern"] .class-wizard-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px);
  border-color: rgba(30, 90, 138, 0.2);
  box-shadow:
    0 20px 48px -12px rgba(16, 42, 67, 0.16),
    0 4px 16px rgba(16, 42, 67, 0.06);
}

[data-theme="modern"] .stepper-step.is-active .stepper-num {
  background: #1e5a8a;
  border-color: #1e5a8a;
  box-shadow: 0 2px 6px rgba(30, 90, 138, 0.3);
}

[data-theme="modern"] .stepper-step.is-completed {
  color: #1e5a8a;
}

[data-theme="modern"] .stepper-step.is-completed .stepper-num {
  color: #1e5a8a;
  border-color: #1e5a8a;
}

[data-theme="modern"] .guide-start-btn,
[data-theme="modern"] .sidebar-create-map-btn {
  background: linear-gradient(135deg, #1e5a8a, #0e3c63);
  box-shadow: 0 4px 14px rgba(30, 90, 138, 0.3);
}

[data-theme="modern"] .guide-start-btn:hover,
[data-theme="modern"] .sidebar-create-map-btn:hover {
  box-shadow: 0 6px 20px rgba(30, 90, 138, 0.4);
}

[data-theme="modern"] .wizard-tags-box {
  background: #f0f6fb;
  border-color: #c8d8e7;
}

[data-theme="modern"] .wizard-tags-box:focus-within {
  border-color: #1e5a8a;
  background: #ffffff;
  box-shadow: inset 0 1px 3px rgba(18, 50, 77, 0.04), 0 0 0 3px rgba(30, 90, 138, 0.18);
  outline: none;
}

[data-theme="modern"] .guide-text-input:focus,
[data-theme="modern"] .guide-text-input:focus-visible {
  border-color: #1e5a8a !important;
  box-shadow: 0 0 0 3px rgba(30, 90, 138, 0.18) !important;
  outline: none !important;
}

[data-theme="modern"] .wizard-layout-card.is-selected {
  border-color: #1e5a8a;
  background: #f0f6fb;
  box-shadow: 0 0 0 2px rgba(30, 90, 138, 0.25);
}

[data-theme="modern"] .wizard-layout-card.is-selected .layout-card-icon-wrap {
  color: #1e5a8a;
}

[data-theme="modern"] .wizard-submit-btn {
  background: linear-gradient(135deg, #1e5a8a, #0e3c63);
  box-shadow: 0 4px 14px rgba(30, 90, 138, 0.3);
}

[data-theme="modern"] .wizard-submit-btn:hover {
  box-shadow: 0 6px 20px rgba(30, 90, 138, 0.4);
}

@media (max-width: 768px) {
  .empty-state.guide-stepper-card,
  .empty-state.class-wizard-card {
    padding: 18px 14px;
    margin: 8px auto;
  }
  .guide-title {
    font-size: 17px;
  }
  .stepper-label {
    display: none;
  }
  .wizard-layout-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Compound Classroom Maps (Sammensatt klassekart)
   ========================================================================== */

.wizard-compound-toggle-card {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(245, 237, 227, 0.6);
  border: 1.5px dashed #cfb9a3;
  transition: all 0.2s ease;
}

.wizard-compound-toggle-card:hover {
  background: rgba(245, 237, 227, 0.95);
  border-color: #a88463;
}

[data-theme="modern"] .wizard-compound-toggle-card {
  background: rgba(234, 241, 248, 0.6);
  border-color: #b0c9df;
}

[data-theme="modern"] .wizard-compound-toggle-card:hover {
  background: rgba(234, 241, 248, 0.95);
  border-color: #1e5a8a;
}

.wizard-compound-toggle-card.is-active {
  background: #fbf7f0;
  border-style: solid;
  border-color: #8c6239;
  box-shadow: 0 2px 10px rgba(140, 98, 57, 0.08);
}

[data-theme="modern"] .wizard-compound-toggle-card.is-active {
  background: #f0f6fb;
  border-color: #1e5a8a;
  box-shadow: 0 2px 10px rgba(30, 90, 138, 0.08);
}

.wizard-compound-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.wizard-toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 44px;
  height: 24px;
  cursor: pointer;
  z-index: 2;
}

.wizard-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  background: #d1c4b7;
  border-radius: 999px;
  transition: background-color 0.25s ease;
  pointer-events: none;
}

[data-theme="modern"] .wizard-toggle-track {
  background: #c3d4e4;
}

.wizard-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.wizard-toggle-checkbox:checked + .wizard-toggle-track {
  background: #8c6239;
}

[data-theme="modern"] .wizard-toggle-checkbox:checked + .wizard-toggle-track {
  background: #1e5a8a;
}

.wizard-toggle-checkbox:checked + .wizard-toggle-track .wizard-toggle-thumb {
  transform: translateX(20px);
}

.wizard-toggle-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wizard-toggle-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #2c221a;
}

[data-theme="modern"] .wizard-toggle-headline {
  color: #172b3d;
}

.wizard-toggle-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edd8c4;
  color: #704724;
}

[data-theme="modern"] .wizard-toggle-pill {
  background: #d4e5f4;
  color: #1a4f78;
}

.wizard-toggle-sub {
  font-size: 12px;
  line-height: 1.4;
  color: #7a6756;
}

[data-theme="modern"] .wizard-toggle-sub {
  color: #55728c;
}

/* Compound Class Manager in Wizard Step 2 */
.wizard-compound-classes-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-compound-classes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wizard-compound-class-card {
  background: #ffffff;
  border: 1px solid #e2d5c5;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(44, 34, 26, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

[data-theme="modern"] .wizard-compound-class-card {
  background: #ffffff;
  border-color: #d1dfed;
  box-shadow: 0 2px 6px rgba(18, 50, 77, 0.04);
}

.wizard-compound-class-card:focus-within {
  border-color: #8c6239;
  box-shadow: 0 0 0 2px rgba(140, 98, 57, 0.15);
}

[data-theme="modern"] .wizard-compound-class-card:focus-within {
  border-color: #1e5a8a;
  box-shadow: 0 0 0 2px rgba(30, 90, 138, 0.15);
}

.wizard-compound-class-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.wizard-class-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.wizard-class-color-badge {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.wizard-class-name-input {
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  color: #2c221a;
  width: 150px;
  transition: all 0.15s ease;
}

[data-theme="modern"] .wizard-class-name-input {
  color: #172b3d;
}

.wizard-class-name-input:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: #d1c4b7;
}

.wizard-class-name-input:focus {
  background: #ffffff;
  border-color: #8c6239;
  outline: none;
}

.wizard-class-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-class-count {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1e9de;
  color: #634b35;
}

[data-theme="modern"] .wizard-class-count {
  background: #e2edf7;
  color: #2b5577;
}

.wizard-class-remove-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #a49180;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.wizard-class-remove-btn:hover {
  color: #c92a2a;
  background: #fdf2f2;
}

.wizard-compound-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* Quick import chips */
.wizard-compound-import-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(245, 237, 227, 0.5);
  border: 1px solid #dfcfbe;
}

[data-theme="modern"] .wizard-compound-import-box {
  background: rgba(234, 241, 248, 0.5);
  border-color: #c5d8ea;
}

.wizard-import-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.wizard-import-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #cfc2b3;
  color: #433324;
  cursor: pointer;
  transition: all 0.18s ease;
}

.wizard-import-chip:hover {
  background: #fcf6ee;
  border-color: #8c6239;
  color: #8c6239;
  transform: translateY(-1px);
}

[data-theme="modern"] .wizard-import-chip {
  border-color: #b7cde1;
  color: #1e5a8a;
}

[data-theme="modern"] .wizard-import-chip:hover {
  background: #edf5fc;
  border-color: #1e5a8a;
}

/* Step 3 Compound Rule Box */
.wizard-compound-rule-box {
  background: #fbf7f0;
  border: 1px solid #dcc9b4;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

[data-theme="modern"] .wizard-compound-rule-box {
  background: #f0f6fb;
  border-color: #bcd4ea;
}

.compound-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* Student Class Badge on Desk Cards & Groups */
.student-class-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 750;
  line-height: 1;
  padding: 1.5px 4.5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  border: 1px solid transparent;
  pointer-events: none;
  z-index: 2;
}

/* Desk cards on map: Badge sits neatly in top-right corner without squishing the student name */
.student-card {
  position: relative;
}

.student-card .student-class-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  max-width: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* When a card has a badge, ensure the name has full horizontal space */
.student-card.has-class-badge .student-name-wrap {
  width: 100%;
  padding-left: 4px;
  padding-right: 4px;
  box-sizing: border-box;
}

.classroom .student-card.has-class-badge .student-name {
  font-size: 11px;
}

.classroom .student-card.has-class-badge.has-long-name .student-name {
  font-size: 9.5px !important;
}

.classroom .student-card.has-class-badge.has-very-long-name .student-name {
  font-size: 8.5px !important;
}

/* Color palettes for source classes */
.student-class-badge.color-0 {
  background: #dbeafe !important;
  color: #1e40af !important;
  border: 1px solid #93c5fd !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.student-class-badge.color-1 {
  background: #d1fae5 !important;
  color: #065f46 !important;
  border: 1px solid #6ee7b7 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.student-class-badge.color-2 {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #fcd34d !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.student-class-badge.color-3 {
  background: #ede9fe !important;
  color: #5b21b6 !important;
  border: 1px solid #c4b5fd !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.student-class-badge.color-4 {
  background: #ffe4e6 !important;
  color: #9f1239 !important;
  border: 1px solid #fda4af !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.student-class-badge.color-5 {
  background: #cffafe !important;
  color: #155e75 !important;
  border: 1px solid #67e8f9 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* Print and Print Preview: Classroom map desk corner tags */
.print-preview-page .classroom .student-class-badge,
.print-result .classroom .student-class-badge,
.print-sheet .classroom .student-class-badge,
.print-preview-page .spatial-desk .student-class-badge,
.print-result .spatial-desk .student-class-badge,
.print-sheet .spatial-desk .student-class-badge {
  display: inline-flex !important;
  position: absolute !important;
  top: 1.5px !important;
  right: 2px !important;
  font-size: 7.5px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  padding: 1px 3px !important;
  border-radius: 2px !important;
  border-width: 1px !important;
  border-style: solid !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  z-index: 5 !important;
}

/* Default fallback for badges without color-* */
.print-preview-page .student-class-badge:not([class*="color-"]),
.print-result .student-class-badge:not([class*="color-"]),
.print-sheet .student-class-badge:not([class*="color-"]) {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

@media print {
  .student-class-badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    z-index: 5 !important;
  }
  .classroom .student-class-badge,
  .spatial-desk .student-class-badge {
    display: inline-flex !important;
    position: absolute !important;
    top: 1.5px !important;
    right: 2px !important;
    font-size: 7.5px !important;
    font-weight: 750 !important;
    line-height: 1 !important;
    padding: 1px 3px !important;
    border-radius: 2px !important;
    border-width: 1px !important;
    border-style: solid !important;
  }
  .group-members .student-class-badge {
    position: static !important;
    margin-left: auto !important;
    font-size: 10px !important;
    font-weight: 750 !important;
    padding: 2.5px 7px !important;
    border-radius: 4px !important;
    border-width: 1px !important;
    border-style: solid !important;
  }
  .student-class-badge:not([class*="color-"]) {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
  }
}
