:root {
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-soft: #eceee8;
  --text: #171a18;
  --muted: #747a72;
  --line: #dfe3d8;
  --accent: #1f6f5b;
  --accent-dark: #145141;
  --danger: #9f3434;
  --danger-soft: #f3dddd;
  --shadow: 0 18px 60px rgba(31, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.container-fluid {
  width: 100%;
  padding: 0;
}

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

.stage {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
}

.stage-landing {
  display: grid;
  place-items: center;
}

.landing-panel {
  display: grid;
  justify-items: center;
  gap: 26px;
}

.landing-actions {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.auth-panel {
  display: grid;
  width: min(420px, calc(100vw - 32px));
  justify-items: stretch;
  gap: 16px;
  padding: 28px;
}

.auth-panel .brand-mark,
.auth-panel h1 {
  justify-self: center;
}

.brand-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 760;
  line-height: 1.05;
}

h1 {
  font-size: clamp(38px, 7vw, 84px);
}

h2 {
  font-size: 20px;
}

.eyebrow,
.panel-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 24px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.tables-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-wide,
.panel-compact,
.table-panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.play-header {
  align-items: center;
}

.session-summary,
.play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.session-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.play-actions {
  justify-content: center;
  margin: 0 0 18px;
}

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-weight: 750;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.btn:hover,
.btn:focus {
  transform: translateY(-1px);
  outline: none;
}

.btn-primary-strong {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary-strong:hover,
.btn-primary-strong:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 0 12px 34px rgba(31, 111, 91, 0.22);
}

.btn-secondary-soft {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary-soft:hover,
.btn-secondary-soft:focus {
  background: #e1e5dc;
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-danger-soft {
  background: var(--danger-soft);
  border-color: #e7bdbd;
  color: var(--danger);
}

.btn-xl {
  min-width: min(360px, 82vw);
  min-height: 68px;
  font-size: 18px;
}

.btn-block {
  width: 100%;
  margin-top: 12px;
}

.player-select .form-group {
  margin: 0;
}

.player-select label.control-label {
  display: none;
}

.player-select .shiny-options-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.player-select .checkbox {
  margin: 0;
}

.player-select .checkbox label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf8;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 650;
}

.player-select input[type="checkbox"] {
  margin-top: 0;
}

.form-control {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.table {
  margin: 0;
  color: var(--text);
}

.table > thead > tr > th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table > tbody > tr > td {
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.debt-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.debt-table {
  table-layout: fixed;
  width: 100%;
}

.empty-state {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbf8;
  padding: 34px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.empty-state span {
  max-width: 420px;
  line-height: 1.45;
}

.compact-empty {
  padding: 24px 18px;
}

.modal-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

@media (max-width: 820px) {
  .stage {
    width: min(100vw - 20px, 1120px);
    padding: 18px 0;
  }

  .stage-header {
    align-items: start;
    flex-direction: column;
  }

  .settings-grid,
  .tables-grid {
    grid-template-columns: 1fr;
  }

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

  .panel-wide,
  .panel-compact,
  .table-panel {
    padding: 18px;
  }
}
