/* =====================================================================
   Vardhaman Capital – Cost Calculator
   Colours & fonts from the Vardhaman Capital Brand Guide.
   ===================================================================== */
:root {
  /* Brand palette (Brand Guide p.8) */
  --brand-primary: #002345;      /* Pantone 282 C */
  --brand-primary-80: #234E74;   /* navy tints shown in the guide */
  --brand-primary-60: #4A77A3;
  --brand-primary-40: #6EA4D3;
  --brand-primary-20: #92CBFC;
  --brand-accent: #2ACCF2;       /* Pantone 306 C */
  --brand-accent-60: #84E1F7;
  --brand-accent-20: #D6F6FD;

  /* Neutrals (derived from navy) */
  --surface: #FFFFFF;
  --page-bg: #F2F5F9;
  --border: #DCE3EC;
  --text: #002345;
  --text-muted: #5B6B7F;

  /* Functional colours – not in the brand palette; used only for P&L / errors */
  --profit: #0E7A4B;
  --profit-bg: #E7F6EF;
  --loss: #C62828;
  --loss-bg: #FDECEC;

  --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif; /* Primary font */
  --font-body: 'Inter', system-ui, sans-serif;                /* Secondary font */

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0, 35, 69, .06), 0 6px 20px rgba(0, 35, 69, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: var(--font-heading); margin: 0; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 2px; }

/* ---------------- Header ---------------- */
.site-header {
  background: var(--surface);
  border-bottom: 4px solid var(--brand-primary);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 24px; min-width: 0; }
.logo-full { width: 280px; height: auto; flex: none; } /* Brand Guide asks for min 350px; reduced to 280px at owner's request */
.logo-icon { display: none; width: 36px; height: 36px; flex: none; }
.brand-text { border-left: 2px solid var(--border); padding-left: 24px; }
.brand-text h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.brand-text p {
  margin: 4px 0 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--text-muted);
}

/* ---------------- Layout ---------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  flex: 1;
}

/* ---------------- Tabs ---------------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--brand-primary);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.tabs [role="tab"] {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #C9D6E4;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tabs [role="tab"]:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.tabs [role="tab"][aria-selected="true"] {
  background: var(--brand-accent);
  color: var(--brand-primary);
}

/* ---------------- Panels & cards ---------------- */
.tab-panel {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px;
  align-items: start;
}
.tab-panel:focus-visible { outline-offset: 6px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-title {
  font-size: 19px;
  font-weight: 800;
  position: relative;
  padding-top: 14px;
}
/* Brand Guide heading accent: short thick navy bar above titles */
.card-title::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 44px; height: 4px;
  background: var(--brand-primary);
}

/* ---------------- Form ---------------- */
.charge-type { border: 0; padding: 0; margin: 20px 0 0; }
.charge-type legend,
.field label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0;
}
.radio-group { display: grid; gap: 8px; }
.radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.radio:hover { border-color: var(--brand-primary-40); }
.radio input { accent-color: var(--brand-primary); width: 18px; height: 18px; margin: 0; flex: none; }
.radio:has(input:checked) { border-color: var(--brand-primary); background: var(--brand-accent-20); }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.field { display: flex; flex-direction: column; }
.field:last-child:nth-child(odd) { grid-column: 1 / -1; }
.field label { display: block; }
.field input {
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--text);
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #9AA8B8; }
.field input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(42, 204, 242, .35); }
.field input[aria-invalid="true"] { border-color: var(--loss); background: var(--loss-bg); }
.field input:disabled { background: #EEF2F6; border-color: #E3E8EF; color: #9AA8B8; cursor: not-allowed; }
.field input:disabled::placeholder { color: transparent; }
.field:has(input:disabled) label { opacity: .5; }
.helper { margin-top: 5px; font-size: 12.5px; color: var(--text-muted); }

.form-error {
  margin: 18px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--loss-bg);
  color: var(--loss);
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid var(--loss);
}

.actions { display: flex; gap: 12px; margin-top: 22px; }
.btn {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  cursor: pointer;
  border: 2px solid var(--brand-primary);
  transition: background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--brand-primary); color: #fff; flex: 1; }
.btn-primary:hover { background: var(--brand-primary-80); border-color: var(--brand-primary-80); }
.btn-secondary { background: #fff; color: var(--brand-primary); }
.btn-secondary:hover { background: var(--brand-accent-20); }

/* ---------------- Results ---------------- */
.results-head { display: flex; align-items: flex-end; gap: 16px; }
/* Brand motif: thin line ending in a four-point star (from the logo) */
.rule, .star-rule {
  flex: 1;
  height: 1px;
  background: var(--brand-accent);
  position: relative;
  margin-bottom: 8px;
}
.rule::after, .star-rule::after {
  content: '✦';
  position: absolute;
  right: -2px; top: 50%;
  transform: translateY(-52%);
  color: var(--brand-accent);
  font-size: 12px;
  line-height: 1;
}

.empty-state {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state p { margin: 0; font-size: 15px; }
.empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-accent-20);
  color: var(--brand-primary);
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat.is-profit { background: var(--profit-bg); border-color: transparent; }
.stat.is-profit .stat-value { color: var(--profit); }
.stat.is-loss { background: var(--loss-bg); border-color: transparent; }
.stat.is-loss .stat-value { color: var(--loss); }
.stat-total { background: var(--brand-primary); border-color: var(--brand-primary); }
.stat-total .stat-label { color: #B9C8D8; }
.stat-total .stat-value { color: var(--brand-accent); }
.stat-wide { grid-column: span 2; }
.pnl-note { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }

.breakdown-title {
  margin: 24px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.breakdown { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.breakdown th, .breakdown td { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.breakdown th { text-align: left; font-weight: 500; }
.breakdown td { text-align: right; font-weight: 500; }
.breakdown tfoot th, .breakdown tfoot td {
  border-bottom: 0;
  border-top: 2px solid var(--brand-primary);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 16px;
  padding-top: 12px;
}
.breakdown tfoot td { color: var(--brand-primary); }
.breakdown tfoot td::after {
  content: '';
  display: block;
  height: 3px; width: 40px;
  margin: 4px 0 0 auto;
  background: var(--brand-accent);
}

.breakeven {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand-accent-20);
  border-left: 4px solid var(--brand-accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.breakeven span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.breakeven strong {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Footer ---------------- */
.site-footer { background: var(--brand-primary); color: #C9D6E4; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 22px 24px; }
.disclaimer { margin: 0; font-size: 13px; line-height: 1.6; }
.disclaimer strong { color: #fff; }
.footer-mark {
  margin: 16px 0 0;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  letter-spacing: .2em;
  color: #fff;
}
.footer-mark .star-rule { margin-bottom: 0; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .tab-panel { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* Phones: use the icon mark instead of the full logo */
  .logo-full { display: none; }
  .logo-icon { display: block; }
  .header-inner { padding: 14px 16px; gap: 12px; }
  .brand { gap: 12px; }
  .brand-text { padding-left: 12px; }
  .brand-text h1 { font-size: 21px; }
  .brand-text p { font-size: 10px; letter-spacing: .14em; }
  .container { padding: 16px 16px 28px; }
  .tabs { grid-template-columns: 1fr 1fr; }
  .tabs [role="tab"] { font-size: 14px; padding: 11px 6px; }
  .card { padding: 18px 16px; }
  .fields { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .btn { width: 100%; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary .stat:nth-child(3) { grid-column: 1 / -1; }
  .stat-total { grid-column: 1 / -1; }
  .stat-wide { grid-column: 1 / -1; }
  .stat-value { font-size: 17px; }
  .footer-inner { padding: 18px 16px; }
}
