/* Zenvy Client Hub */
:root {
  --ink: #1A1F1D; --ink2: #2E3532; --paper: #F5F5F0; --card: #FFFFFF; --sand: #D9D6CD;
  --line: #E5E3DA; --lime: #C7E637; --lime-soft: #EEF6C8; --mut: #6B716D;
  --bad: #B42318; --bad-soft: #FDE7E4; --warn: #9A6212; --warn-soft: #FBF0DC; --ok: #4B5A0E;
  --r: 14px; --shadow: 0 1px 2px rgba(26,31,29,.04), 0 4px 16px rgba(26,31,29,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
h1, h2, h3, h4 { letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--mut); }
.tiny { font-size: .78rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 1.25rem .9rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; padding: .2rem .5rem .6rem; }
.brand img { height: 26px; width: auto; }
.brand span { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--mut); border-left: 1px solid var(--line); padding-left: .6rem; }
.side nav { display: grid; gap: 2px; }
.nav-l { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--mut); padding: .9rem .7rem .3rem; }
.side nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 10px; text-decoration: none; color: var(--ink2); font-weight: 500; font-size: .92rem; }
.side nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side nav a:hover { background: var(--paper); }
.side nav a.on { background: var(--ink); color: #fff; }
.side nav a.on svg { stroke: var(--lime); }
.me { margin-top: auto; display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; align-items: center; background: var(--paper); border-radius: 12px; padding: .7rem; }
.me b { display: block; font-size: .88rem; }
.me small { color: var(--mut); font-size: .75rem; }
.me-links { grid-column: 1 / -1; font-size: .78rem; color: var(--mut); }
.me-links a { color: var(--ink2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 800; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 1rem; padding: 1.1rem clamp(1rem, 3vw, 2.2rem); border-bottom: 1px solid var(--line); background: rgba(245,245,240,.9); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 1.35rem; font-weight: 800; }
.top-r { margin-left: auto; color: var(--mut); font-size: .85rem; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: .35rem .6rem; font-size: 1.1rem; cursor: pointer; }
.content { padding: clamp(1rem, 3vw, 2.2rem); display: grid; gap: 1.4rem; align-content: start; }
.foot { padding: 1rem clamp(1rem, 3vw, 2.2rem) 2rem; color: var(--mut); font-size: .78rem; margin-top: auto; }

/* Cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); display: grid; gap: .8rem; align-content: start; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 1.02rem; font-weight: 700; }
.card-h p { margin: 0; color: var(--mut); font-size: .82rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1.1rem; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.1rem; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .9rem; }
@media (min-width: 1100px) { .kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpis.six .kpi .v { font-size: 1.6rem; } }
@media (min-width: 700px) and (max-width: 1099px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; display: grid; gap: .25rem; box-shadow: var(--shadow); text-decoration: none; }
.kpi .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--mut); font-weight: 600; }
.kpi .v { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .n { font-size: .78rem; color: var(--mut); }
.kpi .v2 { font-size: .98rem; font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; margin-top: -.15rem; }
.kpi .mix { font-size: .74rem; color: var(--mut); font-variant-numeric: tabular-nums; }
.kpi.hl .v2 { color: #fff; } .kpi.hl .mix { color: #B9BFB9; }
.kpi.lime .mix { color: var(--ink2); }
.kpi.bad .v2 { color: var(--bad); }
.kpi.hl { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.hl .l, .kpi.hl .n { color: #B9BFB9; }
.kpi.hl .v { color: var(--lime); }
.kpi.lime { background: var(--lime); border-color: var(--lime); }
.kpi.lime .l, .kpi.lime .n { color: var(--ink2); }
.kpi.bad .v { color: var(--bad); }
a.kpi:hover { border-color: var(--ink); }

/* Section heading */
.sh { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.sh h2 { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: .55rem; }
.sh h2::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 2px var(--ink); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .5rem .95rem; border-radius: 999px; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.sm { padding: .3rem .7rem; font-size: .78rem; }
.btn.block { width: 100%; justify-content: center; padding: .7rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }
fieldset.fs { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
fieldset.fs[disabled] input, fieldset.fs[disabled] select, fieldset.fs[disabled] textarea { background: #F7F7F3; color: var(--ink2); }
.vis-box { background: var(--paper); border: 1px dashed var(--sand); border-radius: 12px; padding: .8rem .9rem; }
.perm-grid { display: grid; grid-template-columns: minmax(10rem, 1fr) repeat(3, auto); gap: .4rem 1rem; align-items: center; font-size: .88rem; }
.perm-grid .h { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); font-weight: 700; }
.perm-grid label { display: inline-flex; gap: .35rem; align-items: center; font-weight: 500 !important; }
.lost-form { display: inline-flex; gap: .4rem; align-items: center; }
.lost-form select { width: auto; border-radius: 999px; padding: .45rem .8rem; font-size: .84rem; }
.hbar { height: .55rem; background: var(--paper); border-radius: 999px; overflow: hidden; min-width: 5rem; }
.hbar span { display: block; height: 100%; border-radius: 999px; }

/* Pills, chips */
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: .14rem .55rem; border-radius: 999px; white-space: nowrap; background: #ECEBE4; color: var(--ink2); }
.pill.lime { background: var(--lime); color: var(--ink); }
.pill.ink { background: var(--ink); color: #fff; }
.pill.ok { background: var(--lime-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.chips { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.chip { font-size: .74rem; padding: .1rem .5rem; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink2); white-space: nowrap; }

/* Tables */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.card .tbl-wrap { border: 0; box-shadow: none; border-radius: 0; margin: 0 -1.25rem; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); font-weight: 700; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #FBFBF8; white-space: nowrap; }
.tbl th a { color: inherit; text-decoration: none; }
.tbl th a:hover { color: var(--ink); }
.tbl td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFAF6; }
.tbl td a.rowlink { font-weight: 700; text-decoration: none; }
.tbl td a.rowlink:hover { text-decoration: underline; }
.tbl tfoot td { font-weight: 800; background: #FBFBF8; border-top: 2px solid var(--ink); }
.empty { padding: 2rem; text-align: center; color: var(--mut); }

/* Toolbar / filters */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.toolbar form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: #EAE9E2; border-radius: 999px; padding: .2rem; flex-wrap: wrap; }
.seg a { padding: .35rem .8rem; border-radius: 999px; font-size: .82rem; text-decoration: none; color: var(--ink2); font-weight: 600; }
.seg a.on { background: var(--ink); color: var(--lime); }
input, select, textarea { font: inherit; font-size: .9rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lime); outline-offset: 0; border-color: var(--ink); }
.toolbar input, .toolbar select { width: auto; min-width: 10rem; border-radius: 999px; padding: .45rem .85rem; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--ink); flex: none; }
.vis-box .check { border-radius: 12px; text-align: left; }

/* Forms */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .9rem 1.1rem; }
.field { display: grid; gap: .3rem; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: .8rem; font-weight: 700; color: var(--ink2); }
.field small { color: var(--mut); font-size: .76rem; }
.req { color: var(--bad); }
.checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; font-weight: 500 !important; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .7rem; cursor: pointer; }
.money-in { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.money-in span { padding: 0 .2rem 0 .7rem; color: var(--mut); }
.money-in input { border: 0; padding-left: .3rem; }
.money-in:focus-within { outline: 2px solid var(--lime); border-color: var(--ink); }
.money-in input:focus { outline: 0; }
.form-actions { grid-column: 1 / -1; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding-top: .4rem; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: 1rem; }
.stack { display: grid; gap: .9rem; }

/* Flash */
.flash { padding: .75rem 1rem; border-radius: 12px; font-size: .9rem; font-weight: 600; background: var(--lime-soft); color: var(--ok); border: 1px solid #D7E89A; }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: #F5C2BC; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: #F0D9A8; }

/* Lists */
.list { display: grid; }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .8rem; padding: .65rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.li:last-child { border-bottom: 0; }
.li b { font-size: .9rem; }
.li a { text-decoration: none; }
.li .sub { grid-column: 1 / -1; font-size: .78rem; color: var(--mut); display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.li.over b { color: var(--bad); }

/* Meta grid */
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; font-size: .88rem; margin: 0; }
.meta dt { color: var(--mut); }
.meta dd { margin: 0; font-weight: 500; }
.note { background: var(--paper); border-left: 3px solid var(--lime); border-radius: 10px; padding: .6rem .8rem; font-size: .88rem; color: var(--ink2); white-space: pre-line; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar-a { fill: var(--sand); }
.chart .bar-b { fill: var(--ink); }
.chart .axis { fill: var(--mut); font-size: 13px; font-family: Manrope, sans-serif; }
.chart .val { fill: var(--ink2); font-size: 10px; font-weight: 700; font-family: Manrope, sans-serif; }
.chart .grid { stroke: var(--line); }
.legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--mut); flex-wrap: wrap; }
.legend i { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; vertical-align: -1px; margin-right: .3rem; }
.progress { height: .6rem; background: var(--paper); border-radius: 999px; overflow: hidden; display: flex; }
.progress span { display: block; height: 100%; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(6, minmax(14rem, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.col { background: #EDECE5; border-radius: var(--r); padding: .7rem; display: grid; gap: .6rem; align-content: start; min-height: 10rem; }
.col-h { display: flex; justify-content: space-between; align-items: center; font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--ink2); padding: 0 .2rem; }
.col-h span { font-variant-numeric: tabular-nums; }
.col-h .cnt { background: var(--ink); color: var(--lime); border-radius: 999px; padding: 0 .5rem; }
.deal { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; display: grid; gap: .4rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.deal:hover { border-color: var(--ink); }
.deal b { font-size: .92rem; }
.deal .r { display: flex; justify-content: space-between; font-size: .8rem; align-items: center; gap: .4rem; }
.deal small { color: var(--mut); font-size: .74rem; }
.prob { height: 4px; background: var(--paper); border-radius: 4px; overflow: hidden; }
.prob span { display: block; height: 100%; background: var(--lime); }

/* Services matrix */
.mx td, .mx th { text-align: center; }
.mx td:first-child, .mx th:first-child { text-align: left; }
.dot { display: inline-block; width: .95rem; height: .95rem; border-radius: 50%; vertical-align: middle; }
.dot.a { background: var(--lime); box-shadow: 0 0 0 2px var(--ink); }
.dot.p { border: 2px dashed var(--ink2); }
.dot.n { width: .3rem; height: .3rem; background: var(--sand); }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-card { align-self: center; justify-self: center; width: min(100% - 2rem, 25rem); display: grid; gap: 1rem; padding: 2rem 0; }
.auth-logo { height: 40px; width: auto; }
.auth-card h1 { font-size: 1.8rem; font-weight: 800; }
.auth-card p { margin: 0; }
.auth-side { background: var(--ink); color: #fff; display: grid; align-content: center; padding: 3rem; gap: 1rem; position: relative; overflow: hidden; }
.auth-side h2 { font-size: clamp(2.2rem, 4vw, 3.6rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.auth-side p { color: #B9BFB9; margin: 0; }
.auth-dot { width: 5rem; height: 5rem; border-radius: 50%; background: var(--lime); }

/* Invoice document */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1.25rem, 4vw, 3rem); box-shadow: var(--shadow); display: grid; gap: 1.8rem; max-width: 860px; }
.doc-h { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; align-items: start; }
.doc-h img { height: 38px; }
.doc-h .agency { font-size: .82rem; color: var(--mut); line-height: 1.6; margin-top: .5rem; }
.doc-title { text-align: right; }
.doc-title h2 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.doc-title .no { color: var(--mut); font-weight: 600; }
.doc-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; font-size: .88rem; }
.doc-parties .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--mut); font-weight: 700; margin-bottom: .25rem; }
.doc table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.doc th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--mut); border-bottom: 2px solid var(--ink); padding: .55rem 0; }
.doc td { padding: .8rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc .tot { display: grid; justify-content: end; gap: .3rem; font-size: .92rem; }
.doc .tot div { display: flex; justify-content: space-between; gap: 3rem; }
.doc .tot .due { font-size: 1.25rem; font-weight: 800; border-top: 2px solid var(--ink); padding-top: .5rem; }
.doc .tot .due span:last-child { background: var(--lime); padding: 0 .4rem; border-radius: 6px; }
.doc-foot { display: grid; gap: .5rem; font-size: .84rem; color: var(--ink2); white-space: pre-line; }
.doc-foot .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--mut); font-weight: 700; }
.stamp { display: inline-block; border: 3px solid currentColor; padding: .2rem .7rem; border-radius: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; transform: rotate(-6deg); }
.stamp.paid { color: #6C8A00; }
.stamp.overdue { color: var(--bad); }

/* Responsive */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; }
  .top-r .today { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { padding: .8rem .85rem; }
  .kpi .v { font-size: 1.35rem; }
  .kpi .n { font-size: .72rem; }
  .top h1 { font-size: 1.1rem; }
}

/* Print: invoice only */
@media print {
  body { background: #fff; }
  .side, .top, .foot, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .doc { border: 0; box-shadow: none; max-width: none; padding: 0; }
  .doc .tot .due span:last-child { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
