/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #1a1a1a;
  --bg-2: #242424;
  --bg-3: #2e2e2e;
  --gold: #d4af37;
  --gold-light: #e8c84a;
  --gold-dim: rgba(212, 175, 55, 0.15);
  --text: #f0f0f0;
  --text-muted: #888;
  --danger: #e05252;
  --success: #4caf82;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
  --header-height: 56px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: manipulation;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ===== APP SHELL ===== */
#app {
  position: fixed;
  inset: 0;
  top: env(safe-area-inset-top);
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  position: absolute;
  inset: 0;
}

.screen.active {
  display: flex;
}

.screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--gold-dim);
  flex-shrink: 0;
}

.app-header-centered {
  justify-content: center;
}

.header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #b8922a 0%, #e8c84a 40%, #d4af37 55%, #f5e070 70%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}

/* ===== LOBBY ===== */
#screen-lobby {
  justify-content: center;
  overflow-y: auto;
}

.lobby-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.logo {
  text-align: center;
}

.logo-icon {
  font-size: 56px;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 10px;
  text-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
}

.logo h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 38px;
  font-weight: 700;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 3px;
  background: linear-gradient(135deg, #b8922a 0%, #e8c84a 40%, #d4af37 55%, #f5e070 70%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
  margin-bottom: 0;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.logo-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px auto 10px;
  width: 80%;
  opacity: 0;
  animation: fade-in 0.8s ease 0.4s forwards;
}

.logo-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(212,175,55,0.5), transparent);
}

.logo-divider-diamond {
  color: var(--gold);
  font-size: 7px;
  opacity: 0.7;
}

.logo-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  color: rgba(212, 175, 55, 0.55);
  font-size: 15px;
  letter-spacing: 5px;
  text-transform: uppercase;
  opacity: 0;
  animation: fade-in 0.8s ease 0.6s forwards;
}

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

/* ===== CARDS ===== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
}

/* ===== FORM ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"] {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  touch-action: manipulation;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--gold);
}

input[type="number"] {
  -moz-appearance: textfield;
}

select.input-select {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

select.input-select:focus {
  border-color: var(--gold);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

/* ===== BUTTONS ===== */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.btn-primary {
  background: var(--gold);
  color: #1a1a1a;
}

.btn-primary:hover {
  background: var(--gold-light);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid #3a3a3a;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  transition: color var(--transition);
}

.btn-icon:hover {
  color: var(--gold);
}

.btn-icon-danger:hover {
  color: var(--danger) !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ===== DIVIDER ===== */
.divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #3a3a3a;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* ===== SECTIONS ===== */
.section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ===== BALANCES ===== */
.balances-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-item {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
}

.balance-item.positive {
  border-color: rgba(76, 175, 130, 0.25);
}

.balance-item.negative {
  border-color: rgba(224, 82, 82, 0.25);
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.balance-info {
  flex: 1;
}

.balance-name {
  font-weight: 600;
  font-size: 15px;
}

.balance-you {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-left: 6px;
}

.balance-amount {
  font-size: 17px;
  font-weight: 700;
}

.balance-amount.positive { color: var(--success); }
.balance-amount.negative { color: var(--danger); }
.balance-amount.zero { color: var(--text-muted); }

/* ===== SETTLEMENT TOGGLE ===== */
.settlement-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text);
  text-align: left;
}

.settlement-toggle:hover {
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.05);
}

.settlement-toggle[aria-expanded="true"] {
  border-color: var(--gold);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.settlement-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.settlement-toggle[aria-expanded="true"] .settlement-toggle-label {
  color: var(--gold);
}

.settlement-toggle-icon {
  font-size: 15px;
  opacity: 0.7;
}

.settlement-toggle[aria-expanded="true"] .settlement-toggle-icon {
  opacity: 1;
}

.settlement-toggle-badge {
  background: var(--gold);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 800;
  border-radius: 10px;
  padding: 2px 8px;
  line-height: 1.4;
  display: none;
}

.settlement-toggle-badge.visible {
  display: inline-block;
}

.settlement-toggle-chevron {
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color var(--transition);
  transform: rotate(0deg);
}

.settlement-toggle[aria-expanded="true"] .settlement-toggle-chevron {
  transform: rotate(90deg);
  color: var(--gold);
}

.settlements-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  opacity: 0;
  background: var(--bg-2);
  border: 1px solid var(--gold);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.settlements-panel.open {
  max-height: 600px;
  opacity: 1;
}

.settlements-panel .settlements-list {
  padding: 12px;
}

/* ===== SETTLEMENTS ===== */
.settlements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settlement-item {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.settlement-from { color: var(--danger); font-weight: 600; }
.settlement-arrow { color: var(--text-muted); }
.settlement-to { color: var(--success); font-weight: 600; }
.settlement-amount { margin-left: auto; font-weight: 700; color: var(--gold); }

.btn-confirm-tx {
  background: none;
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background var(--transition);
}

.btn-confirm-tx:hover {
  background: rgba(76, 175, 130, 0.15);
}

.settlement-confirmed {
  opacity: 0.6;
}

.confirmed-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.btn-unconfirm-tx {
  background: none;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: all var(--transition);
}

.btn-unconfirm-tx:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== ACTIVE SESSION PREVIEW ===== */
.active-session-preview {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--gold-dim);
  cursor: pointer;
}

.active-session-preview:hover {
  border-color: var(--gold);
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 100;
}

.fab:active {
  transform: scale(0.93);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-2);
  border-top: 1px solid var(--gold-dim);
  display: flex;
  align-items: stretch;
  z-index: 200;
}

.bottom-nav.hidden { display: none; }

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: color var(--transition);
  padding: 8px 4px;
}

.nav-btn.active {
  color: var(--gold);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* ===== SESSION MODES ===== */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.mode-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.mode-tab.active {
  background: var(--gold);
  color: #1a1a1a;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

/* ===== QUICK MODE ===== */
.quick-players-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

/* ===== QUICK PLAYER ROW (fler spelare) ===== */
.quick-player-row {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-player-name {
  flex: 1;
  font-weight: 500;
}


.amount-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #3a3a3a;
  background: var(--bg-3);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition);
}

.amount-btn:active {
  border-color: var(--gold);
}

.amount-input {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 4px 4px;
}

.amount-input:focus {
  border-color: var(--gold);
  outline: none;
}

.btn-unit-toggle-inline {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 35%, #3a3a3a, #1a1a1a);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 3px rgba(0,0,0,0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex-shrink: 0;
}

.btn-unit-toggle-inline.active {
  background: radial-gradient(circle at 35% 35%, #c8a830, #8a6e1a);
  box-shadow:
    0 2px 8px rgba(212,175,55,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 -1px 3px rgba(0,0,0,0.4);
}

.btn-unit-toggle-inline:active {
  transform: scale(0.93);
}

.unit-coin-label {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  font-style: italic;
  color: #aaa;
  letter-spacing: 0.02em;
  transition: color 0.2s, transform 0.2s;
  user-select: none;
  pointer-events: none;
}

.btn-unit-toggle-inline.active .unit-coin-label {
  color: #fff8e0;
}

.btn-unit-toggle-inline.flipping .unit-coin-label {
  animation: coin-flip 0.25s ease;
}

@keyframes coin-flip {
  0%   { transform: scaleX(1); opacity: 1; }
  40%  { transform: scaleX(0); opacity: 0.3; }
  60%  { transform: scaleX(0); opacity: 0.3; }
  100% { transform: scaleX(1); opacity: 1; }
}

.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 12px;
  border-top: 1px solid #2e2e2e;
}

.sum-label {
  color: var(--text-muted);
  font-size: 14px;
}

.sum-value {
  font-weight: 700;
  font-size: 16px;
}

.sum-value.zero { color: var(--success); }
.sum-value.nonzero { color: var(--danger); }

/* ===== BUY-IN MODE ===== */
.buyin-players-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.buyin-player-card {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid transparent;
  transition: border-color var(--transition);
}

.buyin-player-card.has-buyin {
  border-color: var(--gold-dim);
}

.buyin-player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.buyin-player-name {
  flex: 1;
  font-weight: 600;
}

.buyin-net {
  font-size: 14px;
  font-weight: 700;
}

.buyin-net.positive { color: var(--success); }
.buyin-net.negative { color: var(--danger); }
.buyin-net.zero { color: var(--text-muted); }

.buyin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.buyin-stat {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 6px;
}

/* ===== HISTORY ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--transition);
}

.history-item:hover {
  border-color: var(--gold-dim);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.history-item-name {
  font-weight: 600;
  font-size: 15px;
}

.history-item-date {
  font-size: 12px;
  color: var(--text-muted);
}

.history-item-type {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.history-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.history-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.history-total-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-3);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 13px;
}

.history-total-chip.positive .history-total-val { color: var(--positive); }
.history-total-chip.negative .history-total-val { color: var(--danger); }

.history-total-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-total-name {
  color: var(--text-muted);
}

.history-total-val {
  font-weight: 600;
}

/* ===== MODALS ===== */
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes overlayFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes sheetSlideDown {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  z-index: 500;
  padding-bottom: env(safe-area-inset-bottom);
  animation: overlayFadeIn 0.25s ease both;
}

.modal-overlay.hidden {
  display: none;
}

.modal-overlay.closing {
  animation: overlayFadeOut 0.25s ease both;
}

.modal-overlay.closing .modal {
  animation: sheetSlideDown 0.25s cubic-bezier(.32,.72,0,1) both;
}

.modal {
  position: relative;
  background: var(--bg-2);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: sheetSlideUp 0.35s cubic-bezier(.32,.72,0,1) both;
  touch-action: none;
}

/* Drag handle */
.modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: -8px auto 4px;
  flex-shrink: 0;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  z-index: 1;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--text);
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  padding-right: 28px;
}

.modal-subtitle {
  color: var(--text-muted);
  margin-top: -8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn {
  flex: 1;
}

/* ===== TYPE SELECTOR ===== */
.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-btn {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.type-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== PLAYER CHECKBOXES ===== */
.player-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-checkbox-btn {
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.player-checkbox-btn.selected {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== GROUP SETTINGS ===== */
.group-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.group-code-display .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.group-code-value {
  flex: 1;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--gold);
}

.group-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
}

.group-player-name {
  flex: 1;
  font-weight: 500;
}

.btn-remove-player {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.btn-remove-player:hover {
  color: var(--danger, #e05252);
  background: rgba(224, 82, 82, 0.1);
}

/* ===== DETAIL ENTRIES ===== */
.detail-entries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.detail-entry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.detail-entry-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-entry-player {
  font-weight: 600;
}

.detail-entry-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.detail-entry-amount {
  font-weight: 700;
}

.detail-entry-amount.positive { color: var(--success); }
.detail-entry-amount.negative { color: var(--danger); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--gold-dim);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: opacity 0.3s ease;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== MISC ===== */
.muted {
  color: var(--text-muted);
  font-size: 14px;
}

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

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ===== CHART ===== */
.modal-chart {
  max-height: 90vh;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* ===== FOOTER SIGNATURE ===== */
.app-signature {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 2px);
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #444;
  pointer-events: none;
  z-index: 50;
}

/* ===== POINT VALUE ROW ===== */
.point-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid #2a2a2a;
}

.point-value-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.point-value-input {
  width: 80px;
  background: var(--bg-3);
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 4px 8px;
  text-align: center;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== SESSION ROUNDS – anteckningsblock ===== */
.session-rounds-list {
  margin-top: 16px;
  position: relative;
  background: #f5e96a;
  border-radius: 4px 4px 6px 6px;
  box-shadow:
    0 2px 0 #c8bc3a,
    0 4px 0 #b0a530,
    0 6px 12px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.6);
  overflow: hidden;
  padding: 10px 0 6px;
  min-height: 60px;
}

/* Spiral-hål */
.session-rounds-list::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 28px,
    #1a1a1a 28px,
    #1a1a1a 44px
  );
  opacity: 0.18;
  z-index: 1;
}

/* Röd marginal-linje */
.session-rounds-list::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 44px;
  width: 1.5px;
  background: rgba(220, 80, 80, 0.55);
  z-index: 1;
  pointer-events: none;
}

.round-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 54px;
  border-bottom: 1px solid rgba(100,140,200,0.2);
  background: transparent;
  position: relative;
}

.round-row:last-child {
  border-bottom: none;
}

.round-latest {
  background: rgba(255,255,255,0.25);
}

.round-old {
  opacity: 0.6;
  text-decoration: line-through;
  text-decoration-color: rgba(26,26,26,0.5);
}

.round-entry {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 400;
  color: #1a1a1a;
}

.notepad-total-circle {
  font-family: 'Caveat', cursive;
  font-size: 36px;
  font-weight: 700;
  color: #c0392b;
  position: absolute;
  top: 14px;
  right: 16px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #c0392b;
  border-radius: 52% 48% 50% 46% / 46% 54% 48% 52%;
  transform: rotate(-4deg);
  z-index: 2;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

.session-screen-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.session-sticky-top {
  flex-shrink: 0;
  padding: 16px 16px 12px;
  background: var(--bg);
  z-index: 10;
}

.session-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px calc(var(--nav-height) + 60px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.session-sticky-total {
  position: fixed;
  bottom: 60px; /* ovanför bottom nav */
  left: 0;
  right: 0;
  background: var(--bg-2);
  border-top: 2px solid #2a2a2a;
  padding: 8px 16px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 200;
}

.rounds-total-row {
  display: grid;
  grid-template-columns: repeat(var(--total-cols, 3), 1fr);
  gap: 6px 8px;
}

.total-entry {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.total-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.total-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.total-value {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.total-entry.positive .total-value { color: #4caf6e; }
.total-entry.negative .total-value { color: #e05252; }
.total-entry:not(.positive):not(.negative) .total-value { color: var(--text-muted); }

/* ===== SPARADE GRUPPER ===== */
.saved-groups-list {
  width: 100%;
  margin-bottom: 12px;
}

.saved-groups-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.saved-group-btn {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}

.saved-group-btn:hover {
  border-color: var(--gold);
  background: var(--bg-3);
}

.saved-group-code {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 0.1em;
  flex: 0 0 auto;
  margin-right: 12px;
}

.saved-group-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  margin-right: 12px;
}

.saved-group-date {
  font-size: 11px;
  color: var(--text-muted);
}

.saved-group-name {
  font-size: 13px;
  color: var(--text-muted);
  flex: 0 0 auto;
  margin-right: 8px;
}

.saved-group-arrow {
  font-size: 20px;
  color: var(--text-muted);
  flex: 0 0 auto;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 2px;
}
