/* ============================================================
   SOLDAE — Design system (charte BTLA)
   Navy #0D1B2A · Cyan #3DD4C8 · Rose #EDD5D0 · Ivoire #FAF7F2
   Cormorant Garamond (display) + Outfit (corps)
   ============================================================ */

:root {
  --navy: #0D1B2A;
  --navy-soft: #16283c;
  --cyan: #3DD4C8;
  --cyan-dark: #2BB8AD;
  --rose: #EDD5D0;
  --ivory: #FAF7F2;
  --white: #FFFFFF;
  --text: #2C3E50;
  --text-soft: #5A6B7A;
  --border: #E8E8E8;
  --ok-bg: #E8F8F7; --ok-fg: #0F6B65;
  --pending-bg: #FEF6E4; --pending-fg: #7A5A07;
  --late-bg: #FDE8E8; --late-fg: #9C2E23;
  --draft-bg: #F0F0F0; --draft-fg: #5D6D70;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --radius-sm: 6px; --radius-md: 12px; --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-modal: 0 8px 32px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--ivory);
  line-height: 1.55;
}
h1, h2, .display { font-family: var(--font-display); font-weight: 600; color: var(--navy); line-height: 1.15; }
h3, h4 { font-family: var(--font-body); font-weight: 600; color: var(--navy); }
a { color: #147A70; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Logo ---------- */
.logo { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.04em; color: var(--navy); }
.logo-accent { color: var(--cyan); }
.sidebar .logo, .public-header .logo { color: inherit; }
.logo-sm { font-size: 19px; }
.logo-link { text-decoration: none !important; color: var(--navy); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  text-decoration: none !important; transition: all .15s ease; line-height: 1.2;
}
.btn-primary { background: var(--cyan); color: var(--navy); }
.btn-primary:hover { background: var(--cyan-dark); box-shadow: 0 3px 10px rgba(61,212,200,.35); transform: translateY(-1px); }
.btn-secondary { background: var(--white); color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--cyan); }
.btn-danger { background: var(--late-bg); color: var(--late-fg); }
.btn-ghost { background: transparent; color: inherit; }
.btn-lg { font-size: 16px; padding: 14px 28px; }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-quiet { background: none; border: none; color: var(--text-soft); font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.link-quiet:hover { color: var(--cyan); }

/* ---------- Public layout ---------- */
.public { background: var(--ivory); display: flex; flex-direction: column; min-height: 100vh; }
.public-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 40px; background: var(--ivory);
  border-bottom: 1px solid rgba(13,27,42,.06);
}
.header-right { display: flex; align-items: center; gap: 14px; }
.public-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 48px 20px; }
.public-main-wide { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.public-footer {
  padding: 28px 40px; background: var(--navy); color: rgba(255,255,255,.7);
  display: flex; justify-content: space-between; align-items: center; font-size: 13px; flex-wrap: wrap; gap: 8px;
}
.public-footer .logo { color: var(--white); }
.footer-links a { color: rgba(255,255,255,.7); }

/* ---------- Landing ---------- */
.hero { text-align: center; padding: 72px 0 56px; }
.hero h1 { font-size: 52px; margin: 0 0 18px; }
.hero .subtitle { font-size: 19px; color: var(--text-soft); max-width: 640px; margin: 0 auto 32px; font-weight: 300; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 14px; font-size: 13px; color: var(--text-soft); }
.stats-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 40px 0; }
.stat-card {
  background: linear-gradient(135deg, var(--navy) 0%, #123249 60%, #185a56 100%);
  color: var(--white); border-radius: var(--radius-md); padding: 28px; text-align: center;
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--cyan); }
.stat-card .stat-label { font-size: 13.5px; color: rgba(255,255,255,.85); margin-top: 6px; }
.benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 48px 0; }
.benefit-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 28px; }
.benefit-card svg { color: var(--cyan-dark); width: 28px; height: 28px; }
.benefit-card h3 { margin: 14px 0 8px; font-size: 17px; }
.benefit-card p { margin: 0; color: var(--text-soft); font-size: 14px; }
.section-title { text-align: center; font-size: 34px; margin: 64px 0 28px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 56px; }
.step-card { text-align: center; padding: 22px 14px; }
.step-num {
  width: 44px; height: 44px; border-radius: 50%; background: var(--rose); color: var(--navy);
  font-family: var(--font-display); font-weight: 700; font-size: 21px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}
.step-card h4 { margin: 0 0 6px; }
.step-card p { margin: 0; font-size: 13.5px; color: var(--text-soft); }
.pricing-card {
  max-width: 460px; margin: 0 auto 72px; background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal); padding: 40px; text-align: center; border-top: 4px solid var(--cyan);
}
.price-line { font-family: var(--font-display); font-size: 46px; font-weight: 700; color: var(--navy); }
.price-line small { font-size: 18px; color: var(--text-soft); font-family: var(--font-body); font-weight: 400; }
.price-setup { color: var(--text-soft); margin-bottom: 20px; }
.pricing-features { list-style: none; padding: 0; margin: 22px 0; text-align: left; }
.pricing-features li { padding: 7px 0 7px 30px; position: relative; font-size: 14.5px; }
.pricing-features li::before { content: '✓'; position: absolute; left: 4px; color: var(--cyan-dark); font-weight: 700; }

/* ---------- Cards / forms ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 24px; }
.card + .card { margin-top: 20px; }
.card h2 { font-size: 24px; margin: 0 0 16px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--navy); margin: 0 0 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--navy); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14.5px; color: var(--text); background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--cyan); }
.hint { font-size: 12.5px; color: var(--text-soft); margin-top: 4px; }
.form-actions { display: flex; gap: 12px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin: 0 0 16px; }
legend { font-weight: 600; font-size: 14px; color: var(--navy); padding: 0 8px; }

/* ---------- Auth pages ---------- */
.auth-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); padding: 40px; }
.auth-card h1 { font-size: 32px; margin: 0 0 6px; }
.auth-sub { color: var(--text-soft); margin: 0 0 24px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-soft); font-size: 13px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google {
  width: 100%; justify-content: center; background: var(--white); color: var(--text);
  border: 1px solid var(--border); font-weight: 500;
}
.btn-google:hover { border-color: var(--navy); }
.auth-foot { margin-top: 20px; font-size: 14px; text-align: center; color: var(--text-soft); }
.totp-secret {
  font-family: 'JetBrains Mono', monospace; font-size: 18px; letter-spacing: 2px;
  background: var(--ivory); padding: 14px; border-radius: var(--radius-sm); text-align: center; user-select: all;
}

/* ---------- Onboarding ---------- */
.onboarding-steps { display: flex; gap: 6px; margin: 26px 0 30px; }
.ob-step { flex: 1; text-align: center; font-size: 12px; color: var(--text-soft); position: relative; padding-top: 14px; }
.ob-step::before { content: ''; display: block; height: 5px; border-radius: 3px; background: var(--border); position: absolute; top: 0; left: 0; right: 0; }
.ob-step.done::before { background: var(--cyan); }
.ob-step.current::before { background: var(--rose); }
.ob-step.current { color: var(--navy); font-weight: 600; }
.progress-note { background: var(--rose); border-radius: var(--radius-md); padding: 14px 18px; font-size: 14px; color: var(--navy); margin-bottom: 20px; }

/* ---------- App shell ---------- */
.app { background: var(--ivory); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: var(--navy); color: rgba(255,255,255,.65);
  display: flex; flex-direction: column; padding: 24px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { color: var(--white); }
.sidebar-nav { margin-top: 30px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,.65); font-size: 14.5px; text-decoration: none !important;
}
.nav-item:hover { background: var(--navy-soft); color: var(--white); }
.nav-item.active { color: var(--cyan); background: var(--navy-soft); font-weight: 600; }
.sidebar-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-user .user-name { font-size: 13px; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .lang-switch a, .sidebar .lang-switch .lang-current { color: rgba(255,255,255,.5); }
.sidebar .lang-switch .lang-current { color: var(--cyan); }

.app-content { flex: 1; min-width: 0; }
.app-header { padding: 26px 36px 0; }
.app-header-org { font-size: 13px; color: var(--text-soft); display: flex; gap: 10px; align-items: center; }
.page-title { font-size: 34px; margin: 6px 0 0; }
.app-main { padding: 24px 36px 48px; }

.sim-banner {
  margin: 14px 36px 0; background: var(--rose); border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 13px; color: var(--navy);
}

/* ---------- Flash ---------- */
.flash { margin: 14px 36px 0; padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; }
.public .flash { margin: 0 0 16px; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash-err { background: var(--late-bg); color: var(--late-fg); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.kpi-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 20px 22px; }
.kpi-label { font-size: 13px; color: var(--text-soft); }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.kpi-late .kpi-value { color: var(--late-fg); }
.kpi-sub { font-size: 12.5px; color: var(--text-soft); }

/* ---------- Chart ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 26px; height: 150px; padding: 10px 6px 0; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar .bar { width: 100%; max-width: 70px; background: linear-gradient(180deg, var(--cyan), var(--cyan-dark)); border-radius: 6px 6px 0 0; min-height: 3px; }
.chart-bar .bar-label { font-size: 12px; color: var(--text-soft); }
.chart-bar .bar-value { font-size: 12px; font-weight: 600; color: var(--navy); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 16px; background: var(--ivory); color: var(--text-soft); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfaf6; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
th.td-num { text-align: right; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-soft); }
.empty-state h3 { color: var(--navy); font-size: 19px; margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-pending { background: var(--pending-bg); color: var(--pending-fg); }
.badge-late { background: var(--late-bg); color: var(--late-fg); }
.badge-draft { background: var(--draft-bg); color: var(--draft-fg); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; background: var(--white);
  border: 1px solid var(--border); color: var(--text-soft); text-decoration: none !important;
}
.filter-chip.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ---------- Invoice form lines ---------- */
.lines-table input { min-width: 70px; }
.lines-table .desc-col { width: 42%; }
.totals-box { margin-left: auto; max-width: 320px; margin-top: 16px; }
.totals-box .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14.5px; }
.totals-box .row.grand { font-weight: 700; font-size: 17px; color: var(--navy); border-top: 2px solid var(--navy); padding-top: 9px; margin-top: 5px; }

/* ---------- Detail page ---------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.meta-list { list-style: none; margin: 0; padding: 0; }
.meta-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.meta-list li:last-child { border-bottom: none; }
.meta-list .k { color: var(--text-soft); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 22px; position: relative; font-size: 13.5px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); position: absolute; left: -6px; top: 13px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings-grid .full { grid-column: 1/-1; }

/* ---------- Language switch ---------- */
.lang-switch { display: flex; gap: 10px; font-size: 12.5px; }
.lang-switch a { color: var(--text-soft); text-decoration: none; }
.lang-switch a:hover { color: var(--cyan-dark); }
.lang-current { color: var(--navy); font-weight: 700; }

/* ---------- Error pages ---------- */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--ivory); font-family: var(--font-body); }
.error-card { text-align: center; background: var(--white); padding: 56px 64px; border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.error-code { font-family: var(--font-display); font-size: 72px; font-weight: 700; color: var(--rose); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stats-band, .benefits { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid, .settings-grid, .form-grid { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; margin-top: 0; overflow-x: auto; }
  .nav-item span { display: none; }
  .sidebar-bottom { border-top: none; padding-top: 0; flex-direction: row; align-items: center; margin-left: auto; }
  .app-header, .app-main { padding-left: 18px; padding-right: 18px; }
  .hero h1 { font-size: 36px; }
  .public-header { padding: 14px 18px; }
}
