:root {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #181c25;
  --panel-2: #202636;
  --text: #f4f7fb;
  --muted: #9aa6b7;
  --line: #30384a;
  --accent: #34d399;
  --accent-2: #60a5fa;
  --warning: #f59e0b;
  --danger: #fb7185;
  --radius: 8px;
  font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(52, 211, 153, 0.14), transparent 30%),
    linear-gradient(315deg, rgba(96, 165, 250, 0.14), transparent 32%),
    var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 24px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  margin-bottom: 10px;
  font-size: 30px;
}

h3 {
  margin-bottom: 16px;
  font-size: 20px;
}

.tabs,
.filters,
.form-actions,
.lookup,
.panel-head,
.admin-actions {
  display: flex;
  gap: 8px;
}

.tabs {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tab,
.filter,
.secondary,
.admin-actions button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.tab.active,
.filter.active,
.primary {
  background: var(--accent);
  color: #052016;
  font-weight: 800;
}

.primary {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.intro > div:first-child,
.panel {
  border: 1px solid var(--line);
  background: rgba(24, 28, 37, 0.92);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.intro p,
.muted,
.note {
  color: var(--muted);
}

.status-strip {
  display: grid;
  gap: 8px;
}

.status-strip span {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(32, 38, 54, 0.8);
  color: #d7e0ee;
}

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

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #cdd6e6;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #10141f;
  color: var(--text);
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.note {
  margin: 10px 0 0;
}

.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.hidden {
  display: none;
}

.panel-head {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 14px;
}

.filters {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.deal-list {
  display: grid;
  gap: 12px;
}

.deal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111722;
  padding: 16px;
}

.deal-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.deal-card strong {
  font-size: 18px;
}

.deal-skin {
  margin: 4px 0 0;
  color: #dce6f5;
}

.badge {
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 800;
}

.badge.paid {
  background: rgba(52, 211, 153, 0.18);
  color: #bbf7d0;
}

.badge.transferred {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
}

.badge.closed {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.badge.dispute {
  background: rgba(251, 113, 133, 0.18);
  color: #fecdd3;
}

dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.deal-comment {
  margin-bottom: 14px;
  color: #cdd6e6;
}

.admin-actions {
  flex-wrap: wrap;
}

.admin-actions button:hover,
.secondary:hover,
.tab:hover,
.filter:hover {
  border-color: #50607a;
}

.deal-result {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #111722;
}

.deal-result.empty {
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.timeline-step {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--muted);
}

.timeline-step.done {
  border-color: rgba(52, 211, 153, 0.5);
  color: #d1fae5;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 14px;
  }

  .topbar,
  .intro,
  .admin-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .tabs {
    justify-content: stretch;
  }

  .tab {
    flex: 1;
  }

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

  .lookup,
  .form-actions {
    display: grid;
  }
}
