:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --panel: #ffffff;
  --ink: #17201d;
  --muted: #61706a;
  --line: #d9dfd8;
  --accent: #0b7a75;
  --accent-dark: #075853;
  --warn: #a84d10;
  --good: #14733b;
  --bad: #a22626;
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 700;
}

button.secondary {
  background: #e8ece7;
  color: var(--ink);
}

button.danger {
  background: var(--bad);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(247, 248, 243, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: 0 0 auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

.brand-block h1,
.brand-block p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar p,
.muted {
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.flash {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f1;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.flash.success {
  background: #e5f4ea;
  border-color: #b9dfc5;
  color: var(--good);
}

.flash.error {
  background: #f9e1e1;
  border-color: #efbbbb;
  color: var(--bad);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric-notice {
  grid-column: 1 / -1;
  background: #fff7df;
}

.metric,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 20px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
}

.tab {
  background: #e8ece7;
  color: var(--ink);
}

.tab.active {
  background: var(--accent-dark);
  color: #fff;
}

.view {
  display: grid;
  gap: 12px;
}

.hidden {
  display: none !important;
}

.card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf0ee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.verified,
.badge.approved {
  background: #dff1e5;
  color: var(--good);
}

.badge.pending_review,
.badge.pending_client_payment {
  background: #fff0d6;
  color: var(--warn);
}

.badge.rejected {
  background: #f8dddd;
  color: var(--bad);
}

.actions,
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.invoice {
  overflow-wrap: anywhere;
  padding: 10px;
  border-radius: 8px;
  background: #f0f3ef;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.payment-panel,
.confirm-payment-form {
  display: grid;
  gap: 10px;
}

.leader-row,
.team-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.leader-row:first-child,
.team-row:first-child {
  border-top: 0;
}

.rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8ece7;
  font-weight: 800;
}

.proof-img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f3ef;
}

.review-item {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.review-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.notice {
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef6f5;
  color: var(--accent-dark);
  font-size: 14px;
}

@media (min-width: 740px) {
  main {
    padding: 22px;
  }

  #tasksView {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .status-strip {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}
