/* Jari design system for Admin and Field: phone first, thumb-friendly, one calm look across all Jari apps.
   Phones get a fixed bottom tab bar and big touch targets; laptops get the same screens with pill tabs on top. */
:root {
  --brand: #0f766e; --brand-strong: #115e59; --brand-soft: #e7f5f2;
  --blue: #0f766e; /* kept so older rules keep working */
  --ink: #14201f; --muted: #5b6b6b; --line: #dde5e4; --bg: #f3f6f6; --surface: #fff;
  --ok: #15803d; --ok-bg: #dcfce7; --bad: #b91c1c; --bad-bg: #fee2e2; --warn: #92400e; --warn-bg: #fef3c7;
  --radius: 14px; --radius-sm: 10px; --tap: 2.75rem; --bar-h: 4rem;
  --shadow: 0 1px 2px rgb(16 40 38 / 0.06), 0 4px 14px rgb(16 40 38 / 0.05);
  --ring: 0 0 0 3px rgb(15 118 110 / 0.28);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif; color: var(--ink); line-height: 1.45; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-block-end: calc(var(--bar-h) + 1rem); }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
h1 { font-size: 1.25rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0.25rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 0.25rem 0 0.5rem; }

/* Layout: a phone-width column that opens up on bigger screens. Room for the bottom bar and the notch. */
.shell { max-width: 40rem; margin: 0 auto; padding: 0 0.85rem calc(var(--bar-h) + 1.5rem + env(safe-area-inset-bottom)); }
.shell.wide { max-width: 64rem; }
.narrow { max-width: 26rem; }
main.card.narrow { margin-block: 2.5rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 1rem; margin: 0.85rem auto; border: 1px solid var(--line); box-shadow: var(--shadow); }
.shell > .card.narrow { margin-block: 2.5rem; }

/* Top bar */
header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap;
  margin-inline: -0.85rem; padding: calc(0.6rem + env(safe-area-inset-top)) 0.85rem 0.6rem; background: rgb(255 255 255 / 0.92); backdrop-filter: blur(8px); border-block-end: 1px solid var(--line); }
header h1::before { content: 'J'; display: inline-grid; place-items: center; inline-size: 1.7rem; block-size: 1.7rem; margin-inline-end: 0.5rem; border-radius: 0.5rem; background: var(--brand); color: #fff; font-size: 0.95rem; vertical-align: middle; }
.status, .daybar, .row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.status { font-size: 0.8rem; color: var(--muted); padding: 0.5rem 0; }
.daybar { margin: 0.75rem 0 0.5rem; }
.daybar strong { font-size: 1rem; }
.dot::before { content: '● '; }
.dot.on { color: var(--ok); font-weight: 600; } .dot.off { color: var(--bad); font-weight: 600; }

/* Forms: 16px text stops iPhones zooming in; fields and buttons are easy to hit with a thumb. */
label { display: block; margin: 0.75rem 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input, select, textarea { display: block; width: 100%; min-block-size: var(--tap); padding: 0.6rem 0.75rem; margin-top: 0.25rem; font: inherit; font-size: 1rem; font-weight: 400; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type='checkbox'], input[type='radio'] { display: inline-block; inline-size: 1.25rem; min-block-size: 0; block-size: 1.25rem; margin-inline-end: 0.5rem; vertical-align: middle; accent-color: var(--brand); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-block-size: var(--tap); padding: 0.5rem 1rem; font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; touch-action: manipulation; }
button:active, .btn:active { transform: translateY(1px); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; margin: 0.4rem 0; }
button.primary:hover { background: var(--brand-strong); }
button.big { width: 100%; min-block-size: 3.25rem; font-size: 1.05rem; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Tabs: bottom bar on phones, pills on bigger screens */
.tabs { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 30; display: flex; gap: 0; margin: 0; padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom)); background: #fff; border-block-start: 1px solid var(--line); box-shadow: 0 -4px 14px rgb(16 40 38 / 0.06); }
.tabs button { flex: 1 1 0; min-inline-size: 0; flex-direction: column; min-block-size: 3.25rem; padding: 0.3rem 0.15rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 0.72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs button.on { background: var(--brand-soft); color: var(--brand-strong); }
@media (min-width: 48rem) {
  .tabs { position: static; z-index: auto; justify-content: flex-start; gap: 0.4rem; margin: 0.75rem 0; padding: 0; background: none; border: 0; box-shadow: none; overflow-x: auto; }
  .tabs button { flex: 0 0 auto; flex-direction: row; min-block-size: var(--tap); padding: 0.5rem 1.1rem; font-size: 0.95rem; border: 1px solid var(--line); background: #fff; }
  .tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
  .shell { padding-block-end: 3rem; }
}

/* Lists */
.item { display: flex; align-items: center; justify-content: flex-start; gap: 0.75rem; width: 100%; min-block-size: 3.5rem; margin: 0.5rem 0; padding: 0.7rem 0.9rem; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 400; }
.item.static { justify-content: space-between; }
.item.col { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.item strong { font-weight: 650; }
.st { flex: none; inline-size: 1.75rem; text-align: center; font-size: 1.4rem; line-height: 1; color: var(--brand); }
.muted, small { color: var(--muted); }
.err { color: var(--bad); font-weight: 600; }
.warn { background: var(--warn-bg); border: 1px solid #f59e0b; border-radius: var(--radius-sm); padding: 0.7rem; margin: 0.6rem 0; }
.flag { color: var(--warn); font-size: 0.85rem; }

/* Tables scroll sideways inside their card on a phone instead of breaking the page */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.75rem 0; overflow-x: auto; display: block; -webkit-overflow-scrolling: touch; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
th, td { padding: 0.55rem 0.6rem; border-block-end: 1px solid var(--line); text-align: start; white-space: nowrap; }
td:first-child, th:first-child { position: sticky; inset-inline-start: 0; background: #fff; }
.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
footer { margin-block-start: 2rem; font-size: 0.75rem; color: var(--muted); text-align: center; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.6rem; margin: 0.75rem 0; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem; box-shadow: var(--shadow); }
.tile b { display: block; margin-block-start: 0.2rem; font-size: 1.4rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; background: #e7ecec; color: #3f4f4f; }
.tag.paid, .tag.active { background: var(--ok-bg); color: var(--ok); }
.tag.overdue, .tag.suspended { background: var(--bad-bg); color: var(--bad); }
.tag.partial, .tag.open, .tag.trial { background: var(--warn-bg); color: var(--warn); }
.keybox { word-break: break-all; font-family: ui-monospace, monospace; font-size: 0.75rem; background: #f4f7f7; border: 1px dashed #94a3a3; border-radius: var(--radius-sm); padding: 0.7rem; margin: 0.5rem 0; max-block-size: 9rem; overflow: auto; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 0.75rem; }
@media (min-width: 30rem) { .grid2 { grid-template-columns: 1fr 1fr; } }
.invoice { background: #fff; max-width: 720px; margin: 1rem auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); }
@media (min-width: 40rem) { .invoice { padding: 2rem; } }
@media print { body { background: #fff; } .noprint, .tabs, header, footer { display: none !important; } .invoice { border: 0; margin: 0; padding: 0; max-width: none; box-shadow: none; } .shell { padding: 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 48rem) { table { display: table; } }
