:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --fg: #1a1d26;
  --muted: #5c6578;
  --card: #ffffff;
  --border: #e1e4ea;
  --accent: #2f6fed;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

.shell {
  max-width: min(120rem, calc(100vw - 2.5rem));
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* —— Thin kiosk top bar —— */
.kiosk-topbar {
  margin: -0.5rem -1.25rem 0.85rem;
  padding: 0.28rem 0.65rem;
  min-height: 2.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgb(24 32 50 / 0.03);
}

@media (min-width: 480px) {
  .kiosk-topbar {
    margin: -0.5rem -1.25rem 1rem;
    padding: 0.3rem 0.85rem;
  }
}

.kiosk-topbar-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  max-width: min(120rem, calc(100vw - 2.5rem));
  width: 100%;
  margin: 0 auto;
}

.kiosk-topbar-title {
  flex: 0 1 auto;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42%;
}

.kiosk-topbar-links {
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  min-width: 0;
}

.kiosk-topbar-link {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.kiosk-topbar-link:hover {
  text-decoration: underline;
}

.kiosk-topbar-spacer {
  flex: 1 1 auto;
  min-width: 0.25rem;
}

.kiosk-topbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.kiosk-topbar-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  text-decoration: none;
  color: var(--fg);
}

.kiosk-topbar-avatar:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.kiosk-topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kiosk-topbar-initials {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.kiosk-topbar-gear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.kiosk-topbar-gear:hover {
  color: var(--accent);
  border-color: var(--border);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.kiosk-topbar-gear-icon {
  font-size: 1rem;
  line-height: 1;
}

.h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.settings-list {
  margin: 0;
  padding-left: 1.15rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.lead {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}

.card--spaced {
  margin-bottom: 1rem;
}

.form-inline {
  display: inline;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
  margin-bottom: 1rem;
  background: #fff;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
  margin-bottom: 1rem;
  background: #fff;
}

textarea {
  width: 100%;
  min-height: 5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
  margin-bottom: 1rem;
  background: #fff;
  resize: vertical;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 0.35rem;
  vertical-align: middle;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}

button,
.btn {
  display: inline-block;
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  text-align: center;
}

button.secondary,
.btn.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

button.danger,
.btn.danger {
  background: #b42318;
  color: #fff;
  border: 1px solid #8a1b12;
}

button.danger.secondary,
.btn.danger.secondary {
  background: transparent;
  color: #b42318;
  border-color: #e8a29e;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 8px;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
}

.btn-icon:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
}

.table-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.table-shell__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--border) 35%, var(--card));
}

.table-shell__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data-table thead th {
  background: color-mix(in srgb, var(--border) 50%, var(--card));
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

table.data-table tbody tr[data-row] {
  cursor: pointer;
}

table.data-table tbody tr[data-row]:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

table.data-table th,
table.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

dialog.table-modal {
  max-width: min(32rem, calc(100vw - 2rem));
  width: 100%;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.18);
  overflow: visible;
}

dialog.table-modal::backdrop {
  background: rgb(15 18 28 / 0.45);
}

.table-modal__inner {
  padding: 1.25rem 1.35rem 1.5rem;
  overflow: visible;
}

.table-modal__title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.table-modal__hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.table-modal__hint--tight-top {
  margin-top: 0.5rem;
}

.table-modal__rule {
  margin: 1.25rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

.table-scroll__empty {
  padding: 1rem;
}

.table-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  align-items: center;
}

.table-modal__actions--compact {
  margin-top: 0;
  padding-top: 0;
}

.table-modal__actions .grow {
  flex: 1 1 auto;
}

.lookup-shell {
  position: relative;
}

.lookup-results {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0.2rem 0 0;
  padding: 0.2rem 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.12);
}

.lookup-results li {
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.lookup-results li:hover,
.lookup-results li:focus {
  background: rgb(15 18 28 / 0.06);
}

.lookup-results li.lookup-results__empty {
  cursor: default;
  color: var(--muted);
  font-size: 0.88rem;
}

.lookup-results li.lookup-results__empty:hover,
.lookup-results li.lookup-results__empty:focus {
  background: transparent;
}

.lookup-results li.lookup-results__on-roster {
  cursor: default;
  color: var(--muted);
  font-size: 0.88rem;
}

.lookup-results li.lookup-results__on-roster:hover,
.lookup-results li.lookup-results__on-roster:focus {
  background: transparent;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.error {
  background: #fff4f4;
  border: 1px solid #f0c4c4;
  color: #7a2222;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.notice.success {
  background: #eef9f0;
  border: 1px solid #b8dcc2;
  color: #1e4d2a;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.roster {
  display: grid;
  gap: 0.65rem;
}

.roster a {
  display: block;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.roster a:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

table:not(.data-table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table:not(.data-table) th,
table:not(.data-table) td {
  text-align: left;
  padding: 0.5rem 0.35rem;
  border-bottom: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.module-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.module-list li {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.module-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.module-list__actions {
  margin-top: 0.5rem;
}

.spelling-module__prompt {
  font-size: 1.2rem;
  line-height: 1.45;
  margin: 0 0 0.75rem;
  word-break: break-word;
}

.spelling-module__prompt strong {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

.spelling-module__sentence {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.spelling-module__form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.spelling-module__form input {
  width: 100%;
  max-width: 24rem;
  font-size: 1.1rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.spelling-module__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.spelling-module__feedback {
  min-height: 1.5rem;
  font-weight: 600;
  margin: 0.75rem 0 0;
}
