/* Auditixx — ledger-inspired UI. Deep green ink, warm paper, saffron accent. */
:root {
  --ink: #0e2a2b; --ink-2: #163c3d; --ink-3: #21504f;
  --paper: #f6f4ee; --card: #ffffff; --line: #e3dfd3; --line-2: #ece9df;
  --text: #1d2623; --muted: #6b7470; --faint: #9aa19d;
  --accent: #d98e04; --accent-soft: #fdf3dc;
  --green: #1f7a4d; --green-soft: #e3f3ea; --red: #b42318; --red-soft: #fdecea;
  --amber: #a15c00; --amber-soft: #fff4e0; --blue: #1d5fa8; --blue-soft: #e7f0fb; --violet: #6941c6; --violet-soft: #f1ecfc;
  --radius: 10px; --shadow: 0 1px 2px rgba(14, 42, 43, .06), 0 1px 1px rgba(14, 42, 43, .04);
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--ink-3); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--ink); }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #cfe0dc; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--ink); display: grid; place-items: center; font: 700 16px var(--serif); }
.brand-name { font: 600 17px var(--serif); letter-spacing: .01em; }
.brand-firm { font-size: 11.5px; color: #8fb1aa; display: block; margin-top: -2px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6f958e; padding: 14px 10px 4px; }
.nav a { color: #cfe0dc; padding: 7px 10px; border-radius: 7px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.nav a:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 16px; text-align: center; opacity: .8; }
.nav .count { margin-left: auto; background: var(--accent); color: var(--ink); font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 9px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--ink-2); font-size: 12.5px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot .role { color: #8fb1aa; font-size: 11.5px; }
.side-foot form { display: inline; }
.side-foot button { background: none; border: 0; color: #8fb1aa; cursor: pointer; padding: 0; font: inherit; }
.side-foot a, .side-foot button:hover { color: #cfe0dc; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(246, 244, 238, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.topbar form.search { flex: 1; max-width: 420px; }
.topbar input[type=search] { width: 100%; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 60px; max-width: 1320px; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; cursor: pointer; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards / grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.card-head h2 { margin: 0; font-size: 14.5px; }
.card-body { padding: 14px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; display: block; color: inherit; box-shadow: var(--shadow); }
a.kpi:hover { border-color: var(--ink-3); text-decoration: none; }
.kpi .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .val { font: 600 24px var(--serif); color: var(--ink); margin-top: 2px; }
.kpi.warn .val { color: var(--red); }
.kpi.accent { border-top: 3px solid var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fbfaf6; white-space: nowrap; }
tbody tr:hover { background: #fcfbf7; }
td.num, th.num { text-align: right; }
tr.dim td { color: var(--faint); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--muted); }
.st-todo { background: #eef0ee; color: #4a5551; }
.st-in_progress { background: var(--blue-soft); color: var(--blue); }
.st-waiting_client { background: var(--amber-soft); color: var(--amber); }
.st-review { background: var(--violet-soft); color: var(--violet); }
.st-done, .st-paid, .st-accepted, .st-sent, .st-closed { background: var(--green-soft); color: var(--green); }
.st-not_applicable, .st-cancelled { background: #f1f1ef; color: var(--faint); }
.st-issued, .st-pending, .st-open, .st-queued, .st-manual { background: var(--amber-soft); color: var(--amber); }
.st-partial, .st-received { background: var(--blue-soft); color: var(--blue); }
.st-rejected, .st-failed, .st-overdue { background: var(--red-soft); color: var(--red); }
.pri-high { color: var(--red); font-weight: 700; }
.pri-low { color: var(--faint); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; background: #f0eee7; color: #5b625f; margin: 1px 2px 1px 0; }
.due small { color: var(--muted); margin-left: 3px; }
.due-over { color: var(--red); font-weight: 600; } .due-over small { color: var(--red); }
.due-today { color: var(--accent); font-weight: 600; }
.due-soon { color: var(--amber); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 12.5px; color: #3a4541; margin-bottom: 4px; }
label .opt { font-weight: 400; color: var(--faint); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], input[type=tel], input[type=month], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid #d6d2c4; border-radius: 8px; padding: 7px 10px; outline: none;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(33, 80, 79, .12); }
.field { margin-bottom: 14px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.check input { margin-top: 3px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.inline-form { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 140px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 650; font-size: 13px; color: var(--ink); padding: 0 6px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; margin-bottom: 10px; }
.svc-grid .check { padding: 3px 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--font); padding: 7px 13px; border-radius: 8px; border: 1px solid #cfcab9; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #faf8f2; text-decoration: none; border-color: #b9b3a0; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-accent:hover { background: #c47f02; }
.btn-danger { color: var(--red); border-color: #efc4bf; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-link { background: none; border: 0; color: var(--ink-3); padding: 0; cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-wa { background: #1e9e55; border-color: #1e9e55; color: #fff; }
.btn-wa:hover { background: #178546; }

/* ---------- Alerts ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-ok { background: var(--green-soft); border-color: #bfe3cd; color: #145a37; }
.flash-err { background: var(--red-soft); border-color: #f3c3bd; color: #8a1c12; }
.note { background: var(--accent-soft); border: 1px solid #f2dca8; color: #6b4a00; padding: 10px 14px; border-radius: 8px; }
.banner { background: var(--red-soft); color: #8a1c12; padding: 8px 28px; font-size: 13px; border-bottom: 1px solid #f3c3bd; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .n { font-weight: 400; color: var(--faint); margin-left: 4px; }

/* ---------- Misc ---------- */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12.5px; }
.dl dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.timeline li.event { color: var(--muted); font-size: 12.5px; }
.timeline .meta { font-size: 12px; color: var(--faint); }
.progress { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 70px; }
.progress > span { display: block; height: 100%; background: var(--green); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 18px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0; display: flex; gap: 10px; align-items: center; }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 11px; }
.checklist .done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.checklist .done span.t { text-decoration: line-through; color: var(--muted); }
.req-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.req-item:last-child { border-bottom: 0; }
.req-item .lbl { flex: 1; min-width: 180px; }
.cal-day { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; margin: 14px 0 6px; font-weight: 650; color: var(--ink); }
.cal-day.past { border-left-color: var(--line); color: var(--muted); }
.msg-body { white-space: pre-wrap; font-size: 12.5px; color: #3a4541; max-height: 110px; overflow: hidden; background: #fbfaf6; border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; }
details summary { cursor: pointer; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .mt { margin-top: 16px; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hide { display: none !important; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--ink); color: #d7e6e2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, .04) 31px 32px); pointer-events: none; }
.auth-art h2 { color: #fff; font: 600 30px/1.2 var(--serif); max-width: 460px; }
.auth-art ul { padding-left: 18px; max-width: 440px; }
.auth-art li { margin: 8px 0; }
.auth-box { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font: 600 24px var(--serif); }

/* ---------- Landing ---------- */
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 6vw; }
.lp-hero { padding: 60px 6vw 70px; background: var(--ink); color: #d7e6e2; position: relative; overflow: hidden; }
.lp-hero::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, .045) 39px 40px); pointer-events: none; }
.lp-hero h1 { color: #fff; font: 600 44px/1.12 var(--serif); max-width: 760px; letter-spacing: -.01em; }
.lp-hero p { font-size: 17px; max-width: 640px; color: #b9d1cb; }
.lp-section { padding: 56px 6vw; }
.lp-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.lp-feat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.lp-feat .num { font: 600 13px var(--serif); color: var(--accent); }
.plan { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.plan .price { font: 600 28px var(--serif); color: var(--ink); }
.lp-foot { padding: 26px 6vw; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }

/* ---------- Print (invoice) ---------- */
.inv { max-width: 820px; margin: 24px auto; background: #fff; border: 1px solid var(--line); padding: 36px 40px; }
.inv h1 { font: 600 26px var(--serif); }
.inv table th { background: #f6f4ee; }
.inv .tot td { border: 0; padding: 4px 12px; }
.inv .grand td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--ink); }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .inv { border: 0; margin: 0; padding: 0; max-width: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -260px; width: 240px; z-index: 30; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .menu-btn { display: inline-block; }
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 10px 14px; }
  .g2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .lp-hero h1 { font-size: 32px; }
  .dl { grid-template-columns: 1fr; }
}
.filters .spacer, .actions .spacer { flex: 1; }

.req-item .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.topbar .brand-firm { max-width: 340px; }
.nav a { padding: 6px 10px; }
.nav-label { padding: 11px 10px 3px; }
@media (max-width: 860px) { .card { overflow: hidden; } .hide-sm { display: none; } .kpi .val { font-size: 21px; } }
td .sub.show-sm { display: none; }
@media (max-width: 860px) { td .sub.show-sm { display: block; } }
