:root,
[data-theme="white"] {
  --bg: #f5f5f5;
  --bg-soft: #ffffff;
  --rail: #ffffff;
  --text: #111111;
  --muted: #6a6a6a;
  --line: #e4e4e4;
  --line-strong: #d0d0d0;
  --hover: #f0f0f0;
  --select: #ececec;
  --accent: #111111;
  --accent-text: #ffffff;
  --ok-bg: #ececec;
  --wait-bg: #111111;
  --wait-text: #ffffff;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  --thumb-bg: #f0f0f0;
}

[data-theme="black"] {
  --bg: #0b0b0b;
  --bg-soft: #141414;
  --rail: #101010;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --line: #262626;
  --line-strong: #3a3a3a;
  --hover: #1a1a1a;
  --select: #222222;
  --accent: #f4f4f4;
  --accent-text: #111111;
  --ok-bg: #222222;
  --wait-bg: #f4f4f4;
  --wait-text: #111111;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --thumb-bg: #1a1a1a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(1200px 500px at 0% 0%, color-mix(in srgb, var(--text) 4%, transparent), transparent 55%),
    var(--bg);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
}

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

.app {
  min-height: 100vh;
}

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

.mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--text) 46%, transparent 46% 54%, color-mix(in srgb, var(--text) 35%, transparent) 54%);
}

.brand-kicker,
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

.brand h1 {
  font-size: 22px;
}

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.theme-switch button {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 8px 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.theme-switch button.is-on {
  background: var(--accent);
  color: var(--accent-text);
}

.main {
  padding: 0 28px 48px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px 12px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.page-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.page-tabs a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0.65;
}

.page-tabs a.is-on,
.page-tabs a:hover {
  background: var(--accent);
  color: var(--accent-text);
  opacity: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.btn.tiny {
  padding: 5px 8px;
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.card.paper {
  background: var(--text);
  color: var(--bg);
}

.card .label,
.card.paper .label {
  color: var(--muted);
  font-size: 13px;
}

.card.paper .label {
  color: color-mix(in srgb, var(--bg) 70%, var(--text));
}

.amount {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 26px;
  margin-top: 8px;
  letter-spacing: -0.04em;
}

.founder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.meta {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.sheet-help {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  max-width: 820px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

#founders-block {
  margin-bottom: 16px;
}

.budget-cell {
  display: grid;
  gap: 6px;
}

.card.paper .budget-cell input {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 22px;
  padding: 6px 0;
  background: transparent;
  color: inherit;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 0;
}

.team-form input[name="name"] {
  font-size: 18px;
  font-weight: 600;
  padding: 6px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.grid-wrap {
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  max-height: calc(100vh - 360px);
  min-height: 240px;
}

table.sheet {
  width: max(100%, 1240px);
  border-collapse: collapse;
  table-layout: fixed;
}

.sheet th,
.sheet td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  vertical-align: stretch;
  font-size: 13px;
}

.sheet th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--hover);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 8px;
  text-align: left;
}

.sheet tr:hover td {
  background: color-mix(in srgb, var(--hover) 70%, var(--bg-soft));
}

.sheet .col-n {
  width: 44px;
  text-align: center;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  padding: 8px 4px;
}

.sheet .col-who { width: 150px; }
.sheet .col-what { width: auto; }
.sheet .col-amt { width: 128px; }
.sheet .col-when { width: 188px; }
.sheet .col-shot { width: 168px; }
.sheet .col-refund { width: 110px; }
.sheet .col-act { width: 78px; }

.cell {
  width: 100%;
  height: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  outline: none;
  border-radius: 0;
}

.cell:focus {
  box-shadow: inset 0 0 0 2px var(--text);
  background: var(--bg-soft);
}

.cell.money {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-align: right;
}

.shot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px;
  min-height: 44px;
}

.shot-link {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--text);
}

.receipt-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--thumb-bg);
}

.check-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  min-height: 44px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}

.badge.ok {
  background: var(--ok-bg);
}

.badge.wait {
  background: var(--wait-bg);
  color: var(--wait-text);
}

.hidden {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #000 55%, transparent);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.lightbox img,
.lightbox embed,
.lightbox video {
  max-width: min(920px, 100%);
  max-height: 88vh;
  border-radius: 8px;
}

.promo-drop {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  background: var(--bg-soft);
  margin-bottom: 16px;
}

.promo-drop.is-over {
  border-color: var(--text);
  background: var(--hover);
}

.promo-drop input[type="file"] {
  margin: 12px auto 0;
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.promo-card video,
.promo-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--thumb-bg);
  border-radius: 8px;
}

.promo-card .pdf-slot {
  height: 160px;
  display: grid;
  place-items: center;
  background: var(--hover);
  border-radius: 8px;
}

.promo-card input[name="title"] {
  width: 100%;
  margin-top: 10px;
  font-weight: 600;
}

.promo-card .meta {
  margin-top: 8px;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .page-tabs,
  .top-actions {
    justify-self: stretch;
  }
}

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 30;
}

.empty {
  color: var(--muted);
  padding: 20px;
}

.team-form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
}

@media (max-width: 980px) {
  .topbar,
  .main {
    padding-left: 16px;
    padding-right: 16px;
  }
}
