/* ============================================================
   Zimm Car Audio Battery Calculator - Premium Theme
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-deepest: #0a0a0a;
  --bg-dark: #111111;
  --bg-card: #1a1a1a;
  --bg-input: #1a1a1a;
  --bg-hover: #222222;
  --bg-row-alt: #141414;

  --silver: #c0c0c0;
  --silver-light: #d4d4d4;
  --silver-bright: #e0e0e0;
  --white: #f5f5f5;
  --text-muted: #888888;

  --accent: #b8860b;
  --accent-hover: #d4a017;
  --accent-glow: rgba(184, 134, 11, 0.25);

  --border: #2a2a2a;
  --border-silver: rgba(192, 192, 192, 0.2);
  --border-silver-hover: rgba(192, 192, 192, 0.4);

  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.25s ease;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(192, 192, 192, 0.08);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-deepest);
  color: var(--silver-light);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--silver-bright);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--white);
  font-weight: 600;
  line-height: 1.25;
}
h1 { font-size: 2rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.6rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* --- Header / Logo --- */
.site-header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #111111 0%, var(--bg-deepest) 100%);
}

.site-header .container {
  max-width: 1100px;
  margin: 0 auto;
}

.site-header .logo {
  display: block;
  max-width: 300px;
  margin: 0 auto 0.75rem;
}

.site-header .logo img {
  filter: invert(1) brightness(1.8);
  opacity: 0.9;
  transition: opacity var(--transition);
}
.site-header .logo img:hover {
  opacity: 1;
}

.main-nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0;
  margin: 0;
}

.main-nav a {
  color: var(--silver);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--white);
  border-bottom-color: var(--accent);
}

.site-header h1 {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--silver);
}

.site-header .tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  letter-spacing: 0.05em;
}

/* --- Layout --- */
.site-main {
  min-height: calc(100vh - 200px);
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-deepest) 100%);
}

.hero h1 {
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Calculator Section --- */
.calculator-section {
  padding: 2.5rem 1rem;
}

.calculator-section form {
  background: var(--bg-card);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.form-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.clickable-row {
  cursor: pointer;
}
.clickable-row:hover td {
  background: rgba(192, 192, 192, 0.05);
}

.text-muted {
  color: var(--text-muted);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

fieldset legend {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--silver);
  padding: 0 0.5rem;
  letter-spacing: 0.03em;
}

.simulator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .simulator-grid { grid-template-columns: 1fr; }
}
.simulator-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.simulator-panel h2 {
  font-size: 1.1rem;
  color: var(--silver);
  margin-bottom: 1.25rem;
  letter-spacing: 0.03em;
}
.btn-lg {
  padding: 0.9rem 2.5rem;
  font-size: 1.1rem;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Results Section --- */
.result-summary {
  text-align: center;
  margin-bottom: 2rem;
}

.result-item {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius);
  display: inline-block;
  margin: 0.5rem;
}

.result-item--highlight {
  border-color: var(--accent);
  background: linear-gradient(135deg, #1a1a0a, #1a1a1a);
}

.result-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.result-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--white);
}

.result-unit {
  display: block;
  font-size: 0.9rem;
  color: var(--silver);
}

/* --- Cell Cards --- */
.cell-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.cell-card {
  background: var(--bg-card);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.cell-card:hover {
  border-color: var(--border-silver-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.cell-card:first-child {
  border-color: var(--accent);
}

.cell-card__rank {
  position: absolute;
  top: -0.6rem;
  right: 1rem;
  background: var(--accent);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 3px;
}

.cell-card__name {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--white);
}

.cell-card__specs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.cell-card__specs dt {
  color: var(--text-muted);
}

.cell-card__specs dd {
  color: var(--silver-bright);
  font-weight: 500;
}

.cell-card__price {
  font-size: 1.1rem;
  color: var(--accent-hover) !important;
  font-weight: 700 !important;
}

/* --- Cost Table --- */
.cost-table {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 1.5rem;
  border-collapse: collapse;
}

.cost-table th,
.cost-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.cost-table th {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.9rem;
}

.cost-table td {
  text-align: right;
  color: var(--silver-bright);
}

.cost-table__total td,
.cost-table__total th {
  border-top: 2px solid var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-silver-hover);
  box-shadow: var(--shadow-glow);
}

.card-header {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--silver);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.form-group .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--white);
  background: var(--bg-input);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--silver);
  box-shadow: 0 0 0 3px rgba(192, 192, 192, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: #555;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c0c0c0' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

select option {
  background: var(--bg-dark);
  color: var(--white);
}

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

/* --- Radio / Checkbox groups --- */
.radio-group,
.checkbox-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.radio-option,
.checkbox-option {
  position: relative;
}

.radio-option input,
.checkbox-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-option label,
.checkbox-option label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border-silver);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--silver);
  background: var(--bg-dark);
  transition: all var(--transition);
  user-select: none;
}

.radio-option input:checked + label,
.checkbox-option input:checked + label {
  border-color: var(--accent);
  color: var(--white);
  background: rgba(184, 134, 11, 0.1);
  box-shadow: 0 0 8px var(--accent-glow);
}

.radio-option label:hover,
.checkbox-option label:hover {
  border-color: var(--border-silver-hover);
  color: var(--white);
}

/* --- Range Slider --- */
.range-wrap {
  position: relative;
}

.range-value {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
  min-width: 3.5rem;
  text-align: center;
  margin-bottom: 0.35rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--silver-bright) 0%, var(--silver) 100%);
  border: 2px solid var(--bg-deepest);
  box-shadow: 0 0 6px rgba(192, 192, 192, 0.3);
  transition: box-shadow var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 12px rgba(192, 192, 192, 0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--silver-bright) 0%, var(--silver) 100%);
  border: 2px solid var(--bg-deepest);
  box-shadow: 0 0 6px rgba(192, 192, 192, 0.3);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border-silver);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #9a7209 100%);
  color: var(--white);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  box-shadow: 0 0 18px var(--accent-glow);
}

.btn-secondary {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  color: var(--silver-bright);
  border-color: var(--border-silver);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--silver);
  box-shadow: 0 0 14px rgba(192, 192, 192, 0.1);
  color: var(--white);
}

.btn-danger {
  background: linear-gradient(135deg, #6b1a1a 0%, #4a1111 100%);
  color: #f5a0a0;
  border-color: #6b1a1a;
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #8b2a2a 0%, #6b1a1a 100%);
  box-shadow: 0 0 14px rgba(200, 50, 50, 0.2);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.9rem 2.2rem;
  font-size: 1rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-silver);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: var(--bg-dark);
  color: var(--silver-bright);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: default;
}

thead th.sortable {
  cursor: pointer;
  user-select: none;
}

thead th.sortable:hover {
  color: var(--white);
}

thead th .sort-icon {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.7rem;
  opacity: 0.4;
}

thead th.sort-asc .sort-icon,
thead th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--accent);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:nth-child(even) {
  background: var(--bg-row-alt);
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--silver);
}

tbody td:last-child {
  white-space: nowrap;
}

.table-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Results Section --- */
.results-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.results-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.results-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #111111 100%);
  border: 1px solid var(--border-silver-hover);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-glow), var(--shadow-card);
}

.results-card .result-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(42, 42, 42, 0.6);
}

.result-row:last-child {
  border-bottom: none;
}

.result-label {
  font-size: 0.9rem;
  color: var(--silver);
}

.result-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}

.result-highlight {
  font-size: 1.3rem;
  color: var(--accent-hover);
}

.config-diagram {
  background: var(--bg-deepest);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85rem;
  color: var(--silver);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.5;
}

.cost-breakdown {
  margin-top: 1rem;
}

.cost-breakdown .cost-item {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  font-size: 0.88rem;
}

.cost-breakdown .cost-item.total {
  border-top: 1px solid var(--border-silver);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--white);
}

/* --- Alerts / Messages --- */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid;
}

.alert-error {
  background: rgba(200, 50, 50, 0.1);
  border-color: rgba(200, 50, 50, 0.3);
  color: #f5a0a0;
}

.alert-success {
  background: rgba(50, 180, 50, 0.1);
  border-color: rgba(50, 180, 50, 0.3);
  color: #a0f5a0;
}

.alert-info {
  background: rgba(50, 130, 200, 0.1);
  border-color: rgba(50, 130, 200, 0.3);
  color: #a0c8f5;
}

/* --- Loading Spinner --- */
.spinner-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.spinner-overlay.active {
  display: flex;
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--silver);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Badge / Status --- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-draft   { background: rgba(136,136,136,0.2); color: #aaa; }
.badge-sent    { background: rgba(50,130,200,0.2);  color: #7db8f0; }
.badge-accepted{ background: rgba(50,180,50,0.2);   color: #7de07d; }
.badge-rejected{ background: rgba(200,50,50,0.2);   color: #f0a0a0; }

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.pagination a,
.pagination span {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-silver);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--silver);
  transition: all var(--transition);
}

.pagination a:hover {
  border-color: var(--silver);
  color: var(--white);
}

.pagination .active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

/* --- Modal --- */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.modal-title {
  font-size: 1.15rem;
  color: var(--white);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ============================================================
   Admin Panel Layout
   ============================================================ */
.admin-layout {
  display: flex;
  gap: 0;
  min-height: 60vh;
}

/* Sidebar */
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: 60vh;
}

.admin-sidebar .admin-nav ul,
.admin-sidebar nav ul {
  list-style: none;
  padding: 0.75rem 0;
  margin: 0;
}

.admin-sidebar .admin-nav a,
.admin-sidebar nav a {
  display: block;
  padding: 0.7rem 1.25rem;
  font-size: 0.88rem;
  color: var(--silver);
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.admin-sidebar .admin-nav a:hover,
.admin-sidebar nav a:hover {
  background: var(--bg-hover);
  color: var(--white);
}

.admin-nav__item--active a,
.admin-sidebar nav a.active {
  color: var(--white) !important;
  background: rgba(184, 134, 11, 0.08);
  border-left-color: var(--accent);
}

.admin-nav__item--logout a {
  color: var(--text-muted) !important;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.admin-nav__item--logout a:hover {
  color: #e74c3c !important;
}

/* Main content area */
.admin-content,
.admin-main {
  flex: 1;
  padding: 1.5rem 2rem;
  min-width: 0;
  overflow-x: auto;
}

.admin-content h1,
.admin-main h1 {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

/* Admin stat cards */
.stats-grid,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

/* Admin filter bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  max-width: 220px;
}

/* Admin login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-white  { color: var(--white); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    position: static;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .admin-sidebar .admin-nav ul {
    display: flex;
    flex-wrap: wrap;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .admin-sidebar .admin-nav a {
    border-left: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
  }

  .admin-nav__item--logout a {
    margin-top: 0;
    border-top: none;
    padding-top: 0.5rem;
  }

  .admin-content,
  .admin-main {
    padding: 1rem;
  }

  .container {
    padding: 0 0.75rem;
  }

  .card {
    padding: 1.25rem;
  }

  .results-card {
    padding: 1.25rem;
  }

  .radio-group {
    flex-direction: column;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar input,
  .filter-bar select {
    max-width: 100%;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }

  table {
    font-size: 0.82rem;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }
}

@media (min-width: 769px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* ============================================================
   Proposal View
   ============================================================ */

.proposal {
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.proposal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 2rem;
}

.proposal__logo img {
  height: 48px;
  filter: invert(1) brightness(1.8);
}

.proposal__meta h1 {
  font-size: 1.6rem;
  color: var(--white);
  text-align: right;
}

.proposal__meta p {
  color: var(--text-muted);
  text-align: right;
  font-size: 0.9rem;
}

.proposal section {
  margin-bottom: 2rem;
}

.proposal section h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.info-table,
.spec-table,
.price-table,
.calc-summary-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table th,
.spec-table th,
.price-table th,
.calc-summary-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.info-table td,
.spec-table td,
.price-table td,
.calc-summary-table td {
  padding: 0.6rem 0.75rem;
  color: var(--silver-light);
  border-bottom: 1px solid var(--border);
}

.info-table th {
  width: 120px;
}

.spec-table thead th,
.price-table thead th,
.calc-summary-table thead th {
  background: var(--bg-hover);
  color: var(--silver-bright);
  font-weight: 600;
}

.price-table td:last-child,
.price-table th:last-child,
.calc-summary-table td:last-child,
.calc-summary-table th:last-child {
  text-align: right;
}

.price-table__total td {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent) !important;
  border-top: 2px solid var(--accent);
  border-bottom: none;
  padding-top: 0.8rem;
}

.calc-summary-table__result td {
  font-weight: 700;
  color: var(--accent) !important;
  border-top: 2px solid var(--accent);
  border-bottom: none;
}

/* --- Calculation breakdown --- */

.calc-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.calc-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.calc-step {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.calc-step h3 {
  font-size: 0.95rem;
  color: var(--silver-bright);
  margin-bottom: 0.75rem;
}

.calc-formula {
  margin-bottom: 0.75rem;
}

.calc-formula .formula {
  font-family: "Cambria Math", "Latin Modern Math", Georgia, serif;
  font-size: 1.05rem;
  color: var(--silver);
  font-style: italic;
}

.calc-work {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: var(--bg-deepest);
  border-radius: var(--radius);
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 0.95rem;
}

.calc-expression {
  color: var(--silver-light);
}

.calc-equals {
  color: var(--text-muted);
}

.calc-result {
  color: var(--white);
  font-weight: 600;
}

.calc-result.highlight {
  color: var(--accent);
  font-size: 1.1rem;
}

.calc-note {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Proposal footer & actions --- */

.proposal__terms ul {
  list-style: disc;
  padding-left: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.8;
}

.proposal__footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.proposal__actions {
  max-width: 900px;
  margin: 1rem auto;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* --- Customer price box (no breakdown) --- */

.price-total-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  background: var(--bg-dark);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  text-align: center;
}

.price-total-box__label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.price-total-box__amount {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
}

.price-total-box__note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* --- Calculator page calc breakdown (collapsible) --- */

.calc-breakdown {
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calc-breakdown__toggle {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--silver-bright);
  background: var(--bg-card);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition);
}

.calc-breakdown__toggle:hover {
  background: var(--bg-hover);
}

.calc-breakdown__toggle::before {
  content: '\25B6';
  font-size: 0.7rem;
  color: var(--accent);
  transition: transform var(--transition);
}

.calc-breakdown[open] > .calc-breakdown__toggle::before {
  transform: rotate(90deg);
}

.calc-breakdown__toggle::-webkit-details-marker {
  display: none;
}

.calc-breakdown > .calc-intro {
  padding: 1rem 1.25rem 0;
}

.calc-breakdown > .calc-steps {
  padding: 0 1.25rem 1.25rem;
}

/* --- Proposal request form --- */

/* --- Voltage simulation graph --- */

.voltage-sim {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.voltage-sim > h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.voltage-sim canvas {
  width: 100%;
  height: auto;
  max-height: 400px;
  margin-top: 1rem;
  border-radius: var(--radius);
}

.voltage-sim__legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--silver);
}

.voltage-sim__legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.voltage-sim__swatch {
  display: inline-block;
  width: 24px;
  height: 3px;
  border-radius: 1px;
}

.voltage-sim__swatch--off {
  background: #e74c3c;
}

.voltage-sim__swatch--on {
  background: #2ecc71;
  background: repeating-linear-gradient(
    90deg,
    #2ecc71 0,
    #2ecc71 6px,
    transparent 6px,
    transparent 10px
  );
}

.voltage-sim__swatch--cutoff {
  background: repeating-linear-gradient(
    90deg,
    #e67e22 0,
    #e67e22 4px,
    transparent 4px,
    transparent 8px
  );
}

/* --- Battery tester --- */

.battery-tester {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.battery-tester > h3 {
  color: var(--white);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.battery-tester__form {
  margin-top: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-row input {
  flex: 1;
  min-width: 0;
}

.input-row select {
  flex: 1;
  min-width: 0;
}

.input-row__label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 1rem;
}

/* Battery tester results */

.battery-tester__results {
  margin-top: 1.5rem;
}

.bt-verdict {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bt-verdict__icon {
  font-size: 1.4rem;
}

.bt-verdict--pass {
  background: rgba(46, 139, 87, 0.2);
  border: 1px solid rgba(46, 139, 87, 0.6);
  color: #5cdb95;
}

.bt-verdict--warn {
  background: rgba(184, 134, 11, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent-hover);
}

.bt-verdict--fail {
  background: rgba(178, 34, 34, 0.2);
  border: 1px solid rgba(178, 34, 34, 0.6);
  color: #e74c3c;
}

.bt-specs {
  margin-bottom: 1.25rem;
}

.bt-specs h4 {
  font-size: 0.95rem;
  color: var(--silver-bright);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bt-good {
  color: #5cdb95 !important;
  font-weight: 600;
}

.bt-warn {
  color: var(--accent-hover) !important;
  font-weight: 600;
}

.bt-bad {
  color: #e74c3c !important;
  font-weight: 600;
}

.bt-highlight-row td {
  border-top: 2px solid var(--accent);
  padding-top: 0.8rem;
}

.bt-warnings-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bt-warnings-list li {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(178, 34, 34, 0.1);
  border-left: 3px solid #e74c3c;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--silver-light);
  font-size: 0.9rem;
}

.proposal-request {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* --- Chemistry selection cards --- */

.chemistry-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.chemistry-options--4col {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .chemistry-options--4col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .chemistry-options,
  .chemistry-options--4col {
    grid-template-columns: 1fr;
  }
}

.chemistry-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--bg-dark);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.chemistry-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chemistry-card:hover {
  border-color: var(--border-silver-hover);
}

.chemistry-card--selected,
.chemistry-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.chemistry-card__name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.25rem;
}

.chemistry-card__badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.chemistry-card__badge--alt {
  background: var(--border-silver);
  color: var(--silver-bright);
}

.chemistry-card__badge--budget {
  background: #2a6e2a;
  color: #c8f7c8;
}

.chemistry-card__badge--warning {
  background: #7a3d00;
  color: #ffd699;
}

.chemistry-card__con {
  color: #e8a040;
  font-style: italic;
}

.chemistry-card__pros {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--silver);
  line-height: 1.7;
}

.chemistry-card__pros li::before {
  content: '\2713 ';
  color: var(--accent);
  font-weight: 700;
}

.chemistry-card__includes {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.chemistry-card__voltage {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.proposal-request h3 {
  color: var(--white);
  margin-bottom: 0.5rem;
}

.proposal-request > p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.proposal-success {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(184, 134, 11, 0.15);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--silver-bright);
}

.proposal-success a {
  color: var(--accent);
  text-decoration: underline;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  .admin-sidebar,
  .mobile-menu-toggle,
  .btn,
  .filter-bar,
  .spinner-overlay,
  .no-print {
    display: none !important;
  }

  .admin-main {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .card,
  .results-card {
    border: 1px solid #ccc;
    page-break-inside: avoid;
    padding: 1rem;
  }

  table {
    border-collapse: collapse;
  }

  thead th {
    border-bottom: 2px solid #000;
  }

  tbody td {
    border-bottom: 1px solid #ccc;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  .results-section {
    opacity: 1 !important;
    transform: none !important;
  }

  .proposal-print-header {
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .proposal-print-header h1 {
    font-size: 18pt;
    margin-bottom: 0.25rem;
  }

  .proposal-print-header p {
    font-size: 10pt;
    color: #555 !important;
  }

  /* Proposal print adjustments */
  .proposal {
    border: none !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .proposal__header {
    border-bottom-color: #000 !important;
  }

  .proposal__logo img {
    filter: none !important;
  }

  .proposal section h2 {
    color: #000 !important;
    border-bottom-color: #ccc !important;
  }

  .calc-step {
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  .calc-work {
    border: 1px solid #eee;
  }

  .calc-result.highlight {
    color: #000 !important;
    font-weight: 700;
  }

  .calc-summary-table__result td,
  .price-table__total td {
    color: #000 !important;
    border-top-color: #000 !important;
  }

  .proposal__actions {
    display: none !important;
  }
}

/* ============================================================
   New components — battery calculator extensions
   ============================================================ */

/* --- Inline checkbox option (box rise, adjustable voltage) --- */
.calc-option {
  margin-top: 0.6rem;
}

.calc-option__label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  color: var(--silver);
  font-size: 0.9rem;
  font-weight: 500;
  user-select: none;
  margin-bottom: 0;
}

.calc-option__label input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  background: none;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.calc-option__badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: rgba(184, 134, 11, 0.15);
  color: var(--accent-hover);
  border: 1px solid rgba(184, 134, 11, 0.3);
}

.calc-option__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.45;
}

/* --- Voltage simulation warnings --- */
.voltage-start-warning,
.voltage-12v-warning {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 0.5rem;
}

.voltage-start-warning {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #e87f72;
}

.voltage-12v-warning {
  margin-top: 0.6rem;
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
  color: #f5b942;
}

/* --- Physical size estimation --- */
.size-estimation {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.size-estimation h3 {
  margin-bottom: 0.4rem;
}

.size-estimation .calc-intro {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.size-estimation__specs {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

.size-spec {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 0.7rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.size-spec__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.size-spec__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

.size-spec__unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.size-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}
