:root {
  --asphalt: #1C2230; --asphalt-2: #262E40; --asphalt-3: #343D52;
  --yellow: #F2B705; --yellow-ink: #3A2C00; --yellow-soft: #FFF4CC;
  --cobalt: #1D4E89; --cobalt-soft: #E3ECF7;
  --sand: #EDE3CF; --bg: #F4F5F7; --paper: #FFFFFF;
  --ink: #1C2230; --muted: #5B6475; --line: #E1E4EA;
  --red: #C8372D; --red-soft: #FBE3E1; --green: #2E7D4F; --green-soft: #E2F2E8;
  --orange: #B4610E; --orange-soft: #FCEBD9;
  --font: 'Archivo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--cobalt); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
h1, h2, h3 { font-stretch: 110%; font-weight: 800; line-height: 1.15; margin: 0; }
h1 { font-size: 26px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--asphalt); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-stretch: 118%; font-size: 19px; color: #fff; text-decoration: none; }
.brand img { display: block; border-radius: 8px; }
.brand span { font-weight: 500; } .brand b { font-weight: 800; }
.side .legal-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }
.side .legal-links a { color: #9AA2B1; font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.check input { margin-top: 3px; width: 16px; height: 16px; flex: none; accent-color: var(--asphalt); }
.side a.nav { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 6px; color: #C9D0DC; text-decoration: none; font-weight: 600; }
.side a.nav svg { width: 18px; height: 18px; flex: none; }
.side a.nav:hover { background: var(--asphalt-2); color: #fff; }
.side a.nav.on { background: var(--yellow); color: var(--yellow-ink); }
.side .sep { height: 1px; background: var(--asphalt-3); margin: 10px 8px; }
.side .bottom { margin-top: auto; padding: 12px 10px 0; font-size: 13px; color: #9AA2B1; }
.side .bottom strong { color: #fff; display: block; }
.side .bottom button { background: none; border: 0; color: #C9D0DC; padding: 6px 0; cursor: pointer; text-decoration: underline; }
.main { min-width: 0; }
.top { display: none; }
.content { padding: 28px 32px 64px; max-width: 1280px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.trial { background: var(--yellow-soft); border-bottom: 1px solid #F1DC8A; padding: 9px 32px; font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.trial a { font-weight: 700; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 8px 14px; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: #F7F8FA; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--yellow-ink); }
.btn.primary:hover { background: #FFC71F; }
.btn.dark { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { display: inline-flex; vertical-align: middle; border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: #EDEFF3; color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; display: block; }

/* Cards & KPIs */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.panel > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 12px; }
.panel .body { padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .v { font-size: 26px; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi .v.pos { color: var(--green); } .kpi .v.neg { color: var(--red); }

.fleet { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: #EDEFF3; margin: 6px 0 12px; }
.fleet span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list li:last-child { border-bottom: 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFBFC; }
td.nw { white-space: nowrap; }
td.act { text-align: right; white-space: nowrap; width: 1%; }
.strong { font-weight: 700; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.p-green { background: var(--green-soft); color: var(--green); }
.p-blue { background: var(--cobalt-soft); color: var(--cobalt); }
.p-red { background: var(--red-soft); color: var(--red); }
.p-orange { background: var(--orange-soft); color: var(--orange); }
.p-grey { background: #EDEFF3; color: var(--muted); }
.p-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }

/* Toolbar */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.search { min-width: 220px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-weight: 600; font-size: 13.5px; }
.field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid #CBD1DB; border-radius: 6px; background: #fff; width: 100%; }
.field textarea { min-height: 72px; resize: vertical; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.calc { background: var(--cobalt-soft); border-radius: 6px; padding: 10px 14px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.calc b { font-variant-numeric: tabular-nums; }
.err { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 6px; font-weight: 600; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(20,25,36,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 680px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal > header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .body { padding: 20px 22px; display: grid; gap: 16px; }
.modal > footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--asphalt); color: #fff; padding: 11px 18px; border-radius: 8px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 92vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--red); }

/* Planning */
.plan { overflow-x: auto; }
.plan-grid { display: grid; min-width: 820px; font-size: 13px; }
.plan-grid .ph { padding: 8px 4px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); background: #FAFBFC; font-size: 12px; }
.plan-grid .ph.we { background: #F1F2F5; }
.plan-grid .ph.td { color: var(--ink); font-weight: 800; box-shadow: inset 0 -3px 0 var(--yellow); }
.plan-grid .rh { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; position: sticky; left: 0; background: #fff; z-index: 1; }
.plan-grid .rh small { display: block; color: var(--muted); font-weight: 500; }
.plan-grid .cell { border-bottom: 1px solid var(--line); border-left: 1px solid #F0F1F4; min-height: 52px; }
.plan-grid .cell.we { background: #FAFAFB; }
.plan-grid .blk { margin: 8px 2px; padding: 5px 8px; border-radius: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; align-self: center; }
.blk.rent { background: var(--cobalt); color: #fff; }
.blk.done { background: #9FB3CC; color: #fff; }
.blk.fix { background: var(--red-soft); color: var(--red); border: 1px solid #F1B9B4; }
.blk.mnt { background: var(--orange-soft); color: var(--orange); border: 1px solid #F2C99C; }

/* Bilan */
.bars { display: grid; gap: 10px; }
.barrow { display: grid; grid-template-columns: 1fr 120px; gap: 4px 12px; align-items: center; }
.barrow .track { grid-column: 1 / -1; height: 8px; background: #EDEFF3; border-radius: 4px; overflow: hidden; }
.barrow .track span { display: block; height: 100%; background: var(--cobalt); }
.result-line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-line.total { font-weight: 800; font-size: 17px; border-bottom: 0; border-top: 2px solid var(--ink); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .art { background: var(--asphalt) center/cover no-repeat; position: relative; color: #fff; display: flex; align-items: flex-end; padding: 40px; }
.auth .art::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(28,34,48,.25), rgba(28,34,48,.92)); }
.auth .art div { position: relative; max-width: 440px; }
.auth .art h2 { font-size: 30px; margin-bottom: 10px; }
.auth .art p { color: #D5DAE3; }
.auth .formside { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.auth form { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.auth .brand { color: var(--ink); padding: 0 0 18px; }
.auth h1 { margin-bottom: 4px; }

.price-box { display: flex; align-items: baseline; gap: 8px; }
.price-box strong { font-size: 44px; font-stretch: 118%; }

/* Mobile */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(20,25,36,.5); }
  .top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--asphalt); color: #fff; position: sticky; top: 0; z-index: 30; }
  .top .brand { padding: 0; font-size: 17px; }
  .top button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
  .top button svg { width: 24px; height: 24px; display: block; }
  .content { padding: 18px 14px 56px; }
  .trial { padding: 9px 14px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .search { min-width: 0; flex: 1; }
  /* Tables become cards on phones */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  table.cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.cards td::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-align: left; }
  table.cards td.act { justify-content: flex-end; width: 100%; }
  table.cards td.act::before { content: none; }
  table.cards td.num { text-align: right; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Wordmark */
.brand img { border-radius: 0 !important; }
.brand span { text-transform: uppercase; letter-spacing: .03em; font-stretch: 110%; font-weight: 800; color: var(--yellow); font-size: 15px; white-space: nowrap; }
.side .brand { padding-left: 8px; padding-right: 0; gap: 9px; }
.side .brand img { width: 30px; height: 30px; flex: none; }
.brand b { color: #fff; font-weight: 800; }
.auth .brand span { color: #5B6475; }
.auth .brand b { color: var(--ink); }
