/* Karakuş Elektrik CRM — shared interface */
:root {
  color-scheme: light;
  --canvas: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #fafbf9;
  --ink: #17243a;
  --ink-soft: #526178;
  --muted: #728097;
  --line: #e2e8f0;
  --navy: #101e34;
  --navy-light: #1b304d;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-tint: #eaf1ff;
  --amber: #e9a42e;
  --amber-tint: #fff5e3;
  --green: #16815d;
  --green-tint: #e5f7ef;
  --red: #c94646;
  --red-tint: #fff0ef;
  --shadow: 0 10px 32px rgba(19, 37, 64, .045), 0 1px 3px rgba(19, 37, 64, .04);
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font-size: 14px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
input, textarea { cursor: text; }
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; letter-spacing: -.025em; }
h1 { font-size: clamp(1.55rem, 2vw, 2rem); font-weight: 760; }
h2 { font-size: 1.22rem; font-weight: 720; }
h3 { font-size: 1.04rem; font-weight: 700; }
p { margin-bottom: 1rem; }
small, .muted { color: var(--muted); }
strong { font-weight: 700; }
::selection { color: #fff; background: var(--blue); }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .42); outline-offset: 2px; }

/* Main frame */
.app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; background: linear-gradient(162deg, #12233c 0%, #0c192c 100%); color: #e8eef8; scrollbar-width: thin; scrollbar-color: #3b4d68 transparent; }
.sidebar a { color: inherit; }
.sidebar a:hover { text-decoration: none; }
.sidebar-header, .brand { display: flex; align-items: center; gap: 11px; min-height: 94px; padding: 24px 23px; }
.brand { padding: 0; min-height: 0; }
.brand-mark { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #f9bb4b, #e38d21); color: #17243a; font-size: 1.25rem; font-weight: 900; box-shadow: 0 7px 18px rgba(232, 156, 33, .2); }
.brand-name, .brand strong { display: block; color: #fff; font-size: 1rem; font-weight: 760; letter-spacing: -.025em; line-height: 1.2; }
.brand-subtitle, .brand small { display: block; margin-top: 2px; color: #9eacc1; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-nav, .nav { display: grid; gap: 4px; padding: 7px 12px 20px; }
.nav-label { padding: 19px 13px 7px; color: #8191a9; font-size: .66rem; font-weight: 740; letter-spacing: .14em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 41px; padding: 9px 12px; border: 1px solid transparent; border-radius: 10px; color: #b9c6d9 !important; font-weight: 560; line-height: 1.3; transition: background .18s, color .18s, border-color .18s; }
.nav-link:hover { background: rgba(255,255,255,.075); color: #fff !important; }
.nav-link.active, .nav-link[aria-current="page"] { background: rgba(71, 128, 251, .18); border-color: rgba(105, 150, 250, .14); color: #fff !important; box-shadow: inset 3px 0 0 #eeb043; }
.nav-link svg, .nav-link .icon { flex: 0 0 19px; width: 19px; height: 19px; opacity: .9; }
.nav-link .nav-count { margin-left: auto; padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,.12); color: #dce5f5; font-size: .72rem; }
.sidebar-footer { margin-top: auto; padding: 18px 23px 25px; border-top: 1px solid rgba(255,255,255,.09); color: #9eacc1; font-size: .78rem; }
.sidebar-footer strong { display: block; color: #e8eef8; font-size: .84rem; }
.sidebar-backdrop { display: none; }

.main { min-width: 0; padding: 0 clamp(18px, 3vw, 40px) 56px; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 78px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.mobile-brand { display: none; }
.topbar-title { display: flex; align-items: center; gap: 12px; font-weight: 690; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.topbar-user { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: .82rem; }
.avatar { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: #e8eef9; color: #2c4c88; font-weight: 760; }
[data-menu-toggle], .menu-toggle { display: none; }
.page-header, .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-header h1, .page-head h1 { margin: 0 0 4px; }
.page-header p, .page-head p { margin: 0; color: var(--ink-soft); }
.page-kicker { margin: 0 0 5px; color: var(--blue); font-size: .7rem; font-weight: 770; letter-spacing: .13em; text-transform: uppercase; }
.page-actions, .actions, .toolbar, .form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar { justify-content: space-between; margin-bottom: 16px; }
.period-filter { justify-content: flex-start; align-items: end; margin-bottom: 22px; }
.period-filter > .field { width: min(100%, 220px); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; }
.toolbar form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Panels and summary figures */
.card { min-width: 0; margin-bottom: 20px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card--flush { padding: 0; overflow: hidden; }
.card-header, .section-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.card-header h2, .section-header h2, .section-title { margin: 0; font-size: 1.06rem; font-weight: 730; }
.card-header p, .section-header p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.card-footer { margin: 20px -22px -22px; padding: 15px 22px; border-top: 1px solid var(--line); background: var(--surface-soft); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, 1fr); gap: 20px; }
.grid > .card, .grid-3 > .card, .grid-4 > .card, .grid-main > .card { margin-bottom: 0; }
.stats-grid, .stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { position: relative; min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.stat-card::before { position: absolute; top: 0; right: 0; width: 86px; height: 86px; border-radius: 0 0 0 100%; background: var(--blue-tint); content: ""; opacity: .65; }
.stat-card--amber::before { background: var(--amber-tint); }
.stat-card--green::before { background: var(--green-tint); }
.stat-card--red::before { background: var(--red-tint); }
.stat-card > * { position: relative; }
.stat-label { margin: 0 0 10px; color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .025em; }
.stat-value { margin: 0; font-size: clamp(1.25rem, 1.8vw, 1.75rem); font-weight: 780; line-height: 1.2; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.stat-note { display: block; margin-top: 7px; color: var(--ink-soft); font-size: .74rem; }
.metric-list { display: grid; gap: 12px; }
.metric-row { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.metric-row:last-child { padding-bottom: 0; border-bottom: 0; }
.metric-row strong { font-variant-numeric: tabular-nums; }

/* Buttons, tags and notices */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; background: #fff; color: var(--ink); font-size: .83rem; font-weight: 680; line-height: 1.2; white-space: nowrap; text-align: center; cursor: pointer; transition: background .16s, color .16s, border-color .16s, box-shadow .16s, transform .16s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 5px 13px rgba(37, 99, 235, .16); }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-secondary { border-color: #d8e2f0; background: #fff; color: #29415f; }
.btn-secondary:hover { border-color: #b6cae4; background: #f4f8ff; }
.btn-danger { border-color: #f0c9c9; background: var(--red-tint); color: #a43333; }
.btn-danger:hover { border-color: #eaa4a4; background: #ffe3e1; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #ecf1f7; color: var(--ink); }
.btn-sm { min-height: 30px; padding: 5px 9px; border-radius: 7px; font-size: .74rem; }
.btn-icon { width: 38px; padding: 0; }
.badge, .pill { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 9px; border: 1px solid transparent; border-radius: 99px; background: #edf2f7; color: #50627a; font-size: .7rem; font-weight: 720; line-height: 1.25; white-space: nowrap; }
.badge::before { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; opacity: .8; }
.badge-blue, .badge-info { background: var(--blue-tint); color: #2457c2; }
.badge-green, .badge-success { background: var(--green-tint); color: #13724f; }
.badge-amber, .badge-warning { background: var(--amber-tint); color: #956014; }
.badge-red, .badge-danger { background: var(--red-tint); color: #ab3b3b; }
.flash { position: relative; display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; padding: 13px 16px; border: 1px solid #bed7fb; border-radius: 11px; background: #eef5ff; color: #1e4e9a; font-size: .84rem; }
.flash p { margin: 0; }
.flash-success { border-color: #bae6d2; background: #eaf9f1; color: #126949; }
.flash-error, .flash-danger { border-color: #f4c3c0; background: #fff0ee; color: #a33434; }
.flash-warning { border-color: #f0d8a6; background: #fff7e8; color: #865716; }
.flash-close, [data-flash-dismiss] { margin: -4px -6px -4px auto; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.flash-close:hover, [data-flash-dismiss]:hover { background: rgba(0,0,0,.055); }

/* Tables and record lists */
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
table, .table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .81rem; }
thead th { padding: 11px 13px; border-bottom: 1px solid var(--line); background: #f7f9fc; color: #627189; font-size: .69rem; font-weight: 760; letter-spacing: .055em; text-align: left; text-transform: uppercase; white-space: nowrap; }
tbody td { padding: 13px; border-bottom: 1px solid #ebeff5; color: var(--ink-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }
td strong, td .primary-cell { color: var(--ink); font-weight: 700; }
td small { display: block; margin-top: 2px; font-size: .72rem; }
td a { font-weight: 660; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.table-number, .text-right { text-align: right; font-variant-numeric: tabular-nums; }
.text-center { text-align: center; }
.table-wrap > table { min-width: 620px; }
.table-wrap .table--compact { min-width: 480px; }
.card--flush .table-wrap thead th:first-child, .card--flush .table-wrap tbody td:first-child { padding-left: 22px; }
.card--flush .table-wrap thead th:last-child, .card--flush .table-wrap tbody td:last-child { padding-right: 22px; }
.empty-state { display: grid; justify-items: center; gap: 9px; padding: 52px 25px; border: 1px dashed #d4deec; border-radius: 13px; background: #fafcff; color: var(--ink-soft); text-align: center; }
.empty-state h2, .empty-state h3 { margin: 0; color: var(--ink); }
.empty-state p { max-width: 420px; margin: 0 0 5px; }
.empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--blue-tint); color: var(--blue); font-size: 1.3rem; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; min-width: 0; gap: 6px; }
.field-full, .span-2 { grid-column: 1 / -1; }
.field label, label.field { color: #34465f; font-size: .76rem; font-weight: 690; }
.field small, .field-help { color: var(--muted); font-size: .72rem; }
.field input, .field select, .field textarea,
input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="password"], input[type="search"], select, textarea { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid #d8e0eb; border-radius: 8px; outline: none; background: #fff; color: var(--ink); font-size: .84rem; line-height: 1.35; transition: border-color .16s, box-shadow .16s, background .16s; }
textarea, .field textarea { min-height: 92px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--blue); cursor: pointer; }
input::placeholder, textarea::placeholder { color: #9aa7b8; }
input:hover, select:hover, textarea:hover { border-color: #b8c7dc; }
input:focus, select:focus, textarea:focus { border-color: #6998ec; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: #f3f6fa; color: #68778d; cursor: not-allowed; }
input[aria-invalid="true"], .field-error input, .field-error select, .field-error textarea { border-color: #d66060; }
.field-error-message { color: var(--red); font-size: .72rem; }
.form-actions { justify-content: flex-end; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-help { margin: 13px 0 0; color: var(--muted); font-size: .75rem; }
.input-group { display: flex; align-items: stretch; }
.input-group > input, .input-group > select { min-width: 0; border-radius: 8px 0 0 8px; }
.input-group > .btn, .input-group > .input-addon { border-radius: 0 8px 8px 0; }
.input-addon { display: grid; place-items: center; min-width: 40px; padding: 0 11px; border: 1px solid #d8e0eb; border-left: 0; background: #f4f7fb; color: var(--ink-soft); }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-row input { flex: 0 0 auto; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 12px; font-weight: 720; }
hr { height: 1px; margin: 20px 0; border: 0; background: var(--line); }

/* Project and quote detail helpers */
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.detail-list > div { min-width: 0; }
.detail-list dt { margin-bottom: 3px; color: var(--muted); font-size: .7rem; font-weight: 680; letter-spacing: .04em; text-transform: uppercase; }
.detail-list dd { margin: 0; color: var(--ink); font-weight: 630; overflow-wrap: anywhere; }
.progress { width: 100%; height: 9px; overflow: hidden; border-radius: 99px; background: #e7edf5; }
.progress > span, .progress-bar { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2867ed, #52a0ff); transition: width .25s; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--ink-soft); font-size: .76rem; }
.timeline { margin: 0; padding: 0 0 0 15px; list-style: none; border-left: 2px solid #e1e9f5; }
.timeline li { position: relative; margin-bottom: 20px; padding-left: 16px; }
.timeline li:last-child { margin-bottom: 0; }
.timeline li::before { position: absolute; top: 5px; left: -21px; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px #b8d0fa; content: ""; }
.timeline li strong { display: block; color: var(--ink); }
.timeline li small { display: block; margin-top: 2px; }
.quote-summary { width: min(100%, 340px); margin-left: auto; }
.quote-summary > div { display: flex; justify-content: space-between; gap: 15px; padding: 7px 0; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.quote-summary > div:last-child { margin-top: 7px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--ink); font-size: 1.1rem; font-weight: 790; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 13px; border-bottom: 2px solid transparent; color: var(--ink-soft); font-weight: 650; white-space: nowrap; }
.tab:hover { color: var(--blue-dark); text-decoration: none; }
.tab.active, .tab[aria-current="page"] { border-color: var(--blue); color: var(--blue-dark); }
.inline-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .78rem; }
.inline-meta strong { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sign-in screen */
.auth-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: radial-gradient(circle at 10% 10%, #264977, transparent 33%), linear-gradient(145deg, #152842, #0d1b30); }
.auth-card { width: min(100%, 420px); padding: 31px; border: 1px solid rgba(255,255,255,.2); border-radius: 20px; background: #fff; box-shadow: 0 26px 65px rgba(0,0,0,.2); }
.auth-card h1 { margin-bottom: 7px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .btn-primary { width: 100%; margin-top: 5px; }

/* Classes used by the server-rendered screens */
.sidebar > .brand { flex-direction: column; align-items: flex-start; gap: 3px; min-height: 0; padding: 19px 23px 17px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-logo { display: block; width: 100%; max-width: 206px; height: auto; aspect-ratio: 628 / 262; object-fit: contain; }
.brand-panel-label { color: #a9b8ce; font-size: .65rem; font-weight: 750; letter-spacing: .15em; line-height: 1.3; }
.brand-mark span { font-size: .55em; line-height: 1; transform: translate(-1px, -5px); }
.brand-text { min-width: 0; }
.nav-group-title { margin: 13px 12px 6px; color: #8191a9; font-size: .65rem; font-weight: 760; letter-spacing: .13em; text-transform: uppercase; }
.nav-icon { display: inline-grid; place-items: center; flex: 0 0 20px; width: 20px; color: #a7b9d5; font-size: 1.1rem; line-height: 1; }
.nav-link.active .nav-icon { color: #f5ba58; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #48d498; box-shadow: 0 0 0 3px rgba(72,212,152,.12); }
.breadcrumb { flex: 1 1 auto; color: var(--muted); font-size: .8rem; }
.breadcrumb span { margin: 0 6px; color: #b4bfcd; }
.breadcrumb strong { color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .topbar-user { font-weight: 670; }
.logout-form { margin: 0; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: .66rem; font-weight: 780; letter-spacing: .13em; text-transform: uppercase; }
.text-link, .table-link { color: var(--blue-dark); font-weight: 690; }
.text-danger { color: var(--red); }
.table-subtext, .table-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; font-weight: 450; }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-card > span:first-child { display: block; margin-bottom: 7px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.stat-card > strong { position: relative; display: block; color: var(--ink); font-size: clamp(1.12rem, 1.65vw, 1.55rem); font-weight: 780; letter-spacing: -.035em; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card > small, .stat-foot { position: relative; display: block; margin-top: 7px; color: var(--muted); font-size: .72rem; }
.project-status-form { display: grid; gap: 7px; margin-top: 14px; }
.project-status-form label { color: var(--muted); font-size: .72rem; font-weight: 650; }
.project-status-form select { width: 100%; min-width: 0; }
.project-status-form .btn { width: 100%; }
.stat-money { white-space: nowrap; }
.dashboard-stats .stat-money { font-size: clamp(1.05rem, 1.5vw, 1.4rem); white-space: normal; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 1.06rem; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: .77rem; }
.head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.form-card { max-width: 100%; }
.form-stack { display: grid; gap: 16px; }
.field-wide { grid-column: 1 / -1; }
.field > span:first-child { color: #34465f; font-size: .76rem; font-weight: 690; }
.field em { color: var(--red); font-style: normal; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.checkbox { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink-soft); font-size: .8rem; cursor: pointer; }
.checkbox:has(input:checked) { border-color: #aec9fb; background: #f1f6ff; color: var(--ink); }
.checkbox input, .check-row input { flex: 0 0 auto; width: 15px; height: 15px; min-height: 0; margin: 0; padding: 0; border: 0; accent-color: var(--blue); }
.search-form { display: flex; align-items: center; gap: 7px; }
.search-form input { width: min(35vw, 250px); }
.toolbar > input[type="search"] { width: min(100%, 320px); }
.toolbar > select { width: min(100%, 245px); }
.detail-copy { color: var(--ink-soft); white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, 1fr); align-items: start; gap: 20px; margin-bottom: 20px; }
.detail-grid > .card { margin-bottom: 0; }
.detail-stack { display: grid; gap: 20px; }
.detail-stack > .card { margin: 0; }
.quote-detail-grid { grid-template-columns: minmax(0, 1fr); }
.quote-detail-grid > .detail-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.info-list { display: grid; gap: 11px; margin: 0; }
.info-list > div { display: grid; grid-template-columns: minmax(95px, 36%) minmax(0, 1fr); gap: 8px; padding-bottom: 10px; border-bottom: 1px solid #edf1f6; }
.info-list > div:last-child { padding-bottom: 0; border-bottom: 0; }
.info-list dt { color: var(--muted); font-size: .75rem; }
.info-list dd { min-width: 0; margin: 0; color: var(--ink); font-size: .81rem; overflow-wrap: anywhere; }
.simple-list { margin: 0; padding: 0; list-style: none; }
.simple-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { border-bottom: 0; }
.simple-list li span { color: var(--muted); }
.progress-track, .mini-progress { height: 8px; overflow: hidden; border-radius: 99px; background: #e7edf5; }
.progress-track { margin-bottom: 21px; }
.progress-track > span, .mini-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2867ed, #52a0ff); }
.mini-progress { width: 104px; height: 6px; margin-bottom: 4px; }
.step-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.step-item { display: flex; align-items: flex-start; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.step-item:first-child { padding-top: 0; }
.step-content { flex: 1 1 auto; min-width: 0; }
.step-content strong { display: block; color: var(--ink); font-size: .82rem; }
.step-content p { margin: 4px 0; color: var(--ink-soft); font-size: .78rem; }
.step-content small { color: var(--muted); }
.step-item.is-done .step-content strong { color: #5d7085; text-decoration: line-through; }
.step-toggle { flex: 0 0 auto; }
.step-check { display: grid; place-items: center; width: 23px; height: 23px; margin: 0; padding: 0; border: 2px solid #a9bada; border-radius: 7px; background: #fff; color: #fff; font-size: .85rem; font-weight: 800; cursor: pointer; }
.is-done .step-check { border-color: var(--green); background: var(--green); }
.step-check:hover { border-color: var(--blue); }
.step-add { margin-top: 20px; padding-top: 19px; border-top: 1px solid var(--line); }
.step-add > summary { display: inline-flex; list-style: none; }
.step-add > summary::-webkit-details-marker { display: none; }
.step-add-form { display: grid; gap: 12px; margin-top: 16px; }
.step-add-form .btn { justify-self: start; }
.btn-text { min-height: 28px; padding: 3px 5px; background: transparent; color: var(--red); font-size: .74rem; }
.btn-text:hover { background: var(--red-tint); }
.btn-block { width: 100%; }
.quote-form .quote-summary { width: 100%; margin-left: 0; }
.quote-summary h2 { margin-bottom: 17px; }
.quote-summary .info-list { margin-bottom: 18px; }
.quote-summary > p { font-size: .73rem; }
.quote-items-table { min-width: 1080px !important; }
.quote-items-table th:nth-child(1) { width: 105px; }
.quote-items-table th:nth-child(2) { width: 190px; }
.quote-items-table th:nth-child(3) { width: 240px; }
.quote-items-table th:nth-child(4) { width: 85px; }
.quote-items-table th:nth-child(5) { width: 85px; }
.quote-items-table th:nth-child(6) { width: 110px; }
.quote-items-table th:nth-child(7) { width: 110px; }
.quote-items-table th:nth-child(8) { width: 48px; }
.quote-items-table input, .quote-items-table select { min-height: 34px; padding: 6px 8px; }
.info-list .total-row { padding-top: 12px; border-top: 1px solid var(--line); border-bottom: 0; }
.info-list .total-row dt, .info-list .total-row dd { color: var(--ink); font-size: .94rem; font-weight: 790; }
.status-planning, .status-draft { background: #edf2f7; color: #53657c; }
.status-inactive { background: #edf2f7; color: #53657c; }
.status-active, .status-sent { background: var(--blue-tint); color: #2457c2; }
.status-on_hold, .status-expired { background: var(--amber-tint); color: #946014; }
.status-completed, .status-accepted { background: var(--green-tint); color: #13724f; }
.status-cancelled, .status-rejected { background: var(--red-tint); color: #ab3b3b; }
.status-in, .status-income, .status-paid { background: var(--green-tint); color: #13724f; }
.status-out, .status-expense, .status-overdue { background: var(--red-tint); color: #ab3b3b; }
.status-partial, .status-partially_paid { background: var(--amber-tint); color: #946014; }
.status-unpaid, .status-open, .status-archived { background: #edf2f7; color: #53657c; }
.auth-body { display: grid; place-items: center; min-height: 100dvh; padding: 22px; background: radial-gradient(circle at 10% 10%, #264977, transparent 33%), linear-gradient(145deg, #152842, #0d1b30); }
.auth-body .auth-card { margin: 0; }
.auth-logo { display: block; width: min(100%, 250px); height: auto; aspect-ratio: 628 / 262; object-fit: contain; margin-bottom: 2px; }
.auth-brand-caption { margin: 0 0 21px; color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .14em; }

@media (max-width: 1180px) {
  .stats-grid, .stat-grid, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-detail-grid > .detail-stack { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(82vw, 280px); height: 100dvh; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 12px 0 32px rgba(0,0,0,.2); }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop, [data-sidebar-backdrop] { display: block; position: fixed; inset: 0; z-index: 20; border: 0; background: rgba(8,19,35,.56); opacity: 0; visibility: hidden; transition: opacity .22s, visibility .22s; }
  body.sidebar-open .sidebar-backdrop, body.sidebar-open [data-sidebar-backdrop] { opacity: 1; visibility: visible; }
  [data-menu-toggle], .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 1.2rem; cursor: pointer; }
  .mobile-brand { display: block; flex: 0 0 112px; width: 112px; }
  .mobile-brand img { display: block; width: 100%; height: auto; max-height: 48px; object-fit: contain; }
  .main { padding: 0 22px 45px; }
  .topbar { min-height: 68px; margin-bottom: 24px; }
  .grid-main { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 13px; }
  .main { padding: 0 15px 35px; }
  .topbar { min-height: 62px; margin-bottom: 21px; gap: 10px; }
  .topbar .breadcrumb { display: none; }
  .topbar-right { margin-left: auto; }
  .topbar-right .topbar-user, .topbar-user span:not(.avatar) { display: none; }
  .page-header, .page-head { align-items: flex-start; flex-direction: column; gap: 13px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .card { padding: 18px; border-radius: 13px; }
  .card-footer { margin: 18px -18px -18px; padding: 14px 18px; }
  .grid, .grid-3, .grid-4, .grid-main { grid-template-columns: 1fr; gap: 14px; }
  .stats-grid, .stat-grid { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.25rem; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; gap: 14px; }
  .field-full, .field-wide, .span-2 { grid-column: auto; }
  .detail-list { grid-template-columns: 1fr; gap: 12px; }
  .check-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .period-filter > .field { width: 100%; }
  .toolbar form, .toolbar form input, .toolbar form select { width: 100%; }
  .toolbar > select, .toolbar > input[type="search"] { width: 100%; }
  .search-form { flex-wrap: wrap; }
  .search-form input { width: 100%; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .head-actions { width: 100%; justify-content: flex-start; }
  .head-actions .btn { flex: 1 1 auto; }
  .form-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 390px) {
  .stats-grid, .stat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #111; font-size: 10pt; }
  .app-shell { display: block; }
  .sidebar, .sidebar-backdrop, .topbar, .page-actions, .toolbar, .form-actions, .btn, [data-menu-toggle], .no-print { display: none !important; }
  .main { padding: 0; }
  .page-header, .page-head { margin-bottom: 12px; }
  .card, .stat-card { padding: 12px; border: 1px solid #d5d5d5; border-radius: 0; box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  .table-wrap > table { min-width: 0; }
  table, .table { font-size: 8pt; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  a { color: #111; text-decoration: none; }
  .badge, .pill { border-color: #c8c8c8; background: transparent; color: #333; }
  @page { size: A4; margin: 14mm; }
}
