:root {
  --brand: #0ea5e9;
  --brand-dark: #0284c7;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: .6rem 1rem; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  min-height: 42px; text-decoration: none !important;
}
.btn:hover { background: #f1f5f9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: .35rem .7rem; min-height: 34px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid #cbd5e1; border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink); min-height: 42px;
}
input[type=checkbox] { width: auto; min-height: 0; }
input[type=color] { padding: 2px; height: 42px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14, 165, 233, .35); border-color: var(--brand); }
.field { margin-bottom: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.error { color: var(--bad); font-size: .9rem; margin: .5rem 0; }
.notice { background: #e0f2fe; border: 1px solid #bae6fd; color: #075985; padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.notice.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.3rem; color: var(--ink); }
.logo img { width: 34px; height: 34px; }

/* App shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #cbd5e1; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { color: #fff; padding: .25rem .5rem 1rem; }
.side a { display: flex; align-items: center; gap: .6rem; color: #cbd5e1; padding: .55rem .7rem; border-radius: 8px; font-weight: 500; }
.side a:hover { background: #1e293b; text-decoration: none; color: #fff; }
.side a.active { background: var(--brand); color: #fff; }
.side .sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 1rem .7rem .35rem; }
.main { padding: 1.5rem; max-width: 1200px; width: 100%; min-width: 0; }
.topbar { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.toolbar input { max-width: 260px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 40; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
  .main { padding: 1rem; }
  .scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 45; }
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.stat .v { font-size: 1.6rem; font-weight: 800; }
.stat .k { color: var(--muted); font-size: .85rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e2e8f0; color: var(--ink-2); white-space: nowrap; }
.pill.scheduled { background: #e0f2fe; color: #075985; }
.pill.on_the_way, .pill.arrived, .pill.in_progress { background: #fef3c7; color: #92400e; }
.pill.done, .pill.paid, .pill.active, .pill.trialing { background: #dcfce7; color: #166534; }
.pill.canceled, .pill.banned, .pill.past_due { background: #fee2e2; color: #991b1b; }
.pill.paused { background: #f1f5f9; color: #475569; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 1.25rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-foot { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* Calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: .5rem; overflow-x: auto; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; min-height: 180px; padding: .5rem; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(14,165,233,.2); }
.day h4 { margin: 0 0 .4rem; font-size: .85rem; color: var(--ink-2); }
.job { background: #f0f9ff; border-left: 3px solid var(--brand); border-radius: 6px; padding: .35rem .45rem; margin-bottom: .35rem; font-size: .82rem; cursor: pointer; }
.job:hover { background: #e0f2fe; }

/* Onboarding */
.steps { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.steps span { flex: 1; min-width: 60px; height: 6px; border-radius: 99px; background: var(--line); }
.steps span.on { background: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { background: #f1f5f9; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .6rem; font-size: .85rem; display: inline-flex; gap: .35rem; align-items: center; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; z-index: 200; box-shadow: var(--shadow); }
