/* ============================================================
   Sikaflow — brand & app design system.
   Static SaaS UI. Sidebar layout, KPI tiles, cards, tables, charts.
   Brand: accent #E05A00, dark #1a1a1a, Sora (headings) + DM Sans (body).
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap");

:root {
  --accent: #E05A00;
  --accent-600: #c44f00;
  --accent-050: #fdf1e8;
  --dark: #1a1a1a;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --sidebar-bg: #16181d;
  --sidebar-ink: #c9cdd6;
  --sidebar-active: #E05A00;

  --green: #1f9d55;
  --green-bg: #e7f6ee;
  --red: #d64545;
  --red-bg: #fdeaea;
  --amber: #b7791f;
  --amber-bg: #fdf3e0;
  --blue: #2b6cb0;
  --blue-bg: #e8f0fa;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --sidebar-w: 244px;
  --topbar-h: 64px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-name {
  font-family: "Sora", system-ui, sans-serif;
  color: var(--dark);
  margin: 0 0 .4em;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shell ---------- */
main.content {
  margin-left: var(--sidebar-w);
  padding: 26px clamp(16px, 3vw, 40px) 40px;
  max-width: calc(var(--maxw) + var(--sidebar-w));
  min-height: calc(100vh - var(--topbar-h));
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}
.page-head h2 { font-size: 1.5rem; margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; font-size: .92rem; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 40;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.brand-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #ff8a3d);
  color: #fff;
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
}
.brand-mark.small { width: 22px; height: 22px; font-size: .8rem; border-radius: 6px; }
.brand-name { color: #fff; font-size: 1.15rem; font-weight: 700; }
.sidebar-close { display: none; background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer; }

.sidebar-space-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .68rem;
  color: #7c828f;
  margin: 8px 6px 14px;
}

.side-nav:not([hidden]) { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-ink);
  font-weight: 500;
  font-size: .93rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--accent); color: #fff; }
.nav-ico {
  width: 22px; text-align: center;
  font-size: 1rem; opacity: .95;
}

.sidebar-footer { margin-top: auto; padding-top: 16px; }
.tenant-hint { font-size: .72rem; color: #6b7280; margin: 0; word-break: break-all; }

/* ---------- Topbar ---------- */
.topbar {
  margin-left: var(--sidebar-w);
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 clamp(16px, 3vw, 40px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title { font-size: 1.05rem; margin: 0; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--ink); }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch button {
  border: 0; background: #fff; padding: 6px 11px;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted);
  cursor: pointer;
}
.lang-switch button.active { background: var(--accent); color: #fff; }

.user-chip { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-050); color: var(--accent);
  font-weight: 700; font-size: .82rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 600; font-size: .85rem; }
.user-role { font-size: .72rem; color: var(--muted); }
.btn-logout {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 12px; border-radius: 8px; font: inherit; font-size: .82rem;
  font-weight: 600; cursor: pointer;
}
.btn-logout:hover { border-color: var(--accent); color: var(--accent); }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 1.05rem; margin: 0; }
.card-sub { color: var(--muted); font-size: .85rem; margin: -6px 0 14px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ---------- KPI tiles ---------- */
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent);
}
.kpi.green::before { background: var(--green); }
.kpi.red::before { background: var(--red); }
.kpi.blue::before { background: var(--blue); }
.kpi.amber::before { background: var(--amber); }
.kpi-label { color: var(--muted); font-size: .82rem; font-weight: 500; margin: 0 0 6px; }
.kpi-value { font-family: "Sora", sans-serif; font-size: 1.55rem; font-weight: 700; color: var(--dark); line-height: 1.1; }
.kpi-value small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.kpi-delta { font-size: .78rem; margin-top: 6px; font-weight: 600; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-sub { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th {
  background: #fafafb; color: var(--muted); font-weight: 600;
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
}
table.data tbody tr:hover { background: #fafafb; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; line-height: 1.5;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.amber { color: var(--amber); background: var(--amber-bg); }
.badge.blue { color: var(--blue); background: var(--blue-bg); }
.badge.grey { color: var(--muted); background: #eef0f2; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 16px; font: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-600); text-decoration: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #f9dede; text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.field .hint { font-size: .74rem; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font: inherit; font-size: .9rem; background: #fff; color: var(--ink); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-050);
}

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- Progress / meters ---------- */
.meter { height: 8px; border-radius: 999px; background: #eef0f2; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.green > span { background: var(--green); }
.meter.red > span { background: var(--red); }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-variant-numeric: tabular-nums; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; }
.right { text-align: right; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: #eef0f2; color: var(--muted); font-size: .74rem; font-weight: 600;
}

/* Auth/access notice */
.notice {
  padding: 14px 16px; border-radius: var(--radius-sm); font-size: .9rem;
  border: 1px solid var(--line); background: #fff;
}
.notice.warn { background: var(--amber-bg); border-color: #f0dcae; color: #8a5a10; }

.demo-banner {
  margin-left: var(--sidebar-w);
  background: var(--accent-050);
  color: var(--accent-600);
  font-size: .8rem;
  text-align: center;
  padding: 6px 10px;
  border-bottom: 1px solid #f4d9c4;
}

/* Section list rows */
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 600; }
.list-row .d { font-size: .8rem; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before {
  content: ""; position: absolute; left: 4px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent);
}
.timeline li::after {
  content: ""; position: absolute; left: 8px; top: 13px; bottom: 0; width: 1px; background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline .ts { font-size: .74rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-100%); transition: transform .25s ease; width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .menu-toggle { display: inline-block; }
  .topbar { margin-left: 0; }
  main.content { margin-left: 0; }
  .demo-banner { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .user-meta { display: none; }
}
@media (max-width: 560px) {
  .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .btn-logout .lang-fr, .btn-logout .lang-en { display: none !important; }
  .btn-logout::after { content: "⎋"; }
}

/* ---------- Footer ---------- */
.app-footer { margin-left: var(--sidebar-w); border-top: 1px solid var(--line); background: #fff; }
.app-footer-inner {
  display: block;
  padding: 34px clamp(16px, 3vw, 40px) 22px; font-size: .82rem; color: var(--muted);
}
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.3fr; gap: 30px; align-items: start; }
.footer-brand { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 700; font-size: 1rem; color: var(--ink); }
.footer-tag { color: var(--muted); font-size: .88rem; margin: 8px 0; max-width: 34ch; }
.footer-contact { margin: 0; }
.footer-contact a { color: var(--muted); }
.footer-col h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); margin: 0 0 12px; }
.footer-quick { display: flex; flex-direction: column; gap: 8px; }
.footer-quick a { color: var(--muted); font-size: .9rem; }
.footer-sep { color: var(--line); }
.footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
}
.footer-legal { margin: 0; color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }
.footer-quick a:hover, .footer-links a:hover, .footer-contact a:hover, .footer-credit a:hover { color: var(--accent); }
.footer-credit { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: .78rem; }
.footer-credit a { color: var(--muted); font-weight: 600; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } .footer-bottom { flex-direction: column; align-items: flex-start; } }
@media (max-width: 900px) { .app-footer { margin-left: 0; } }

/* ============================================================
   Language selector (4 langs) + footer newsletter — added for
   FR/EN/PT/ES support and the newsletter block.
   ============================================================ */
.lang-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 8px;
  padding: 2px 6px;
}
.lang-globe { font-size: .9rem; line-height: 1; }
.lang-select {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  padding: 2px 2px;
  outline: none;
}

.footer-newsletter { margin: 6px 0; }
.footer-news-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .8;
  margin-bottom: 6px;
}
.footer-news-row { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-news-row input[type="email"] {
  flex: 1 1 200px;
  min-width: 160px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 8px;
  font: inherit;
  font-size: .9rem;
}
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.footer-news-msg { margin: 8px 0 0; font-size: .82rem; }
.footer-news-msg.ok { color: #1a7f4b; }
.footer-news-msg.error { color: #c0392b; }

/* Logo is now an <img> (Concept A) — drop the placeholder gradient/letter styling. */
img.brand-mark { background: none; object-fit: contain; border-radius: 0; }
