/* Duebird app: a concept build by Rouge Flamingo. Its own brand, not Rouge Flamingo's. */
:root {
  --ink: #14232b; --muted: #5d6c73; --line: #e3e8ea; --bg: #f5f7f6; --card: #ffffff;
  --teal: #0f5d63; --teal-2: #e3f0ef; --sun: #f4b63f; --sun-2: #fdf1d8; --red: #b4413a; --red-2: #f8e3e1; --green: #2f7d4f; --green-2: #e0f0e6;
  --radius: 14px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.demo-banner { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; align-items: center; padding: 8px 16px; background: #3d1a2b; color: #fbf5f0; font-size: 13px; text-align: center; }
.demo-banner a { color: #f4a6bb; font-weight: 600; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 36px); }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; text-decoration: none; padding: 4px 8px; }
.logo__mark { width: 26px; height: 26px; border-radius: 8px; background: var(--teal); box-shadow: inset -9px -9px 0 var(--sun); }
.side nav { display: grid; gap: 4px; }
.side nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; }
.side nav a:hover { background: var(--bg); color: var(--ink); }
.side nav a.is-on { background: var(--teal-2); color: var(--teal); }
.ico { width: 18px; text-align: center; }
.side__foot { margin-top: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; padding: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.side__foot small { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 21px; margin: 0; margin-right: auto; }
.menu { display: none; border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; }
.search input { width: 260px; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--bg); }
.search input:focus { outline: 2px solid var(--teal); outline-offset: 1px; background: #fff; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c8d1d4; }
.btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn--primary:hover { background: #0b4a4f; }
.btn--small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

#view { padding: 26px 28px 60px; display: grid; gap: 22px; outline: none; }
.grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.kpi__label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi__value { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.kpi__note { font-size: 13px; margin-top: 4px; }
.up { color: var(--green); } .down { color: var(--red); }
.row2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.card h2 { font-size: 16px; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card h2 small { font-weight: 500; color: var(--muted); font-size: 13px; }

.chart { position: relative; }
.chart svg { width: 100%; height: 220px; display: block; }
.chart .legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .12s; }
.tip.is-on { opacity: 1; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #fafbfb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill--paid { background: var(--green-2); color: var(--green); }
.pill--due { background: var(--sun-2); color: #8a5b00; }
.pill--overdue { background: var(--red-2); color: var(--red); }
.pill--draft { background: var(--bg); color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; font-size: 13px; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.client h3 { margin: 0; font-size: 16px; }
.client p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.client dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; }
.client dt { font-size: 12px; color: var(--muted); }
.client dd { margin: 0; font-weight: 700; }

.rules { display: grid; gap: 12px; }
.rule { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.rule p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cfd8db; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.preview { background: var(--bg); border-radius: 12px; padding: 14px 16px; font-size: 14px; white-space: pre-line; }

.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(20, 35, 43, .35); }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--card); padding: 26px; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.12); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
.drawer__x { position: absolute; top: 14px; right: 14px; border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.drawer h2 { margin: 0 0 4px; font-size: 22px; }
.drawer .meta { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.lines { width: 100%; margin: 14px 0; }
.lines td { cursor: default; padding: 8px 0; }
.total { display: flex; justify-content: space-between; font-weight: 800; font-size: 18px; padding-top: 10px; }
.timeline { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; border-left: 2px solid var(--line); }
.timeline li { padding-left: 16px; position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--teal); }
.timeline small { color: var(--muted); display: block; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
form.new { display: grid; gap: 14px; }
form.new label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
form.new input, form.new select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-weight: 400; }
form.new .err { color: var(--red); font-size: 13px; font-weight: 500; min-height: 1em; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 30; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) { .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .row2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 15; top: 0; bottom: 0; left: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0,0,0,.1); }
  .side.is-open { transform: none; }
  .menu { display: block; }
  .top { padding: 14px 16px; flex-wrap: wrap; }
  .search { order: 3; flex: 1 1 100%; } .search input { width: 100%; }
  #view { padding: 18px 16px 50px; }
  .grid-kpi { gap: 10px; } .kpi__value { font-size: 22px; }
  .hide-sm { display: none; }
}
