/* Texsolon Billing */
:root {
  --navy: #0E1A36; --navy-2: #1E2C52; --navy-3: #16234A; --platform: #0A1229;
  --ink: #16181D; --ink-2: #3A404B; --muted: #5B6270; --line: #E3E6EB; --line-2: #EEF0F3; --field: #CDD2DA;
  --ground: #F5F6F8; --card: #FFFFFF; --blue: #2152D9; --blue-d: #163A9E; --blue-l: #E8EEFC; --blue-ll: #F4F7FE;
  --green-bg: #E4F4EC; --green: #0D5C38; --green-2: #127A4B; --amber-bg: #FFF2DC; --amber: #6B3F00; --amber-2: #9A5B00;
  --red-bg: #FDE8E6; --red: #7A1A12; --red-2: #B42318; --gray-bg: #EEF0F3;
  --mono: 'IBM Plex Mono', ui-monospace, monospace; --sans: 'IBM Plex Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--ground); font-size: 14px; line-height: 1.45; }
a { color: var(--blue); } a:hover { color: var(--blue-d); }
h1 { font-size: 26px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .center { text-align: center; } .right { text-align: right; }
.red { color: var(--red-2); } .amber { color: var(--amber-2); } .green { color: var(--green-2); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--navy); color: #C9D2E8; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.side-platform { background: var(--platform); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: #9BA8C7; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small.gold { color: #F2B84B; font-weight: 500; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid #3A4A75; color: #fff; border-radius: 8px; width: 40px; height: 40px; font-size: 18px; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-links a { display: block; padding: 9px 12px; border-radius: 8px; color: #C9D2E8; text-decoration: none; }
.nav-links a:hover { background: var(--navy-3); color: #fff; }
.nav-links a.active { background: var(--navy-2); color: #fff; font-weight: 500; }
.nav-head { padding: 12px 12px 4px; font-size: 11px; letter-spacing: 1px; color: #8391B3; font-weight: 600; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.nav-foot .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--navy-3); color: #fff; text-decoration: none; }
.nav-foot .me small { display: block; color: #9BA8C7; font-size: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.signout, .impersonate { padding: 6px 12px; color: #9BA8C7; text-decoration: none; font-size: 13px; }
.impersonate { color: #F2B84B; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 28px; display: flex; justify-content: flex-end; }
.topbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.topbar select { height: 36px; }
.content { padding: 24px 28px 48px; max-width: 1280px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 820px) {
  .side { flex-basis: 100%; padding: 12px; gap: 8px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-links, .nav-foot { display: none; }
  body.nav-open .nav-links, body.nav-open .nav-foot { display: flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
}

/* Page parts */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { font-size: 13px; color: var(--muted); } .crumb a { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.cols > .wide { flex: 999 1 560px; min-width: 0; }
.cols > .narrow-col { flex: 1 1 300px; min-width: 0; }
.cols > .half { flex: 1 1 380px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat span:first-child { font-size: 13px; color: var(--muted); }
.stat strong { font-size: 24px; font-weight: 600; font-family: var(--mono); }
.stat small { font-size: 12.5px; color: var(--muted); }
.banner { padding: 10px 28px; font-size: 14px; }
.banner-blue { background: var(--blue-l); color: var(--blue-d); }
.banner-amber { background: var(--amber-bg); color: var(--amber); }
.banner-red { background: var(--red-bg); color: var(--red); }
.flash { padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-warn { background: var(--amber-bg); color: var(--amber); }
.flash-info { background: var(--blue-l); color: var(--blue-d); }

/* Forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); border: 1px solid var(--field); border-radius: 8px; background: #fff; font-weight: 400; }
input, select { height: 42px; padding: 0 12px; }
textarea { padding: 10px 12px; line-height: 1.5; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; accent-color: var(--blue); }
input[type=color] { width: 48px; padding: 2px; }
input[type=file] { height: auto; padding: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
input.num, .num input { font-family: var(--mono); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-end { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 15px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; border: 1px solid var(--field); background: #fff; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #AEB5C1; color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--blue-d); color: #fff; }
.btn-outline { border-color: var(--blue); color: var(--blue); font-weight: 600; }
.btn-danger { color: var(--red-2); border-color: #F0B4AE; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 46px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.linkbtn.red { color: var(--red-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 500; padding: 11px 10px; background: #FAFBFC; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t th:first-child, table.t td:first-child { padding-left: 20px; }
table.t th:last-child, table.t td:last-child { padding-right: 20px; }
table.t td.num, table.t th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
table.t .sub { display: block; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.tfoot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.pager a { margin-left: 14px; }
.filters { padding: 12px 20px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters input, .filters select { height: 38px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--field); background: #fff; display: inline-flex; align-items: center; font-size: 13px; color: var(--ink); text-decoration: none; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* Pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-blue { background: var(--blue-l); color: var(--blue-d); }
.pill-gray { background: var(--gray-bg); color: var(--ink-2); }

/* Meters */
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter > div:first-child { display: flex; justify-content: space-between; }
.bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 8px; background: var(--blue); border-radius: 4px; }
.bar > i.warn { background: #C27A00; } .bar > i.full { background: var(--red-2); }

/* Bars chart */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; border-bottom: 1px solid var(--field); }
.chart i { flex: 1; background: #A9BDF2; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart i.today { background: var(--blue); }
.chart-x { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Lists */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.attn { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; border-radius: 10px; text-decoration: none; }
.attn strong { font-size: 18px; }
.attn.red { background: var(--red-bg); color: var(--red); } .attn.amber { background: var(--amber-bg); color: var(--amber); }
.attn.blue { background: var(--blue-l); color: var(--blue-d); } .attn.gray { background: var(--ground); color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--blue); }

/* Document builder */
.lines input, .lines select { height: 36px; font-size: 13px; padding: 0 8px; }
.lines td { vertical-align: middle; }
.lines .w-qty { width: 80px; } .lines .w-price { width: 110px; } .lines .w-disc { width: 70px; }
.disc { display: flex; }
.disc input { border-radius: 6px 0 0 6px; width: 64px; }
.disc select { border-radius: 0 6px 6px 0; border-left: 0; width: 58px; padding: 0 4px; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(14,26,54,.12); max-height: 300px; overflow-y: auto; }
.picker-list button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: #fff; font: inherit; cursor: pointer; }
.picker-list button:hover, .picker-list button.on { background: var(--blue-l); }
.picker-list .code { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 8px; }
.scanbox { display: flex; align-items: center; gap: 10px; border: 2px solid var(--blue); border-radius: 8px; padding: 0 12px; }
.scanbox input { border: 0; outline: 0; flex: 1; font-family: var(--mono); height: 42px; }
.scanbox input:focus { outline: 0; }
.summary .kv span:last-child { font-family: var(--mono); }
.summary .grand { font-size: 16px; font-weight: 600; border-top: 1px solid var(--line); padding-top: 12px; }

/* Login & bare pages */
.login { display: flex; flex-wrap: wrap; min-height: 100vh; }
.login-hero { flex: 1 1 460px; background: var(--navy); color: #fff; padding: 52px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-hero h1 { font-size: 40px; line-height: 1.15; max-width: 520px; }
.login-hero p { color: #C9D2E8; font-size: 16px; max-width: 520px; }
.login-hero small { color: #9BA8C7; }
.brand-lg { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 600; }
.brand-lg em { font-style: normal; color: #8FA8F0; }
.brand-lg.dark { color: var(--ink); } .brand-lg.dark em { color: var(--blue); }
.login-form { flex: 1 1 460px; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.card.narrow { width: 100%; max-width: 410px; padding: 34px; }
.install { max-width: 820px; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 20px; }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.checks .ok { color: var(--green-2); } .checks .bad { color: var(--red-2); font-weight: 600; }
.public { max-width: 820px; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 18px; }
.pubbar { background: var(--navy); color: #fff; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pubbar a { color: #fff; text-decoration: none; }
.result-ok { border: 2px solid var(--green-2); padding: 0; overflow: hidden; }
.result-ok .rh { background: var(--green-bg); color: var(--green); padding: 14px 20px; font-weight: 600; }
.result-bad { border: 2px solid var(--red-2); padding: 0; overflow: hidden; }
.result-bad .rh { background: var(--red-bg); color: var(--red); padding: 14px 20px; font-weight: 600; }
.result-ok dl, .result-bad dl { margin: 0; padding: 18px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 20px; }
dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; } dd { margin: 4px 0 0; font-weight: 500; }

/* Modal (HTML dialog) */
dialog { border: 0; border-radius: 16px; padding: 26px; width: min(520px, calc(100% - 32px)); box-shadow: 0 24px 64px rgba(14,26,54,.3); }
dialog::backdrop { background: rgba(14,26,54,.5); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font-size: 20px; }

@media print {
  .side, .topbar, .banner, .no-print, .flash { display: none !important; }
  body, .main { background: #fff; }
  .content { padding: 0; }
}
