:root {
  --navy: #1e3a5f;
  --blue: #2c5282;
  --teal: #285e61;
  --amber: #744210;
  --calc-bg: #edf2f7;
  --final-bg: #fefcbf;
  --border: #cbd5e0;
  --bg: #f7fafc;
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: #1a202c;
}

.app-header {
  background: var(--navy);
  color: #fff;
  padding: 1rem 1.5rem;
}

.header-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.header-content h1 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.header-content p {
  margin: 0;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.9; }
.btn-primary { background: #3182ce; color: #fff; }
.btn-secondary { background: #4a5568; color: #fff; }
.btn-success { background: #2f855a; color: #fff; }
.btn-danger { background: #c53030; color: #fff; }
.btn-install { background: #d69e2e; color: #1a202c; }

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
}

.stat-card.highlight {
  background: var(--final-bg);
  border-color: #d69e2e;
}

.stat-label {
  font-size: 0.8rem;
  color: #4a5568;
}

.stat-card strong {
  font-size: 1.3rem;
  color: var(--navy);
  margin-top: 0.2rem;
}

.table-wrapper {
  margin: 0 1.5rem 2rem;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 70vh;
}

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

th, td {
  border: 1px solid var(--border);
  padding: 0.45rem;
  text-align: center;
  font-size: 0.85rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.bg-dark { background: var(--navy); color: #fff; }
.bg-blue { background: var(--blue); color: #fff; }
.bg-teal { background: var(--teal); color: #fff; }
.bg-amber { background: var(--amber); color: #fff; }

.col-header th {
  background: #2d3748;
  color: #fff;
  white-space: nowrap;
}

.col-header th.calc-head { background: var(--teal); }
.col-header th.final-head { background: var(--amber); }

.sticky-col {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 5;
  min-width: 180px;
}

thead .sticky-col {
  background: var(--navy);
  z-index: 15;
}

input[type="text"], input[type="number"] {
  width: 100%;
  border: 1px solid transparent;
  padding: 0.35rem;
  text-align: center;
  font-size: 0.9rem;
  background: transparent;
  border-radius: 4px;
}

input[type="text"] {
  text-align: right;
  font-weight: 600;
}

input:focus {
  outline: none;
  border-color: #3182ce;
  background: #ebf8ff;
}

input.invalid {
  background: #fed7d7;
  border-color: #e53e3e;
}

.calc-cell {
  background: var(--calc-bg);
  font-weight: 700;
  color: var(--teal);
}

.final-cell {
  background: var(--final-bg);
  font-weight: 800;
  color: var(--amber);
  font-size: 0.95rem;
}

.del-btn {
  background: transparent;
  border: none;
  color: #e53e3e;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
}