:root {
  --bg-dark: #1e2329;
  --bg-card: #2b313a;
  --text-main: #c9d1d9;
  --text-muted: #8b949e;
  --accent-orange: #e36209;
  --accent-hover: #f9826c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.5;
}

.container { max-width: 960px; margin: 0 auto; padding: 20px; }

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--bg-card);
}

.branding { text-decoration: none; color: inherit; }
.logo { font-size: 1.5rem; font-weight: 700; color: #fff; letter-spacing: 1px; }
.logo .highlight { color: var(--accent-orange); font-family: 'JetBrains Mono', monospace; font-weight: 600; }

.subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: -2px; }

/* Form */
.add-bar {
  background-color: var(--bg-card); padding: 16px 20px; border-radius: 8px;
  display: flex; gap: 12px; align-items: flex-end; margin-top: 24px; flex-wrap: wrap;
}

.form-group { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-group label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select {
  background-color: var(--bg-dark); border: 1px solid #444c56; border-radius: 5px;
  padding: 8px 12px; color: white; font-family: inherit; font-size: 0.9rem; width: 100%; height: 38px;
}


.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent-orange); }

/* Buttons */
.btn {
  background-color: var(--accent-orange); color: white; padding: 8px 16px;
  border-radius: 5px; font-weight: bold; cursor: pointer; border: none;
  transition: background-color 0.3s ease;
}
.btn:hover { background-color: var(--accent-hover); }

.btn-sm { padding: 6px 10px; font-size: 0.75rem; border-radius: 4px; }
.btn-danger { background-color: #c9382d; }
.btn-danger:hover { background-color: #e54a3f; }

/* Table */
table { width: 100%; border-collapse: collapse; margin-top: 24px; }
th, td { padding: 10px 14px; text-align: left; font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: normal; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; border-bottom: 2px solid var(--bg-card); }
tr:not(:last-child) td { border-bottom: 1px solid #343b45; }

.rate-cell { font-family: 'JetBrains Mono', monospace; color: var(--accent-orange); font-size: 1rem; }
.qty-cell { font-family: 'JetBrains Mono', monospace; color: white; }
.red-cell { color:#ff6b6b; font-weight:bold; }
.green-cell { color:#51cf66; font-weight:bold; }

/* Edit modal */
.modal-overlay { display: none; position: fixed; inset: 0; background-color: rgba(0,0,0,0.7); justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.show { display: flex; opacity: 1; }

.modal-box { background-color: var(--bg-card); padding: 20px; border-radius: 8px; width: 280px; border-top: 4px solid var(--accent-orange); }
.modal-close { float: right; color: var(--text-muted); font-size: 1.5rem; background: none; border: none; cursor: pointer; padding: 0 4px; }

/* Toast */
.toast { position: fixed; bottom: 30px; right: 30px; background-color: var(--accent-orange); color: white; padding: 12px 20px; border-radius: 6px; display: none; z-index: 2000; font-weight: bold; transition: opacity 0.5s ease; }

/* Input/Output aggregation */
.agg-container { display:flex; gap:24px; margin-top:8px; align-items:flex-start; flex-wrap:wrap; justify-content:center; }
.agg-table { width:100%; border-collapse:collapse; background-color:var(--bg-card); border-radius:6px; overflow:hidden; }
.agg-table th, .agg-table td { padding:8px 14px; text-align:left; font-size:0.9rem; }
.agg-table th { color:var(--text-muted); font-weight:normal; font-size:0.75rem; text-transform:uppercase; letter-spacing:1px; border-bottom:2px solid #343b45; background-color:rgba(0,0,0,.15); }
.agg-table tr:not(:last-child) td { border-bottom:1px solid #343b45; }

/* Empty state */
.empty-state { text-align: center; color: var(--text-muted); margin-top: 40px; font-style: italic; }

/* Responsive */
@media (max-width: 768px) {
  .add-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  th, td { padding: 8px 10px; font-size: 0.8rem; }
}
