:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #d9e2ec;
  --race: #0f766e;
  --race-dark: #115e59;
  --gold: #b7791f;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: #111827;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #263244;
  --race: #2dd4bf;
  --race-dark: #14b8a6;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

body[dir="rtl"] {
  font-family: Tahoma, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-inline-end: 1px solid var(--line);
  background: var(--panel);
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--race);
  color: white;
  font-weight: 800;
}

.brand-title {
  margin: 0;
  font-size: 18px;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button,
.icon-button,
.primary-button,
.ghost-button {
  cursor: pointer;
}

.nav button {
  border: 0;
  width: 100%;
  text-align: start;
  padding: 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.nav button.active,
.nav button:hover {
  background: color-mix(in srgb, var(--race) 12%, transparent);
  color: var(--race);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(14px);
}

.page-title {
  margin: 0;
  font-size: 23px;
}

.page-kicker {
  margin: 0 0 4px;
  color: var(--race);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button,
.ghost-button,
.primary-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}

.icon-button {
  width: 40px;
}

.ghost-button,
.primary-button {
  padding: 0 14px;
}

.primary-button {
  border-color: var(--race);
  background: var(--race);
  color: white;
}

.mini-button {
  min-height: 32px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.danger-button,
.danger-text {
  color: var(--danger);
}

.account-badge,
.readonly {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--race) 40%, var(--line));
  padding: 0 12px;
  color: var(--race);
  font-size: 13px;
  font-weight: 800;
}

.readonly {
  border-color: var(--line);
  color: var(--muted);
}

.content {
  padding: 26px 28px 80px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.two-col {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

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

.stat {
  padding: 20px;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  margin: 8px 0 0;
  font-size: 29px;
  font-weight: 800;
}

.stat-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.searchbar {
  display: flex;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.searchbar input,
.searchbar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
}

.login-card {
  padding: 22px;
}

.login-card h2 {
  margin: 0 0 18px;
}

.login-card label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-card input,
.login-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  margin-bottom: 6px;
}

.login-card button {
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.52);
}

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 22px;
}

.modal-card h2 {
  margin: 0 0 18px;
}

.modal-card label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-card input,
.modal-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.confirmed,
.paid,
.approved {
  background: #dcfce7;
  color: #166534;
}

.pending,
.negotiating {
  background: #fef3c7;
  color: #92400e;
}

.invited {
  background: #dbeafe;
  color: #1d4ed8;
}

.declined,
.failed {
  background: #fee2e2;
  color: #991b1b;
}

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

.mini-card {
  padding: 18px;
}

.mini-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.mini-card span {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  padding: 14px 16px;
  border-inline-start: 4px solid var(--gold);
  color: var(--muted);
}

.hidden {
  display: none;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .stats,
  .two-col,
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .content,
  .sidebar {
    padding-inline: 16px;
  }

  .stats,
  .two-col,
  .cards {
    grid-template-columns: 1fr;
  }

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

  .searchbar {
    flex-direction: column;
  }
}
