:root {
  /* BITSmart brand (matches bitsmart.tech, Oct 2026 refresh) */
  --navy: #023352; --amber: #F7B008; --amber-dark: #dc9c00; --amber-soft: #fff4d6; --amber-text: #6B5200;
  --ink: #1a2733; --muted: #5a6b7c; --line: #dde3ea; --bg: #f3f5f8; --card: #fff;
  --ok: #1f7a46; --ok-bg: #e6f4ec; --err: #b42318; --err-bg: #fdecea; --info-bg: #e8f0f6;
  --radius: 10px;
  --font: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
h1, h2 { color: var(--navy); }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.4rem 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: .9em; }
.r { text-align: right; } .mt { margin-top: 1rem; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem; background: #fff; border-bottom: 3px solid var(--amber); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; }
.brand span { padding-left: .6rem; border-left: 1px solid var(--line); }
.topbar nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; padding: .4rem .75rem; border-radius: 6px; color: #333; }
.topbar nav a:hover { background: var(--bg); }
.topbar nav a.on { background: var(--navy); color: #fff; }
.me { display: flex; gap: .8rem; align-items: center; font-size: .9rem; }
.me form { margin: 0; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 1.5rem; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); } .crumbs a { color: var(--muted); }
.actions { display: flex; gap: .5rem; } .actions form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.card.narrow { max-width: 640px; margin: 2rem auto; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; font: inherit; font-weight: 600; padding: .5rem 1rem; border-radius: 8px; border: 1px solid #cfcfcf; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #999; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--navy); }
.btn.primary:hover { background: var(--amber-dark); border-color: var(--amber-dark); }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.danger, .link.danger, .icon.danger { color: var(--err); }
.btn:disabled, fieldset:disabled .btn { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.icon { background: none; border: 1px solid transparent; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: .95rem; color: #555; }
.icon:hover:not(:disabled) { border-color: var(--line); background: var(--bg); }
.icon:disabled { opacity: .25; cursor: default; }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label small { font-weight: 400; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; padding: .5rem .65rem; border: 1px solid #cfcfcf; border-radius: 7px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox] { width: auto; accent-color: var(--navy); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: var(--amber-dark); }
textarea { resize: vertical; line-height: 1.5; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.stack.tight { gap: .4rem; } .stack.tight form { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem 1rem; }
.span2 { grid-column: 1 / -1; }
form.inline { display: inline-flex; gap: 2px; margin: 0; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--info-bg); color: #24446b; }

.status { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .15rem .5rem; border-radius: 999px; background: #eee; color: #444; vertical-align: middle; }
.status.sent { background: #e5efff; color: #1d4ed8; }
.status.viewed { background: var(--amber-soft); color: #8a5a00; }
.status.accepted { background: var(--ok-bg); color: var(--ok); }
.status.declined, .status.expired { background: var(--err-bg); color: var(--err); }
.status.withdrawn { background: #eee; color: #777; }

.filters { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.chip { text-decoration: none; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .85rem; }
.chip b { color: var(--muted); font-weight: 600; margin-left: .2rem; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); } .chip.on b { color: var(--amber); }
.filters .search, .filters > input { margin-left: auto; min-width: 260px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: #fafafa; }
table.list th.r { text-align: right; }
table.list td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
table.list tbody tr { cursor: pointer; } table.list tbody tr:hover { background: #fffbef; }
table.list tr:last-child td { border-bottom: 0; }
table.list a { text-decoration: none; font-weight: 600; }
tr.inactive { opacity: .55; }
.empty { text-align: center; padding: 3rem 1rem; background: #fff; border: 1px dashed #ccc; border-radius: var(--radius); }

/* builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.sticky { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.section { border-left: 4px solid var(--navy); }
.section.pricing { border-left-color: var(--amber); }
.section-bar { display: flex; align-items: center; gap: .3rem; margin-bottom: .6rem; }
.section-bar .tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-right: auto; }
.section-title { font-size: 1.1rem; font-weight: 700; }
.dirty-note { display: none; color: #8a5a00; font-size: .85rem; margin-left: .5rem; }
form.is-dirty .dirty-note { display: inline; }
.add-row { display: flex; gap: .5rem; margin-bottom: 1rem; }

table.items th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .4rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.items th.r { text-align: right; }
table.items td { padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.items input, table.items select, table.items textarea { padding: .35rem .45rem; font-size: .9rem; }
.itemcell { min-width: 220px; width: 100%; } .itemcell > * { margin-bottom: .3rem; }
table.items select[data-f=billing] { width: 104px; }
.rowtools form.inline { flex-direction: column; }
.rowtools .icon { width: 26px; height: 24px; }
.itemcell input[data-f=name] { font-weight: 600; }
.unitlabel { max-width: 160px; font-size: .82rem !important; }
input.num { width: 78px; text-align: right; } input.num.sm { width: 54px; }
table.items input.num { width: 72px; } table.items input.num.sm, table.items input[data-f=quantity] { width: 54px; }
input.cost { background: #fafafa; color: var(--muted); }
td.line { font-weight: 700; white-space: nowrap; padding-top: .9rem !important; }
.optcell { white-space: nowrap; font-size: .85rem; }
.optcell .pre { display: none; } tr.opt .optcell .pre { display: flex; }
tr.opt { background: #fffcf2; }
.rowtools { white-space: nowrap; }
tr.saving td.line { opacity: .4; }
tr.saved td.line { color: var(--ok); }
.add-items { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input[name=name] { flex: 1; min-width: 200px; width: auto; }

table.totals td, table.totals th { padding: .25rem 0; }
table.totals .bucket th { text-align: left; padding-top: .8rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
table.totals .gross td { font-weight: 700; }
table.totals .internal td { color: var(--muted); font-size: .85rem; border-top: 1px dashed var(--line); }
table.totals .fy td { padding-top: .9rem; font-weight: 700; border-top: 2px solid var(--navy); }
.copy { display: flex; gap: .4rem; } .copy input { font-size: .8rem; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
ul.activity { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
ul.activity li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
details.contact { border-bottom: 1px solid var(--line); padding: .6rem 0; }
details.contact summary { cursor: pointer; }
details.contact form { margin-top: .7rem; }

@media (max-width: 1000px) {
  .builder, .cols { grid-template-columns: 1fr; }
  .sticky { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 1rem; }
  .grid2 { grid-template-columns: 1fr; }
  .filters .search, .filters > input { min-width: 0; width: 100%; margin-left: 0; }
  .topbar { gap: .6rem; padding: .6rem 1rem; }
}

/* phase 2 */
.termrow { align-items: flex-start; padding: .35rem 0; }
.termrow input { margin-top: .3rem; }
.signedcard { border: 2px solid var(--ok); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; background: var(--ok-bg); }
.signedcard h2 { color: var(--ok); margin-bottom: .5rem; }
.signedcard .kv { font-size: .82rem; margin: .5rem 0 .7rem; }
.sigbox { background: #fff; border-radius: 6px; border-bottom: 1px solid var(--line); min-height: 60px; display: flex; align-items: flex-end; }
.sigsvg { width: 100%; height: auto; aspect-ratio: 3 / 1; }
.sigtyped { font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive; font-size: 1.9rem; color: var(--navy); padding: .2rem .4rem; }
textarea.mono-ish { font-size: .9rem; line-height: 1.55; }
.termspreview { font-size: .92rem; max-height: 600px; overflow: auto; }
.side-col .activity a { text-decoration: none; }
.mdtable-wrap { overflow-x: auto; } table.mdtable { border-collapse: collapse; } table.mdtable th, table.mdtable td { border: 1px solid var(--line); padding: .3rem .5rem; text-align: left; }
details.help summary { cursor: pointer; }
details.help pre { background: var(--bg); border-radius: 8px; padding: .8rem; overflow-x: auto; font-size: .78rem; line-height: 1.5; margin: .8rem 0 0; white-space: pre; }
.card.narrow.wide { max-width: 760px; }
.btn.ms { gap: .6rem; background: #fff; border-color: #8c8c8c; color: #1a1a1a; padding: .65rem 1rem; }
.btn.ms:hover { background: #f3f3f3; }
.or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .85rem; margin: 1.2rem 0 .8rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.cols.wl { grid-template-columns: 2fr 1fr; } @media (max-width: 1000px) { .cols.wl { grid-template-columns: 1fr; } }
.deal-results { display: flex; flex-direction: column; gap: .3rem; max-height: 300px; overflow: auto; }
.deal-results button.deal { text-align: left; font: inherit; font-size: .9rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; cursor: pointer; }
.deal-results button.deal span { display: block; color: var(--muted); font-size: .8rem; }
.deal-results button.deal:hover { border-color: var(--amber-dark); }
.deal-results button.deal.on { border-color: var(--navy); background: var(--amber-soft); }
.pax8box { background: var(--bg); border-radius: 8px; padding: .7rem .9rem; } .pax8box p { margin: 0 0 .5rem; } .pax8-import { gap: .9rem; }
.sigpad { border: 1px solid #c5cfd9; border-radius: 10px; background: #fff; overflow: hidden; }
.sigtabs { display: flex; gap: .3rem; padding: .45rem .6rem; border-bottom: 1px solid var(--line); background: var(--bg); }
.sigtabs .tab { font: inherit; font-size: .85rem; border: 0; background: none; padding: .25rem .8rem; border-radius: 999px; cursor: pointer; color: var(--muted); }
.sigtabs .tab.on { background: var(--navy); color: #fff; }
.sigpad .pane { padding: .7rem; position: relative; }
.sigpad input.typed { font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive; font-size: 1.9rem; color: var(--navy); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.sigpad canvas { display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; border-bottom: 1px solid var(--line); }
.sigpad [data-clear] { position: absolute; right: 1rem; bottom: 1rem; }
.sigbox.current { max-width: 320px; margin-bottom: .5rem; }
.error { color: var(--err); }
.cs-card { border-left: 4px solid var(--amber); }
.cs-card.ok { border-left-color: var(--ok); }
.cs-sign { border-top: 1px solid var(--line); padding-top: .8rem; }
.cs-sign h3 { margin-top: 0; }
.sigimg { max-width: 100%; max-height: 80px; display: block; }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.pkg-card { border: 1px solid var(--line); border-radius: 10px; padding: .7rem; display: flex; flex-direction: column; gap: .45rem; background: #fff; }
.pkg-card.rec { border: 2px solid var(--amber); }
.pkg-card .pkg-name { font-weight: 700; }
.pkg-card textarea { font-size: .85rem; }
.pkg-tools { display: flex; gap: .3rem; align-items: center; }
.pkg-price { background: var(--bg); border-radius: 6px; padding: .4rem .5rem; }
select.pkgsel { font-size: .8rem !important; max-width: 200px; }

.tight-list { margin: .4rem 0; }
.logo-preview { max-height: 60px; max-width: 220px; border: 1px solid var(--line); border-radius: 6px; padding: 6px; background: #fff; }
.grow { flex: 1; min-width: 260px; }
.w220 { width: 220px; }
.head.tight { margin-bottom: .6rem; }
.m0 { margin: 0; }
.mt-xs { margin: .2rem 0 0; }
[data-href] { cursor: pointer; }
.warn-row td { background: #fff5f4; }
