:root {
  --background: #f6f7f3;
  --foreground: #17211d;
  --panel: #ffffff;
  --line: #d9dfd5;
  --muted: #64706a;
  --brand: #126451;
  --brand-strong: #0b4a3c;
  --accent: #d7a84d;
  --danger: #b74435;
  --warning: #8d6717;
  --soft-green: #e2efe7;
  --soft-gold: #f4ead1;
  --soft-red: #f5dfdb;
  --soft-gray: #eef0ec;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: linear-gradient(180deg, rgba(18, 100, 81, 0.08), transparent 360px), var(--background);
  color: var(--foreground);
  font-family: Arial, Helvetica, sans-serif;
}

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

button,
select,
input,
textarea,
a,
summary {
  min-height: 44px;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.install-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.topbar,
.hero-grid,
.dashboard-grid,
.workbench,
.modules-grid {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(2.15rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.session-card,
.panel,
.access-panel,
.overview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 38px rgba(23, 33, 29, 0.08);
}

.session-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 10px;
  padding: 12px;
}

.signed-session {
  grid-template-columns: repeat(auto-fit, minmax(130px, auto));
  align-items: center;
}

.signed-session span,
.signed-session small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.session-actions a,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--foreground);
  padding: 0 12px;
  font-weight: 900;
  text-decoration: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--foreground);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: stretch;
  margin-bottom: 16px;
}

.access-panel {
  min-height: 330px;
  padding: 28px;
  background: linear-gradient(135deg, rgba(18, 100, 81, 0.96), rgba(18, 100, 81, 0.78)), #126451;
  color: #fff;
}

.access-panel .eyebrow,
.access-panel p {
  color: rgba(255, 255, 255, 0.82);
}

.access-panel h2 {
  max-width: 760px;
  font-size: clamp(2rem, 4vw, 4rem);
}

.easy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.easy-actions a,
.primary,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #241b07;
  padding: 0 16px;
  font-weight: 900;
  text-decoration: none;
}

.easy-actions a {
  background: #fff;
  color: var(--brand-strong);
}

.qr-flow {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  align-items: center;
  max-width: 690px;
}

.qr-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 112px;
  height: 112px;
  border: 8px solid rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.qr-box span {
  background: var(--brand-strong);
  border-radius: 4px;
}

.overview {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}

.overview div {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.overview div:last-child {
  border-bottom: 0;
}

.metric {
  display: block;
  color: var(--brand);
  font-size: 2.45rem;
  font-weight: 900;
  line-height: 1;
}

.overview p {
  margin-bottom: 0;
  font-weight: 800;
}

.module-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 14px;
  margin-bottom: 2px;
}

.module-nav a {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--foreground);
  padding: 0 14px;
  text-decoration: none;
  font-weight: 900;
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.panel {
  padding: 20px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.success,
.calm {
  background: var(--soft-green);
  color: var(--brand-strong);
}

.warning {
  background: var(--soft-gold);
  color: var(--warning);
}

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

.muted {
  background: var(--soft-gray);
  color: var(--muted);
}

.task-list,
.admin-queue,
.detail-grid,
.role-grid {
  display: grid;
  gap: 10px;
}

.task-list div,
.admin-queue div,
.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 14px;
}

.task-list p,
.calendar-list p,
.compact-row p,
.vote-card p,
.comment-box p,
.architecture p {
  margin-bottom: 0;
}

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

.admin-queue span,
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-queue strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.workbench {
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  align-items: start;
  margin-bottom: 16px;
}

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

.topic-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
  padding: 14px;
  text-align: left;
  text-decoration: none;
}

.topic-row.active {
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand);
}

.topic-row small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.3;
}

.summary {
  font-size: 1.05rem;
}

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

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.attachments span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft-gray);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.comment-box {
  border-left: 4px solid var(--brand);
  background: var(--soft-green);
  border-radius: 8px;
  padding: 14px;
}

.new-topic {
  margin-bottom: 16px;
}

.topic-form {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.6fr;
  gap: 12px;
  align-items: end;
}

.wide-field {
  grid-column: 1 / -1;
}

.login-panel {
  width: min(100%, 520px);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.tenant-switcher {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-label input {
  width: 20px;
  min-height: 20px;
}

.help-text {
  margin: 16px 0 0;
  font-size: 0.92rem;
}

.notice {
  border-radius: 8px;
  margin: 14px 0;
  padding: 12px 14px;
  font-weight: 800;
}

.success-notice {
  background: var(--soft-green);
  color: var(--brand-strong);
}

.warning-notice {
  background: var(--soft-gold);
  color: var(--warning);
}

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

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

.compact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.compact-row:last-child {
  padding-bottom: 0;
}

.compact-row span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  text-align: right;
}

.budget-table {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.budget-table > span:nth-child(-n + 3) {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.vote-card {
  display: grid;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.vote-bar {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft-gray);
}

.vote-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

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

.info-list {
  display: grid;
  gap: 8px;
}

details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
}

summary {
  display: flex;
  align-items: center;
  font-weight: 900;
  cursor: pointer;
}

.wide {
  grid-column: span 2;
}

.architecture {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
  background: #18251f;
  color: #fff;
}

.architecture .eyebrow,
.architecture p {
  color: rgba(255, 255, 255, 0.74);
}

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

.role-grid span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.easy-mode .shell {
  width: min(760px, calc(100% - 20px));
}

.easy-mode .module-nav,
.easy-mode .overview,
.easy-mode .architecture {
  display: none;
}

.easy-mode .hero-grid,
.easy-mode .dashboard-grid,
.easy-mode .workbench,
.easy-mode .modules-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 920px) {
  .topbar,
  .hero-grid,
  .dashboard-grid,
  .workbench,
  .modules-grid,
  .architecture,
  .topic-form,
  .tenant-switcher {
    grid-template-columns: 1fr;
  }

  .session-card,
  .signed-session,
  .admin-queue,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .wide,
  .wide-field {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .access-panel,
  .panel {
    padding: 16px;
  }

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

  .panel-head,
  .compact-row,
  .topic-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .compact-row span {
    text-align: left;
  }

  .budget-table {
    grid-template-columns: 1fr;
  }
}
