/* =====================================================================
   Cyprus Tax Navigator — modern fintech SaaS
   Inspired by Acctual / Mercury / Ramp aesthetic:
   clean sans-serif, off-white canvas, single lime accent, sharp + functional
   ===================================================================== */

/* ----- Tokens ----- */
:root {
  /* Surfaces */
  --bg:           #f7f7f5;
  --bg-2:         #efeeea;
  --card:         #ffffff;
  --rule:         #e6e5e0;
  --rule-strong:  #c9c8c2;

  /* Ink */
  --ink:          #0a0a0a;
  --ink-soft:     #303030;
  --ink-mute:     #6e6e6e;
  --ink-faint:    #a0a09a;

  /* Single accent — lime/olive */
  --accent:       #bef264;
  --accent-bg:    #ecfccb;
  --accent-deep:  #4d7c0f;

  /* States */
  --positive:     #15803d;
  --warning:      #b45309;
  --warning-bg:   #fef3c7;
  --negative:     #b91c1c;

  /* Dark mini-panels (for stats only) */
  --ink-bg:       #0a0a0a;

  /* Type */
  --sans: "Geist", "Inter Tight", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Geometry */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-md: 0 1px 2px rgba(10, 10, 10, 0.04), 0 4px 14px -4px rgba(10, 10, 10, 0.08);
}

/* ----- Reset / base ----- */
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
}
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}
@media (max-width: 880px) {
  .container { padding: 24px 16px 60px; }
}

/* Tabular numbers everywhere a number appears */
.headline-value, .br-line span:last-child, .cap-applied,
.field input[type="number"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ===== Header ===== */
.top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
}
h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ink);
}
h1 em { font-style: normal; font-weight: 600; color: var(--ink); }
.subtitle {
  margin: 10px 0 0;
  color: var(--ink-mute);
  font-size: 15px;
  max-width: 52ch;
}
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  background: var(--card);
}
.lang-switch button {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.02em;
  transition: all 120ms;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.active {
  background: var(--ink);
  color: var(--card);
}

/* ===== Top tab navigation ===== */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-nav .tabs {
  display: flex;
  gap: 4px;
  width: 100%;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 20px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  transition: all 140ms;
  letter-spacing: -0.005em;
  white-space: nowrap;
  margin-bottom: -1px;  /* overlap the bottom border */
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

/* ===== Form sections ===== */
.form-section {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.form-section h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.012em;
  margin: 0 0 4px;
  color: var(--ink);
}
.form-section .hint {
  color: var(--ink-mute);
  font-size: 14px;
  margin: 0 0 18px;
  max-width: 58ch;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
  text-transform: none;
}

.field input[type="number"],
.field input[type="text"],
.field select {
  background: var(--card);
  border: 1px solid var(--rule-strong);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  border-radius: var(--radius-sm);
  outline: none;
  -moz-appearance: textfield;
  transition: border-color 120ms, box-shadow 120ms;
  min-width: 0;
  width: 100%;
}
.field input[type="number"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.field select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
  -webkit-appearance: none;
  appearance: none;
}
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus,
.field select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.field input::placeholder { color: var(--ink-faint); }

.field-hint { color: var(--ink-faint); font-size: 11.5px; line-height: 1.4; }

/* Cap applied note */
.cap-applied {
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 2px;
}

/* Yes/No segmented */
.yesno {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  align-self: flex-start;
  background: var(--card);
}
.yesno button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--rule-strong);
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-mute);
  cursor: pointer;
  transition: all 120ms;
}
.yesno button:last-child { border-right: none; }
.yesno button:hover { background: var(--bg-2); color: var(--ink); }
.yesno button.active {
  background: var(--ink);
  color: var(--card);
}

/* Checkbox */
.field .checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 0;
}
.field .checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-deep);
  cursor: pointer;
}

/* FTP grid (foreign tax paid) */
.ftp-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ftp-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 0.8fr 0.8fr;
  gap: 10px;
  align-items: center;
}
.ftp-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mute);
}
.ftp-row input {
  background: var(--card);
  border: 1px solid var(--rule-strong);
  padding: 7px 9px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  border-radius: var(--radius-sm);
  outline: none;
  width: 100%;
}
.ftp-row input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-bg); }
.ftp-empty { color: var(--ink-faint); font-size: 12.5px; }

/* Exemption choice */
.exemption-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.choice-label {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-mute);
}
.choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.choice-row button {
  border: 1px solid var(--rule-strong);
  background: var(--card);
  color: var(--ink-soft);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
}
.choice-row button:hover { background: var(--bg-2); color: var(--ink); }
.choice-row button.active {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}

/* ===== Section 0 — Situation intake ===== */
.situation {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.situation-question {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.situation-q {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.situation-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.situation-btn {
  border: 1px solid var(--rule-strong);
  background: var(--card);
  padding: 9px 16px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 120ms ease;
  text-align: center;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.situation-btn:hover {
  background: var(--bg-2);
  border-color: var(--ink-soft);
  color: var(--ink);
}
.situation-btn.active {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
.situation-warn {
  background: var(--warning-bg);
  border: 1px solid #fcd34d;
  color: var(--warning);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
}

/* ===== Info icon + popover ===== */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--rule-strong);
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
  flex-shrink: 0;
  transition: all 120ms;
  font-style: normal;
}
.info-icon:hover {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
.info-popover {
  position: absolute;
  z-index: 1000;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -8px rgba(10, 10, 10, 0.18), 0 2px 4px rgba(10, 10, 10, 0.06);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.55;
  font-family: var(--sans);
  display: none;
}
.info-popover.show { display: block; }
.info-popover b { color: var(--ink); font-weight: 600; }
.info-popover ul { margin: 8px 0 0; padding-left: 18px; }
.info-popover li { margin: 4px 0; }

/* ===== Output panel ===== */
.output-pane {
  position: sticky;
  top: 20px;
  align-self: start;
}

/* Headline stats — dark block. Hero (total tax) spans full width in lime;
   net & rate sit side-by-side under it. Labels are crisp white. */
.headline {
  background: var(--ink-bg);
  color: var(--card);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
}
.headline-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.headline-label {
  font-family: var(--sans);
}
.headline-value {
  font-family: var(--sans);
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
/* Hero: total tax — full row, lime, oversized. */
.headline > .headline-stat:first-child {
  grid-column: 1 / -1;
  padding-bottom: 18px;
  border-bottom: 1px solid #1f1f1f;
}
.headline > .headline-stat:first-child .headline-label {
  color: var(--card);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.headline > .headline-stat:first-child .headline-value {
  font-size: 44px;
  font-weight: 700;
  color: var(--accent);
}
/* Secondary metrics: net income, effective rate. */
.headline-stat:not(:first-child) .headline-label {
  color: #d4d4d2;
  font-size: 11.5px;
  font-weight: 500;
}
.headline-stat:not(:first-child) .headline-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--card);
}

/* Empty state — shown until situation answered */
.empty-state {
  background: var(--card);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: left;
}
.empty-state-h {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.empty-state-h::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}
.empty-state p {
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0;
  line-height: 1.5;
}

/* Output cards */
.output-section {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.output-section h3 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.breakdown {
  display: flex;
  flex-direction: column;
}
.br-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  font-family: var(--sans);
  font-size: 14px;
  border-bottom: 1px solid var(--rule);
}
.br-line:last-child { border-bottom: none; }
.br-line span:first-child { color: var(--ink-soft); }
.br-line span:last-child {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.br-line.subtle { color: var(--ink-mute); font-size: 13px; }
.br-line.subtle span:first-child { color: var(--ink-mute); }
.br-line.subtle span:last-child { color: var(--ink-mute); font-weight: 400; }
.br-line.bold {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  border-bottom: none;
}
.br-line.bold span:first-child { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.br-line.bold span:last-child { font-size: 14px; font-weight: 600; color: var(--ink); }

.applied {
  list-style: none;
  padding: 0;
  margin: 0;
}
.applied li {
  padding: 9px 0;
  color: var(--ink-soft);
  font-size: 14px;
  border-bottom: 1px solid var(--rule);
}
.applied li:last-child { border-bottom: none; }

.recs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}
.recs li {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--card);
  line-height: 1.5;
  position: relative;
  padding-left: 14px;
}
.recs li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
}
.rec-info::before { background: var(--ink-faint); }
.rec-warn { background: var(--warning-bg); border-color: #fde68a; color: #6b4502; }
.rec-warn::before { background: var(--warning); }
.rec-opportunity { background: var(--accent-bg); border-color: #d9f99d; color: var(--accent-deep); }
.rec-opportunity::before { background: var(--accent-deep); }

/* Narrative — clean paragraph block */
.narrative-section {
  background: var(--card);
  border-color: var(--rule);
}
.narrative {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.narrative p { margin: 0 0 10px; }
.narrative p:last-child { margin-bottom: 0; }
.narrative p:first-child { color: var(--ink); font-weight: 500; }
.narrative .disclaimer-line {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--ink-mute);
  font-weight: 400;
}

/* Action buttons */
.actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.actions button {
  flex: 1;
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 120ms ease;
  letter-spacing: -0.005em;
  border: 1px solid;
}
.btn-primary {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-deep); color: var(--card); border-color: var(--accent-deep); }
.btn-secondary {
  background: var(--card);
  color: var(--ink-soft);
  border-color: var(--rule-strong);
}
.btn-secondary:hover { background: var(--bg-2); color: var(--ink); border-color: var(--ink); }

/* Warnings panel */
.warnings {
  background: var(--warning-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.warnings h3 {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--warning);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.warnings h3::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--warning);
  border-radius: 50%;
}
.warnings ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.warnings li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: #6b4502;
  line-height: 1.5;
}
.warnings .dismiss {
  background: var(--card);
  border: 1px solid var(--rule-strong);
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-self: center;
  transition: all 120ms;
  white-space: nowrap;
}
.warnings .dismiss:hover { background: var(--ink); color: var(--card); border-color: var(--ink); }

/* Module header separator in output */
.module-header {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 16px 0 8px;
  border-top: 1px solid var(--rule);
  margin-top: 12px;
}
.output-pane > .module-header:first-child,
.output-pane > * + .module-header { margin-top: 16px; }

/* Payroll employee list */
.employee-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.employee-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.4fr auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
@media (max-width: 700px) {
  .employee-row { grid-template-columns: 1fr; }
}
.btn-remove-employee {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink-mute);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  margin-bottom: 4px;
  transition: all 120ms;
}
.btn-remove-employee:hover { background: var(--negative); color: white; border-color: var(--negative); }
.btn-add-employee {
  background: var(--ink);
  color: var(--card);
  border: none;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms;
}
.btn-add-employee:hover { background: var(--accent-deep); }

/* Year banner */
.year-banner {
  background: var(--ink);
  color: var(--card);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.year-banner::before {
  content: "2025";
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(190, 242, 100, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Disclaimer footer */
.disclaimer-footer {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--ink-mute);
  text-align: center;
}

/* ----- Print / PDF ----- */
@media print {
  body { background: white; }
  .container { padding: 0; max-width: none; }
  .top, .lang-switch, .modules-panel, .form-section,
  .actions, .warnings, .dismiss, .year-banner { display: none !important; }
  .layout { display: block; }
  .output-pane { position: static; }
  .headline { background: white !important; color: black !important; border: 2px solid black; }
  .headline-label { color: #555 !important; }
  .headline > .headline-stat:first-child .headline-value { color: black !important; }
  .output-section { border: 1px solid #999; page-break-inside: avoid; }
  .narrative-section { background: white !important; }
  .recs li { background: white !important; color: black !important; }
  .disclaimer-footer { border: 1px solid #999; padding: 14px; }
}
