:root {
  --ink: #171717;
  --ink-soft: #262626;
  --paper: #f4f2ed;
  --paper-deep: #e9e6df;
  --card: #ffffff;
  --line: #d7d4cc;
  --muted: #686862;
  --yellow: #ffd21c;
  --orange: #ff9f1a;
  --green: #168f50;
  --green-soft: #e7f5ed;
  --red: #a62f26;
  --navy: var(--ink);
  --navy2: var(--ink-soft);
  --cyan: var(--yellow);
  --bg: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Manrope, Inter, Arial, sans-serif; }
h1, h2, h3, .brand { font-family: "Plus Jakarta Sans", Arial, sans-serif; letter-spacing: -.035em; }
h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.05; }
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 32px)); margin: auto; }

.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; border-bottom: 1px solid #303030; }
.topbar .shell { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 17px; font-weight: 800; }
.brand::before { content: "M"; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 15px; }
.brand::after { content: "."; color: var(--yellow); }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { color: #bdbdbd; text-decoration: none; font-size: 12px; font-weight: 700; }
.nav a:hover, .nav a.active { color: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 12px 18px; font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .18s, box-shadow .18s, background .18s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 8px 20px rgb(22 143 80 / 16%); }
.btn-primary:hover { background: #107b43; }
.btn-secondary { background: #fff; border-color: #bbb7ae; color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.topbar .btn-secondary { background: transparent; border-color: #4a4a4a; color: #fff; }
.topbar .btn-dark { background: var(--yellow); color: var(--ink); }

.hero-small { position: relative; overflow: hidden; padding: 58px 0 42px; background: linear-gradient(112deg, var(--yellow), var(--orange) 65%, #ff7a00); color: var(--ink); }
.hero-small::after { content: ""; position: absolute; right: max(16px, calc((100vw - 1120px) / 2)); top: -38px; width: 250px; height: 250px; background: url("assets/brand/matospro-logo.png") center/contain no-repeat; opacity: .18; }
.hero-small .shell { position: relative; z-index: 1; }
.hero-small h1 { max-width: 760px; margin: 7px 0 12px; }
.hero-small p { color: #4d3a12; max-width: 720px; line-height: 1.65; }
.hero-small p:first-child { color: var(--ink); font-size: 10px; font-weight: 800; letter-spacing: .18em; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; padding: 40px 0 64px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; box-shadow: 0 14px 36px rgb(23 23 23 / 5%); }
.card h2, .card h3 { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { color: var(--ink); font-size: 13px; font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #c8c4ba; border-radius: 8px; padding: 12px 14px; background: #fff; color: var(--ink); font: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(23 23 23 / 8%); }
.field textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.full { grid-column: 1 / -1; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #ece9e3; }
.muted { color: var(--muted); }
.notice { padding: 14px 16px; border-radius: 8px; background: #fff8df; color: #5f4600; font-size: 14px; }
.success { background: var(--green-soft); color: #145a40; }
.warning { background: #fff1df; color: #754300; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.footer { background: #0d0d0d; color: #aaa; padding: 30px 0; }

.dashboard { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { background: var(--ink); color: #fff; padding: 28px 20px; border-top: 1px solid #303030; }
.sidebar h3 { color: var(--yellow); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.sidebar a { display: block; color: #bdbdbd; text-decoration: none; padding: 11px 12px; border-radius: 8px; margin: 4px 0; font-size: 13px; font-weight: 700; }
.sidebar a.active, .sidebar a:hover { background: var(--yellow); color: var(--ink); }
.workspace { padding: 32px; overflow: auto; background-image: linear-gradient(rgb(23 23 23 / 3%) 1px, transparent 1px), linear-gradient(90deg, rgb(23 23 23 / 3%) 1px, transparent 1px); background-size: 40px 40px; }
.workspace > h1 { margin-bottom: 8px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; margin: 24px 0; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.metric strong { display: block; margin-top: 6px; color: var(--ink); font-size: 28px; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #ece9e3; text-align: left; font-size: 13px; }
th { background: #f8f7f3; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.status { border: 0; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.status-nouveau { background: #fff5bd; color: #624f00; }
.status-contacte { background: #fff1df; color: #754300; }
.status-devis { background: #eeeaff; color: #463587; }
.status-gagne { background: var(--green-soft); color: #145a40; }
.status-perdu { background: #ffe9e7; color: #8d2720; }
.empty { padding: 48px; color: var(--muted); text-align: center; }
.upload-previews { display:flex; gap:8px; overflow-x:auto; padding:8px 0; }
.upload-previews img { width:84px; height:84px; flex:0 0 auto; object-fit:cover; border:1px solid var(--line); border-radius:10px; }

@media (max-width: 850px) {
  .nav { display: none; }
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position:sticky;top:116px;z-index:18;display: flex; overflow: auto; padding: 8px 10px;scrollbar-width:none;box-shadow:0 5px 14px rgb(0 0 0 / 18%); }
  .sidebar h3 { display: none; }
  .sidebar a { min-height:42px;display:flex;align-items:center;white-space: nowrap; }
  .workspace { padding: 20px; }
  .metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .topbar .shell { min-height: 64px; }
  .topbar .shell > strong { display: none; }
  .brand { font-size: 14px; }
  .brand::before { width: 30px; height: 30px; }
  body{font-size:15px}.shell{width:min(100% - 24px,1120px)}
  .hero-small { padding: 30px 0 24px; }.hero-small::after{width:170px;height:170px;right:-24px;opacity:.12}
  .hero-small h1{font-size:30px}.hero-small p{line-height:1.5}
  .card { padding: 17px;border-radius:14px; }.grid{gap:16px;padding:24px 0 40px}
  .field input,.field select,.field textarea,.btn{min-height:48px;font-size:16px}.actions{display:grid;grid-template-columns:1fr}.actions .btn{width:100%}
  .workspace{padding:18px 12px 34px}.workspace>h1{font-size:29px}.metrics { grid-template-columns:1fr 1fr;gap:10px;margin:18px 0}.metric{padding:13px;font-size:12px}.metric strong{font-size:24px}
  .table-wrap{overflow:visible;border:0;background:transparent}.table-wrap table{min-width:0}.table-wrap thead{display:none}.table-wrap tbody{display:grid;gap:12px}.table-wrap tr{display:block;padding:8px 14px;background:#fff;border:1px solid var(--line);border-radius:13px;box-shadow:0 7px 18px rgb(23 23 23 / 5%)}.table-wrap td{display:grid;grid-template-columns:minmax(90px,38%) 1fr;gap:10px;align-items:start;padding:10px 0;border-bottom:1px solid #ece9e3;overflow-wrap:anywhere}.table-wrap td:last-child{border-bottom:0}.table-wrap td::before{content:attr(data-label);color:var(--muted);font-size:9px;font-weight:800;letter-spacing:.06em;text-transform:uppercase}.table-wrap select,.table-wrap input,.table-wrap .btn{max-width:100%;min-height:42px}
}
