:root {
  --zebra-black: #111111;
  --zebra-charcoal: #1f1f1f;
  --zebra-yellow: #ffcd00;
  --zebra-cream: #f7f4e8;
  --zebra-white: #ffffff;
  --zebra-success: #00a550;
  --zebra-danger: #b3261e;
  --border: #2f2f2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Barlow", "Segoe UI", sans-serif;
  color: var(--zebra-white);
  background: radial-gradient(circle at 20% 10%, #2d2d2d 0%, #101010 52%, #090909 100%);
  min-height: 100vh;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(115deg, rgba(255, 205, 0, 0.08), transparent 38%), repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 16px);
  pointer-events: none;
}

.page-shell {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.4rem;
}

.top-header {
  border: 1px solid var(--border);
  background: linear-gradient(110deg, rgba(255, 205, 0, 0.1) 0%, rgba(17, 17, 17, 0.85) 45%);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--zebra-yellow);
  font-size: 0.74rem;
}

h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.3rem, 2.1vw, 2rem);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-note {
  margin: 0;
  color: #efe8c7;
  max-width: 420px;
  line-height: 1.35;
}

.upload-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.upload-form input[type="file"] {
  color: var(--zebra-white);
  max-width: 240px;
}

.card {
  margin-top: 1rem;
  border: 1px solid var(--border);
  background: rgba(17, 17, 17, 0.86);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.28);
}

.sheet-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.nav-main {
  margin-top: 0.8rem;
}

.sheet-pill {
  text-decoration: none;
  color: var(--zebra-white);
  border: 1px solid var(--border);
  background: var(--zebra-charcoal);
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
}

.sheet-pill.active {
  border-color: var(--zebra-yellow);
  color: var(--zebra-black);
  background: var(--zebra-yellow);
  font-weight: 700;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
}

h2, h3 {
  margin: 0;
}

.muted {
  color: #d2cdb4;
}

.input-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 1rem;
}

.input-item {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  font-weight: 500;
}

.input-item em {
  opacity: 0.7;
  font-style: normal;
}

.input-item input {
  border-radius: 10px;
  border: 1px solid #4d4d4d;
  background: #1a1a1a;
  color: var(--zebra-white);
  padding: 0.56rem 0.62rem;
}

.input-item input.validation-error {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

.calculator-validation {
  grid-column: 1 / -1;
  margin: 0;
  color: #ffb3b3;
  font-weight: 600;
}

.input-item select {
  border-radius: 10px;
  border: 1px solid #4d4d4d;
  background: #1a1a1a;
  color: var(--zebra-white);
  padding: 0.56rem 0.62rem;
}

.optional-input {
  border: 1px dashed rgba(0, 165, 80, 0.8);
  border-radius: 12px;
  padding: 0.55rem;
  background: rgba(0, 165, 80, 0.1);
}

.optional-input em {
  color: #96e3b8;
  margin-left: 0.25rem;
}

.optional-note {
  color: #96e3b8;
  font-size: 0.75rem;
  line-height: 1.25;
}

@media (min-width: 980px) {
  .input-grid {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
  }

  .optional-input {
    grid-column: 1;
    grid-row: 2;
  }

  .hardware-margin-input {
    grid-column: 3;
    grid-row: 1;
  }

  .software-margin-input {
    grid-column: 4;
    grid-row: 1;
  }
}

.actions-row {
  grid-column: 1 / -1;
}

.btn {
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.52rem 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-solid {
  background: var(--zebra-yellow);
  color: var(--zebra-black);
}

.btn-outline {
  background: transparent;
  border-color: var(--zebra-yellow);
  color: var(--zebra-yellow);
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.table-form input[type="number"],
.table-form input[type="text"] {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #4d4d4d;
  background: #1a1a1a;
  color: var(--zebra-white);
  padding: 0.42rem 0.5rem;
}

.top-space {
  margin-top: 0.8rem;
}

.discount-form {
  margin-top: 1rem;
}

.discount-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.discount-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 500;
  position: relative;
}

.discount-item .unit {
  position: absolute;
  right: 0.6rem;
  top: 1.8rem;
  color: #c0c0c0;
  font-size: 0.85rem;
  pointer-events: none;
}

.discount-item input {
  border-radius: 10px;
  border: 1px solid #4d4d4d;
  background: #1a1a1a;
  color: var(--zebra-white);
  padding: 0.56rem 0.62rem;
  padding-right: 2rem;
}

table td.currency,
table td.percentage {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table td.percentage {
  color: #ffa630;
}

.result-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.show-one-year {
  margin-top: 0.8rem;
}

.result-card {
  border: 1px solid #3a3a3a;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 205, 0, 0.05), rgba(17, 17, 17, 0.92));
}

.result-card h4 {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid #2d2d2d;
  background: rgba(20, 20, 20, 0.95);
  color: var(--zebra-yellow);
  letter-spacing: 0.02em;
}

.result-card table {
  font-size: 0.86rem;
}

.result-card td:first-child {
  width: 66%;
  padding-right: 1.1rem;
}

.result-card td.currency,
.result-card td.percentage {
  width: 34%;
  padding-left: 1.1rem;
}

.table-scroll {
  margin-top: 0.8rem;
  overflow: auto;
  max-height: 60vh;
}

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

th, td {
  border: 1px solid #2d2d2d;
  padding: 0.45rem 0.55rem;
  white-space: nowrap;
}

th {
  background: #1c1c1c;
  position: sticky;
  top: 0;
}

.rownum {
  color: var(--zebra-yellow);
  font-weight: 700;
}

.green-cell {
  background: rgba(0, 165, 80, 0.28);
}

.flash-stack {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.45rem;
}

.flash {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
}

.flash-success {
  background: rgba(0, 165, 80, 0.2);
  border: 1px solid rgba(0, 165, 80, 0.55);
}

.flash-error {
  background: rgba(179, 38, 30, 0.2);
  border: 1px solid rgba(179, 38, 30, 0.55);
}

.empty-note {
  margin-top: 1rem;
  border-radius: 10px;
  border: 1px dashed #4d4d4d;
  padding: 0.8rem;
  color: #d7d7d7;
}

@media (max-width: 760px) {
  .page-shell {
    padding: 0.8rem;
  }

  .top-header {
    border-radius: 12px;
  }
}
