:root {
  --felt-deep: #0b1c17;
  --felt: #11281f;
  --felt-light: #1a3328;
  --felt-edge: #244035;
  --bone: #f4ead5;
  --bone-dim: #c9bfaa;
  --bone-soft: #ddd0b3;
  --brass: #c9a961;
  --brass-bright: #e8c97f;
  --brass-deep: #a08544;
  --crimson: #b8463a;
  --crimson-deep: #8a2e25;
  --green: #56a97a;
  --ink: #07140f;
  --line: rgba(244, 234, 213, 0.08);
  --line-strong: rgba(244, 234, 213, 0.16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--ink);
  color: var(--bone);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
body {
  background:
    radial-gradient(ellipse at top, rgba(201, 169, 97, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(184, 70, 58, 0.04) 0%, transparent 60%),
    var(--ink);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; }

/* ============ Layout ============ */
.app {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, var(--felt-deep) 0%, var(--ink) 100%);
  border-right: 1px solid var(--line);
  padding: 32px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--brass-bright), var(--brass-deep));
  display: grid; place-items: center;
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-weight: 700; font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.brand-name { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.brand-name .pro { color: var(--brass); font-style: italic; font-weight: 400; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--bone-dim); opacity: 0.5; padding: 16px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--bone-soft); font-size: 14px;
  cursor: pointer; transition: all 0.18s ease;
  border: 1px solid transparent; user-select: none;
}
.nav-item:hover { background: rgba(244, 234, 213, 0.04); color: var(--bone); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(201, 169, 97, 0.12), rgba(201, 169, 97, 0.02));
  color: var(--brass-bright);
  border-color: rgba(201, 169, 97, 0.18);
}
.nav-icon { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--crimson); color: var(--bone);
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
}
.group-card {
  margin-top: auto; padding: 14px;
  border-radius: 12px;
  background: rgba(244, 234, 213, 0.03);
  border: 1px solid var(--line);
}
.group-card-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--bone-dim); margin-bottom: 6px;
}
.group-card-name { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; }
.group-card-meta { font-size: 12px; color: var(--bone-dim); margin-top: 4px; }

.main { padding: 32px 40px 100px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; gap: 16px; flex-wrap: wrap; }
.greet-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--brass); margin-bottom: 6px;
}
.greet-title {
  font-family: 'Fraunces', serif; font-size: 30px; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.1;
}
.greet-title em { font-style: italic; color: var(--brass-bright); font-weight: 400; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; color: var(--bone); font-size: 13px; cursor: pointer;
  border: 1px solid rgba(244, 234, 213, 0.1);
}

/* ============ Forms ============ */
.select, .input, textarea.input {
  background: rgba(244, 234, 213, 0.04);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  padding: 10px 14px; border-radius: 10px;
  font-size: 14px; outline: none;
  width: 100%;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brass); }
textarea.input { resize: vertical; min-height: 80px; font-family: inherit; }
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--bone-dim); margin-bottom: 6px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(244, 234, 213, 0.04);
  color: var(--bone);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.18s ease; text-decoration: none;
}
.btn:hover { background: rgba(244, 234, 213, 0.08); }
.btn-primary { background: var(--brass); color: var(--ink); border-color: var(--brass); font-weight: 600; }
.btn-primary:hover { background: var(--brass-bright); border-color: var(--brass-bright); }
.btn-ghost { border-color: transparent; }
.btn-danger { color: var(--crimson); border-color: rgba(184, 70, 58, 0.3); }
.btn-danger:hover { background: rgba(184, 70, 58, 0.12); }
.btn-sm { font-size: 12px; padding: 7px 14px; }

/* ============ Flash ============ */
.flash {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
  font-size: 14px; border: 1px solid var(--line-strong);
}
.flash.ok { border-color: rgba(86, 169, 122, 0.4); background: rgba(86, 169, 122, 0.1); color: #88c79e; }
.flash.err { border-color: rgba(184, 70, 58, 0.4); background: rgba(184, 70, 58, 0.1); color: #e57b6b; }

/* ============ Hero ============ */
.hero {
  border-radius: 20px; overflow: hidden; position: relative;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(201, 169, 97, 0.18) 0%, transparent 60%),
    linear-gradient(135deg, var(--felt) 0%, var(--felt-deep) 100%);
  border: 1px solid var(--line-strong);
  padding: 32px; margin-bottom: 28px;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(244, 234, 213, 0.04) 1px, transparent 0);
  background-size: 24px 24px; pointer-events: none;
}
.hero-content { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; }
.hero-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--brass); margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.pulse-dot {
  width: 8px; height: 8px; background: var(--brass); border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 169, 97, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(201, 169, 97, 0); }
}
.hero-title {
  font-family: 'Fraunces', serif; font-size: 36px; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 8px;
}
.hero-meta { color: var(--bone-dim); font-size: 14px; margin-bottom: 24px; }
.hero-meta strong { color: var(--bone); font-weight: 500; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.countdown {
  display: flex; gap: 6px;
  background: rgba(7, 20, 15, 0.5);
  padding: 16px 20px; border-radius: 14px;
  border: 1px solid var(--line);
}
.countdown-block { text-align: center; min-width: 52px; }
.countdown-num {
  font-family: 'Fraunces', serif; font-size: 28px; font-weight: 500;
  color: var(--brass-bright); font-variant-numeric: tabular-nums; line-height: 1;
}
.countdown-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--bone-dim); margin-top: 6px;
}
.countdown-sep { color: var(--brass-deep); font-size: 24px; align-self: center; }

/* ============ Stats ============ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat {
  background: rgba(244, 234, 213, 0.02);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 18px;
  position: relative; overflow: hidden;
}
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--bone-dim); margin-bottom: 8px;
}
.stat-value {
  font-family: 'Fraunces', serif; font-size: 32px; font-weight: 500;
  color: var(--bone); font-variant-numeric: tabular-nums; line-height: 1;
}
.stat-trend { font-size: 12px; color: var(--brass); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }

/* ============ Grids / panels ============ */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.panel {
  background: rgba(244, 234, 213, 0.02);
  border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
}
.panel-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.panel-title { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.panel-action { font-size: 12px; color: var(--brass); cursor: pointer; }
.panel-action:hover { color: var(--brass-bright); }
.panel-body { padding: 8px 0; }
.panel-pad { padding: 22px; }

/* Activity */
.activity-item {
  display: flex; gap: 14px; padding: 14px 22px;
  border-bottom: 1px solid var(--line); align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  color: var(--bone);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.activity-text { font-size: 13px; line-height: 1.5; flex: 1; }
.activity-text strong { color: var(--bone); font-weight: 600; }
.activity-text .verb { color: var(--bone-dim); }
.activity-time { font-size: 11px; color: var(--bone-dim); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

.announcement { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.announcement:last-child { border-bottom: none; }
.announcement-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pin-icon { width: 14px; height: 14px; color: var(--brass); }
.announcement-title { font-size: 14px; font-weight: 600; color: var(--bone); }
.announcement-body { font-size: 13px; color: var(--bone-soft); line-height: 1.5; }
.announcement-time { font-size: 11px; color: var(--bone-dim); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }

/* ============ Tables / seats ============ */
.terms-bar {
  display: flex; gap: 24px; padding: 16px 22px;
  background: rgba(7, 20, 15, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.term-block { display: flex; flex-direction: column; gap: 2px; }
.term-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--bone-dim); }
.term-value { font-size: 14px; font-weight: 500; color: var(--bone); font-family: 'JetBrains Mono', monospace; }

.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.table-card {
  background: radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt) 60%, var(--felt-deep) 100%);
  border-radius: 20px; padding: 28px; position: relative;
  border: 1px solid var(--felt-edge);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(244, 234, 213, 0.04);
  overflow: hidden;
}
.table-card::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(244, 234, 213, 0.025) 1px, transparent 0);
  background-size: 6px 6px; pointer-events: none;
}
.table-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; position: relative; }
.table-name { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.table-sub { font-size: 12px; color: var(--bone-dim); margin-top: 2px; }
.table-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em;
  padding: 5px 10px; border-radius: 999px; font-weight: 600;
}
.status-filling { background: rgba(201, 169, 97, 0.15); color: var(--brass-bright); border: 1px solid rgba(201, 169, 97, 0.3); }
.status-full { background: rgba(184, 70, 58, 0.15); color: #e57b6b; border: 1px solid rgba(184, 70, 58, 0.3); }
.status-open { background: rgba(86, 169, 122, 0.12); color: #88c79e; border: 1px solid rgba(86, 169, 122, 0.25); }

.poker-table-wrap { position: relative; aspect-ratio: 1.6 / 1; margin: 8px 0 18px; }
.seat { cursor: pointer; transition: transform 0.18s ease; }
.seat:hover { transform: scale(1.08); transform-origin: center; }
.seat circle.bg { transition: fill 0.2s ease, stroke 0.2s ease; }
.seat.empty circle.bg {
  fill: rgba(7, 20, 15, 0.6);
  stroke: rgba(201, 169, 97, 0.3);
  stroke-dasharray: 3 3;
}
.seat.filled circle.bg { fill: var(--felt-deep); stroke: var(--brass); stroke-width: 1.5; }
.seat.you circle.bg { fill: var(--crimson-deep); stroke: var(--brass-bright); stroke-width: 2; }
.seat-initials {
  fill: var(--bone); font-family: 'DM Sans', sans-serif;
  font-size: 11px; font-weight: 600; text-anchor: middle; dominant-baseline: central; pointer-events: none;
}
.seat-label { fill: var(--bone-soft); font-size: 9px; font-weight: 500; text-anchor: middle; pointer-events: none; }
.seat-empty-plus { fill: var(--brass); font-size: 16px; font-weight: 300; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.table-counts {
  display: flex; justify-content: space-around;
  padding: 14px 0 0; border-top: 1px solid rgba(244, 234, 213, 0.08); position: relative;
}
.count-item { text-align: center; }
.count-num { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 500; color: var(--bone); line-height: 1; }
.count-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--bone-dim); margin-top: 4px; }
.table-actions { display: flex; gap: 8px; margin-top: 16px; position: relative; }
.table-actions .btn { flex: 1; justify-content: center; font-size: 12px; padding: 9px 14px; }

/* Roster */
.roster { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.roster-title { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; }
.roster-title-count { font-size: 12px; color: var(--bone-dim); font-family: 'JetBrains Mono', monospace; }
.player-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(244, 234, 213, 0.025);
  border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 6px;
  font-size: 13px; transition: all 0.18s ease;
}
.player-pill:hover { background: rgba(244, 234, 213, 0.05); border-color: var(--line-strong); }
.player-pill.waitlist { border-style: dashed; }
.player-mini {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600; flex-shrink: 0;
}
.player-name { flex: 1; }
.player-tag {
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
}
.tag-vip { background: rgba(201, 169, 97, 0.15); color: var(--brass-bright); }
.tag-reliable { background: rgba(86, 169, 122, 0.12); color: #88c79e; }
.tag-late { background: rgba(184, 70, 58, 0.15); color: #e57b6b; }

/* Polls */
.poll { margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.poll-question { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 500; padding: 18px 22px 4px; letter-spacing: -0.01em; }
.poll-meta { font-size: 11px; color: var(--bone-dim); padding: 0 22px 12px; font-family: 'JetBrains Mono', monospace; }
.poll-options { padding: 0 22px 18px; display: flex; flex-direction: column; gap: 8px; }
.poll-option {
  position: relative; padding: 12px 16px;
  background: rgba(244, 234, 213, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
  transition: all 0.18s ease; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.poll-option:hover { border-color: var(--brass); }
.poll-option.voted { border-color: var(--brass); }
.poll-option-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(201, 169, 97, 0.18), rgba(201, 169, 97, 0.06));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.poll-option-text { font-size: 14px; position: relative; display: flex; align-items: center; gap: 10px; }
.poll-option-pct { font-size: 13px; font-weight: 600; color: var(--brass-bright); position: relative; font-family: 'JetBrains Mono', monospace; }
.check-circle {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--bone-dim);
  display: grid; place-items: center; flex-shrink: 0;
}
.poll-option.voted .check-circle { background: var(--brass); border-color: var(--brass); }
.poll-option.voted .check-circle::after { content: '✓'; color: var(--ink); font-size: 10px; font-weight: 700; }

/* Chat */
.chat-shell { display: grid; grid-template-columns: 220px 1fr; height: 600px; }
.chat-channels { border-right: 1px solid var(--line); padding: 12px 0; overflow-y: auto; }
.chat-channel {
  padding: 10px 18px; font-size: 13px; cursor: pointer;
  color: var(--bone-soft);
  border-left: 2px solid transparent;
  display: flex; align-items: center; gap: 8px;
}
.chat-channel:hover { background: rgba(244, 234, 213, 0.03); }
.chat-channel.active { background: rgba(201, 169, 97, 0.06); color: var(--brass-bright); border-left-color: var(--brass); }
.channel-hash { color: var(--bone-dim); font-weight: 600; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-header { padding: 14px 22px; border-bottom: 1px solid var(--line); }
.chat-header-name { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; }
.chat-messages { flex: 1; padding: 16px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 12px; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--bone);
}
.msg-content { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author { font-size: 13px; font-weight: 600; }
.msg-time { font-size: 11px; color: var(--bone-dim); font-family: 'JetBrains Mono', monospace; }
.msg-body { font-size: 14px; line-height: 1.5; color: var(--bone-soft); word-wrap: break-word; }
.msg.system .msg-body { font-style: italic; color: var(--bone-dim); font-size: 12px; }
.chat-input-row { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.chat-input {
  flex: 1; background: rgba(244, 234, 213, 0.03);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 18px;
  color: var(--bone); font-size: 14px; outline: none;
}
.chat-input:focus { border-color: var(--brass); }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brass); color: var(--ink);
  border: none; cursor: pointer;
  display: grid; place-items: center; transition: background 0.18s ease;
}
.send-btn:hover { background: var(--brass-bright); }

/* Players grid */
.players-toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(244, 234, 213, 0.02);
  color: var(--bone-soft); font-size: 12px;
  cursor: pointer; transition: all 0.18s ease; user-select: none;
}
.filter-chip:hover { border-color: var(--brass); }
.filter-chip.active { background: var(--brass); color: var(--ink); border-color: var(--brass); font-weight: 600; }
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.player-card {
  background: rgba(244, 234, 213, 0.02);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 18px; transition: all 0.18s ease;
}
.player-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.player-card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.player-card-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; color: var(--bone); flex-shrink: 0;
}
.player-card-name { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 500; }
.player-card-nick { font-size: 12px; color: var(--bone-dim); margin-top: 2px; }
.player-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.pcs { text-align: center; }
.pcs-num { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 500; }
.pcs-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--bone-dim); margin-top: 2px; }

/* Mobile */
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px 18px 100px; }
  .greet-title { font-size: 24px; }
  .hero { padding: 22px; }
  .hero-content { grid-template-columns: 1fr; }
  .hero-title { font-size: 26px; }
  .countdown { justify-content: center; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .tables-grid { grid-template-columns: 1fr; }
  .roster { grid-template-columns: 1fr; }
  .terms-bar { gap: 14px; }
  .field-row { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chat-channels {
    display: flex; flex-direction: row; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--line); padding: 8px;
  }
  .chat-channel { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; padding: 6px 12px; }
  .chat-channel.active { border-left-color: transparent; border-bottom-color: var(--brass); }
  .chat-messages { height: 400px; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(11, 28, 23, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-strong);
    z-index: 100;
    padding: 10px 4px env(safe-area-inset-bottom, 10px);
  }
  .mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 6px 0; color: var(--bone-dim); font-size: 10px; cursor: pointer;
  }
  .mobile-nav-item.active { color: var(--brass); }
  .mobile-nav-item svg { width: 20px; height: 20px; }
}

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--felt-deep);
  border: 1px solid var(--brass);
  color: var(--bone);
  padding: 12px 20px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .check {
  width: 18px; height: 18px; background: var(--brass);
  color: var(--ink); border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 11px;
}

/* Auth pages */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, var(--felt) 0%, var(--felt-deep) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 20px; padding: 36px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 28px; }
.auth-brand .brand-mark { width: 44px; height: 44px; font-size: 20px; }
.auth-brand .brand-name { font-size: 22px; }
.auth-title { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 500; text-align: center; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-sub { color: var(--bone-dim); font-size: 13px; text-align: center; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--bone-dim); }
.auth-foot a { color: var(--brass); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(244, 234, 213, 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(244, 234, 213, 0.15); }

/* ============ Hebrew/RTL font fallback ============ */
:root {
  --font-body: 'DM Sans', 'Heebo', system-ui, sans-serif;
}
body.rtl { font-family: 'Heebo', 'DM Sans', system-ui, sans-serif; }

/* ============ Lang toggle ============ */
.lang-toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(244, 234, 213, 0.02);
  color: var(--bone-soft);
  font-size: 12px; font-weight: 600;
  text-decoration: none;
  cursor: pointer; transition: all 0.18s ease;
  font-family: 'DM Sans', 'Heebo', sans-serif;
}
.lang-toggle:hover { border-color: var(--brass); color: var(--brass); }

/* ============ LEDGER ============ */
.ledger-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px; align-items: center;
}
.ledger-toolbar .btn { font-weight: 600; }
.ledger-totals {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 18px;
}
.ledger-totals .stat { padding: 16px; }
.ledger-totals .stat-value { font-size: 24px; }
.ledger-totals .stat.warn .stat-value { color: var(--crimson); }

.ledger-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ledger-summary-table th, .ledger-summary-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
body.rtl .ledger-summary-table th,
body.rtl .ledger-summary-table td { text-align: right; }
.ledger-summary-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--bone-dim); font-weight: 600;
}
.ledger-summary-table td.num,
.ledger-summary-table th.num {
  text-align: right; font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}
body.rtl .ledger-summary-table td.num,
body.rtl .ledger-summary-table th.num { text-align: left; }
.ledger-summary-table .player-cell {
  display: flex; align-items: center; gap: 10px;
}
.net-pos { color: #88c79e; font-weight: 600; }
.net-neg { color: #e57b6b; font-weight: 600; }
.net-zero { color: var(--bone-dim); }

.ledger-log {
  margin-top: 24px;
}
.log-entry {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.log-entry:hover { background: rgba(244, 234, 213, 0.02); }
.log-entry .typebadge {
  font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px;
  font-weight: 600;
}
.type-buyin { background: rgba(184, 70, 58, 0.15); color: #e57b6b; }
.type-rebuy { background: rgba(201, 169, 97, 0.15); color: var(--brass-bright); }
.type-cashout { background: rgba(86, 169, 122, 0.15); color: #88c79e; }
.type-adjustment { background: rgba(244, 234, 213, 0.08); color: var(--bone-dim); }
.log-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 14px;
}
.log-time {
  font-size: 11px; color: var(--bone-dim);
  font-family: 'JetBrains Mono', monospace;
}
.log-thumb {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--felt-deep);
  background-size: cover; background-position: center;
  cursor: pointer;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* Ledger entry modal/form */
.ledger-form {
  background: rgba(244, 234, 213, 0.02);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}
.ledger-form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px; align-items: end;
}

/* ============ SETTLEMENTS ============ */
.settle-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 234, 213, 0.02);
  transition: opacity 0.18s ease;
}
.settle-card.paid {
  opacity: 0.5;
  background: rgba(86, 169, 122, 0.04);
}
.settle-payer, .settle-payee {
  display: flex; align-items: center; gap: 12px;
}
.settle-payer { justify-content: flex-end; }
body.rtl .settle-payer { justify-content: flex-start; }
.settle-arrow {
  color: var(--brass);
  font-size: 22px;
  font-weight: 700;
}
.settle-amount {
  font-family: 'Fraunces', serif;
  font-size: 24px; font-weight: 500;
  color: var(--brass-bright);
  font-variant-numeric: tabular-nums;
}
.settle-status {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 4px 10px; border-radius: 999px; font-weight: 600;
}
.status-paid { background: rgba(86, 169, 122, 0.18); color: #88c79e; }
.status-unpaid { background: rgba(184, 70, 58, 0.15); color: #e57b6b; }

/* ============ STATS ============ */
.stats-hero {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 28px;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 30px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.leaderboard-rank {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  color: var(--bone-dim);
  font-weight: 500;
  text-align: center;
}
.leaderboard-rank.top-1 { color: var(--brass-bright); }
.leaderboard-rank.top-2 { color: #c9bfaa; }
.leaderboard-rank.top-3 { color: #c47466; }
.leaderboard-net {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.leaderboard-meta { font-size: 11px; color: var(--bone-dim); }

/* ============ Tabs (event sub-pages) ============ */
.event-tabs {
  display: flex; gap: 6px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.event-tab {
  padding: 12px 20px;
  font-size: 13px; font-weight: 500;
  color: var(--bone-soft);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.18s ease;
}
.event-tab:hover { color: var(--bone); }
.event-tab.active {
  color: var(--brass-bright);
  border-bottom-color: var(--brass);
}

/* ============ Ledger mobile ============ */
@media (max-width: 900px) {
  .ledger-totals { grid-template-columns: repeat(2, 1fr); }
  .ledger-form-grid { grid-template-columns: 1fr 1fr; }
  .ledger-summary-table { font-size: 12px; }
  .ledger-summary-table th, .ledger-summary-table td { padding: 10px 8px; }
  .settle-card { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .settle-payer, .settle-payee { justify-content: flex-start; }
  .settle-arrow { display: none; }
  .stats-hero { grid-template-columns: repeat(2, 1fr); }
  .log-entry { grid-template-columns: 1fr auto; row-gap: 4px; }
  .log-entry .log-thumb { grid-row: span 2; }
}

/* ============ Image lightbox ============ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: none;
  place-items: center;
  cursor: zoom-out;
}
.lightbox.show { display: grid; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ============ Tournament ============ */
.payout-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.payout-table th, .payout-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  text-align: left;
}
body.rtl .payout-table th, body.rtl .payout-table td { text-align: right; }
.payout-place {
  font-family: 'Fraunces', serif;
  font-size: 18px; color: var(--brass-bright);
  font-weight: 500;
}


/* ============ V3: Avatars (photo-aware) ============ */
.avatar-img {
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.avatar-circle {
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'DM Sans', 'Heebo', sans-serif;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ============ V3: Reliability badges ============ */
.rel-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px; font-weight: 600;
}
.rel-vip      { background: rgba(201,169,97,0.16);  color: var(--brass-bright); }
.rel-reliable { background: rgba(86,169,122,0.15);  color: #88c79e; }
.rel-late     { background: rgba(244,234,213,0.08); color: var(--bone-dim); }
.rel-risk     { background: rgba(184,70,58,0.15);   color: #e57b6b; }
.rel-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500;
  color: var(--bone-dim);
  margin-left: 6px;
}

/* ============ V3: Calendar ============ */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 14px; flex-wrap: wrap;
}
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-nav button {
  padding: 6px 14px;
  border: 1px solid var(--line);
  background: rgba(244,234,213,0.02);
  color: var(--bone);
  border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px;
}
.cal-nav button:hover { border-color: var(--brass); color: var(--brass); }
.cal-title {
  font-family: 'Fraunces', serif;
  font-size: 22px; font-weight: 500;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  background: rgba(244,234,213,0.02);
}
.cal-dow {
  padding: 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--bone-dim);
  border-bottom: 1px solid var(--line);
  text-align: center;
  background: rgba(0,0,0,0.15);
}
.cal-cell {
  min-height: 96px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other-month { opacity: 0.35; background: rgba(0,0,0,0.1); }
.cal-cell.today { background: rgba(201,169,97,0.06); }
.cal-cell.today .cal-day { color: var(--brass-bright); font-weight: 700; }
.cal-day {
  font-size: 12px;
  color: var(--bone-soft);
  font-weight: 500;
}
.cal-event {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(86,169,122,0.18);
  color: #88c79e;
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 2px solid #88c79e;
}
body.rtl .cal-event { border-left: none; border-right: 2px solid #88c79e; }
.cal-event.is-tournament { background: rgba(201,169,97,0.18); color: var(--brass-bright); border-left-color: var(--brass); }
body.rtl .cal-event.is-tournament { border-right-color: var(--brass); }
.cal-event.is-canceled { background: rgba(184,70,58,0.10); color: #e57b6b; text-decoration: line-through; border-left-color: #e57b6b; }
body.rtl .cal-event.is-canceled { border-right-color: #e57b6b; }
.cal-event.is-full { background: rgba(184,70,58,0.18); color: #e57b6b; border-left-color: #e57b6b; }
body.rtl .cal-event.is-full { border-right-color: #e57b6b; }

@media (max-width: 900px) {
  .cal-cell { min-height: 60px; padding: 4px 6px; }
  .cal-event { font-size: 9px; padding: 2px 5px; }
  .cal-day { font-size: 10px; }
}

/* ============ V3: Reports / charts ============ */
.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-bottom: 18px;
}
.chart-panel {
  background: rgba(244,234,213,0.02);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 18px;
}
.chart-panel canvas { max-width: 100%; }
.chart-title {
  font-family: 'Fraunces', serif; font-size: 17px; font-weight: 500;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
}

/* ============ V3: Drag-and-drop seats ============ */
.seat-pool {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px;
  margin-bottom: 18px;
  background: rgba(244,234,213,0.02);
  border: 1px dashed var(--line);
  border-radius: 12px;
  min-height: 60px;
}
.draggable-player {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--felt-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: grab;
  font-size: 13px;
  user-select: none;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.draggable-player:hover { border-color: var(--brass); }
.draggable-player:active { cursor: grabbing; }
.draggable-player.dragging { opacity: 0.4; transform: scale(0.95); }

.poker-seat.drop-target { stroke: var(--brass); stroke-width: 3; cursor: pointer; }
.poker-seat.drop-hover { fill: rgba(201,169,97,0.4); }

/* ============ V3: Tournament UI ============ */
.payout-builder {
  background: rgba(244,234,213,0.02);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 18px; margin-bottom: 18px;
}
.payout-row {
  display: grid;
  grid-template-columns: 60px 1fr 100px auto;
  gap: 10px; align-items: center;
  margin-bottom: 8px;
}
.payout-pool-summary {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 12px 16px; margin-top: 14px;
  background: rgba(0,0,0,0.2); border-radius: 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
}
.payout-pool-summary strong { color: var(--brass-bright); font-weight: 600; }


/* ============ V4: Search bar ============ */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 280px;
}
.search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  background: rgba(244,234,213,0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--bone);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s ease;
}
.search-input:focus { border-color: var(--brass); }
.search-input::placeholder { color: var(--bone-dim); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--felt-deep);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 12px 36px rgba(0,0,0,0.4);
}
.search-results.show { display: block; }
.search-result-section { padding: 8px 0; }
.search-result-section:not(:last-child) { border-bottom: 1px solid var(--line); }
.search-result-label {
  padding: 4px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bone-dim);
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--bone);
  cursor: pointer;
}
.search-result-item:hover { background: rgba(201,169,97,0.08); }

@media (max-width: 900px) {
  .search-wrap { max-width: 160px; }
}
@media (max-width: 600px) {
  .search-wrap { display: none; }
}

/* ============ V4: Notification bell ============ */
.bell-btn {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(244,234,213,0.02);
  color: var(--bone-soft);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}
.bell-btn:hover { border-color: var(--brass); color: var(--brass); }
.bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--crimson, #b8463a);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid; place-items: center;
  border: 2px solid var(--felt-base, #0d1410);
}
body.rtl .bell-badge { right: auto; left: -4px; }


/* ============================================================
   V5: APP-LIKE MOBILE EXPERIENCE
   ============================================================ */

/* Safe-area insets for iPhone notches */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Standalone mode — no browser chrome */
html.pwa-installed body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}
html.pwa-installed input,
html.pwa-installed textarea,
html.pwa-installed [contenteditable] {
  user-select: text;
  -webkit-user-select: text;
}

/* Disable iOS double-tap zoom */
button, .btn, .nav-item, .mobile-nav-item, .player-card, .event-tab {
  touch-action: manipulation;
}

@media (max-width: 900px) {
  html, body {
    overscroll-behavior-y: none;
  }

  /* Topbar respects notch */
  .topbar {
    padding-top: max(14px, var(--safe-top));
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(13, 20, 16, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }

  /* Main content gets bottom padding so nav doesn't cover content */
  .main {
    padding-bottom: calc(70px + var(--safe-bottom)) !important;
    min-height: calc(100vh - 70px);
  }

  /* Mobile nav is the primary navigation */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(13, 20, 16, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--line);
    z-index: 100;
    justify-content: space-around;
    align-items: stretch;
  }

  .mobile-nav-item {
    flex: 1;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--bone-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.18s ease;
    font-family: inherit;
  }
  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.18s ease;
  }
  .mobile-nav-item:active svg { transform: scale(0.88); }
  .mobile-nav-item.active {
    color: var(--brass-bright);
  }
  .mobile-nav-item.active svg { transform: scale(1.05); }
  .mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 30%;
    right: 30%;
    height: 3px;
    background: var(--brass);
    border-radius: 0 0 3px 3px;
  }

  .mobile-nav-dot {
    position: absolute;
    top: 6px;
    right: 30%;
    width: 7px;
    height: 7px;
    background: #e57b6b;
    border-radius: 50%;
    border: 1px solid rgba(13,20,16,0.95);
  }

  /* Hide the desktop sidebar on mobile */
  .sidebar { display: none !important; }
  .app { grid-template-columns: 1fr !important; }

  /* Topbar adjustments */
  .greet-eyebrow { font-size: 10px; }
  .greet-title { font-size: 18px; }

  /* The main content has nice horizontal padding */
  .main { padding-left: 14px !important; padding-right: 14px !important; }

  /* Cards full bleed */
  .panel { border-radius: 14px; }

  /* Buttons larger tap target */
  .btn { min-height: 42px; padding: 10px 16px; }
  .btn-sm { min-height: 34px; padding: 6px 12px; }

  /* Inputs larger so they don't trigger zoom on iOS */
  input, select, textarea, .input, .select { font-size: 16px !important; }
}

/* ============ "More" bottom sheet ============ */
.mob-sheet {
  position: fixed; inset: 0;
  z-index: 200;
  display: none;
  pointer-events: none;
}
.mob-sheet.show { display: block; pointer-events: auto; }
.mob-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.mob-sheet.show .mob-sheet-backdrop { opacity: 1; }

.mob-sheet-content {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--felt-deep, #1c3227);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 8px 16px calc(28px + var(--safe-bottom)) 16px;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -16px 40px rgba(0,0,0,0.5);
}
.mob-sheet.show .mob-sheet-content { transform: translateY(0); }

.mob-sheet-handle {
  width: 40px; height: 4px;
  background: var(--line-strong);
  border-radius: 999px;
  margin: 8px auto 18px;
}

.mob-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mob-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 14px;
  background: rgba(244, 234, 213, 0.04);
  text-decoration: none;
  color: var(--bone);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  position: relative;
  transition: transform 0.12s ease, background 0.12s ease;
}
.mob-sheet-item:active { transform: scale(0.96); background: rgba(244, 234, 213, 0.08); }
.mob-sheet-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  background: rgba(201, 169, 97, 0.1);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--brass-bright);
  font-weight: 600;
}

/* ============ Install banner ============ */
.install-banner {
  position: fixed;
  bottom: calc(72px + var(--safe-bottom));
  left: 12px; right: 12px;
  z-index: 150;
  background: var(--felt-deep, #1c3227);
  border: 1px solid var(--brass);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: slideUp 0.4s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.install-banner-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
}
.install-icon {
  width: 48px; height: 48px;
  background: var(--brass);
  color: var(--felt-base, #0d1410);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 28px;
  font-family: serif;
  flex-shrink: 0;
}
.install-text { flex: 1; min-width: 0; font-size: 13px; }
.install-text strong { font-size: 14px; }
.install-subtext { color: var(--bone-dim); font-size: 11px; margin-top: 2px; }
.install-dismiss {
  background: transparent;
  border: none;
  color: var(--bone-dim);
  font-size: 22px;
  width: 28px; height: 28px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Hide install banners by default; JS shows them at the right time */
@media (min-width: 901px) {
  .install-banner { display: none !important; }
  .mobile-nav { display: none !important; }
  .mob-sheet { display: none !important; }
}

/* ============ Slide-in page transitions on mobile ============ */
@media (max-width: 900px) {
  .main {
    animation: pageIn 0.22s ease-out;
  }
  @keyframes pageIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  body.rtl .main { animation: pageInRtl 0.22s ease-out; }
  @keyframes pageInRtl {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
  }
}

/* ============ Pull-to-refresh indicator ============ */
.ptr-indicator {
  position: fixed;
  top: calc(var(--safe-top) + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-50px);
  width: 36px; height: 36px;
  background: var(--brass);
  color: var(--felt-base, #0d1410);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px;
  z-index: 200;
  transition: transform 0.18s ease;
  pointer-events: none;
}
.ptr-indicator.pulling { transform: translateX(-50%) translateY(20px); }
.ptr-indicator.refreshing { transform: translateX(-50%) translateY(20px); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: translateX(-50%) translateY(20px) rotate(360deg); } }

/* ============ Chat mobile improvements ============ */
@media (max-width: 900px) {
  .chat-shell {
    height: calc(100vh - 70px - var(--safe-bottom) - 90px);
    flex-direction: column !important;
  }
  .chat-channels { display: none; }
  .chat-channels.show {
    display: block !important;
    position: fixed; inset: 0;
    z-index: 100;
    background: var(--felt-base, #0d1410);
  }
  .chat-input-row {
    position: sticky;
    bottom: 0;
    padding-bottom: 8px;
    background: var(--felt-deep, #1c3227);
  }
}

/* ============ iOS-only helpers ============ */
.ios-only { display: none; }
html.ios .ios-only { display: block; }
html.ios .android-only { display: none; }

