:root {
  --bg-main: radial-gradient(circle at 10% 20%, #eff6ff, transparent 40%),
    radial-gradient(circle at 90% 0%, #fee2e2, transparent 35%), #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 6px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg-main);
}

.page {
  min-height: 100vh;
  padding: 20px 14px;
}

.container {
  margin: 0 auto;
  max-width: 1400px;
}

.header-card {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  box-shadow: var(--shadow-md);
  padding: 20px 24px;
}

.header-title {
  margin: 0;
  font-family: 'Exo 2', 'Manrope', sans-serif;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.2;
}

.header-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(420px, 1.7fr) minmax(280px, 1fr) minmax(540px, 2fr);
    align-items: start;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-body {
  padding: 12px 14px 14px;
}

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

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  transition: 0.15s ease;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: #cbd5e1;
}

.btn-full {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.materials-list {
  display: grid;
  gap: 8px;
}

.material-item {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.material-title {
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

.material-meta {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.material-price {
  text-align: right;
  min-width: 120px;
}

.material-input {
  width: 118px;
  text-align: right;
  font-size: 12px;
  padding: 6px 8px;
}

.material-price-display {
  font-size: 12px;
  font-weight: 800;
  color: #1e3a8a;
}

.prices-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.results-wrap {
  min-height: 180px;
}

.placeholder {
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-muted);
  text-align: center;
  padding: 40px 12px;
  font-size: 13px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid #dbeafe;
  padding: 7px 9px;
  font-size: 11px;
}

.results-table th {
  background: #dbeafe;
  color: #1e3a8a;
  font-weight: 800;
  text-transform: uppercase;
}

.results-table tbody tr:nth-child(even) {
  background: #f8fbff;
}

.results-table tbody tr:hover {
  background: #edf4ff;
}

.results-table td:last-child {
  font-weight: 800;
  color: #1e3a8a;
}

.hidden {
  display: none !important;
}

.invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.card-materials .card-body {
  max-height: 460px;
  overflow-y: auto;
}

.card-materials.collapsed .card-body {
  max-height: 220px;
}

.status-message {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-error {
  color: #9f1239;
  background: var(--danger-soft);
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 8px;
}
