/* SMART DUKA — shared interface styles */
:root {
  --brand: #0f766e; --brand-600: #0d6560; --brand-50: #ecfdf8;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f5f7fa; --card: #fff;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
  --sidebar: #0b2b2a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; } h1 { font-size: 1.4rem; } h2 { font-size: 1.1rem; } h3 { font-size: .95rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .r { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* Buttons & forms */
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .9rem; border-radius: 8px; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
button:hover, .btn:hover { border-color: #cbd5e1; text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .primary:hover { background: var(--brand-600); }
.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.ghost { background: transparent; border-color: transparent; } .ghost:hover { background: rgba(15,23,42,.05); }
.sm { padding: .3rem .6rem; font-size: .85rem; }
label { display: block; font-weight: 500; margin-bottom: .75rem; color: var(--ink-2); }
label > span { display: block; margin-bottom: .25rem; font-size: .85rem; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input[type=checkbox] { width: auto; margin-right: .4rem; }
.check { display: flex; align-items: center; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.error-text { color: var(--bad); font-size: .85rem; margin: .5rem 0; }

/* Cards, tables, badges */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 1.3rem; font-weight: 650; margin-top: .2rem; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; } .cols > * { min-width: 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line); padding: .5rem .6rem; white-space: nowrap; }
table.data th.r { text-align: right; }
table.data td.r { white-space: nowrap; }
table.data td { border-bottom: 1px solid var(--line); padding: .55rem .6rem; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; } table.data tr.clickable:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #f1f5f9; color: var(--ink-2); white-space: nowrap; }
.badge.ok, .badge.active, .badge.completed, .badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.pending, .badge.restricted, .badge.open, .badge.trial { background: var(--warn-bg); color: var(--warn); }
.badge.bad, .badge.suspended, .badge.terminated, .badge.voided, .badge.upheld { background: var(--bad-bg); color: var(--bad); }
.badge.info, .badge.overturned { background: var(--info-bg); color: var(--info); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.loading { text-align: center; color: var(--muted); padding: 2rem; }
.banner { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.banner.warn { background: var(--warn-bg); border-color: #fcd34d; color: #78350f; }
.banner.bad { background: var(--bad-bg); border-color: #fca5a5; color: #7f1d1d; }
.banner.info { background: var(--info-bg); border-color: #93c5fd; color: #1e3a8a; }
.toolbar-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.toolbar-row input, .toolbar-row select { width: auto; min-width: 160px; }

/* App shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--sidebar) 240px, var(--bg) 240px); }
.sidebar { background: var(--sidebar); color: #cbd5e1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.05rem; padding: .25rem .5rem 1rem; }
.brand .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 800; }
.brand small { display: block; font-weight: 400; color: #94a3b8; font-size: .75rem; }
.nav a { display: flex; align-items: center; gap: .6rem; color: #cbd5e1; padding: .5rem .65rem; border-radius: 8px; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(20,184,166,.18); color: #fff; }
.nav .section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: .9rem .65rem .3rem; }
.sidebar .foot { margin-top: auto; font-size: .8rem; color: #94a3b8; padding: .5rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .foot button { color: #e2e8f0; background: transparent; border-color: rgba(255,255,255,.15); margin-top: .5rem; }
.main { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.topbar .right { display: flex; gap: .5rem; align-items: center; }
.menu-btn { display: none; }

/* Charts */
.chart { width: 100%; height: 180px; }
.chart .bar { fill: var(--brand); } .chart .bar:hover { fill: var(--brand-600); }
.chart text { font-size: 10px; fill: var(--muted); }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; gap: .5rem; align-items: center; margin: .35rem 0; font-size: .85rem; }
.hbar .track { background: #f1f5f9; height: 8px; border-radius: 99px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}.w50{width:50%}.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}

/* Dialog & toast */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 50px rgba(15,23,42,.25); }
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog .dlg-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
dialog .dlg-body { padding: 1.1rem 1.2rem; max-height: 70vh; overflow-y: auto; }
dialog.wide { width: min(860px, 96vw); }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 1000; }
.toast { background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; }
.toast.error { background: var(--bad); } .toast.success { background: var(--ok); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .hero { background: linear-gradient(145deg, #0b2b2a, #0f766e); color: #e2f5f2; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.auth .hero h1 { font-size: 2.2rem; color: #fff; } .auth .hero p { max-width: 460px; font-size: 1.05rem; }
.auth .hero ul { padding-left: 1.1rem; } .auth .hero li { margin: .3rem 0; }
.auth .panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth .panel .card { width: min(440px, 100%); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .5rem .75rem; color: var(--muted); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 1rem; }
  .cols, .grid2, .grid3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; } .auth .hero { padding: 2rem 1.5rem; } .auth .hero ul { display: none; }
}

/* ---------------- Offline status */
.net-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line, #e5e7eb); background: #fff; border-radius: 99px; padding: 4px 10px;
  font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap; color: #166534; }
.net-pill i { width: 8px; height: 8px; border-radius: 99px; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.net-pill.off { color: #9a3412; border-color: #fed7aa; background: #fff7ed; } .net-pill.off i { background: #f97316; box-shadow: 0 0 0 3px rgba(249,115,22,.2); animation: netblink 1.4s infinite; }
.net-pill.sync { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; } .net-pill.sync i { background: #3b82f6; animation: netblink 1s infinite; }
.net-pill.warn { color: #92400e; border-color: #fde68a; background: #fffbeb; } .net-pill.warn i { background: #f59e0b; }
.net-pill.bad { color: #991b1b; border-color: #fecaca; background: #fef2f2; } .net-pill.bad i { background: #ef4444; }
@keyframes netblink { 50% { opacity: .35; } }
.toast.warn { background: #b45309; }
.badge.pending { background: #eff6ff; color: #1d4ed8; }
.offline-bar { margin: 0 0 12px; }
@media (prefers-reduced-motion: reduce) { .net-pill i { animation: none !important; } }
.neg { color: var(--bad); }

/* ---------------- Sign in / create account */
.auth-card { animation: auth-in .35s ease-out; }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }
.auth-title { font-size: 1.25rem; margin: .25rem 0 .75rem; }
.auth-pane label { display: block; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: .25rem 0 .75rem; font-size: .9rem; }
.auth-row label.check { margin: 0; }
.auth-alt { text-align: center; font-size: .92rem; margin: 1rem 0 0; color: var(--muted); }
button.wide { width: 100%; justify-content: center; padding: .7rem 1rem; font-size: 1rem; }
.pw { position: relative; display: block; }
.pw input { padding-right: 4.2rem; width: 100%; }
.pw .pw-toggle { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); padding: .3rem .6rem; font-size: .85rem; }
.pw-meter { display: block; height: 4px; background: var(--line); border-radius: 4px; margin: .4rem 0 .2rem; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; background: #dc2626; transition: width .2s, background .2s; }
.pw-meter i[data-s="2"] { background: #f59e0b; } .pw-meter i[data-s="3"] { background: #16a34a; } .pw-meter i[data-s="4"] { background: #0f766e; }

/* ---------------- Register business wizard (/start) */
.wizard-page { background: var(--bg); min-height: 100vh; }
.wizard-top { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line); }
.wizard-top .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); }
.wizard-user { display: flex; gap: .75rem; align-items: center; color: var(--muted); font-size: .92rem; }
.wizard { width: min(720px, 100%); margin: 1.5rem auto 3rem; padding: 0 1rem; display: grid; gap: 1rem; }
.wizard-card { animation: auth-in .35s ease-out; }
.wizard-title { font-size: 1.45rem; margin: 0 0 .25rem; }
.steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 1rem 0 1.25rem; counter-reset: s; }
.steps li { flex: 1; display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .88rem; padding-bottom: .5rem; border-bottom: 3px solid var(--line); transition: border-color .2s, color .2s; }
.steps li b { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-size: .8rem; flex: none; }
.steps li.on { color: var(--ink); border-bottom-color: var(--brand); } .steps li.on b { background: var(--brand); color: #fff; }
.steps li.done b { background: var(--g-50, #dcfce7); color: var(--brand); }
.cat-grid { border: 0; padding: 0; margin: .5rem 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.cat-grid legend { font-weight: 600; margin-bottom: .5rem; font-size: .92rem; }
label.cat { margin: 0; cursor: pointer; }
label.cat input { position: absolute; opacity: 0; pointer-events: none; }
label.cat span { display: flex; flex-direction: column; gap: .3rem; padding: .8rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; font-size: .9rem; transition: border-color .15s, background .15s; }
label.cat span i { font-style: normal; font-size: 1.4rem; }
label.cat input:checked + span { border-color: var(--brand); background: var(--g-50, #f0fdf4); }
label.cat input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.wizard-actions { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.wizard-actions .primary { margin-left: auto; min-width: 160px; justify-content: center; }
.review { background: var(--g-50, #f0fdf4); border-radius: 12px; padding: .75rem 1rem; margin: .75rem 0; }
.review h3 { margin: 0 0 .4rem; font-size: 1rem; }
.review dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; } .review dt { color: var(--muted); } .review dd { margin: 0; font-weight: 600; }
.mine h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
@media (max-width: 600px) { .steps li span { display: none; } .steps li { justify-content: center; } }
.wizard-actions [hidden], .auth-card [hidden] { display: none !important; }
.mine-list { display: grid; gap: .5rem; }
.mine-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; }
.mine-row > div { display: grid; gap: .1rem; min-width: 0; } .mine-row small { color: var(--muted); }
.mine-row button { flex: none; }
