/* =========================================================
   ASCON PORTAL – same brand as the website (Swedish blue/yellow)
========================================================= */
:root {
  --blue: #006aa7;
  --blue-700: #00466f;
  --blue-50: #e8f2fa;
  --yellow: #fecc02;
  --navy: #0a1f33;
  --navy-2: #102b45;
  --ink: #13283d;
  --muted: #5a6e82;
  --line: #e1e8ef;
  --bg: #f3f6f9;
  --white: #fff;
  --red: #c62828;
  --green: #1b7a43;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(10, 31, 51, 0.06), 0 1px 2px rgba(10, 31, 51, 0.04);
  --shadow: 0 10px 30px rgba(10, 31, 51, 0.1);
  --font-head: 'Archivo', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side: 268px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); font-size: 15.5px; line-height: 1.6; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); line-height: 1.15; margin: 0 0 0.5em; }
a { color: var(--blue); }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 20px; height: 20px; flex: 0 0 auto; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login__art { position: relative; background: var(--navy); overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
.login__art img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.login__art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10, 31, 51, 0.95) 10%, rgba(10, 31, 51, 0.2)); }
.login__art > * { position: relative; z-index: 1; }
.login__art h2 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.6rem); max-width: 520px; }
.login__art p { color: #c8dcec; max-width: 460px; margin: 0; }
.login__panel { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.login__box { width: min(380px, 100%); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.brand img { width: 42px; height: 42px; }
.brand b { font: 800 1.5rem/1 var(--font-head); letter-spacing: 0.12em; color: var(--navy); display: block; }
.brand small { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.login h1 { font-size: 1.9rem; }
.login .sub { color: var(--muted); margin: 0 0 26px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.9rem; color: var(--navy); }
.field input { font: inherit; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); }
.field input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(0, 106, 167, 0.12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 12px; border: 0; background: var(--blue); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; transition: 0.15s; }
.btn:hover { background: var(--blue-700); }
.btn--yellow { background: var(--yellow); color: var(--navy); }
.btn--yellow:hover { background: #ffd83a; }
.btn--block { width: 100%; padding: 14px; }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn--ghost:hover { background: var(--bg); }
.error { background: #fdecea; color: var(--red); padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; margin-bottom: 14px; }
.login__foot { margin-top: 28px; font-size: 0.8rem; color: var(--muted); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login__art { display: none; } }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #c8dcec; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; overflow-y: auto; }
.side .brand { margin: 0 8px 30px; }
.side .brand b { color: #fff; }
.side .brand small { color: #8fa9c1; }
.side nav { display: grid; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #c8dcec; text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.side nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side nav a.active { background: var(--blue); color: #fff; box-shadow: inset 4px 0 0 var(--yellow); }
.side__label { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: #6f8aa3; margin: 18px 12px 8px; font-weight: 700; }
.credit { display: block; margin-top: 10px; font-size: 0.72rem; opacity: 0.8; }
.side__foot { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.8rem; color: #8fa9c1; }
.flag { display: inline-block; width: 20px; height: 13px; border-radius: 2px; vertical-align: -2px; margin-right: 6px; background: linear-gradient(90deg, transparent 0 31%, var(--yellow) 31% 50%, transparent 50%), linear-gradient(0deg, transparent 0 40%, var(--yellow) 40% 60%, transparent 60%), var(--blue); }

.top { position: sticky; top: 0; z-index: 20; background: rgba(243, 246, 249, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 14px 32px; }
.search { flex: 1; max-width: 520px; position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { width: 100%; font: inherit; padding: 11px 14px 11px 40px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.search input:focus { outline: none; border-color: var(--blue); }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--yellow); color: var(--navy); display: grid; place-items: center; font-weight: 800; text-transform: uppercase; }
.menu-btn { display: none; border: 0; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; }

.content { padding: 32px; max-width: 1180px; width: 100%; }
.pagehead { background: linear-gradient(110deg, var(--navy) 0%, var(--blue-700) 70%, var(--blue) 100%); color: #fff; border-radius: 20px; padding: 34px 36px; margin-bottom: 28px; position: relative; overflow: hidden; }
.pagehead::before { content: ''; position: absolute; top: 0; bottom: 0; right: 130px; width: 34px; background: var(--yellow); opacity: 0.9; }
.pagehead::after { content: ''; position: absolute; left: 70%; right: 0; top: 50%; height: 34px; transform: translateY(-50%); background: var(--yellow); opacity: 0.9; }
.pagehead > * { position: relative; z-index: 1; max-width: 66%; }
.pagehead h1 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.3rem); }
.pagehead p { color: #c8dcec; margin: 0; }
.crumb { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; color: var(--yellow); margin-bottom: 8px; }

.layout { display: grid; grid-template-columns: 1fr 220px; gap: 28px; align-items: start; }
.toc { position: sticky; top: 90px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; font-size: 0.88rem; }
.toc h4 { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.toc a:hover { background: var(--bg); }
.toc a.on { border-left-color: var(--yellow); background: var(--blue-50); color: var(--blue); font-weight: 600; }

.sec { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 30px; margin-bottom: 22px; box-shadow: var(--shadow-sm); scroll-margin-top: 90px; }
.sec h2 { font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.sec h2::before { content: ''; width: 6px; height: 22px; border-radius: 3px; background: var(--yellow); }
.sec p { margin: 0 0 1em; }
.sec > :last-child, .sec > :last-child > :last-child { margin-bottom: 0; }
.sec.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--yellow); } 100% { box-shadow: var(--shadow-sm); } }

ul.list { padding-left: 20px; margin: 0 0 1em; display: grid; gap: 8px; }
ul.list li::marker { color: var(--blue); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 1em; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--bg); }
.card .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--blue); color: var(--yellow); display: grid; place-items: center; margin-bottom: 12px; }
.card h3 { font-size: 1.02rem; margin-bottom: 4px; }
.card p { font-size: 0.92rem; color: var(--muted); margin: 0; }

.tablewrap { overflow-x: auto; margin-bottom: 1em; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th { text-align: left; background: var(--navy); color: #fff; font-weight: 600; padding: 11px 14px; white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
tr:nth-child(even) td { background: #fafcfd; }
td:first-child { font-weight: 600; color: var(--navy); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; counter-reset: s; margin-bottom: 1em; }
.step { position: relative; padding: 18px 18px 18px 18px; border-radius: 12px; background: var(--blue-50); }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: var(--yellow); font-weight: 800; margin-bottom: 10px; }
.step h3 { font-size: 1rem; margin-bottom: 4px; }
.step p { font-size: 0.9rem; margin: 0; color: var(--ink); }

.callout { border-radius: 12px; padding: 16px 18px; margin-bottom: 1em; border-left: 5px solid; }
.callout b { display: block; margin-bottom: 2px; color: var(--navy); }
.callout--blue { background: var(--blue-50); border-color: var(--blue); }
.callout--yellow { background: #fff8d6; border-color: var(--yellow); }
.callout--red { background: #fdecea; border-color: var(--red); }
.callout--grey { background: var(--bg); border-color: #a9b8c6; }

.faq details { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--navy); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.3rem; line-height: 1; color: var(--blue); }
.faq details[open] summary::after { content: '–'; }
.faq details p { padding: 0 18px 16px; margin: 0; color: var(--muted); }

.checklist { list-style: none; padding: 0; margin: 0 0 1em; display: grid; gap: 8px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.checklist input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--blue); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.progress i { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress i b { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--yellow)); border-radius: 4px; transition: width 0.3s; }

.docs { display: grid; gap: 10px; margin-bottom: 1em; }
.doc { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.doc .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; }
.doc b { display: block; color: var(--navy); }
.doc small { color: var(--muted); }
.tag { margin-left: auto; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--yellow); color: var(--navy); white-space: nowrap; }

.contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.contact { border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.contact .role { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--blue); }
.contact b { display: block; color: var(--navy); margin: 4px 0 8px; }
.contact div { font-size: 0.9rem; color: var(--muted); }

/* ---------- Dashboard ---------- */
.hello { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; margin-bottom: 22px; }
.welcome { background: var(--navy); color: #fff; border-radius: 20px; padding: 32px; position: relative; overflow: hidden; min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; }
.welcome img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.45; }
.welcome::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 31, 51, 0.95), rgba(10, 31, 51, 0.2)); }
.welcome > * { position: relative; z-index: 1; }
.welcome h1 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.welcome p { color: #c8dcec; margin: 0; max-width: 520px; }
.stat-card { background: var(--blue); color: #fff; border-radius: 20px; padding: 28px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card .num { font: 900 3.6rem/1 var(--font-head); color: var(--yellow); }
.stat-card small { color: #c8dcec; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.quick a { display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--navy); font-weight: 600; transition: 0.15s; }
.quick a:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--yellow); color: var(--navy); display: grid; place-items: center; }
.news article { padding: 16px 0; border-top: 1px solid var(--line); }
.news article:first-of-type { border-top: 0; padding-top: 0; }
.news .meta { display: flex; gap: 10px; align-items: center; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.news .meta span { background: var(--blue-50); color: var(--blue); font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.news h3 { font-size: 1.05rem; margin-bottom: 4px; }
.news p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.dates li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.dates li:first-child { border-top: 0; }
.dates b { color: var(--navy); }
.dates ul { list-style: none; padding: 0; margin: 0; }

/* ---------- Search results ---------- */
.results a { display: block; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; text-decoration: none; color: var(--ink); }
.results a:hover { border-color: var(--blue); }
.results small { color: var(--blue); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.results b { display: block; color: var(--navy); font-size: 1.05rem; }
.results p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
mark { background: #fff1a8; padding: 0 2px; border-radius: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } .toc { display: none; } }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform 0.25s; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: grid; place-items: center; }
  .hello, .grid2 { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .pagehead::before, .pagehead::after { display: none; }
  .pagehead > * { max-width: none; }
}
@media (max-width: 600px) {
  .content { padding: 18px 16px; }
  .top { padding: 12px 16px; }
  .user span { display: none; }
  .sec { padding: 22px 18px; }
  .pagehead { padding: 26px 22px; }
  .quick { grid-template-columns: 1fr; }
}
.scrim { display: none; }
@media (max-width: 960px) { .scrim.show { display: block; position: fixed; inset: 0; background: rgba(10, 31, 51, 0.45); z-index: 40; } }

/* =========================================================
   CRM
========================================================= */
.app > div { min-width: 0; } /* let wide tables/kanban scroll inside the content column */
.crm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.crm-head .crumb { color: var(--blue); }
.crm-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin: 0 0 4px; }
.crm-head p { margin: 0; color: var(--muted); }
.crm-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crm-head select, .crm-head input[type=month], .filters-row select, .filters-row input {
  font: inherit; font-size: .9rem; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.btn--sm { padding: 7px 12px; font-size: .85rem; }
.btn--danger { background: #fdecea; color: var(--red); }
.btn--danger:hover { background: #f9d6d2; }
.btn .i { width: 18px; height: 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; border-top: 4px solid var(--blue); box-shadow: var(--shadow-sm); }
.kpi small { display: block; color: var(--muted); font-weight: 600; font-size: .8rem; }
.kpi b { display: block; font: 800 1.45rem/1.3 var(--font-head); color: var(--navy); margin: 4px 0 2px; }
.kpi span { font-size: .82rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.kpi.k-green { border-top-color: var(--green); }
.kpi.k-yellow { border-top-color: var(--yellow); }
.kpi.k-red { border-top-color: var(--red); }
.kpi.k-red b { color: var(--red); }

.crm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.crm-grid .sec { margin: 0; }
@media (max-width: 1100px) { .crm-grid { grid-template-columns: 1fr; } }

.crm-table td, .crm-table th { white-space: nowrap; }
.crm-table td:first-child { font-weight: 500; }
.crm-table td small { color: var(--muted); }
.crm-table .r, .lines .r { text-align: right; font-variant-numeric: tabular-nums; }
.crm-table tr.link, .crm-table tr[data-act] { cursor: pointer; }
.crm-table tbody tr:hover td { background: var(--blue-50); }
.crm-table tfoot td { border-top: 2px solid var(--navy); background: #f7fafc; font-weight: 600; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.empty { padding: 26px; text-align: center; color: var(--muted); background: var(--bg); border-radius: 12px; }
.muted { color: var(--muted); font-size: .9rem; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--bg); color: var(--ink); white-space: nowrap; }
.b-blue { background: var(--blue-50); color: var(--blue); }
.b-yellow { background: #fff4c2; color: #7a5d00; }
.b-green { background: #e3f4ea; color: var(--green); }
.b-red { background: #fdecea; color: var(--red); }
.b-grey { background: #eef1f4; color: var(--muted); }

.bar { display: inline-block; width: 90px; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.bar.red i { background: var(--red); }
.hbars { display: grid; gap: 8px; }
.hbars a { display: grid; grid-template-columns: 140px 1fr 70px; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); font-size: .92rem; padding: 4px 0; }
.hbars .bar { width: 100%; height: 12px; }
.hbars b { text-align: right; color: var(--navy); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: #e9eef3; border-radius: 14px; padding: 10px; min-height: 300px; transition: background .15s; }
.kcol.over { background: var(--blue-50); outline: 2px dashed var(--blue); }
.khead { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 4px 4px 10px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.kbody { display: grid; gap: 8px; }
.kcard { background: #fff; border-radius: 10px; padding: 12px; box-shadow: var(--shadow-sm); cursor: grab; border-left: 4px solid var(--blue); display: grid; gap: 4px; }
.kcol[data-stage="Vunnen"] .kcard { border-left-color: var(--green); }
.kcol[data-stage="Förlorad"] .kcard { border-left-color: #a9b8c6; opacity: .8; }
.kcard.drag { opacity: .5; }
.kcard b { color: var(--navy); font-size: .92rem; line-height: 1.3; }
.kcard small { color: var(--muted); font-size: .8rem; }
.kmeta { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .85rem; color: var(--navy); }
.ini { width: 26px; height: 26px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-size: .7rem; }
.knext { font-size: .75rem; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.knext .i { width: 13px; height: 13px; }
.knext.late { color: var(--red); font-weight: 600; }
.klink { font-size: .8rem; font-weight: 600; }
.kempty { text-align: center; color: #9aaabb; font-size: .8rem; padding: 18px 0; border: 2px dashed #cfd9e2; border-radius: 10px; }

/* Forms / modal */
.modal { border: 0; border-radius: 18px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow); }
.modal--wide { width: min(920px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(10, 31, 51, .5); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 1.25rem; }
.modal .fgrid, .modal .lines, .modal .lines-h, .modal .muted, .modal .ferr { margin-left: 22px; margin-right: 22px; }
.modal .fgrid { padding-top: 18px; }
.modal footer { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #f9fbfc; margin-top: auto; position: sticky; bottom: 0; }
.modal footer .sp { flex: 1; }
.x { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.x:hover { background: var(--bg); color: var(--red); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.ff { display: flex; flex-direction: column; gap: 4px; }
.ff.wide, .chk.wide { grid-column: 1 / -1; }
.ff label { font-weight: 600; font-size: .85rem; color: var(--navy); }
.ff input, .ff select, .ff textarea { font: inherit; font-size: .95rem; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
.ff input:focus, .ff select:focus, .ff textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 106, 167, .12); }
.ff small, .chk small { color: var(--muted); font-size: .78rem; }
.chk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; font-size: .9rem; color: var(--navy); padding-top: 22px; cursor: pointer; }
.chk small { flex-basis: 100%; font-weight: 400; margin-left: 26px; }
.chk input { width: 18px; height: 18px; accent-color: var(--blue); }
.ferr { color: var(--red); font-weight: 600; font-size: .9rem; min-height: 1.2em; margin: 10px 0; }
@media (max-width: 600px) { .fgrid { grid-template-columns: 1fr; } }

.lines-h { font-size: 1rem; margin-top: 18px; }
.lines table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.lines th { background: none; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: 6px; }
.lines td { padding: 4px; border: 0; }
.lines tr:nth-child(even) td { background: none; }
.lines td:first-child { font-weight: 400; }
.lines input { width: 100%; font: inherit; font-size: .9rem; padding: 8px; border: 1.5px solid var(--line); border-radius: 8px; }
.lines td:nth-child(2) input, .lines td:nth-child(4) input { width: 100px; }
.lines td:nth-child(3) input { width: 70px; }
.lsum { text-align: right; margin: 6px 0 4px; }

.quick-time .qt { display: grid; grid-template-columns: 1.2fr 1.4fr .9fr .6fr 2fr auto auto; gap: 10px; align-items: end; }
.quick-time .chk { padding: 0 0 10px; }
@media (max-width: 1200px) { .quick-time .qt { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 600px) { .quick-time .qt { grid-template-columns: 1fr; } }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.chip-sum { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 700; color: var(--navy); }
.chip-sum small { display: block; color: var(--muted); font-weight: 600; font-size: .75rem; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transition: .25s; z-index: 100; border-left: 5px solid var(--yellow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-left-color: var(--red); }

/* Invoice document */
.invoice-doc { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 44px; box-shadow: var(--shadow-sm); max-width: 900px; color: #111; }
.inv-top { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; padding-bottom: 26px; border-bottom: 4px solid var(--yellow); }
.inv-brand { display: flex; gap: 12px; align-items: center; }
.inv-brand img { width: 52px; height: 52px; }
.inv-brand b { font: 800 1.5rem/1 var(--font-head); letter-spacing: .12em; color: var(--navy); display: block; }
.inv-brand small { color: var(--muted); }
.inv-title h2 { font-size: 1.8rem; letter-spacing: .1em; color: var(--blue); margin-bottom: 8px; }
.inv-title table { font-size: .9rem; }
.inv-title td { padding: 2px 0 2px 16px; border: 0; background: none !important; }
.inv-title td:first-child { color: var(--muted); padding-left: 0; font-weight: 400; }
.inv-parties { display: flex; gap: 40px; flex-wrap: wrap; margin: 26px 0; }
.inv-parties div { line-height: 1.5; }
.inv-parties small, .inv-foot small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; }
.inv-parties b { display: block; font-size: 1.05rem; color: var(--navy); }
.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th { background: var(--navy); color: #fff; padding: 10px 12px; text-align: left; font-size: .85rem; }
.inv-lines td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.inv-lines td:first-child { font-weight: 400; color: #111; }
.inv-lines .r, .inv-lines th.r { text-align: right; }
.inv-sum { margin: 18px 0 0 auto; width: min(340px, 100%); }
.inv-sum div { display: flex; justify-content: space-between; padding: 6px 0; }
.inv-sum .tot { border-top: 2px solid var(--navy); margin-top: 6px; padding-top: 10px; font-size: 1.2rem; }
.inv-sum .tot b { color: var(--blue); }
.inv-note { background: #fff8d6; border-left: 4px solid var(--yellow); padding: 10px 14px; border-radius: 8px; margin: 20px 0 0; font-size: .92rem; }
.inv-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem; line-height: 1.6; }
@media (max-width: 700px) { .invoice-doc { padding: 22px; } .inv-foot { grid-template-columns: 1fr; } }

@media print {
  body { background: #fff; }
  .side, .top, .scrim, .no-print, .toast, .crm-head { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .invoice-doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .sec { box-shadow: none; break-inside: avoid; }
}
