/* Nextleaf Studio – design system. Tokens come from the handoff; tuned against the PNG references. */
:root {
  --forest: #123D31;
  --forest-deep: #073D30;
  --side: #0A4334;
  --btn: #0B4D3A;
  --btn-hover: #083D2E;
  --lime: #C8EF81;
  --lime-soft: #E6F4C9;
  --lime-wash: #EFF8DE;
  --canvas: #F7F8F2;
  --surface: #FFFFFF;
  --ink: #102B23;
  --title: #0B3D2E;
  --muted: #596574;
  --sub: #46576B;
  --border: #DDE1DB;
  --border-strong: #B9C2BB;
  --green: #1E7A2E;
  --amber: #C98A0B;
  --amber-bg: #FDEFCF;
  --red: #D13A3A;
  --red-bg: #FBE3E3;
  --blue: #2B6FD6;
  --blue-bg: #DEEBFB;
  --gray-bg: #E9ECE7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 43, 35, .05), 0 6px 18px rgba(16, 43, 35, .05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 16px/1.45 var(--font); }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(11, 77, 58, .45); outline-offset: 2px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--side); color: #E6F1EA; padding: 22px 14px 18px;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 18px; text-decoration: none; color: #fff; }
.brand .word { font-size: 31px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.leaf-a { fill: var(--lime); } .leaf-b { fill: #6CCB4A; }
.on-light .leaf-a, .page-title .leaf-a { fill: #8ED35A; } .on-light .leaf-b, .page-title .leaf-b { fill: #2E9B3E; }
.menu-wrap { position: relative; }
.side-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-radius: 14px; cursor: pointer;
  background: transparent; border: 1px solid rgba(255, 255, 255, .22); color: #fff; text-align: left; }
.side-card:hover { background: rgba(255, 255, 255, .06); }
.side-card .meta { flex: 1; min-width: 0; line-height: 1.25; }
.side-card .meta b { display: block; font-weight: 500; font-size: 15.5px; }
.side-card .meta small { color: rgba(255, 255, 255, .65); font-size: 13px; }
.side-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.nav a { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 16px; border-radius: 14px; text-decoration: none;
  color: #E3EFE8; font-size: 16.5px; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a[aria-current="page"] { background: var(--lime); color: var(--ink); font-weight: 600; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.nav .dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--lime); }
.nav a[aria-current="page"] .dot { background: var(--btn); }
.nav .count { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--lime); color: var(--ink);
  font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.nav-foot { margin-top: auto; padding-top: 14px; }
.nav-foot .nav { margin: 0 0 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .14); }
.popover { position: absolute; z-index: 60; min-width: 230px; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 43, 35, .2); padding: 6px; }
.popover.up { bottom: calc(100% + 8px); left: 0; right: 0; }
.popover.down { top: calc(100% + 8px); left: 0; right: 0; }
.popover.end { left: auto; right: 0; min-width: 190px; }
.popover a, .popover button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; font-size: 15px; }
.popover a:hover, .popover button.item:hover { background: var(--lime-wash); }
.popover .item[aria-disabled="true"] { color: var(--muted); cursor: default; }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.popover .danger { color: #A62B2B; }
.menu-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; text-transform: uppercase; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 32px; border-bottom: 1px solid rgba(16, 43, 35, .07); }
.back-to-nextleaf { display: inline-flex; align-items: center; flex: none; min-height: 40px; padding: 0 10px; border: 1px solid currentColor; border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.back-to-nextleaf:hover { background: var(--lime-soft); }
@media (max-width: 560px) {
  .topbar:has(.back-to-nextleaf) { gap: 6px; }
  .topbar:has(.back-to-nextleaf) .crumbs { visibility: hidden; flex-wrap: nowrap; overflow: hidden; }
  .back-to-nextleaf { order: 1; }
}
.crumbs { display: flex; align-items: center; gap: 12px; font-size: 16px; flex: 1; min-width: 0; flex-wrap: wrap; }
.crumbs .sep { color: var(--muted); opacity: .7; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.crumbs .here { font-weight: 600; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; position: relative; }
.icon-btn:hover { background: rgba(16, 43, 35, .06); }
.badge-dot { position: absolute; top: 7px; right: 8px; width: 11px; height: 11px; border-radius: 50%; background: #7ED957; border: 2px solid var(--canvas); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--lime); color: var(--ink); font-weight: 600; display: grid; place-items: center;
  border: 0; cursor: pointer; flex: none; text-decoration: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; } .avatar.md { width: 44px; height: 44px; font-size: 15px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; } .avatar.xl { width: 116px; height: 116px; font-size: 54px; }
.avatar.soft { background: var(--lime-soft); } .avatar.blue { background: #D8E7FA; } .avatar.sand { background: #F1E4CF; } .avatar.mint { background: #D7F1E4; } .avatar.lav { background: #E4DCF6; }
.nav-toggle { display: none; }
.content { padding: 28px 32px 56px; flex: 1; }
.topbar .menu-wrap .popover { right: 0; left: auto; width: 380px; }

.page-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 260px; }
.page-title { display: flex; align-items: center; gap: 14px; font-size: 40px; line-height: 1.1; font-weight: 700; color: var(--title); letter-spacing: -.02em; }
.page-title .leaf { width: 54px; height: 44px; flex: none; }
.page-title.sm { font-size: 34px; }
.page-sub { margin-top: 8px; font-size: 18px; color: var(--sub); }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; text-decoration: none; margin-bottom: 14px; color: var(--ink); }
.back-link:hover { text-decoration: underline; }
.back-link.boxed { padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 22px; border-radius: 12px;
  border: 1.5px solid transparent; font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; background: var(--btn); color: #fff; white-space: nowrap; }
.btn:hover { background: var(--btn-hover); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn.outline:hover { background: var(--lime-wash); }
.btn.outline-green { background: var(--surface); color: var(--btn); border-color: var(--btn); }
.btn.lime { background: var(--lime); color: var(--ink); } .btn.lime:hover { background: #BBE56F; }
.btn.soft { background: var(--lime-soft); color: var(--ink); font-weight: 500; }
.btn.danger-soft { background: var(--red-bg); color: #8E2323; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .75; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--btn); text-decoration: underline; font-weight: 500; }

/* -------------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid rgba(16, 43, 35, .08); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card.flush { padding: 0; }
.card + .card, .grid + .card, .card + .grid, .tabs + .card { margin-top: 20px; }
.card h2, .card .h2 { font-size: 22px; font-weight: 700; color: var(--title); letter-spacing: -.01em; }
.card .h2-sub { color: var(--sub); font-size: 15px; margin-top: 2px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.card.tint { background: var(--lime-wash); border-color: #DCEBBF; }
.grid { display: grid; gap: 20px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); align-items: start; }
.grid.side-l { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.grid + .grid { margin-top: 20px; }
.stat { display: flex; align-items: center; gap: 18px; padding: 22px 24px; }
.stat .tile { width: 68px; height: 68px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.tile.gray { background: #E9ECEF; } .tile.amber { background: #FCEBD0; color: #6B4A06; } .tile.green { background: var(--lime-soft); color: var(--forest); }
.tile.red { background: var(--red-bg); color: #A42A2A; } .tile.lime { background: var(--lime-soft); }
.tile.sm { width: 48px; height: 48px; border-radius: 12px; }
.stat .label { font-size: 16.5px; }
.stat .value { font-size: 38px; font-weight: 700; color: var(--title); line-height: 1.1; letter-spacing: -.02em; }
.stat .value.md { font-size: 32px; }
.stat .note { font-size: 14.5px; color: var(--sub); margin-top: 2px; }
.stat .note.good { color: #2F7A3A; }
.grid + .stat-gap, .stats { margin-bottom: 22px; }

/* -------------------------------------------------------------- chips/badges */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px; min-height: 30px; border-radius: 999px; font-size: 15px; background: var(--gray-bg); white-space: nowrap; }
.chip .d { width: 9px; height: 9px; border-radius: 50%; background: #6B7280; }
.chip.green { background: var(--lime-soft); } .chip.green .d { background: #1E7A2E; }
.chip.amber { background: var(--amber-bg); } .chip.amber .d { background: var(--amber); }
.chip.red { background: var(--red-bg); } .chip.red .d { background: var(--red); }
.chip.blue { background: var(--blue-bg); } .chip.blue .d { background: var(--blue); }
.chip.gray { background: var(--gray-bg); } .chip.lime { background: var(--lime); }
.chip.plain { padding: 4px 12px; }
.chip.icon-chip { gap: 10px; padding: 5px 14px 5px 10px; background: #EEF0EC; color: var(--ink); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 8px; background: #E9ECEF; font-size: 13px; color: var(--ink); }

/* ------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.price-tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 13px; background: var(--surface);
}
.price-tabs button {
  flex: 0 0 auto; padding: 9px 13px; border: 0; border-radius: 9px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 650; color: var(--ink); background: transparent;
}
.price-tabs button[aria-pressed="true"], .price-tabs button:hover { background: #e4f3ed; color: #134c3a; }
.price-tabs button:focus-visible { outline: 2px solid #174b3c; outline-offset: -2px; }
.table th { text-align: left; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--ink); padding: 14px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--sub); font-size: 12.5px; }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 16px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; } .table tbody tr[data-href]:hover { background: var(--lime-wash); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; }
.table .ref { font-weight: 700; color: var(--forest); text-decoration: none; }
.table .ref:hover { text-decoration: underline; }
.table .sub { display: block; font-size: 14px; color: var(--sub); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.cell-person { display: flex; align-items: center; gap: 14px; }
.cell-person .name { font-weight: 600; } .cell-person .email { font-size: 14.5px; color: var(--sub); }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 460px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink); }
.search input { padding-left: 44px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; color: var(--sub); font-size: 15px; }
.pager nav { display: flex; gap: 6px; align-items: center; }
.pager a, .pager span.pg { min-width: 38px; height: 38px; padding: 0 12px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); text-decoration: none; color: var(--ink); font-size: 14.5px; }
.pager a:hover { background: var(--lime-wash); } .pager .cur { background: var(--lime); border-color: var(--lime); font-weight: 700; }
.pager .off { opacity: .45; pointer-events: none; }
.empty { text-align: center; padding: 48px 16px; color: var(--sub); }
.empty .tile { margin: 0 auto 14px; }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }

/* -------------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field > .lbl { font-weight: 600; font-size: 15px; }
.field .opt { font-weight: 400; color: var(--muted); }
.req { color: #C0392B; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-size: 16px; }
.input::placeholder, .textarea::placeholder { color: #7B8791; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--btn); box-shadow: 0 0 0 3px rgba(11, 77, 58, .18); }
.input[readonly], .input:disabled, .select:disabled, .textarea:disabled { background: #ECEEEA; color: #4B5560; }
.select { appearance: none; padding-right: 40px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23102B23' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.textarea { min-height: 96px; resize: vertical; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: #C0392B; background: #FFF8F7; }
.field-error { color: #B3261E; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.input-icon { position: relative; } .input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.input-icon .input { padding-left: 46px; } .input-icon .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.hint { font-size: 14px; color: var(--sub); font-style: italic; }
.section-title { font-size: 20px; font-weight: 700; color: var(--title); margin: 8px 0 12px; }
.form-divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.check { display: flex; gap: 12px; align-items: center; cursor: pointer; font-size: 16px; }
.check input { appearance: none; width: 22px; height: 22px; border-radius: 6px; border: 1.8px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center; flex: none; cursor: pointer; margin: 0; }
.check input:checked { background: var(--btn); border-color: var(--btn); }
.check input:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:disabled { opacity: .55; cursor: not-allowed; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.radio-pills { display: flex; gap: 10px; }
.radio-pills label { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border: 1.5px solid var(--border); border-radius: 999px; cursor: pointer; background: var(--surface); }
.radio-pills input { accent-color: var(--btn); width: 18px; height: 18px; }
.radio-pills label:has(input:checked) { background: var(--lime-soft); border-color: #BBD98A; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; z-index: 1; }
.switch .track { position: absolute; inset: 0; background: #D4D9D2; border-radius: 999px; transition: .15s; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: .15s; }
.switch input:checked + .track { background: var(--btn); } .switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(11, 77, 58, .45); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; } .switch input:disabled + .track { opacity: .55; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 14px; background: #FBFCF8; padding: 20px; text-align: center; color: var(--sub); font-size: 14.5px; position: relative; }
.dropzone b { display: block; color: var(--ink); font-size: 16px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone.drag { background: var(--lime-wash); border-color: var(--btn); }
.note-box { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; background: #E5F1EC; font-size: 15.5px; }
.note-box.blue { background: #E4ECF6; } .note-box.amber { background: #FDF1DA; } .note-box.red { background: var(--red-bg); color: #8E2323; } .note-box.lime { background: var(--lime-soft); } .note-box.gray { background: #ECEFEA; }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--red-bg); color: #8E2323; font-size: 15px; }

/* --------------------------------------------------------------------- tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 20px; max-width: 100%; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 26px; border-radius: 11px; text-decoration: none; font-size: 16px; background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { background: var(--lime-wash); }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { background: var(--lime); font-weight: 700; }
.tabs.line { background: none; border: 0; box-shadow: none; padding: 0; border-bottom: 1px solid var(--border); border-radius: 0; display: flex; margin-bottom: 20px; width: 100%; }
.tabs.line a { border-radius: 0; padding: 12px 22px; } .tabs.line [aria-current="page"] { background: none; border-bottom: 3px solid var(--btn); }
.tabs.pills a[aria-current="page"] { border-radius: 12px; }

/* -------------------------------------------------------- dialog/modal/drawer */
dialog { border: 0; padding: 0; color: var(--ink); background: transparent; max-width: none; max-height: none; overflow: visible; }
dialog::backdrop { background: rgba(16, 30, 24, .5); }
dialog.modal[open] { position: fixed; inset: 0; margin: auto; width: min(640px, calc(100vw - 32px)); height: fit-content; max-height: calc(100vh - 32px); display: flex; }
dialog.modal.wide[open] { width: min(800px, calc(100vw - 32px)); }
dialog.modal.narrow[open] { width: min(520px, calc(100vw - 32px)); }
.dlg { background: var(--surface); border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); width: 100%; display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; }
.dlg-head { padding: 26px 30px 12px; display: flex; gap: 16px; align-items: flex-start; }
.dlg-head h2 { font-size: 30px; color: var(--title); letter-spacing: -.02em; line-height: 1.15; }
.dlg-head .sub { color: var(--sub); margin-top: 4px; font-size: 16px; }
.dlg-head .grow { flex: 1; }
.dlg-body { padding: 8px 30px 18px; overflow-y: auto; flex: 1; }
.dlg-foot { padding: 16px 30px 24px; display: flex; gap: 12px; justify-content: flex-end; align-items: center; border-top: 1px solid var(--border); }
.dlg-foot .lead { margin-right: auto; color: var(--sub); }
.x-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; flex: none; }
.x-btn:hover { background: rgba(16, 43, 35, .08); }
dialog.drawer[open] { position: fixed; top: 0; right: 0; bottom: 0; left: auto; margin: 0; width: min(580px, 100vw); height: 100vh; display: flex; }
dialog.drawer .dlg { border-radius: 22px 0 0 22px; max-height: 100vh; height: 100vh; }
dialog.drawer.narrow[open] { width: min(500px, 100vw); }
.dlg .dlg-head .tile { width: 52px; height: 52px; border-radius: 14px; }
.stepper { display: flex; align-items: center; margin: 6px 0 18px; }
.stepper .s { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 15px; color: var(--sub); }
.stepper .s i { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-style: normal; background: var(--surface); font-size: 14px; }
.stepper .s.on i { background: var(--btn); color: #fff; border-color: var(--btn); } .stepper .s.on { color: var(--ink); font-weight: 600; }
.stepper .bar { flex: 1; height: 1.5px; background: var(--border-strong); margin: 0 10px 22px; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--forest); color: #fff; padding: 14px 18px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; gap: 12px; align-items: flex-start; font-size: 15.5px; }
.toast.error { background: #8E2323; } .toast.info { background: #2B4A6B; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; }

/* ----------------------------------------------------------- notifications */
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-list form { margin: 0; }
.notif { display: flex; gap: 12px; padding: 12px; border-radius: 10px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; align-items: flex-start; }
.notif:hover { background: var(--lime-wash); } .notif .u { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: transparent; flex: none; }
.notif.unread .u { background: #3DB54A; } .notif.unread b { font-weight: 700; } .notif b { font-weight: 500; display: block; font-size: 15px; }
.notif small { color: var(--muted); }

/* -------------------------------------------------------------------- auth */
.auth { display: grid; grid-template-columns: minmax(340px, 40%) 1fr; min-height: 100vh; }
.auth-panel { background: #03402F; color: #fff; padding: 72px 64px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.auth-panel .brand { padding: 0; } .auth-panel .brand .word { font-size: 42px; }
.auth-panel h2 { margin-top: 96px; font-size: 56px; line-height: 1.12; letter-spacing: -.03em; font-weight: 700; }
.auth-panel h2 em { font-style: normal; color: var(--lime); display: block; }
.auth-panel p { margin-top: 24px; font-size: 22px; line-height: 1.4; max-width: 420px; }
.auth-panel .leaves { position: absolute; bottom: 0; left: 0; width: 100%; height: 46%; pointer-events: none; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--canvas); }
.auth-card { width: min(600px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 56px 52px 40px; box-shadow: var(--shadow); }
.auth-card h1 { text-align: center; font-size: 48px; letter-spacing: -.03em; color: #052E22; line-height: 1.1; margin-bottom: 30px; }
.auth-card h1.md { font-size: 40px; }
.auth-card .field > label { font-size: 17px; }
.auth-card .input { min-height: 56px; font-size: 18px; border-radius: 12px; }
.auth-card .btn.block { min-height: 62px; font-size: 21px; border-radius: 14px; }
.auth-card .center { text-align: center; margin-top: 16px; }
.or { display: flex; align-items: center; gap: 16px; color: var(--sub); margin: 22px 0; font-size: 17px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-foot { text-align: center; color: var(--sub); margin-top: 24px; font-size: 17px; }
.auth-solo { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--canvas); }
.auth-solo .auth-card { width: min(660px, 100%); padding: 44px 48px 32px; }
.auth-solo .logo-row { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-solo .logo-row .brand { color: var(--title); padding: 0; }
.auth-solo .logo-row .leaf-a { fill: #8ED35A; } .auth-solo .logo-row .leaf-b { fill: #2E9B3E; }
.invite-box { border: 1px solid var(--border); border-radius: 16px; padding: 6px 20px; margin-bottom: 22px; }
.invite-box .r { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.invite-box .r:last-child { border-bottom: 0; } .invite-box .r span { color: var(--sub); } .invite-box .r b { font-weight: 500; }
.invite-box .r .ro { background: #ECEEEA; padding: 6px 12px; border-radius: 8px; }
.demo-hint { margin: 20px auto 0; max-width: 600px; font-size: 14px; color: var(--sub); text-align: center; }
.demo-hint code { background: #EDEFE8; padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* --------------------------------------------------------- page specifics */
.profile-card { display: grid; grid-template-columns: auto 1fr 1.25fr; gap: 0; align-items: stretch; padding: 28px 32px; }
.profile-card .who { padding: 0 32px 0 32px; border-left: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.profile-card .who h2 { font-size: 30px; } .profile-card .who .email { font-size: 20px; color: var(--sub); } .profile-card .who .role { font-size: 18px; color: var(--sub); }
.profile-card .edit { padding-left: 32px; border-left: 1px solid var(--border); }
.profile-card .edit h3 { font-size: 19px; margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.form-row > label { font-size: 16px; }
.perm-note { font-size: 14.5px; color: var(--sub); }
.sec-line { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.sec-line .tile { width: 54px; height: 54px; border-radius: 14px; background: var(--lime-soft); color: var(--forest); display: grid; place-items: center; }
.sec-line h2 { font-size: 24px; } .sec-line p { color: var(--sub); }
.btn-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 0 20px; min-height: 54px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 18px; margin-bottom: 14px; text-align: left; }
.btn-row:hover { background: var(--lime-wash); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 16px; }
.kv dt { color: var(--sub); } .kv dd { margin: 0; }
.doc { background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 40px 44px; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
dialog.quote-preview.wide[open] { width: min(900px, calc(100vw - 24px)); }
.quote-preview .dlg-head { padding-block: 16px; border-bottom: 1px solid var(--border); }
.quote-preview .dlg-head h2 { font-size: 20px; }
.quote-preview .dlg-body { background: #edf1ed; padding: clamp(8px, 3vw, 24px); }
.quote-preview .doc { padding: clamp(14px, 4vw, 40px); border-top: 5px solid #174b3c; border-radius: 8px; }
.quote-letterhead, .quote-details {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px;
}
.quote-letterhead { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.quote-brand img { display: block; max-width: 100%; height: auto; margin-bottom: 6px; }
.quote-brand a { font-size: 13px; color: #376454; overflow-wrap: anywhere; }
.quote-reference { text-align: right; }
.quote-reference strong { display: block; color: #143c30; font-size: clamp(21px, 4vw, 34px); line-height: 1.15; }
.quote-details { margin: 23px 0; font-size: 14px; }
.quote-details strong { display: block; font-size: 17px; }
.quote-preview [data-preview="contact"] { white-space: pre-line; overflow-wrap: anywhere; color: var(--sub); }
.quote-dates { display: grid; grid-template-columns: auto auto; column-gap: 14px; row-gap: 5px; margin: 0; }
.quote-dates dt { color: var(--sub); }
.quote-dates dd { margin: 0; font-weight: 600; }
.quote-project { margin: 0 0 12px; color: #143c30; font-size: clamp(18px, 3vw, 26px); overflow-wrap: anywhere; }
.quote-preview .table thead th { background: #174b3c; color: #fff; letter-spacing: .02em; }
.quote-preview .table td, .quote-preview .table th { padding: 9px 10px; }
.quote-preview .table td.num { white-space: nowrap; }
.quote-preview .table td:first-child { overflow-wrap: anywhere; }
.quote-preview .table tbody tr { background: #fff; }
.quote-preview .table tbody tr:nth-child(even) { background: #f4f7f4; }
.quote-preview .quote-totals { margin-top: 16px; }
.quote-preview .quote-totals .r { gap: 10px; font-size: 15px; }
.quote-preview .quote-grand-total { border-block: 1px solid var(--border); color: #143c30; }
.quote-preview .quote-grand-total strong:last-child { font-size: 21px; }
.quote-terms { display: grid; gap: 14px; margin-top: 23px; }
.quote-terms h4 { margin: 0 0 4px; color: #143c30; }
.quote-terms p { margin: 0; color: var(--sub); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote-document-footer {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 22px;
  padding-top: 12px; border-top: 1px solid var(--border); color: var(--sub); font-size: 12px;
}
.quote-preview [data-preview-row][hidden] { display: none; }
@media (max-width: 480px) {
  .quote-details { grid-template-columns: 1fr; }
  .quote-dates { justify-content: start; }
  .quote-preview .table td, .quote-preview .table th { padding: 7px 5px; font-size: 12px; }
  .quote-preview .table { min-width: 0; }
  .quote-preview .table td.num { white-space: normal; }
}
.doc .doc-title { font-size: 40px; font-weight: 700; color: var(--title); text-align: right; }
.doc .small-label { font-size: 13px; letter-spacing: .08em; color: var(--sub); font-weight: 700; text-transform: uppercase; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.doc .totals { margin-left: auto; width: min(340px, 100%); }
.doc .totals .r { display: flex; justify-content: space-between; padding: 6px 4px; font-size: 18px; }
.doc .totals .r.hl { background: var(--lime-soft); border-radius: 10px; font-weight: 700; padding: 10px 12px; margin-top: 6px; font-size: 20px; }
.doc .wm { display: flex; align-items: center; gap: 10px; color: var(--title); font-size: 36px; font-weight: 700; letter-spacing: -.03em; }
.doc-actions-card .row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.doc-actions-card .row:last-of-type { border-bottom: 0; }
.row-link { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; background: var(--surface); width: 100%; cursor: pointer; margin-bottom: 12px; text-align: left; }
.row-link:hover { background: var(--lime-wash); } .row-link .grow { flex: 1; }
.row-link.lime { background: var(--lime-soft); border-color: #C9E199; } .row-link.red { background: var(--red-bg); border-color: #F0C2C2; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 34px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 20px; bottom: -2px; width: 2px; background: #BBD79A; }
.timeline li:last-child::before { display: none; }
.timeline li .dot { position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #B7BFB9; }
.timeline li.on .dot { background: #2F8F3A; border-color: #2F8F3A; }
.timeline li b { display: block; font-weight: 600; } .timeline li small { color: var(--sub); font-size: 14.5px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; } .list-row .grow { flex: 1; min-width: 0; } .list-row .t { font-weight: 600; } .list-row small { color: var(--sub); display: block; }
.mini-chip { padding: 3px 12px; border-radius: 999px; font-size: 14px; background: var(--lime-soft); white-space: nowrap; }
.mini-chip.gray { background: var(--gray-bg); } .mini-chip.amber { background: var(--amber-bg); }
.view-all { color: var(--btn); text-decoration: underline; font-size: 15px; }
.sparkline { width: 100%; height: auto; display: block; }

/* team access */
.perm-table th, .perm-table td { text-align: center; } .perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.pill-check { display: inline-flex; }
.pill-check input { position: absolute; opacity: 0; }
.pill-check span { display: inline-flex; gap: 6px; align-items: center; padding: 4px 14px; border-radius: 999px; background: var(--gray-bg); font-size: 15px; cursor: pointer; min-width: 64px; justify-content: center; }
.pill-check input:checked + span { background: var(--lime-soft); } .pill-check input:focus-visible + span { outline: 3px solid rgba(11, 77, 58, .45); }
.pill-check input:disabled + span { opacity: .5; cursor: not-allowed; }
.settings-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); gap: 22px; align-items: start; }
.subnav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; }
.subnav a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; text-decoration: none; font-size: 16.5px; }
.subnav a:hover { background: var(--lime-wash); } .subnav a[aria-current="page"] { background: var(--lime); font-weight: 700; }
.int-card { text-align: left; } .int-card .logos { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.logo-tile { width: 48px; height: 48px; border-radius: 14px; background: #F1F3EE; display: grid; place-items: center; }
.int-card h3 { font-size: 24px; color: var(--title); } .int-card .sub { color: var(--sub); font-size: 16.5px; min-height: 26px; }
.int-card .chip { margin: 12px 0; } .int-card p { color: var(--sub); min-height: 52px; margin-bottom: 18px; font-size: 16px; }
.logo-wrap { border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: 26px 18px; background: #F8F9F5; display: grid; place-items: center; min-height: 96px; }
.logo-wrap img { max-width: 100%; max-height: 80px; }

/* overview */
.hello { display: flex; align-items: center; gap: 14px; } .hello .leaf { width: 54px; height: 44px; }
.priority { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.priority:last-child { border-bottom: 0; } .priority .grow { flex: 1; min-width: 0; } .priority .sub { color: var(--sub); }
.priority input[type=checkbox] { appearance: none; width: 24px; height: 24px; border-radius: 6px; border: 1.8px solid var(--border-strong); background: #fff; cursor: pointer; flex: none; margin: 0; }
.priority input[type=checkbox]:checked { background: var(--btn); border-color: var(--btn); }
.time-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: var(--lime-soft); font-size: 15px; font-weight: 500; }
.time-chip.amber { background: var(--amber-bg); }
.automation-tile { background: linear-gradient(135deg, #F1FAE0, #E8F6D3); border: 1px solid #D5E9B4; }

/* work board / calendar */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; overflow-x: auto; align-items: start; }
.col { border-radius: 16px; padding: 0 0 12px; background: rgba(255, 255, 255, .5); border: 1px solid rgba(16, 43, 35, .06); min-height: 260px; }
.col-head { padding: 14px 18px; border-radius: 16px 16px 0 0; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 20px; }
.col.planned .col-head { background: #E9ECEF; } .col.in_progress .col-head { background: #DBE8FA; } .col.waiting .col-head { background: #FCEBCF; } .col.completed .col-head { background: #E0F0CD; }
.col-head .n { min-width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .8); display: grid; place-items: center; font-size: 15px; }
.work-card { display: block; margin: 12px 12px 0; padding: 16px; background: var(--surface); border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); text-decoration: none; }
.work-card:hover { border-color: var(--btn); } .work-card h4 { font-size: 18px; font-weight: 700; } .work-card .cl { color: var(--sub); margin: 2px 0 12px; }
.work-card .meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; font-size: 14.5px; color: var(--sub); }
.work-card .meta > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.work-card .who { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.cal { display: grid; grid-template-columns: 62px repeat(7, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; min-width: 760px; }
.cal .h { background: #E8F1DF; text-align: center; padding: 8px 4px; border-left: 1px solid var(--border); font-size: 14.5px; } .cal .h b { display: block; font-size: 17px; }
.cal .time { font-size: 14px; padding: 0 8px; color: var(--ink); height: 46px; display: flex; align-items: center; justify-content: flex-end; }
.cal .cell { border-left: 1px solid var(--border); border-top: 1px solid var(--border); height: 46px; position: relative; }
.ev { position: absolute; left: 4px; right: 4px; z-index: 2; border-radius: 8px; padding: 6px 8px; font-size: 13.5px; line-height: 1.25; overflow: hidden; text-decoration: none; display: block; color: var(--ink); }
.ev b { display: block; font-size: 14px; } .ev.green { background: #DDF1C3; } .ev.blue { background: #D5E8FB; } .ev.amber { background: #FCE8C5; }
.dot-sm { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-sm.green { background: #2E9B3E; } .dot-sm.blue { background: #2B6FD6; } .dot-sm.amber { background: #E3A21A; }

/* chat */
.chat-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr) 320px; gap: 20px; align-items: stretch; height: calc(100vh - 280px); min-height: 560px; }
.chat-grid > .card { display: flex; flex-direction: column; min-height: 0; padding: 18px; }
.conv { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; text-decoration: none; margin-bottom: 6px; }
.conv:hover { background: var(--lime-wash); } .conv.on { background: var(--lime-soft); } .conv b { display: block; font-size: 17px; } .conv small { color: var(--sub); }
.conv .unread { margin-left: auto; background: var(--btn); color: #fff; min-width: 22px; height: 22px; border-radius: 11px; font-size: 12.5px; display: grid; place-items: center; padding: 0 6px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 4px; }
.msg { display: flex; gap: 14px; margin: 14px 0 22px; } .msg .by { font-weight: 700; } .msg .at { color: var(--sub); font-size: 14.5px; margin-left: 8px; }
.msg p { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.link-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; margin: 10px 0 18px; }
.composer { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--border-strong); border-radius: 14px; padding: 8px; margin-top: 10px; }
.composer input[type=text] { flex: 1; border: 0; outline: 0; font-size: 16.5px; padding: 8px; min-width: 0; background: none; }

/* sticky action bar for builders */
.stepper-qty { display: inline-flex; border: 1.5px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper-qty button { width: 38px; height: 38px; border: 0; background: #fff; cursor: pointer; font-size: 20px; } .stepper-qty button:hover { background: var(--lime-wash); }
.stepper-qty input { width: 52px; text-align: center; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 16px; -moz-appearance: textfield; }
.margin-pill { display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--lime-soft); font-weight: 600; color: #1D5B2B; }
.summary-box .r { display: flex; justify-content: space-between; padding: 12px 6px; font-size: 17px; border-bottom: 1px solid var(--border); }
.summary-box .r.hl { background: var(--lime-soft); border-radius: 10px; font-weight: 700; border: 0; font-size: 19px; padding: 14px 14px; margin: 8px -4px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr) 1.1fr; gap: 0; align-items: center; }
.kpi-row > div { padding: 6px 22px; border-right: 1px solid var(--border); } .kpi-row > div:last-child { border: 0; }
.kpi-row .lbl { font-size: 16.5px; } .kpi-row .big { font-size: 34px; font-weight: 700; color: var(--title); letter-spacing: -.02em; }
.deposit-box { background: var(--lime-wash); border-radius: 14px; padding: 18px 22px !important; }
.hint-pill { padding: 10px 16px; border-radius: 10px; background: #E9ECEF; font-size: 15px; }
.sticky-actions { position: sticky; bottom: 0; }

@media (max-width: 1280px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-card { grid-template-columns: 1fr; gap: 20px; } .profile-card .who, .profile-card .edit { border-left: 0; padding: 0; }
  .chat-grid { grid-template-columns: 240px minmax(0, 1fr); } .chat-grid > .card:last-child { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 14px; } .kpi-row > div { border: 0; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: 290px; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .nav-toggle { display: grid; }
  .topbar { padding: 0 16px; } .content { padding: 22px 16px 48px; }
  .grid.c3, .grid.c2, .grid.side, .grid.side-l, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 32px; } .page-title .leaf { width: 42px; height: 36px; }
  .auth { grid-template-columns: 1fr; } .auth-panel { padding: 32px 28px 40px; } .auth-panel h2 { margin-top: 28px; font-size: 38px; } .auth-panel p { font-size: 18px; } .auth-panel .leaves { height: 30%; opacity: .6; }
  .auth-card, .auth-solo .auth-card { padding: 32px 22px 26px; border-radius: 22px; } .auth-card h1 { font-size: 36px; }
  .settings-layout { grid-template-columns: 1fr; } .subnav { flex-direction: row; overflow-x: auto; position: static; }
  .row2, .row3, .check-grid { grid-template-columns: 1fr; } .form-row { grid-template-columns: 1fr; gap: 4px; }
  .doc { padding: 24px 18px; } .chat-grid { grid-template-columns: 1fr; height: auto; } .chat-grid > .card { min-height: 420px; }
  .board { grid-template-columns: repeat(4, 280px); } .topbar .menu-wrap .popover { width: min(380px, calc(100vw - 32px)); }
  dialog.drawer .dlg { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .actions, .no-print { display: none !important; } .app { display: block; } }

/* ---- fixes from the first visual pass ---- */
[hidden] { display: none !important; }
.brand svg { width: 40px; height: 33px; flex: none; }
.auth-panel .brand svg { width: 66px; height: 55px; }
.auth-solo .logo-row .brand svg, .doc .wm svg { width: 44px; height: 36px; }
.doc .wm svg { width: 52px; height: 43px; }
.grid > .card, .grid > .card + .card, .grid > section.card, .grid > div > .card:first-child { margin-top: 0; }
.grid.stats > .card { margin-top: 0; }
.stat { padding: 20px 22px; gap: 16px; }
.stat .tile { width: 60px; height: 60px; border-radius: 15px; }
.stat .label { font-size: 15.5px; line-height: 1.25; }
.stat .value { font-size: 34px; }
.stat .value.md { font-size: 28px; }
.stat .note { font-size: 14px; }
.stat > div:last-child { min-width: 0; }
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.nav a { font-size: 16px; }
.page-title .leaf { width: 50px; height: 41px; }
.doc .doc-head .wm { font-size: 34px; }
.chip.plain .icon { margin-right: -2px; }
.table td .sub .tag { margin-right: 6px; }
.tile { display: grid; place-items: center; flex: none; border-radius: 14px; background: #E9ECEF; }
.tile.green, .tile.lime { background: var(--lime-soft); color: var(--forest); } .tile.amber { background: #FCEBD0; color: #6B4A06; } .tile.red { background: var(--red-bg); color: #A42A2A; } .tile.gray { background: #E9ECEF; color: var(--ink); }
.tile.sm { width: 44px; height: 44px; border-radius: 12px; }
.dlg-foot { flex-wrap: wrap; }
.dropzone small { display: block; margin-top: 2px; }
.dropzone b + span, .dropzone span + small { display: block; }

/* ---- mobile overflow fixes ---- */
.pager nav { flex-wrap: wrap; }
.priority { flex-wrap: wrap; }
@media (max-width: 960px) {
  .chat-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-grid > .card { min-width: 0; }
  .page-head .actions { width: 100%; }
  .toolbar .search { max-width: none; }
  .stat .value { font-size: 30px; }
  .card { padding: 18px; }
  .auth-card h1 { font-size: 34px; }
}

.table-wrap, .card, .dlg-body { position: relative; }
.card { min-width: 0; }
@media (max-width: 960px) {
  [style*="grid-template-columns"]:not(.cal):not(.keep-cols) { grid-template-columns: minmax(0, 1fr) !important; }
  .kpi-row { grid-template-columns: minmax(0, 1fr); }
  .automation-tile .btn { max-width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .table th, .table td { padding: 12px 10px; }
  dialog.modal[open] { max-height: 100vh; }
  .dlg-head h2 { font-size: 24px !important; }
  .board { grid-template-columns: repeat(4, 280px); }
}

svg.leaf { width: 44px; height: 36px; flex: none; }
.dlg-head h2 svg.leaf { width: 40px; height: 33px; vertical-align: -6px; margin-right: 6px; }
.crumbs { flex-wrap: nowrap; overflow: hidden; }
.crumbs > * { white-space: nowrap; }
@media (max-width: 960px) { .crumbs > :not(:last-child) { display: none; } }
.team-grid { display: grid; grid-template-columns: minmax(380px, .85fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
.team-grid > .card { margin-top: 0; }
@media (max-width: 1300px) { .team-grid { grid-template-columns: minmax(0, 1fr); } }

/* automations list: one shared column layout so every row lines up */
.auto-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 170px 270px 330px; gap: 18px 24px; align-items: center; margin-top: 14px; padding: 18px 22px; min-height: 104px; }
.auto-row h2 { font-size: 22px; line-height: 1.2; }
.auto-row .tile { width: 64px; height: 64px; border-radius: 16px; }
.auto-status { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.auto-info { display: grid; gap: 8px; align-content: center; border-left: 1px solid var(--border); padding-left: 22px; min-height: 64px; }
.auto-info > span { display: flex; gap: 10px; align-items: center; }
.auto-actions { display: grid; grid-template-columns: 92px 128px 104px; gap: 10px; justify-content: end; }
.auto-actions .btn { width: 100%; padding: 0 10px; }
.auto-actions form { margin: 0; }
@media (max-width: 1480px) { .auto-row { grid-template-columns: 64px minmax(0, 1fr) 150px; } .auto-info { grid-column: 2 / 3; border-left: 0; padding-left: 0; min-height: 0; } .auto-actions { grid-column: 3 / 4; flex-direction: column; align-items: stretch; } .auto-row .auto-status { grid-column: 3 / 4; grid-row: 1; } .auto-actions { grid-row: 2 / 4; } }
@media (max-width: 960px) { .auto-row { grid-template-columns: 56px minmax(0, 1fr); } .auto-row .auto-status, .auto-info, .auto-actions { grid-column: 1 / -1; grid-row: auto; } .auto-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; } .auto-actions .btn { flex: 1 1 auto; } }

.subnav-rule { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; width: calc(100% - 8px); }
.subnav a.leaves-settings { color: var(--sub); }
.subnav a.leaves-settings:hover { color: var(--ink); }

.perm-card { display: flex; gap: 14px; align-items: center; margin-top: 16px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--lime-wash); flex-wrap: wrap; }
.perm-card .grow { flex: 1; min-width: 160px; } .perm-card b { font-size: 17px; }
.preset-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
dialog#perm-dialog[open] { z-index: 5; }

/* Nextleaf animated tree (supplied by the owner) */
.brand-tree{width:65px;height:72px;overflow:visible}.tree-trunk{fill:#79634b;stroke:#66543e;stroke-width:.5;stroke-linejoin:round}.trunk-highlight{stroke:#b59a72;stroke-width:1;stroke-linecap:round;opacity:.72}.tree-branches{stroke:#706b49;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round}.tree-ground{stroke:#8b986d}.leaf-vein{stroke:#d9ee95;stroke-width:1;stroke-linecap:round}.tree-blossom ellipse{fill:#e998b8;stroke:#c77c9a;stroke-width:.25}.tree-blossom circle{fill:#f3d28b}.tree-leaf{--fresh-leaf:#719648}.growing-leaf-2,.growing-leaf-5,.growing-leaf-8{--fresh-leaf:#93b35e}.growing-leaf-4,.growing-leaf-9{--fresh-leaf:#527e3e}.leaf-growth{animation:nextleaf-full-season 24s linear var(--season-delay) infinite both;transform-box:view-box;transform-origin:0px 0px}.leaf-sway{animation:nextleaf-leaf-breeze 3.8s ease-in-out var(--sway-delay) infinite;transform-box:view-box;transform-origin:0px 0px}.leaf-sway>path:first-child{animation:nextleaf-full-season-colour 24s linear var(--season-delay) infinite both}.blossom-growth{transform-box:view-box;transform-origin:0px 0px;animation:nextleaf-full-season-blossom 24s ease-in-out var(--bloom-delay) infinite both}.blossom-sway{animation:nextleaf-blossom-breeze 4.6s ease-in-out infinite;transform-origin:0px 0px;transform-box:view-box}@keyframes nextleaf-leaf-breeze{0%,100%{transform:rotate(-4deg)}50%{transform:translate(.6px,-.4px) rotate(5deg)}}@keyframes nextleaf-blossom-breeze{0%,100%{transform:rotate(-5deg)}50%{transform:rotate(6deg)}}@keyframes nextleaf-full-season{0%,3%{opacity:0;transform:translate(0,0) scale(.015) rotate(-14deg)}8%{opacity:1;transform:translate(0,0) scale(.12) rotate(-10deg)}26%,68%{opacity:1;transform:translate(0,0) scale(1) rotate(0)}75%{opacity:1;transform:translate(calc(var(--drift)*-.3),9px) scale(.98) rotate(15deg)}85%{opacity:0;transform:translate(var(--drift),38px) scale(.86) rotate(var(--fall-turn))}86%,100%{opacity:0;transform:translate(0,0) scale(.015) rotate(-14deg)}}@keyframes nextleaf-full-season-colour{0%,43%{fill:var(--fresh-leaf);stroke:#52723d}55%{fill:#b6bb58;stroke:#8b9149}66%,86%{fill:#e0bd51;stroke:#b28c36}87%,100%{fill:var(--fresh-leaf);stroke:#52723d}}@keyframes nextleaf-full-season-blossom{0%,23%{opacity:0;transform:scale(.04)}34%,47%{opacity:1;transform:scale(1)}60%{opacity:0;transform:translate(3px,13px) scale(.75)}61%,100%{opacity:0;transform:scale(.04)}}@media(prefers-reduced-motion:reduce){.leaf-growth,.leaf-sway,.blossom-growth,.blossom-sway,.leaf-sway>path:first-child{animation:none;transform:none;opacity:1}.leaf-sway>path:first-child{fill:var(--fresh-leaf);stroke:#52723d}}
.brand .brand-tree{width:56px;height:62px;overflow:visible;flex:none}.auth-panel .brand .brand-tree{width:78px;height:87px}.auth-solo .logo-row .brand .brand-tree{width:64px;height:72px}.sidebar .brand{gap:8px;padding-bottom:10px}
