:root {
  --bg: #0b1220;
  --bg-top: #08101d;
  --bg-bottom: #0c1525;
  --panel: rgba(17, 26, 45, 0.92);
  --panel-2: #16223b;
  --panel-3: #1b2a49;
  --text: #e8eefc;
  --muted: #9eb0d1;
  --line: #283754;
  --primary: #4ea1ff;
  --primary-strong: #3c93f5;
  --good: #35c26b;
  --bad: #ff7272;
  --warn: #d9a441;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  --radius: 18px;
  --radius-sm: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--text);
}

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

button,
input,
select {
  margin: 0;
}

button {
  cursor: pointer;
}

.container {
  width: min(1280px, calc(100% - 32px));
  margin: 32px auto 48px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.2;
}

.subtext {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 1.05rem;
}

.cards,
.layout-grid {
  display: grid;
  gap: 20px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.layout-grid {
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.stat-card {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card strong {
  margin-top: 10px;
  font-size: clamp(1.8rem, 2.2vw, 2.2rem);
  line-height: 1.1;
  word-break: break-word;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-width: 0;
}

.form-grid > * {
  min-width: 0;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.form-grid label span {
  font-size: 0.92rem;
  color: var(--muted);
}

.form-grid input,
.form-grid select,
.toolbar select,
button.small,
button.primary,
button.ghost {
  width: 100%;
  min-width: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 14px;
  line-height: 1.2;
}

.form-grid input:focus,
.form-grid select:focus,
.toolbar select:focus,
button:focus {
  outline: 2px solid rgba(78, 161, 255, 0.35);
  outline-offset: 0;
  border-color: var(--primary);
}

.form-grid input::placeholder {
  color: #7f93b8;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.form-actions button {
  width: auto;
  min-width: 140px;
  max-width: 180px;
}

button.primary {
  background: var(--primary);
  color: #08101d;
  border-color: transparent;
  font-weight: 700;
}

button.primary:hover {
  background: var(--primary-strong);
}

button.ghost {
  width: auto;
  background: transparent;
  color: var(--text);
}

button.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

button.small {
  width: auto;
  padding: 8px 10px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.hidden {
  display: none;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar select {
  width: auto;
  min-width: 124px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

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

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

th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

td.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.badge.pending {
  background: rgba(217, 164, 65, 0.15);
  color: #f0c66a;
}

.badge.win {
  background: rgba(53, 194, 107, 0.15);
  color: #70dfa0;
}

.badge.loss {
  background: rgba(255, 114, 114, 0.14);
  color: #ff9797;
}

.badge.void {
  background: rgba(158, 176, 209, 0.14);
  color: #c4d4f1;
}

.profit-positive {
  color: var(--good);
  font-weight: 700;
}

.profit-negative {
  color: var(--bad);
  font-weight: 700;
}

@media (max-width: 1280px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .container {
    width: min(100% - 20px, 100%);
    margin: 20px auto 32px;
  }

  .card {
    padding: 16px;
  }

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 20px;
}

  .stacked-mobile {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head {
    align-items: stretch;
  }

  .toolbar select,
  .form-actions button,
  button.ghost {
    width: 100%;
    max-width: none;
  }
}

.stat-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.calc-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.calc-preview-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.calc-preview-item strong {
  font-size: 1rem;
  line-height: 1.2;
}

input[readonly] {
  background: #12203a;
}

@media (max-width: 760px) {
  .calc-preview {
    grid-template-columns: 1fr;
  }
}

.toolbar input[type="date"] {
  width: auto;
  min-width: 150px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 14px;
  line-height: 1.2;
}

.toolbar input[type="date"]:focus {
  outline: 2px solid rgba(78, 161, 255, 0.35);
  outline-offset: 0;
  border-color: var(--primary);
}

.toolbar button.ghost {
  width: auto;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .toolbar input[type="date"] {
    width: 100%;
  }
}

.stat-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
