:root {
  --bg: #f2eadf;
  --surface: rgba(255, 250, 244, 0.82);
  --surface-strong: #fffaf5;
  --surface-alt: #efe1ce;
  --line: #d7c0a6;
  --ink: #201816;
  --muted: #6f6258;
  --accent: #ca6a18;
  --accent-deep: #7a3f15;
  --shadow: 0 24px 60px rgba(91, 55, 22, 0.12);
  --success: #235b43;
  --warn: #8a5b1e;
  --danger: #8f3a34;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(202, 106, 24, 0.18), transparent 24%),
    radial-gradient(circle at 85% 10%, rgba(92, 58, 29, 0.12), transparent 18%),
    linear-gradient(135deg, #f7f0e8 0%, #eadbc8 100%);
  font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  min-height: 100vh;
}

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

.kicker {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: stretch;
}

.login-brand,
.login-card,
.sidebar,
.panel,
.hero-band,
.stat-card {
  border: 1px solid rgba(215, 192, 166, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-brand {
  padding: 44px;
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(255, 248, 240, 0.95), rgba(244, 228, 208, 0.86));
}

.login-brand h1 {
  max-width: 10ch;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: 0.92;
  font-family: "Arial Narrow", "Aptos Display", "Franklin Gothic Medium", sans-serif;
  letter-spacing: -0.04em;
}

.login-copy {
  max-width: 44ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.mini-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(215, 192, 166, 0.75);
  font-weight: 700;
}

.login-card {
  align-self: center;
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 252, 247, 0.9);
}

.login-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(35, 91, 67, 0.12);
}

.login-form,
.config-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input:focus,
textarea:focus {
  border-color: rgba(202, 106, 24, 0.82);
  box-shadow: 0 0 0 4px rgba(202, 106, 24, 0.12);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  padding: 14px 18px;
  font-weight: 800;
}

.primary-btn {
  color: #fff7ef;
  background: linear-gradient(135deg, #201816, #57301a 58%, #c86d1d);
}

.secondary-btn {
  color: #fff7ef;
  background: #3b2a20;
}

.ghost-btn {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(215, 192, 166, 0.75);
}

.danger-btn {
  padding: 14px 18px;
  font-weight: 800;
  color: #fff8ef;
  background: linear-gradient(135deg, #6b1e1e, #982f2f);
}

.form-feedback {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.dashboard-body {
  padding: 18px;
}

.dashboard-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  padding: 24px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(36, 26, 22, 0.96), rgba(91, 52, 25, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  color: #fff6ee;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar .kicker,
.sidebar-copy,
.menu-link,
.operator-card span {
  color: rgba(255, 242, 231, 0.72);
}

.sidebar-title {
  font-size: 2.6rem;
  line-height: 0.94;
  font-family: "Arial Narrow", "Aptos Display", "Franklin Gothic Medium", sans-serif;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
}

.sidebar-copy {
  line-height: 1.6;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  margin: 26px 0;
}

.menu-link {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 243, 231, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
}

.menu-link.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff8ef;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.operator-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.operator-card span {
  display: block;
  margin-bottom: 8px;
}

.operator-card strong {
  font-size: 1.1rem;
}

.dashboard-main {
  display: grid;
  gap: 18px;
}

.view-pane {
  display: none;
  gap: 18px;
}

.view-pane.is-active {
  display: grid;
}

.hero-band,
.panel,
.stat-card {
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.94), rgba(249, 241, 231, 0.88));
}

.hero-band {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 22px;
  padding: 24px 28px;
}

.hero-band h2 {
  max-width: 12ch;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 0.96;
  font-family: "Arial Narrow", "Aptos Display", "Franklin Gothic Medium", sans-serif;
  letter-spacing: -0.05em;
  margin-bottom: 0;
}

.hero-copy,
.hero-note,
.panel-note {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  display: grid;
  align-content: start;
  gap: 14px;
}

.status-chip {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, #261c18, #694022);
  color: #fff8f0;
}

.status-chip span {
  display: block;
  margin-bottom: 10px;
  color: rgba(255, 241, 229, 0.72);
}

.status-chip strong {
  font-size: 1.35rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.stat-card {
  min-height: 138px;
  padding: 18px 20px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat-card strong {
  font-size: clamp(1.02rem, 1.6vw, 1.5rem);
  line-height: 1.1;
  word-break: break-word;
}

.stat-card small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.overview-strip {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.mini-panel {
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(215, 192, 166, 0.72);
  background: rgba(255, 251, 246, 0.78);
  box-shadow: var(--shadow);
}

.mini-panel span {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mini-panel p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
}

.content-grid-line {
  grid-template-columns: 0.9fr 1.1fr;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

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

.panel-label {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel h3,
.panel h4 {
  margin-bottom: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.log-stack {
  display: grid;
  gap: 12px;
}

.log-item {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(215, 192, 166, 0.6);
}

.log-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.log-level,
.log-time {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.log-time {
  color: var(--muted);
}

.log-message {
  margin: 0;
  line-height: 1.55;
}

.log-info {
  background: rgba(255, 255, 255, 0.58);
}

.log-warn {
  background: rgba(255, 236, 204, 0.7);
}

.log-warn .log-level {
  color: var(--warn);
}

.log-error {
  background: rgba(255, 225, 225, 0.75);
}

.log-error .log-level {
  color: var(--danger);
}

.log-empty {
  margin: 0;
  color: var(--muted);
}

.qr-stage {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 26px;
  border: 1px dashed rgba(202, 106, 24, 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(247, 235, 219, 0.7));
}

#qrImage {
  width: min(100%, 290px);
  height: auto;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(215, 192, 166, 0.72);
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 800;
}

.pairing-code-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(215, 192, 166, 0.65);
  background: rgba(255, 255, 255, 0.58);
}

.pairing-code-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pairing-code-box {
  margin-top: 12px;
  padding: 18px;
  border-radius: 20px;
  border: 1px dashed rgba(202, 106, 24, 0.5);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(244, 230, 213, 0.9));
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

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

.line-status-card {
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(215, 192, 166, 0.6);
}

.line-status-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.line-status-card strong {
  font-size: 1.3rem;
}

.line-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.security-block {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(215, 192, 166, 0.55);
}

.section-headline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.question-list {
  display: grid;
  gap: 14px;
  max-height: 860px;
  overflow: auto;
  padding-right: 4px;
}

.question-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(215, 192, 166, 0.62);
  display: grid;
  gap: 12px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.link-btn {
  background: transparent;
  color: var(--accent-deep);
  font-weight: 800;
  padding: 0;
}

@media (max-width: 1180px) {
  .dashboard-shell,
  .login-shell,
  .hero-band,
  .content-grid,
  .content-grid-line,
  .workspace-grid,
  .overview-strip {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

    .stats-grid,
    .field-grid,
    .line-actions-grid,
    .pairing-actions {
      grid-template-columns: 1fr;
    }
  }

@media (max-width: 720px) {
  .dashboard-body,
  .login-body {
    padding: 12px;
  }

  .hero-band,
  .panel,
  .login-brand,
  .login-card,
  .sidebar,
  .stat-card {
    border-radius: 24px;
  }

  .hero-band,
  .panel,
  .sidebar,
  .login-brand,
  .login-card,
  .stat-card {
    padding: 20px;
  }

    .panel-head,
    .panel-actions,
    .section-headline,
    .question-meta,
    .form-actions {
      flex-direction: column;
      align-items: flex-start;
  }
}
