:root {
  color-scheme: light;
  --paper: #f8f3e8;
  --paper-deep: #f1e6d0;
  --surface: #fffdf8;
  --surface-muted: #f9f3e7;
  --ink: #3b3023;
  --muted: #746b5e;
  --gold: #c99735;
  --gold-soft: #e9cf96;
  --brown: #755322;
  --brown-deep: #4d3519;
  --line: rgba(117, 83, 34, 0.14);
  --line-strong: rgba(117, 83, 34, 0.22);
  --success: #287451;
  --success-bg: #e7f3eb;
  --warning: #8a5a13;
  --warning-bg: #f9edd2;
  --danger: #a5473e;
  --danger-bg: #f8e7e3;
  --sidebar-width: 256px;
  --shadow-sm: 0 10px 28px rgba(90, 62, 26, 0.07);
  --shadow-lg: 0 28px 80px rgba(62, 43, 20, 0.16);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 3%, rgba(201, 151, 53, 0.12), transparent 26rem),
    var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

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

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(201, 151, 53, 0.34);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--brown);
  font-weight: 700;
}

p,
h1,
h2,
h3,
dl,
dd {
  margin: 0;
}

.is-hidden {
  display: none !important;
}

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

.noscript {
  padding: 16px;
  background: var(--danger-bg);
  color: var(--danger);
  text-align: center;
}

.boot-screen {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.boot-screen img {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  animation: breathe 1.4s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { opacity: 0.58; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Login */

.login-view {
  display: grid;
  width: min(1180px, calc(100% - 48px));
  min-height: 720px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

body:has(.login-view:not(.is-hidden)) {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 0;
}

.login-brand {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 54px;
  background:
    linear-gradient(150deg, rgba(72, 49, 22, 0.9), rgba(117, 83, 34, 0.78)),
    var(--brown);
  color: #fffaf0;
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 244, 220, 0.18);
  border-radius: 50%;
}

.login-brand::before {
  top: -150px;
  right: -130px;
  width: 420px;
  height: 420px;
}

.login-brand::after {
  top: -90px;
  right: -70px;
  width: 300px;
  height: 300px;
}

.brand-art {
  position: absolute;
  top: 45px;
  left: 50px;
  width: 232px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  box-shadow: 0 26px 54px rgba(36, 23, 10, 0.24);
}

.brand-art img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.login-eyebrow,
.panel-kicker,
.card-kicker,
.topbar-kicker {
  color: var(--gold);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login-brand .login-eyebrow {
  color: #f1d58f;
}

.login-brand h1 {
  margin-top: 14px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(38px, 4vw, 58px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.18;
}

.login-brand > p:not(.login-eyebrow) {
  max-width: 470px;
  margin-top: 22px;
  color: rgba(255, 250, 240, 0.78);
  font-size: 16px;
  line-height: 1.8;
}

.login-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-proof span {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 250, 240, 0.88);
  font-size: 12px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 64px;
  background:
    linear-gradient(135deg, rgba(201, 151, 53, 0.055), transparent 42%),
    var(--surface);
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 38px;
}

.mobile-brand img {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.mobile-brand div,
.sidebar-brand div {
  display: flex;
  flex-direction: column;
}

.mobile-brand strong,
.sidebar-brand strong {
  color: var(--brown-deep);
  font-size: 18px;
  letter-spacing: 0.08em;
}

.mobile-brand span,
.sidebar-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.login-panel h2 {
  margin-top: 10px;
  font-size: 34px;
  letter-spacing: -0.03em;
}

.panel-intro {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.setup-card {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  padding: 15px;
  border: 1px solid rgba(138, 90, 19, 0.18);
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--warning);
}

.setup-icon {
  display: flex;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.setup-card strong {
  display: block;
  font-size: 14px;
}

.setup-card p {
  margin: 4px 0 7px;
  font-size: 12px;
  line-height: 1.55;
}

.setup-card a {
  color: inherit;
  font-size: 12px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 19px;
  margin-top: 32px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.field > span,
.field-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea,
.search-field input,
.compact-select select,
.ticket-input-row input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.6;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus,
.compact-select select:focus,
.ticket-input-row input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 151, 53, 0.1);
  outline: 0;
}

.field input::placeholder,
.field textarea::placeholder,
.search-field input::placeholder,
.ticket-input-row input::placeholder {
  color: #aaa096;
}

.field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 62px;
}

.text-button {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--brown);
  font-size: 12px;
  font-weight: 750;
  transform: translateY(-50%);
}

.primary-button,
.secondary-button,
.ghost-button,
.gold-button,
.icon-button,
.link-button {
  border: 0;
  font-weight: 750;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary-button,
.secondary-button,
.gold-button,
.ghost-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13px;
}

.primary-button {
  background: var(--brown);
  color: #fff;
  box-shadow: 0 8px 20px rgba(117, 83, 34, 0.16);
}

.primary-button:hover:not(:disabled) {
  background: var(--brown-deep);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--brown);
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(117, 83, 34, 0.38);
  background: var(--surface-muted);
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.gold-button {
  background: var(--gold);
  color: #2f2110;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled),
.gold-button:active:not(:disabled) {
  transform: translateY(1px);
}

.login-button {
  width: 100%;
  min-height: 50px;
  justify-content: space-between;
  padding-inline: 18px;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid rgba(165, 71, 62, 0.15);
  border-radius: 9px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.security-note {
  display: flex;
  gap: 9px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.security-note > span {
  color: var(--gold);
  font-size: 9px;
  transform: translateY(3px);
}

/* Application shell */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(18px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 27px 24px 24px;
}

.sidebar-brand img {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(117, 83, 34, 0.13);
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
}

.analytics-filter {
  align-items: flex-end;
}

.analytics-filter .field {
  min-width: 145px;
  margin: 0;
}

.analytics-filter .field span {
  font-size: 11px;
}

.analytics-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.insight-list {
  display: grid;
  gap: 10px;
}

.insight-item {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 11px;
  background: var(--surface-muted);
}

.insight-item.success { border-left-color: var(--success); }
.insight-item.danger { border-left-color: var(--danger); }
.insight-item.warning { border-left-color: var(--warning); }

.insight-item strong {
  color: var(--brown-deep);
  font-size: 12px;
}

.insight-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.resource-warning {
  margin: 16px 0 4px;
  border: 1px solid rgba(170, 104, 30, 0.18);
  border-radius: 10px;
  background: rgba(255, 247, 226, 0.8);
}

.resource-toggle {
  align-self: end;
  min-height: 48px;
}

.insight-layout textarea[readonly] {
  min-height: 390px;
  background: #fbfaf7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
}

.dialog-subform {
  padding: 0 28px 28px;
  border-top: 1px solid var(--line);
}

.dialog-subform .card-heading {
  padding-top: 22px;
}

.followup-list {
  max-height: 260px;
  margin-top: 18px;
  overflow-y: auto;
}

#student-dialog {
  max-width: 880px;
}

#student-detail-meta {
  margin-bottom: 18px;
}

@media (max-width: 1100px) {
  .analytics-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-filter {
    width: 100%;
    flex-wrap: wrap;
  }
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 8px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 680;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--brown);
}

.nav-item.is-active {
  background: var(--paper-deep);
  color: var(--brown-deep);
  font-weight: 800;
}

.nav-icon {
  display: flex;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--brown);
  font-size: 12px;
  font-weight: 850;
}

.nav-item.is-active .nav-icon {
  border-color: var(--brown);
  background: var(--brown);
  color: #fff;
}

.qr-management-block {
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
  scroll-margin-top: 96px;
}

.sidebar-foot {
  margin: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.environment-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(40, 116, 81, 0.11);
}

.sidebar-foot small {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(22px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(248, 243, 232, 0.9);
  backdrop-filter: blur(18px);
}

.topbar-left,
.account-area,
.section-toolbar,
.toolbar-actions,
.selection-bar,
.card-heading,
.dialog-heading,
.dialog-actions,
.form-footer,
.result-heading {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 14px;
}

.topbar h1 {
  margin-top: 4px;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.account-area {
  gap: 13px;
}

.account-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brown);
  font-size: 20px;
}

.menu-button {
  display: none;
}

.system-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 24px clamp(22px, 3vw, 44px) 0;
  padding: 16px 18px;
  border: 1px solid rgba(138, 90, 19, 0.17);
  border-radius: 12px;
  background: var(--warning-bg);
  color: var(--warning);
}

.system-banner strong {
  font-size: 13px;
}

.system-banner p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.system-banner .secondary-button {
  flex: 0 0 auto;
  border-color: rgba(138, 90, 19, 0.2);
  background: rgba(255, 253, 248, 0.72);
  color: inherit;
}

.page-container {
  padding: 30px clamp(22px, 3vw, 44px) 56px;
}

.page-panel {
  max-width: 1420px;
  margin: 0 auto;
}

.welcome-card {
  position: relative;
  display: flex;
  min-height: 205px;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  padding: 34px 40px;
  border-radius: 20px;
  background:
    linear-gradient(105deg, rgba(63, 43, 20, 0.98), rgba(117, 83, 34, 0.9)),
    var(--brown);
  color: #fffaf0;
  box-shadow: 0 22px 52px rgba(82, 55, 23, 0.16);
}

.welcome-card::before {
  position: absolute;
  top: -125px;
  right: 8%;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  content: "";
}

.welcome-card h2 {
  max-width: 680px;
  margin-top: 10px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(25px, 3vw, 40px);
  letter-spacing: 0.03em;
}

.welcome-card > div > p:last-child {
  max-width: 650px;
  margin-top: 13px;
  color: rgba(255, 250, 240, 0.72);
  font-size: 13px;
  line-height: 1.7;
}

.welcome-mark {
  position: relative;
  width: 122px;
  height: 122px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 32px;
  box-shadow: 0 20px 44px rgba(28, 19, 9, 0.24);
}

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

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

.metric-card,
.content-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  display: flex;
  min-height: 142px;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
  border-radius: 15px;
}

.metric-card > span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  margin-top: 10px;
  color: var(--brown-deep);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.metric-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.content-card {
  padding: 24px;
  border-radius: 15px;
}

.card-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.card-heading h3,
.qr-card h3,
.guidance-card h3,
.ticket-result h3 {
  margin-top: 5px;
  font-size: 18px;
}

.link-button {
  flex: 0 0 auto;
  padding: 6px;
  background: transparent;
  color: var(--brown);
  font-size: 12px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-item {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(117, 83, 34, 0.09);
  border-radius: 10px;
  background: var(--surface-muted);
}

.stack-date {
  display: flex;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--paper-deep);
  color: var(--brown);
}

.stack-date strong {
  font-size: 15px;
}

.stack-date span {
  font-size: 8px;
}

.stack-copy {
  min-width: 0;
}

.stack-copy strong,
.stack-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-copy strong {
  font-size: 13px;
}

.stack-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.empty-state {
  padding: 38px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.empty-state p {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.6;
}

.section-toolbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.toolbar-actions {
  gap: 9px;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.filter-row {
  display: flex;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  flex: 1;
}

.search-field input,
.compact-select select {
  min-height: 40px;
  background: var(--surface);
  font-size: 12px;
}

.compact-select {
  width: 150px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid rgba(117, 83, 34, 0.09);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(241, 230, 208, 0.24);
}

td {
  min-width: 100px;
  color: var(--ink);
}

.align-right {
  text-align: right;
}

.cell-title {
  display: block;
  max-width: 290px;
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-subtitle {
  display: block;
  max-width: 300px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--brown);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.success {
  background: var(--success-bg);
  color: var(--success);
}

.status-pill.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.table-action {
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--brown);
  font-size: 11px;
  font-weight: 750;
}

.table-action:hover {
  text-decoration: underline;
}

.compact-button {
  min-height: 40px;
  padding: 8px 15px;
}

.selection-bar {
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.inline-field {
  min-width: min(400px, 100%);
  flex: 1;
}

.inline-field select {
  min-height: 40px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.mini-metrics > div {
  padding: 14px;
  border: 1px solid rgba(117, 83, 34, 0.09);
  border-radius: 10px;
  background: var(--surface-muted);
}

.mini-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.mini-metrics strong {
  display: block;
  margin-top: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px;
}

.inline-alert {
  margin-bottom: 15px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 11px;
}

.tab-strip {
  display: flex;
  gap: 22px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.data-tab {
  position: relative;
  padding: 10px 2px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.data-tab.is-active {
  color: var(--brown-deep);
}

.data-tab.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--gold);
  content: "";
}

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

.qr-card {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  padding: 20px;
  border: 1px solid rgba(117, 83, 34, 0.1);
  border-radius: 14px;
  background: var(--surface-muted);
}

.qr-preview {
  display: grid;
  width: 176px;
  height: 176px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.qr-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.qr-card p:not(.card-kicker) {
  min-height: 48px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

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

.form-card {
  max-width: 920px;
}

.form-grid {
  display: grid;
  gap: 15px;
}

.form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-columns {
  grid-template-columns: 1.5fr 1fr 1fr;
}

.form-card > .field,
.form-card > .form-grid {
  margin-bottom: 17px;
}

.form-footer {
  justify-content: space-between;
  gap: 16px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.form-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.guidance-card {
  align-self: start;
  background: var(--paper-deep);
}

.guidance-card ol {
  display: flex;
  margin: 22px 0 0;
  padding: 0;
  counter-reset: guide;
  flex-direction: column;
  gap: 18px;
  list-style: none;
}

.guidance-card li {
  position: relative;
  padding-left: 35px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  counter-increment: guide;
}

.guidance-card li::before {
  position: absolute;
  top: -2px;
  left: 0;
  display: flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--surface);
  color: var(--brown);
  content: counter(guide, decimal-leading-zero);
  font-size: 9px;
  font-weight: 850;
}

.checkin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 18px;
}

.checkin-console {
  min-height: 450px;
  padding: clamp(28px, 4.5vw, 60px);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 10%, rgba(201, 151, 53, 0.23), transparent 18rem),
    var(--brown-deep);
  color: #fffaf0;
  box-shadow: 0 22px 52px rgba(82, 55, 23, 0.2);
}

.card-kicker.light {
  color: #e5c377;
}

.checkin-console h2 {
  max-width: 560px;
  margin-top: 14px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.2;
}

.checkin-console > p:not(.card-kicker) {
  max-width: 580px;
  margin-top: 16px;
  color: rgba(255, 250, 240, 0.68);
  font-size: 13px;
  line-height: 1.75;
}

.ticket-input-row {
  display: flex;
  gap: 9px;
  margin-top: 44px;
}

.ticket-input-row input {
  min-width: 0;
  flex: 1;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ticket-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.43);
}

.checkin-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 28px;
  color: rgba(255, 250, 240, 0.56);
  font-size: 10px;
}

.camera-entry {
  margin-top: 18px;
}

.camera-scan-button {
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.09);
  color: #fffaf0;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.camera-scan-button:hover {
  border-color: rgba(229, 195, 119, 0.48);
  background: rgba(255, 255, 255, 0.13);
}

.camera-button-icon {
  display: flex;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--gold);
  color: var(--brown-deep);
  font-size: 17px;
}

.camera-scan-button strong,
.camera-scan-button small {
  display: block;
}

.camera-scan-button strong {
  font-size: 12px;
}

.camera-scan-button small {
  margin-top: 3px;
  color: rgba(255, 250, 240, 0.58);
  font-size: 9px;
  font-weight: 500;
}

.camera-support-message {
  max-width: 540px;
  margin-top: 8px;
  color: rgba(255, 250, 240, 0.52);
  font-size: 9px;
  line-height: 1.5;
}

.ticket-result {
  min-height: 450px;
}

.ticket-result > .empty-state {
  display: flex;
  min-height: 400px;
  flex-direction: column;
  justify-content: center;
}

.result-heading {
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-list {
  display: flex;
  flex-direction: column;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(117, 83, 34, 0.09);
}

.detail-list dt {
  color: var(--muted);
  font-size: 11px;
}

.detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.result-message {
  margin: 16px 0;
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.full-button {
  width: 100%;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.toggle-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--brown);
}

/* Dialogs */

.modal-dialog {
  width: min(820px, calc(100% - 30px));
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.modal-dialog::backdrop {
  background: rgba(51, 38, 24, 0.48);
  backdrop-filter: blur(5px);
}

.camera-dialog {
  width: min(520px, calc(100% - 26px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  background: var(--brown-deep);
  color: #fffaf0;
  box-shadow: var(--shadow-lg);
}

.camera-dialog::backdrop {
  background: rgba(30, 21, 12, 0.78);
  backdrop-filter: blur(7px);
}

.camera-dialog-shell {
  padding: 22px;
}

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

.camera-dialog-heading h2 {
  margin-top: 5px;
  font-size: 21px;
}

.camera-close-button {
  display: flex;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
}

.camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #181109;
}

.camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(62%, 250px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.camera-guide span {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: #f1ca73;
  border-style: solid;
}

.camera-guide span:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 8px 0 0; }
.camera-guide span:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.camera-guide span:nth-child(3) { right: 0; bottom: 0; border-width: 0 3px 3px 0; border-radius: 0 0 8px; }
.camera-guide span:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }

.camera-waiting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 17, 9, 0.88);
  color: rgba(255, 250, 240, 0.72);
  font-size: 12px;
  text-align: center;
}

.camera-status {
  margin-top: 14px;
  color: #f1d38d;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.camera-privacy {
  margin: 5px 0 15px;
  color: rgba(255, 250, 240, 0.5);
  font-size: 9px;
  line-height: 1.6;
}

.camera-dialog .secondary-button {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fffaf0;
}

.modal-dialog form {
  padding: 26px;
}

.small-dialog {
  width: min(540px, calc(100% - 30px));
}

.dialog-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2 {
  margin-top: 6px;
  font-size: 22px;
}

.modal-dialog form > .field,
.modal-dialog form > .form-grid,
.modal-dialog form > .toggle-field {
  margin-bottom: 17px;
}

.ticket-editor {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.ticket-editor > div:first-child {
  margin-bottom: 13px;
}

.ticket-editor p:not(.field-title) {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.ticket-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ticket-type-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-type-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(84px, 0.7fr) minmax(84px, 0.7fr) minmax(92px, 0.75fr) minmax(96px, 0.7fr) 38px;
  gap: 10px;
  align-items: end;
  padding: 13px;
  border: 1px solid rgba(117, 83, 34, 0.1);
  border-radius: 10px;
  background: var(--surface);
}

.ticket-type-row .field {
  gap: 6px;
}

.ticket-type-row .field input {
  min-height: 40px;
  padding-block: 8px;
}

.remove-ticket-type {
  width: 38px;
  height: 40px;
  color: var(--danger);
  font-size: 18px;
}

.ticket-enabled-field {
  min-height: 40px;
  align-self: end;
  justify-content: center;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  white-space: nowrap;
}

.ticket-enabled-field span {
  font-size: 11px;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* Mobile navigation and feedback */

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  border: 0;
  background: rgba(51, 38, 24, 0.35);
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: flex;
  width: min(360px, calc(100% - 44px));
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brown);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
  animation: toast-in 0.2s ease-out;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qr-card {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .qr-preview {
    width: 132px;
    height: 132px;
  }

  .checkin-layout {
    grid-template-columns: 1fr;
  }

  .ticket-result,
  .ticket-result > .empty-state {
    min-height: 300px;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 270px;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }

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

  .nav-backdrop.is-open {
    display: block;
  }

  .workspace {
    margin-left: 0;
  }

  .menu-button {
    display: inline-flex;
  }

  .overview-grid,
  .form-layout {
    grid-template-columns: 1fr;
  }

  .guidance-card {
    max-width: none;
  }

  .qr-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body:has(.login-view:not(.is-hidden)) {
    display: block;
    padding: 0;
  }

  .login-view {
    display: block;
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    justify-content: center;
    padding: 42px 24px;
  }

  .mobile-brand {
    display: flex;
  }

  .topbar {
    min-height: 74px;
    padding: 11px 16px;
  }

  .topbar-kicker,
  .account-copy {
    display: none;
  }

  .topbar h1 {
    margin-top: 0;
    font-size: 19px;
  }

  .ghost-button {
    min-height: 38px;
    padding-inline: 12px;
  }

  .system-banner {
    align-items: flex-start;
    margin: 16px 16px 0;
  }

  .page-container {
    padding: 20px 16px 44px;
  }

  .welcome-card {
    min-height: 230px;
    padding: 28px;
  }

  .welcome-mark {
    display: none;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric-card {
    min-height: 120px;
    padding: 17px;
  }

  .metric-card strong {
    font-size: 27px;
  }

  .section-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions > button {
    flex: 1;
  }

  .filter-row {
    flex-direction: column;
  }

  .compact-select {
    width: 100%;
  }

  .mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.two-columns,
  .form-grid.three-columns {
    grid-template-columns: 1fr;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .qr-card {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 15px;
    padding: 15px;
  }

  .qr-preview {
    width: 112px;
    height: 112px;
  }

  .qr-card p:not(.card-kicker) {
    min-height: 0;
  }

  .checkin-console {
    min-height: 390px;
    padding: 30px 22px;
  }

  .ticket-input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .camera-scan-button {
    width: 100%;
  }

  .checkin-tips {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .modal-dialog form {
    padding: 20px;
  }

  .ticket-editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ticket-type-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-type-row .ticket-name-field {
    grid-column: 1 / -1;
  }

  .ticket-enabled-field {
    justify-content: flex-start;
  }

  .remove-ticket-type {
    grid-column: 2;
    justify-self: end;
  }

  .camera-dialog-shell {
    padding: 17px;
  }
}

@media (max-width: 480px) {
  .login-panel h2 {
    font-size: 30px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card small {
    display: none;
  }

  .qr-card {
    grid-template-columns: 1fr;
  }

  .qr-preview {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .selection-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-bar > button {
    width: 100%;
  }

  .system-banner {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
