/* FAZELY CRM — premium workspace style (violet / lavender / warm paper, FAZELY orange as accent). */
@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-Regular.26ff2d0c11e7.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-Bold.edb9a4910728.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Rethink Sans"; src: url("../fonts/RethinkSans-Italic.e663abbb6c68.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/PlusJakartaSans-Bold.5a3a96a9ba07.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("../fonts/SpaceMono-Bold.d6a2ed5cbe1c.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("../fonts/SpaceMono-Regular.b0ea4c1a4ffd.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/InstrumentSerif-Regular.5eb8d8adf794.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --violet: #5B3FD1; --violet-dark: #46309F; --violet-ink: #2E2266; --violet-text: #4B37A8;
  --lav-50: #FAF8FF; --lav-100: #F3F0FD; --lav-200: #E7E1FB; --lav-300: #D6CDF7; --lav-400: #B9ABF0;
  --paper: #FAF8F5; --white: #FFFFFF; --ink: #1E1A33; --muted: #6E6888; --line: #E6E0F6;
  --accent: #EB5E28; --accent-soft: #FDEBE3;
  --ok: #23784A; --ok-soft: #DDF2E5; --warn: #9A6400; --warn-soft: #FFF1D6; --danger: #B3261E; --danger-soft: #FBE5E3; --info: #2F5FB3; --info-soft: #E3EDFC;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(91,63,209,.06), 0 10px 30px -18px rgba(46,34,102,.35);
  --font: "Rethink Sans", system-ui, sans-serif; --heading: "Plus Jakarta Sans", var(--font);
  --mono: "Space Mono", ui-monospace, Consolas, monospace; --serif: "Instrument Serif", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--violet-dark); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--heading); font-weight: 700; line-height: 1.2; margin: 0 0 .6rem; color: var(--violet-ink); letter-spacing: -0.015em; }
h1 { font-size: 1.75rem; color: var(--violet-text); letter-spacing: -0.025em; }
h2 { font-size: 1.08rem; } h3 { font-size: .98rem; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: .84em; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 8px; }

/* Layout ------------------------------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--white); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .55rem; padding: 4px 8px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.brand img { width: 118px; height: auto; display: block; }
.brand b { font-family: var(--heading); font-size: 1.3rem; color: var(--violet-ink); }
.brand span { font-family: var(--mono); font-weight: 700; font-size: .66rem; letter-spacing: .12em; color: #fff; background: var(--violet); padding: 3px 8px; border-radius: 999px; }
.nav a { display: flex; align-items: center; gap: .65rem; color: #3D3266; padding: .5rem .7rem; border-radius: 10px; font-size: .93rem; margin: 1px 0; }
.nav a:hover { background: var(--lav-100); text-decoration: none; color: var(--violet-ink); }
.nav a.active { background: var(--lav-200); color: var(--violet-dark); font-weight: 700; }
.nav a.active svg { color: var(--violet); }
.nav .group { color: #9A93B5; font-size: .7rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; margin: 1.1rem .7rem .35rem; }
.nav svg { width: 17px; height: 17px; flex: none; color: #8C82B5; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 2rem; background: rgba(250,248,245,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar form.search input { width: 340px; border-radius: 999px; background: var(--white); padding-left: 1rem; }
.topbar .user { display: flex; gap: .7rem; align-items: center; font-size: .9rem; }
.topbar .user > a { font-weight: 700; color: var(--violet-ink); }
.content { padding: 1.8rem 2rem 3rem; max-width: 1320px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: -.3rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack > * + * { margin-top: 1rem; }

/* Cards ------------------------------------------------------------------------------------------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .9rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; gap: .5rem; }
.card-head h2, .card-head h3 { margin: 0; }
.kpi { padding: 1.05rem 1.2rem; background: linear-gradient(180deg, var(--lav-50), var(--white)); }
.kpi .label { color: var(--muted); font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; }
.kpi .value { font-family: var(--font); font-weight: 700; font-size: 1.55rem; margin-top: .25rem; white-space: nowrap; color: var(--violet-ink); letter-spacing: -0.02em; }
.kpi .hint { font-size: .82rem; color: var(--muted); }
.kpi.accent { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 16px 34px -20px rgba(91,63,209,.9); }
.kpi.accent .label, .kpi.accent .hint { color: #DCD4FF; }
.kpi.accent .value { color: #fff; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }

/* Tables ------------------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #7D74A3; background: var(--lav-100); padding: .6rem .75rem; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table th:first-child { border-top-left-radius: 10px; } .table th:last-child { border-top-right-radius: 10px; }
.table td { padding: .65rem .75rem; border-bottom: 1px solid #EFEBFA; vertical-align: middle; }
.table tbody tr:hover td { background: var(--lav-50); }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; border-bottom: none; }
.table tfoot tr.grand td { background: var(--violet); color: #fff; }
.table tfoot tr.grand td:first-child { border-bottom-left-radius: 10px; } .table tfoot tr.grand td:last-child { border-bottom-right-radius: 10px; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

/* Badges ------------------------------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: var(--lav-200); color: var(--violet-dark); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.draft { background: #EEECF4; color: #5E5878; }
.badge.issued, .badge.recorded, .badge.open { background: var(--info-soft); color: var(--info); }
.badge.sent, .badge.partially_paid { background: var(--warn-soft); color: var(--warn); }
.badge.accepted, .badge.paid, .badge.delivered, .badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.rejected, .badge.void, .badge.cancelled, .badge.overdue { background: var(--danger-soft); color: var(--danger); }
.badge.expired, .badge.superseded { background: #EEECF4; color: var(--muted); }
.badge.channel { background: var(--accent-soft); color: #B4471B; }

/* Forms ------------------------------------------------------------------------------------------- */
label { font-weight: 700; font-size: .84rem; display: block; margin-bottom: .3rem; color: #3D3266; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .55rem .75rem; border: 1px solid var(--lav-300); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(91,63,209,.13); }
textarea { resize: vertical; }
.field { margin-bottom: 1rem; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.field .errors, .errorlist { color: var(--danger); font-size: .84rem; margin: .25rem 0 0; padding: 0; list-style: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.radio-inline ul, ul.radio-inline { display: flex; gap: 1rem; list-style: none; padding: 0; margin: 0; }
.radio-inline label, .check label { font-weight: 400; display: inline-flex; gap: .4rem; align-items: center; }
input[type=checkbox], input[type=radio] { accent-color: var(--violet); width: 1rem; height: 1rem; }

/* Buttons ----------------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-family: var(--mono); font-weight: 700; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase;
  padding: .62rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--violet); background: transparent; color: var(--violet); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, transform .15s; }
.btn:hover { background: var(--lav-100); text-decoration: none; color: var(--violet-dark); transform: translateY(-1px); }
.btn.primary { background: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-dark); border-color: var(--violet-dark); color: #fff; }
.btn.dark { background: var(--violet-ink); border-color: var(--violet-ink); color: #fff; }
.btn.dark:hover { background: #221A4D; color: #fff; }
.btn.danger { color: var(--danger); border-color: #E7B7B3; }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.small { padding: .32rem .7rem; font-size: .66rem; }
.btn.ghost { border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
details.action { position: relative; }
details.action > summary { list-style: none; }
details.action > summary::-webkit-details-marker { display: none; }
details.action .pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: 330px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 50px -20px rgba(46,34,102,.45); padding: 1.05rem; }

/* Messages ---------------------------------------------------------------------------------------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .75rem 1rem; border-radius: 12px; margin-bottom: .5rem; border: 1px solid; }
.messages .success { background: var(--ok-soft); border-color: #B9DFC6; color: #1F5C38; }
.messages .error { background: var(--danger-soft); border-color: #F0BDB8; color: #8C1D17; }
.messages .info, .messages .warning { background: var(--warn-soft); border-color: #F1D79F; color: #6E4A00; }
.callout { border-left: 3px solid var(--violet); background: var(--lav-100); padding: .8rem 1rem; border-radius: 0 12px 12px 0; }
.callout.info { border-color: var(--info); background: var(--info-soft); }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.secret { font-family: var(--mono); background: var(--violet-ink); color: #E3DBFF; padding: .75rem .95rem; border-radius: 12px; word-break: break-all; user-select: all; }

/* Tabs & timeline --------------------------------------------------------------------------------- */
.tabs { display: inline-flex; gap: .25rem; padding: .25rem; background: var(--lav-100); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 1.2rem; flex-wrap: wrap; }
.tabs a { padding: .4rem .9rem; color: #5E5385; border-radius: 999px; font-size: .9rem; }
.tabs a:hover { text-decoration: none; background: #fff; }
.tabs a.active { background: #fff; color: var(--violet-dark); font-weight: 700; box-shadow: 0 1px 3px rgba(46,34,102,.12); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.25rem; border-left: 2px solid var(--lav-200); margin-left: .35rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px var(--lav-200); }
.timeline .when { font-size: .76rem; color: var(--muted); font-family: var(--mono); }

/* Line editor ------------------------------------------------------------------------------------- */
.lines-editor td { vertical-align: top; padding: .45rem .35rem; }
.lines-editor input, .lines-editor select, .lines-editor textarea { padding: .42rem .5rem; font-size: .9rem; }
.lines-editor .w-qty { width: 84px; } .lines-editor .w-unit { width: 92px; } .lines-editor .w-price { width: 118px; } .lines-editor .w-pct { width: 78px; } .lines-editor .w-tax { width: 96px; }
.lines-editor .handle { color: var(--muted); font-family: var(--mono); font-weight: 700; text-align: center; padding-top: .75rem; }
.totals-box { min-width: 320px; background: var(--lav-50); border: 1px solid var(--line); border-radius: 14px; padding: .4rem; }
.totals-box table { width: 100%; border-collapse: separate; border-spacing: 0; }
.totals-box td { padding: .45rem .6rem; }
.totals-box tr.grand td { background: var(--violet); color: #fff; font-weight: 700; }
.totals-box tr.grand td:first-child { border-radius: 10px 0 0 10px; } .totals-box tr.grand td:last-child { border-radius: 0 10px 10px 0; }

/* Chart ------------------------------------------------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: .55rem; height: 170px; padding: .5rem 0 0; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 26px; }
.bars .pair { display: flex; align-items: flex-end; gap: 3px; height: 140px; width: 100%; justify-content: center; }
.bars .b { width: 42%; max-width: 18px; border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bars .b.inv { background: var(--violet); } .bars .b.col { background: var(--accent); }
.bars .lbl { font-size: .7rem; color: var(--muted); font-family: var(--mono); }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }

/* Login & public pages ---------------------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1fr) 1.05fr; background: var(--paper); }
.login-side { position: relative; overflow: hidden; background: var(--violet); color: #fff; display: flex; flex-direction: column; justify-content: flex-start; gap: 2.2rem; padding: 44px 48px; }
.login-side::after { content: ""; position: absolute; left: -6%; right: -6%; bottom: -10%; height: 46%; background: url("../website/img/flowers-cluster.d9435ff2cb8b.svg") center bottom / cover no-repeat; opacity: .96; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%); mask-image: linear-gradient(to bottom, transparent, #000 22%); }
.login-side .tag { position: relative; z-index: 1; align-self: flex-start; font-family: var(--mono); font-weight: 700; font-size: .7rem; letter-spacing: .12em; background: #fff; color: var(--violet); padding: .3rem .7rem; border-radius: 999px; }
.login-side h2 { position: relative; z-index: 1; color: #fff; font-family: var(--heading); font-size: clamp(2.2rem, 3.6vw, 3.4rem); line-height: 1.02; letter-spacing: -0.04em; margin: 0 0 1rem; max-width: 13ch; }
.login-side p { position: relative; z-index: 1; font-family: var(--serif); font-size: 1.45rem; line-height: 1.3; color: #E7E1FF; max-width: 26ch; margin: 0; }
.login-main { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 88px); }
.login-main .logo { width: 150px; margin-bottom: 2.6rem; }
.login-card { width: 100%; max-width: 460px; }
.login-card h1 { font-family: var(--heading); font-weight: 700; font-size: 2.3rem; color: var(--violet-text); letter-spacing: -0.035em; margin-bottom: .5rem; }
.login-card .intro { font-family: var(--serif); font-size: 1.3rem; color: #5D52A0; margin: 0 0 1.8rem; }
.cells { border: 1px solid var(--lav-300); border-radius: 16px; overflow: hidden; background: #fff; margin-bottom: 1.2rem; }
.cells .cell { border-bottom: 1px solid var(--lav-300); padding: .55rem 1rem .6rem; }
.cells .cell:last-child { border-bottom: 0; }
.cells label { font-family: var(--mono); font-weight: 400; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: #8C82B5; margin: 0 0 .1rem; }
.cells input { border: 0; padding: .2rem 0 .25rem; font-size: 1.05rem; border-radius: 0; box-shadow: none !important; background: transparent; }
.cells .cell:focus-within { background: var(--lav-50); box-shadow: inset 3px 0 0 var(--violet); }
.btn.block { width: 100%; padding: .95rem 1.2rem; font-size: .82rem; }
.login-foot { margin-top: 1.6rem; font-size: .84rem; color: var(--muted); line-height: 1.6; }
.login-foot a { white-space: nowrap; }
.rule { display: none; }

.pagination { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; margin-top: .9rem; font-size: .88rem; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: .2rem; } .nav .group { display: none; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .topbar form.search input { width: 100%; }
  .content { padding: 1rem; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { min-height: 300px; order: -1; padding: 28px; }
}
@media print { .sidebar, .topbar, .actions { display: none !important; } .shell { display: block; } }

.public-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem 9rem; background: var(--paper) url("../website/img/flowers-band.47832282e482.svg") center bottom / 1600px auto no-repeat; }
.public-card { width: 100%; max-width: 760px; background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 2.4rem clamp(1.4rem, 4vw, 2.8rem); }
.public-card .logo { width: 140px; margin-bottom: 1.6rem; }
.public-card h1 { font-size: 2rem; }
.public-card h2 { margin-top: 1.4rem; color: var(--violet-text); }
