:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --panel: #ffffff;
  --panel-soft: #eef3ee;
  --text: #17201d;
  --muted: #66746d;
  --border: #d9e0dc;
  --accent: #23413a;
  --accent-2: #d7a84f;
  --danger: #a33a3a;
  --ok: #286a46;
  --shadow: 0 16px 36px rgba(23, 32, 29, .08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
}

.shell {
  min-height: 100vh;
}

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

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
}

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

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 4vw, 40px) 48px;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}

.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}

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

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

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

.panel,
.stat,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23, 32, 29, .05);
}

.panel {
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.stat {
  padding: 16px;
  min-height: 104px;
}

.stat-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 8px;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 800;
}

.stat-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: .82rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 65, 58, .12);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.btn.secondary {
  background: var(--panel-soft);
  color: var(--accent);
}

.btn:disabled {
  opacity: .55;
  cursor: wait;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0;
  overflow-x: auto;
}

.tab {
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}

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

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

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
}

.gain {
  color: var(--ok);
  font-weight: 800;
}

.loss {
  color: var(--danger);
  font-weight: 800;
}

.notice {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #fff5dc;
  color: #65420d;
  border: 1px solid #ebd59c;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .grid.stats,
  .grid.two,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand-subtitle {
    display: none;
  }
}

