/* Nikaram smart-PUC - responsive styles (mobile first) */
:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;
  --bg: #f1f5f4;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dbe3e1;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 14px; }
h2 small { font-weight: 400; font-size: .8rem; margin-left: 6px; }
.muted { color: var(--muted); }

/* ---------- top bar & nav ---------- */
.topbar {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  margin-right: auto;
}
.brand img { background: #fff; border-radius: 8px; padding: 2px; }
.nav-toggle {
  background: transparent;
  border: 0;
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: #fff; border-radius: 2px; }
.mainnav {
  display: none;
  width: 100%;
  flex-direction: column;
  padding: 6px 0 12px;
}
.mainnav.open { display: flex; }
.mainnav a {
  color: #e6fffb;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.mainnav a:hover, .mainnav a.active { background: rgba(255, 255, 255, .16); color: #fff; }

/* dropdown groups (Entry / Master / Reports) */
.navgroup summary {
  list-style: none;
  cursor: pointer;
  color: #e6fffb;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.navgroup summary::-webkit-details-marker { display: none; }
.navgroup summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s;
}
.navgroup[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.navgroup summary:hover, .navgroup.active > summary, .navgroup[open] > summary { background: rgba(255, 255, 255, .16); color: #fff; }
.navdrop { display: flex; flex-direction: column; padding: 4px 0 4px 14px; }
.navdrop a { font-weight: 400; }

.logout-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 12px 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .2);
}
.logout-form .who { color: #ccfbf1; font-size: .9rem; }
.logout-form .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .5); background: transparent; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .mainnav { display: flex; flex-direction: row; align-items: center; width: auto; padding: 0; gap: 2px; }
  .mainnav a, .navgroup summary { padding: 8px 12px; }
  .navgroup { position: relative; }
  .navdrop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
  }
  .navdrop a { color: var(--text); padding: 9px 12px; }
  .navdrop a:hover { background: var(--primary-soft); color: var(--primary-dark); }
  .navdrop a.active { background: var(--primary); color: #fff; }
  .logout-form { margin: 0 0 0 10px; padding: 0 0 0 12px; border-top: 0; border-left: 1px solid rgba(255, 255, 255, .25); }
}

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 16px 30px;
  flex: 1;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.two-col { display: grid; gap: 18px; }
.two-col > .card { margin-bottom: 0; }
@media (min-width: 900px) {
  .two-col { grid-template-columns: 340px 1fr; align-items: start; }
}
.footer {
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
  padding: 16px;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field label, .field .label { font-weight: 600; font-size: .88rem; }
.req { color: var(--danger); }
input[type=text], input[type=password], input[type=date], input[type=tel], input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 44px;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .18);
}
input:disabled { background: #f3f6f5; color: #374151; font-weight: 600; }
input.upper { text-transform: uppercase; }
.hint { color: var(--muted); font-size: .8rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .82rem; }

.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  min-height: 44px;
  flex: 1;
  min-width: 120px;
}
.radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.radio:has(input:focus-visible) { outline: 3px solid rgba(15, 118, 110, .35); outline-offset: 2px; border-color: var(--primary); }
.btn:focus-visible { outline: 3px solid rgba(15, 118, 110, .4); outline-offset: 3px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.span-full { grid-column: 1 / -1; }
/* PUC entry form: always 3 columns on desktop, row by row as laid out in the markup */
@media (min-width: 640px) and (max-width: 1023px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-3 textarea { min-height: 44px; height: 44px; }

.form-card.narrow { max-width: 520px; }
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.saving-as { color: var(--muted); font-size: .85rem; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 12px; min-height: 34px; font-size: .85rem; }
.btn-block { width: 100%; }
form.inline { display: inline; }

/* ---------- alerts & badges ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--ok-soft); border-color: #86efac; color: #14532d; }
.alert-error { background: var(--danger-soft); border-color: #fca5a5; color: #7f1d1d; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-valid { background: var(--ok-soft); color: var(--ok); }
.badge-due { background: var(--warn-soft); color: var(--warn); }
.badge-expired { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 20px 0; margin: 0; }

/* ---------- dashboard center name ---------- */
.dash-head { flex-wrap: wrap; }
.center-badge {
  order: 3;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 10px;
  border-radius: 16px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, .22), transparent 45%),
    linear-gradient(120deg, #0f766e 0%, #0d9488 45%, #22c1a8 100%);
  box-shadow: 0 8px 22px rgba(13, 148, 136, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.center-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .18) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: center-shine 6s ease-in-out infinite;
}
@keyframes center-shine { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .center-badge::after { animation: none; display: none; } }
.center-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
}
.center-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.center-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.center-name { font-size: 1.15rem; font-weight: 700; letter-spacing: .01em; overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .center-badge { order: 0; width: auto; max-width: 52%; margin: 0 auto; padding-right: 26px; }
  .center-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- dashboard stats ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.stat:hover { border-color: var(--primary); }
.stat-num { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-due { border-left-color: #f59e0b; }
.stat-expired { border-left-color: var(--danger); }

/* ---------- filters ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: end; }
.filters .field { margin-bottom: 12px; }
.filter-actions { display: flex; gap: 10px; grid-column: 1 / -1; margin-bottom: 4px; }
.filter-actions .btn { flex: 1; }
@media (min-width: 900px) {
  .filters { grid-template-columns: repeat(5, 1fr) auto; }
  .filter-actions { grid-column: auto; margin-bottom: 12px; }
}
.result-count { margin: 0 0 10px; color: var(--muted); font-size: .9rem; }

/* ---------- tables (become cards on mobile) ---------- */
.table-wrap { width: 100%; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { background: #f6f9f8; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
.table tbody tr:hover { background: #fafcfc; }
.table td.remarks { max-width: 220px; overflow-wrap: anywhere; }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions .btn { margin-left: 4px; }

@media (max-width: 899px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 6px 12px;
    background: #fff;
  }
  .rtable td {
    border: 0;
    border-bottom: 1px dashed #e7ecea;
    padding: 7px 0;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    text-align: right;
  }
  .rtable td:last-child { border-bottom: 0; }
  .rtable td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: .82rem;
    text-align: left;
    flex-shrink: 0;
  }
  .rtable td[data-label=""]::before { content: none; }
  .rtable td.actions { justify-content: flex-end; padding-top: 10px; }
  .table td.remarks { max-width: none; }
}

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }

/* ---------- login / setup ---------- */
.auth-body { background: linear-gradient(160deg, #0f766e 0%, #134e4a 60%, #0b3b38 100%); }
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card, .setup-card { width: 100%; max-width: 400px; padding: 28px 24px; }
.setup-card { max-width: 520px; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand h1 { font-size: 1.4rem; margin-top: 8px; color: var(--primary); }
.login-brand p { margin: 4px 0 0; font-size: .9rem; }
.auth-foot { color: #ccfbf1; font-size: .85rem; margin-top: 16px; }
.setup-log { list-style: none; padding: 0; margin: 14px 0; }
.setup-log li { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; font-size: .9rem; }
.log-ok { background: #f0fdf4; }
.log-new { background: var(--primary-soft); font-weight: 600; }
.log-err { background: var(--danger-soft); color: #7f1d1d; }

/* ---------- reports ---------- */
.report-filters { grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .report-filters { grid-template-columns: 220px 220px auto; justify-content: start; } }
.report-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.report-range { font-weight: 600; }
.report-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 12px; border-radius: 99px; background: #eef2f1; font-size: .85rem; }
.chip-valid { background: var(--ok-soft); color: var(--ok); }
.chip-due { background: var(--warn-soft); color: var(--warn); }
.chip-expired { background: var(--danger-soft); color: var(--danger); }
.print-only { display: none; }

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .footer, .no-print, .alert { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .page-head { margin-bottom: 6px; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-head { display: flex !important; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid #0f766e; padding-bottom: 6px; margin-bottom: 8px; }
  .print-head > div { display: flex; flex-direction: column; gap: 2px; }
  .print-head .ph-app { font-size: 17px; color: #0f766e; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-head .ph-center { font-size: 13px; font-weight: 700; color: #111; }
  .print-head .ph-right { text-align: right; font-size: 10px; color: #555; }
  .print-head .ph-right strong { font-size: 13px; color: #111; }
  .page-head h1 { display: none; }
  .print-foot { margin-top: 10px; font-size: 10px; color: #555; }
  .badge, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  /* always print as a real table, even on narrow paper */
  .rtable { display: table !important; width: 100% !important; }
  .rtable thead { display: table-header-group !important; }
  .rtable tbody { display: table-row-group !important; }
  .rtable tr { display: table-row !important; border: 0; padding: 0; margin: 0; }
  .rtable td, .rtable th { display: table-cell !important; width: auto !important; padding: 4px 5px; border-bottom: 1px solid #ccc; text-align: left; font-size: 9.5px; vertical-align: top; }
  .rtable th { white-space: nowrap; font-size: 8.5px; }
  .rtable td { white-space: nowrap; }
  .rtable td.remarks, .rtable td[data-label="Contact Name"] { white-space: normal; overflow-wrap: anywhere; }
  .table-wrap { overflow: visible !important; }
  .report-summary { font-size: 10px; }
  .chip { padding: 2px 6px; font-size: 9px; }
  .badge { padding: 1px 5px; font-size: 8.5px; }
  .rtable td::before { content: none !important; }
  .rtable tr { page-break-inside: avoid; }
}

/* ---------- icons & month navigation ---------- */
.ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.report-filters .filter-actions { flex-wrap: wrap; align-items: center; }
.month-nav {
  display: inline-flex;
  border: 1px solid var(--primary);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  flex: 1 1 100%;
}
.month-nav .btn {
  flex: 1;
  border: 0;
  border-radius: 0;
  min-height: 44px;
  padding: 8px 10px;
  font-weight: 600;
  letter-spacing: .01em;
  gap: 6px;
}
.month-nav .btn + .btn { border-left: 1px solid rgba(15, 118, 110, .35); }
.month-nav .btn:hover { background: var(--primary-soft); }
.month-nav .btn:focus-visible { outline-offset: -3px; }
@media (max-width: 479px) {
  .month-nav .m-word { display: none; }
}
@media (min-width: 900px) {
  .report-filters { grid-template-columns: 190px 190px 1fr; }
  .report-filters .filter-actions > .btn { flex: 0 0 auto; }
  .month-nav { flex: 0 0 auto; }
  .month-nav .btn { flex: 0 0 auto; padding: 8px 16px; }
}

/* ---------- card header with action (dashboard reminders) ---------- */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; }
.btn-alert {
  background: linear-gradient(120deg, #dc2626, #f97316);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(220, 38, 38, .25);
}
.btn-alert:hover { background: linear-gradient(120deg, #b91c1c, #ea580c); }
@media (max-width: 599px) { .card-head .btn-alert { width: 100%; } }

/* ---------- renewed status & 5 dashboard cards ---------- */
.badge-renewed, .chip-renewed { background: #e5e7eb; color: #4b5563; }
.stat-vehicles { border-left-color: #6366f1; }
.stats-5 .stat-vehicles { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .stats-5 { grid-template-columns: repeat(5, 1fr); }
  .stats-5 .stat-vehicles { grid-column: auto; }
}

/* ---------- alerts: select + send ---------- */
.alert-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f6f9f8;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.btn-alert:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.check { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; vertical-align: middle; }
.alert-table .col-check { width: 44px; text-align: center; }
.alert-table .col-send { white-space: nowrap; }
.alert-table tr.is-selected { background: #ecfdf5; }
.send-cell { display: inline-flex; align-items: center; gap: 8px; }
.sent-count {
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border-radius: 99px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  background: #e5e7eb;
  color: #4b5563;
}
.sent-count.is-sent { background: var(--primary-soft); color: var(--primary-dark); }
.btn-send { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-send:hover { background: var(--danger-soft); }
.btn-send .ico { width: 15px; height: 15px; }
@media (max-width: 899px) {
  .alert-table td.col-check { justify-content: space-between; text-align: right; }
}
@media print {
  .alert-table .col-check { display: none !important; }
}
.select-all { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.select-all .muted { font-weight: 400; }
/* alerts: Send All on the left, Select all at the right end (above the checkbox column) */
.alert-toolbar .select-all { margin-left: auto; }
@media (min-width: 900px) { .alert-table .col-check { padding-right: 14px; } }
/* alerts: chips then Send All at the right end of the summary row */
.report-chips { align-items: center; }
.report-chips .btn-alert { margin-left: 4px; }
.alert-toolbar { justify-content: flex-end; }
@media (max-width: 599px) { .report-chips .btn-alert { width: 100%; margin-left: 0; } }

/* ---------- styled confirm modal ---------- */
.modal {
  border: 0;
  padding: 26px 24px 20px;
  width: min(420px, calc(100vw - 32px));
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  text-align: center;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  animation: modal-in .18s ease-out;
}
.modal::backdrop {
  background: rgba(15, 23, 42, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in .18s ease-out;
}
.modal.closing { animation: modal-out .14s ease-in forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal, .modal::backdrop, .modal.closing { animation: none; } }
.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.modal-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal-alert .modal-icon { background: linear-gradient(135deg, #fee2e2, #ffedd5); color: #ea580c; box-shadow: 0 0 0 8px #fff7ed; }
.modal-danger .modal-icon { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 8px #fef2f2; }
.modal-title { margin: 0 0 6px; font-size: 1.2rem; }
.modal-msg { margin: 0 0 22px; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; }
/* wide tables scroll inside their card instead of the whole page */
@media (min-width: 900px) { .table-wrap { overflow-x: auto; } }

/* PUC entry (3-column desktop): Expiry Date under Validity, Remarks fills the space beside them */
@media (min-width: 1024px) {
  .grid-3 .f-validity, .grid-3 .f-expiry { grid-column: 1; }
  .grid-3 .f-remarks { grid-column: 2 / span 2; grid-row: 3 / span 2; }
  .grid-3 .f-remarks textarea { flex: 1; height: auto; min-height: 120px; }
}

/* ---------- PUC entry: highlighted Quick Entry panel + Other Details ---------- */
.entry-layout { display: grid; gap: 22px; align-items: start; }
@media (min-width: 900px) { .entry-layout { grid-template-columns: minmax(320px, 1fr) 2fr; gap: 28px; } }
.entry-layout fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.panel-title {
  float: left;               /* makes the legend sit inside the panel like a normal heading */
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin-bottom: 14px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
}
.panel-title + * { clear: both; }
.panel-title.muted { color: var(--muted); }
.entry-layout .quick-panel {
  padding: 18px 18px 6px;
  border: 2px solid var(--primary);
  border-radius: 14px;
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 70%);
  box-shadow: 0 8px 22px rgba(15, 118, 110, .14);
}
.quick-panel .field label, .quick-panel .field .label { color: var(--primary-dark); }
.quick-panel input[type=text], .quick-panel input[type=tel], .quick-panel input[type=date] {
  border-color: #99f6e4;
  font-weight: 600;
  font-size: 17px;
  background: #fff;
}
.quick-panel input::placeholder { font-weight: 400; }
.quick-panel .radio { background: #fff; border-color: #99f6e4; }
.entry-layout .detail-panel {
  padding: 18px 18px 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfcfc;
}
.detail-grid { gap: 0 18px; }
@media (min-width: 640px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-panel .f-remarks textarea { min-height: 96px; }

/* Other Details toggle: phones/tablets only */
.details-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  margin-top: -8px;
  font: inherit;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: left;
  background: #fff;
  border: 1px dashed var(--primary);
  border-radius: 12px;
  cursor: pointer;
}
.details-toggle small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.details-toggle .ico { width: 22px; height: 22px; transition: transform .2s; }
.details-toggle[aria-expanded="true"] .ico { transform: rotate(180deg); }
.details-toggle:hover { background: var(--primary-soft); }
@media (max-width: 899px) {
  .entry-layout.details-collapsed .detail-panel { display: none; }
}
@media (min-width: 900px) {
  .details-toggle { display: none; }
}

/* hidden attribute must win over .field { display: flex } */
[hidden] { display: none !important; }
.api-url input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.hint code { background: #eef2f1; padding: 0 4px; border-radius: 4px; }

/* ---------- settings: message format ---------- */
.var-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.var-btn {
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid #99f6e4;
  background: var(--primary-soft);
  color: var(--primary-dark);
  cursor: pointer;
}
.var-btn:hover { background: #99f6e4; }
.msg-preview { margin-top: 6px; }
.msg-preview-label { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.msg-bubble {
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 2px;
  background: #dcf8c6;           /* chat bubble green */
  color: #111b21;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .92rem;
  max-width: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}

/* ---------- Manual WhatsApp ---------- */
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5a; }
.btn-wa:disabled { opacity: .6; cursor: progress; }
.btn-wa .ico { width: 15px; height: 15px; }
.wa-note { display: flex; align-items: flex-start; gap: 8px; color: #075e54; font-size: .9rem; }
.wa-note .ico { color: #25d366; flex-shrink: 0; margin-top: 2px; }
.alert-toolbar:has(.wa-note) { justify-content: flex-start; background: #f0fdf4; border-color: #bbf7d0; }

/* ---------- database backup ---------- */
.backup-card h2 { display: flex; align-items: center; gap: 8px; }
.backup-card h2 .ico { color: var(--primary); }
.backup-card > .hint { display: block; margin-top: 10px; }
.backup-status {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; font-size: .92rem;
}
.backup-status.is-ok { background: var(--ok-soft); color: #14532d; }
.backup-status.is-overdue { background: var(--warn-soft); color: #78350f; }
.backup-alert {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px;
  border: 1px solid #fcd34d; border-left: 5px solid #f59e0b; border-radius: 12px;
  background: #fffbeb; color: #78350f; box-shadow: var(--shadow);
}
.backup-alert-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: #fef3c7; color: #d97706; flex-shrink: 0;
}
.backup-alert-text { flex: 1; min-width: 200px; }
.btn-backup { background: #d97706; border-color: #d97706; }
.btn-backup:hover { background: #b45309; }
.modal-success .modal-icon { background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 0 8px #f0fdf4; }
@media (max-width: 599px) { .backup-alert .btn-backup { width: 100%; } }

/* settings: two cards side by side on desktop */
@media (min-width: 1024px) {
  .settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: stretch; }
  .settings-layout > .form-card.narrow { max-width: none; margin-bottom: 0; display: flex; flex-direction: column; }
  .settings-layout > .form-card.narrow > .form-actions { margin-top: auto; } /* Save at the bottom of equal-height cards */
  .settings-layout > .backup-card { grid-column: 1 / -1; }
  .backup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
  .backup-grid .upload-form { margin-top: 0; padding-top: 0; border-top: 0; padding-left: 28px; border-left: 1px solid var(--border); }
}

/* ---------- users ---------- */
.role-tag { font-size: .7rem; background: rgba(255, 255, 255, .2); padding: 1px 6px; border-radius: 99px; margin-left: 2px; }
.user-grid { gap: 0 18px; }
@media (min-width: 640px) { .user-grid { grid-template-columns: 1fr 1fr; } }
.switch-row { flex: 0 0 auto; }
.perm-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px 14px 8px; margin: 4px 0 14px; min-width: 0; }
.perm-box[disabled] .perm-table { opacity: .45; }
.perm-box.has-error { border-color: var(--danger); }
.perm-table th, .perm-table td { padding: 8px 10px; vertical-align: middle; }
.perm-table .perm-col { text-align: center; white-space: nowrap; }
.perm-table th.perm-col label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.perm-cell { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .85rem; }
.perm-group td { background: #f6f9f8; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.no-access h2 { color: var(--danger); }
/* (permission grid labels stay visible; phones use the card layout below) */

/* ---------- dashboard: active sessions ---------- */
.sessions-card h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sessions-card h2 .ico { color: var(--primary); }
.session-meter { padding: 4px 12px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-size: .88rem; }
.session-meter.is-full { background: var(--warn-soft); color: var(--warn); }
.sessions-card tr.is-current { background: #f0fdfa; }
.sessions-card .hint { display: block; margin: 10px 0 0; }

/* ---------- dashboard: highlighted Renewal Reminders ---------- */
.reminders-card {
  border: 1px solid #fcd34d;
  border-left: 5px solid #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 120px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, .14);
}
.reminders-card.has-due { border-left-color: #ea580c; box-shadow: 0 10px 28px rgba(234, 88, 12, .18); }
.reminders-card h2 { display: flex; align-items: center; gap: 12px; font-size: 1.15rem; }
.reminders-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; background: #fef3c7; color: #d97706;
}
.reminders-card.has-due .reminders-icon { background: #ffedd5; color: #ea580c; animation: bell 2.4s ease-in-out infinite; }
@keyframes bell { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .reminders-card.has-due .reminders-icon { animation: none; } }
.reminders-count {
  display: inline-block; margin-left: 6px; padding: 1px 10px; border-radius: 99px;
  background: #ea580c; color: #fff; font-size: .78rem; vertical-align: middle;
}
.reminders-sub { display: block; font-size: .8rem; font-weight: 400; color: #92400e; margin-top: 2px; }
.reminders-empty { display: flex; align-items: center; justify-content: center; gap: 8px; color: #166534; }
.reminders-empty .ico { color: var(--ok); }
.reminders-card .table th { background: #fff7ed; }

/* ---------- dashboard: compact session strip ---------- */
.session-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 12px; margin-top: -4px;
  font-size: .82rem; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 10px; background: #fff;
}
.session-strip-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.session-strip-label .ico { width: 16px; height: 16px; color: var(--primary); }
.session-strip-label b { color: var(--ok); }
.session-strip-label b.is-full { color: var(--warn); }
.session-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; background: #f3f6f5; color: var(--text);
}
.session-chip.is-current { background: var(--primary-soft); color: var(--primary-dark); }
.chip-x {
  border: 0; background: transparent; color: var(--danger); font-size: 1rem; line-height: 1;
  cursor: pointer; padding: 0 0 0 4px;
}

/* ======================================================================
   Phones / small tablets (<= 767px): everything about 10% smaller
   ====================================================================== */
.perm-all-text { display: none; }            /* desktop: the column header already says "All" */
@media (max-width: 767px) {
  html { font-size: 90%; }                   /* all rem-based sizes shrink 10% */
  body { font-size: 13.5px; }                /* 15px -> 13.5px */
  input[type=text], input[type=password], input[type=date], input[type=tel], input[type=number],
  input[type=url], select, textarea {
    font-size: 14.4px;                       /* 16px -> 14.4px */
    min-height: 40px;                        /* 44px -> 40px */
    padding: 8px 10px;
  }
  .quick-panel input[type=text], .quick-panel input[type=tel], .quick-panel input[type=date] { font-size: 15.3px; }
  .grid-3 textarea { min-height: 40px; height: 40px; }
  .btn { min-height: 40px; padding: 8px 16px; }
  .btn-sm { min-height: 31px; padding: 4px 10px; }
  .radio { min-height: 40px; padding: 8px 12px; }
  .check, .radio input { width: 16px; height: 16px; }
  .topbar-inner { min-height: 50px; }
  .brand img { width: 25px; height: 25px; }
  .details-toggle { min-height: 43px; }
  .container { padding: 14px 12px 24px; }
  .card { padding: 15px; }

  /* footer: "Developed by ..." on its own full line */
  .footer-sep { display: none; }
  .footer-app, .footer-dev { display: block; }
  .footer-dev { white-space: nowrap; margin-top: 2px; }

  /* Users & Permissions: each page becomes a small card with wrapping option boxes */
  .perm-box { padding: 12px 10px 6px; }
  .perm-box .table-wrap { overflow: visible; }
  .perm-table, .perm-table tbody { display: block; width: 100%; }
  .perm-table thead { display: none; }
  .perm-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .perm-table td { display: block; padding: 0; border: 0; }
  .perm-table td:first-child { flex: 0 0 100%; font-weight: 600; }
  .perm-table td.perm-col { text-align: left; }
  .perm-table .perm-none { display: none; }
  .perm-table td.perm-col:has(.perm-none) { display: none; }
  .perm-table .perm-cell {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: .9rem;
  }
  .perm-table .perm-cell:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
  .perm-table .perm-all-cell { margin-left: auto; }
  .perm-all-text { display: inline; font-weight: 600; }
  .perm-group { border-bottom: 0 !important; padding: 12px 0 2px !important; }
  .perm-group td { flex: 0 0 100%; background: transparent; padding: 0; }
}
/* permission box: the table always starts below the floated "Menu & Page Permissions" heading */
.perm-box .table-wrap, .perm-box .field-error { clear: both; }

/* PUC Alert: Skip Sent / Show All */
.show-choice .radio { min-width: 0; padding: 8px 12px; white-space: nowrap; }
.chip-hidden { background: #e0f2fe; color: #075985; text-decoration: none; }
.chip-hidden:hover { background: #bae6fd; }
@media (min-width: 900px) {
  .report-filters:has(.show-choice) { grid-template-columns: 190px 190px auto 1fr; }
}
/* in the 2-column filter grid a half-width cell is too narrow for both pills: give Show its own row */
@media (max-width: 899px) {
  .report-filters .field:has(.show-choice) { grid-column: 1 / -1; }
}

/* ---------- live password checklist ---------- */
.pw-rules { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: .82rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: 6px; }
.pw-rules li::before {
  content: ""; width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid #cbd5e1; box-sizing: border-box;
}
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 9px no-repeat; }
.pw-rules li.bad { color: var(--danger); }
.pw-rules li.bad::before { border-color: var(--danger); }
.show-pw { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; margin-bottom: 12px; }

/* ---------- PUC Amount (Settings > PUC Amount) ---------- */
.check-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.collection-total {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px; width: fit-content; margin: 14px 0 0 auto;
  padding: 10px 18px; border: 1px solid #99f6e4; border-radius: 10px; background: var(--primary-soft);
  color: var(--primary); font-weight: 600;
}
.collection-total b { font-size: 1.15rem; }

/* ---------- footer: company website + Terms & Conditions ---------- */
.footer-company { color: var(--text, #1f2937); font-weight: 700; text-decoration: none; }
.footer-company:hover { color: var(--primary); text-decoration: underline; }
.footer-links { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 6px; font-size: .8rem; }
.footer-links span { color: var(--border); }
.footer-links a { color: var(--primary); text-decoration: none; font-weight: 500; }
.footer-links a:hover { text-decoration: underline; }
/* wider screens: copyright stays centred, the links sit in the right corner (a 3-column grid, so they never overlap) */
@media (min-width: 900px) {
  .footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 16px; }
  .footer-main { grid-column: 2; }
  .footer-links { grid-column: 3; justify-self: end; margin-top: 0; }
}

/* ======================================================================
   Floating Screen (desktop): floating button on the dashboard + compact entry
   shown in the small always-on-top window (about 20% smaller)
   ====================================================================== */
.running-btn {
  position: fixed;
  right: 28px;
  bottom: 84px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, #dc2626, #f97316);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(220, 38, 38, .35);
  cursor: pointer;
}
.running-btn:hover { background: linear-gradient(120deg, #b91c1c, #ea580c); }
/* small shake every few seconds to catch the eye; stops on hover, while the floating screen is open, and for reduced motion */
.running-btn { animation: running-shake 4s ease-in-out 1s infinite; }
.running-btn:hover, .running-btn:focus-visible, .running-btn.is-running { animation: none; }
@keyframes running-shake {
  0%, 82%, 100% { transform: translateX(0) rotate(0); }
  85% { transform: translateX(-2px) rotate(-2deg); }
  88% { transform: translateX(2px) rotate(2deg); }
  91% { transform: translateX(-2px) rotate(-1.5deg); }
  94% { transform: translateX(1px) rotate(1deg); }
  97% { transform: translateX(0) rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .running-btn { animation: none; } }
.running-btn:focus-visible { outline: 3px solid rgba(220, 38, 38, .4); outline-offset: 3px; }
.running-btn .ico { width: 18px; height: 18px; }
.running-btn-nav { position: static; margin-right: 8px; padding: 6px 14px; font-size: .88rem; box-shadow: 0 3px 10px rgba(0, 0, 0, .18); } /* top bar, before Dashboard */
.running-btn-nav .ico { width: 15px; height: 15px; }
.running-btn.is-running { background: #fff; color: var(--danger); box-shadow: 0 0 0 2px var(--danger), 0 8px 22px rgba(220, 38, 38, .2); }
@media (max-width: 899px), (hover: none), (pointer: coarse) { .running-btn { display: none; } }

/* the floating window itself: the entry page fills it */
body.pip-host { margin: 0; min-height: 0; height: 100vh; overflow: hidden; background: #fff; display: block; }
.pip-frame { display: block; width: 100%; height: 100vh; border: 0; }

/* entry page inside the floating window */
body.running-mode { zoom: .8; background: #fff; min-height: 0; }
.running-mode .container { max-width: none; padding: 10px 12px 8px; }
.running-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.running-head h1 { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; color: var(--primary-dark); }
.running-head h1 .ico { width: 18px; height: 18px; color: var(--danger); }
.running-mode .form-card { padding: 0; margin: 0; border: 0; box-shadow: none; background: none; }
.running-mode .entry-layout { grid-template-columns: 1fr; gap: 10px; }
.running-mode .entry-layout .quick-panel { padding: 12px 12px 2px; box-shadow: none; }
.running-mode .panel-title { display: none; }
.running-mode .field { margin-bottom: 10px; }
.running-mode .details-toggle, .running-mode .saving-as { display: none; }
.running-mode .detail-panel:not(:has(.has-error)) { display: none; } /* shown only to fix an error in it */
.running-mode .form-actions { padding-top: 10px; border-top: 0; }
.running-mode .form-actions .btns, .running-mode #saveBtn { width: 100%; }
.running-mode .alert { padding: 8px 10px; margin-bottom: 8px; font-size: .9rem; }
.running-mode .alert-success { position: fixed; top: 6px; left: 8px; right: 8px; z-index: 5; margin: 0; box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.btn-exit-smart {
  color: #fff;
  font-weight: 700;
  background: linear-gradient(120deg, #dc2626, #f97316);
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(220, 38, 38, .3);
}
.btn-exit-smart:hover { background: linear-gradient(120deg, #b91c1c, #ea580c); }

/* "smart" in the app name smart-PUC: 2px smaller than the rest of the name */
.name-smart { font-size: calc(1em - 2px); }

/* ---------- dashboard: Renewal Reminders - today's balance + past days (Settings > Missed alerts) ---------- */
.due-today {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  border-radius: 12px; border: 1px solid; text-decoration: none; color: var(--text);
}
.due-today.is-due { background: #fff7ed; border-color: #fdba74; box-shadow: 0 6px 18px rgba(234, 88, 12, .15); }
.due-today.is-clear { background: var(--ok-soft); border-color: #86efac; }
a.due-today:hover { filter: brightness(.98); }
.due-num { font-size: 2.4rem; font-weight: 800; line-height: 1; min-width: 56px; text-align: center; }
.due-today.is-due .due-num { color: #ea580c; }
.due-today.is-clear .due-num { color: var(--ok); }
.due-text { flex: 1; display: flex; flex-direction: column; }
.due-text small { color: var(--muted); }
.due-go { font-weight: 700; color: #ea580c; white-space: nowrap; }
.past-head { text-align: center; margin: 16px 0 8px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.past-days { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; } /* centred row of day cards */
.past-days > .past-day { flex: 0 1 170px; min-width: 150px; }
.past-day {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px;
  border: 1px solid var(--border); border-left: 4px solid; border-radius: 10px;
  background: #fff; color: var(--text); text-decoration: none;
}
.past-day.is-due { border-left-color: var(--danger); background: #fff7f7; }
.past-day.is-clear { border-left-color: var(--ok); }
a.past-day:hover { border-color: var(--primary); }
.past-when { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.past-date { font-size: .85rem; }
.past-num { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.past-day.is-due .past-num { color: var(--danger); }
.past-day.is-clear .past-num { color: var(--ok); }
.past-note { font-size: .78rem; color: var(--muted); }

/* Settings: PUC Amount + Vehicle Type required side by side */
.check-row { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.check-field:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
/* Quick Entry: Vehicle Type (when required) styled like the other quick fields */
.quick-panel select { border-color: #99f6e4; font-weight: 600; background-color: #fff; }

/* Renewal Reminders: today's card - day label + expiry date line */
.due-when { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.due-info b { color: #92400e; }
.due-today.is-clear .due-info b { color: var(--ok); }

/* PUC Alert: Back (opened from the dashboard) at the right end of the filter card */
.filters-back { margin-left: auto; }

/* past-day card: the expiry date those alerts were for */
.past-expiry { font-size: .78rem; color: var(--muted); }
.past-expiry b { color: var(--text); }

/* Settings: right column = Database Backup (+ Upload) and Alert Settings cards */
.alert-card h2 { display: flex; align-items: center; gap: 8px; }
.alert-card h2 .ico { color: var(--primary); }
.backup-card .hint { display: block; margin-top: 10px; }
.upload-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.upload-form h3 { margin: 0 0 10px; font-size: .95rem; }
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-row input[type=file] { flex: 1; min-width: 0; font: inherit; font-size: .88rem; }

/* ---------- crash page + Error Log ---------- */
.crash-card { width: 100%; max-width: 440px; padding: 30px 26px 22px; text-align: center; }
.crash-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--danger-soft); color: var(--danger);
  box-shadow: 0 0 0 8px #fef2f2;
}
.crash-icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.crash-title { font-size: 1.3rem; margin: 0 0 8px; color: var(--text); }
.crash-text { margin: 0 0 18px; color: var(--muted); font-size: .92rem; }
.crash-ref {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin: 0 auto 16px; padding: 12px 16px; max-width: 260px;
  border: 1px dashed #fca5a5; border-radius: 12px; background: #fff7f7;
}
.crash-ref span { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.crash-ref b { font-size: 1.9rem; line-height: 1.1; color: var(--danger); letter-spacing: .02em; user-select: all; }
.crash-ref small { font-size: .75rem; color: var(--muted); }
.crash-support {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 18px;
  padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); text-align: left;
}
.crash-support .ico { width: 24px; height: 24px; flex-shrink: 0; }
.crash-support span { display: flex; flex-direction: column; font-size: .88rem; }
.crash-support a { font-weight: 600; }
.crash-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.crash-actions .btn { flex: 1 1 160px; }
.crash-brand { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); font-size: .8rem; font-weight: 700; color: var(--primary); }
.error-alert {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid #fca5a5; border-left: 5px solid var(--danger); border-radius: 10px;
  background: var(--danger-soft); color: #7f1d1d; text-decoration: none;
}
.error-alert .ico { width: 22px; height: 22px; color: var(--danger); flex-shrink: 0; }
.error-alert span:nth-child(2) { flex: 1; }
.error-alert-go { font-weight: 700; color: var(--danger); white-space: nowrap; }
.err-msg { font-weight: 600; overflow-wrap: anywhere; }
.err-type { display: block; font-size: .78rem; color: var(--muted); }
.err-where { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; overflow-wrap: anywhere; }
.err-trace summary { cursor: pointer; color: var(--primary); font-size: .8rem; }
.err-trace pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75rem; background: #f6f8f8; padding: 8px; border-radius: 6px; max-height: 240px; overflow: auto; }
.errors-table tr.is-new { background: #fff7f7; }

/* crash screen: support phone number */
.crash-support .crash-phone { font-size: 1.15rem; font-weight: 800; letter-spacing: .03em; color: var(--primary-dark); text-decoration: none; }

/* Users: username = fixed "<super>_" prefix + typed part */
.prefix-input { display: flex; align-items: stretch; }
.prefix-input .prefix {
  display: flex; align-items: center; padding: 0 10px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-soft); border: 1px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px; white-space: nowrap;
}
.prefix-input input { border-radius: 0 8px 8px 0; min-width: 0; flex: 1; }
.user-limit p { margin: 0; }

/* ---------- owner panel (Nikaram): centres ---------- */
.owner-create { max-width: none; }
.owner-create-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.owner-create-row .field { flex: 1 1 260px; margin-bottom: 0; }
.owner-create .hint { display: block; margin-top: 10px; }
.owner-table tr.is-disabled td { background: #fafafa; color: var(--muted); }
.owner-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; }
.owner-delete summary { list-style: none; cursor: pointer; }
.owner-delete summary::-webkit-details-marker { display: none; }
.owner-delete[open] summary { background: var(--danger); color: #fff; }
.owner-delete-form {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 10px; min-width: 220px;
  border: 1px solid #fca5a5; border-radius: 10px; background: #fff7f7; text-align: left;
}
.owner-delete-form label { font-size: .8rem; font-weight: 600; color: #7f1d1d; }

/* renewal notice (shown once a day to a centre's logins) */
.renewal-notice .modal-icon { background: var(--warn-soft); color: var(--warn); box-shadow: 0 0 0 8px #fffbeb; }
.renewal-notice.is-over .modal-icon { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 8px #fef2f2; }
.renewal-notice.is-over .modal-title { color: var(--danger); }
.renewal-contact { font-size: .9rem; }

/* owner panel: subscription */
.owner-create-row .field-days { flex: 0 0 110px; }
.sub-note { display: block; font-size: .75rem; color: var(--muted); }
.days-form { display: flex; gap: 4px; align-items: center; }
.days-form input { width: 76px; min-height: 34px; padding: 4px 8px; }
.badge-alert-on { background: #fef3c7; color: #92400e; display: inline-block; margin-top: 3px; }
.renew-list { position: relative; }
.renew-list summary { list-style: none; cursor: pointer; white-space: nowrap; }
.renew-list summary::-webkit-details-marker { display: none; }
.renew-drop {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 230px; padding: 8px 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); display: grid; gap: 6px;
}
.renew-drop small { display: block; color: var(--muted); }
.btn-renewed { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-renewed:hover { background: #166534; }
.btn-renew-alert { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-renew-alert:hover { background: #d97706; }
.btn-stop-alert { background: #475569; border-color: #475569; color: #fff; }
.btn-stop-alert:hover { background: #334155; }
.owner-actions .btn:disabled { opacity: .4; cursor: not-allowed; }

/* owner panel: each centre's buttons on their own row under its details */
.owner-table tr.owner-actions-row td { padding-top: 0; padding-bottom: 14px; border-top: 0; }
.owner-table tr:has(+ .owner-actions-row) td { border-bottom: 0; }
.owner-actions { justify-content: flex-start; }
.renew-drop { position: static; margin-top: 6px; box-shadow: none; }
@media (max-width: 899px) {
  .owner-table tr.owner-actions-row td::before { display: none; }
  .owner-table tr.owner-actions-row td { padding-top: 10px; }
}
.renew-drop { min-width: 0; } .renew-drop small { white-space: normal; }

/* dashboard: 6th card = all-time alerts sent */
.stat-sent { border-left-color: #16a34a; }
.stat-sub { display: block; margin-top: 2px; font-size: .75rem; color: var(--muted); }
.stats-6 .stat-vehicles { grid-column: auto; }
@media (min-width: 900px) and (max-width: 1199px) { .stats-6 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .stats-6 { grid-template-columns: repeat(6, 1fr); } }

/* owner panel: created date (new centre) + renewal date panel */
.owner-create-row .field-date { flex: 0 0 170px; }
.owner-renew summary { list-style: none; cursor: pointer; }
.owner-renew summary::-webkit-details-marker { display: none; }
.owner-renew-form {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 10px; min-width: 220px;
  border: 1px solid #86efac; border-radius: 10px; background: #f0fdf4; text-align: left;
}
.owner-renew-form label { font-size: .8rem; font-weight: 600; color: #14532d; }
.owner-renew-form small { color: var(--muted); font-size: .75rem; }

/* owner panel: renewal list item with days + delete */
.renew-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.renew-item + .renew-item { padding-top: 6px; border-top: 1px dashed var(--border); }
.renew-days { display: inline-block; padding: 0 7px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-size: .72rem; font-weight: 700; }
.renew-del {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: 1px solid #fca5a5; background: #fff;
  color: var(--danger); font-size: 1rem; line-height: 1; cursor: pointer;
}
.renew-del:hover { background: var(--danger); color: #fff; }

/* ======================================================================
   Plans (Silver / Gold / Platinum): badge, comparison, gentle upgrade hints
   ====================================================================== */
.plan-badge {
  font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 9px; margin-right: 8px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .5); cursor: pointer;
  background: rgba(255, 255, 255, .15); color: #fff;
}
.plan-badge:hover { background: rgba(255, 255, 255, .28); }
.plan-badge.is-static { cursor: default; }
.plan-badge.plan-platinum.is-static:hover { background: linear-gradient(135deg, #e0f2fe, #6366f1); }
.plan-silver { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #1f2937; border-color: #d1d5db; }
.plan-gold { background: linear-gradient(135deg, #fde68a, #d97706); color: #3b2402; border-color: #fcd34d; }
.plan-platinum { background: linear-gradient(135deg, #e0f2fe, #6366f1); color: #1e1b4b; border-color: #c7d2fe; }
.plan-info { max-width: 640px; width: calc(100% - 24px); }
.plan-table th, .plan-table td { text-align: center; font-size: .85rem; padding: 7px 8px; }
.plan-table td:first-child, .plan-table th:first-child { text-align: left; }
.plan-table th small { display: block; font-size: .65rem; font-weight: 600; text-transform: none; color: var(--primary); }
.plan-table .is-current { background: #f0fdfa; font-weight: 600; }
.pi-yes { color: var(--ok); font-weight: 800; }
.pi-no { color: #cbd5e1; }
.plan-upgrade { font-size: .9rem; }
/* small star chip next to a locked feature: quiet, never an error */
.upgrade-hint {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin-left: 4px;
  padding: 0 7px; border-radius: 99px; font-size: .68rem; font-weight: 700; line-height: 1.6;
  color: #92400e; background: #fffbeb; border: 1px solid #fde68a; cursor: pointer; white-space: nowrap;
}
.upgrade-hint .ico { width: 11px; height: 11px; color: #f59e0b; }
.upgrade-hint:hover { background: #fef3c7; }
.plan-note { margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
.plan-note.is-full { color: #92400e; }
.plan-range { display: block; margin-top: 2px; }
.locked-save { display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
input.is-locked { background: #f3f6f5; color: var(--muted); }
.center-facts { display: grid; gap: 0 12px; grid-template-columns: 2fr 1fr 1fr; margin-bottom: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.center-facts .hint { grid-column: 1 / -1; margin-top: -6px; }
@media (max-width: 599px) { .center-facts { grid-template-columns: 1fr; } }
.radio-note { flex-direction: column; align-items: flex-start; gap: 2px; }
.radio-note span { display: inline-flex; align-items: center; gap: 8px; }
.radio-note small { font-size: .7rem; font-weight: 400; color: var(--muted); }

/* owner panel: create form rows, Edit / Payments panels */
.owner-create .owner-create-row + .owner-create-row { margin-top: 10px; }
.owner-create-row .field-mobile { flex: 0 0 170px; }
.owner-create-row .field-plan { flex: 1 1 320px; }
.owner-create-row .field-amount { flex: 0 0 150px; }
.owner-create .radio .plan-badge { margin: 0; }
.full-backup-note { text-align: right; margin-top: 2px; }
.owner-panel summary { list-style: none; cursor: pointer; }
.owner-panel summary::-webkit-details-marker { display: none; }
.owner-panel-form {
  display: grid; gap: 8px; margin-top: 8px; padding: 12px; min-width: 300px; max-width: 560px;
  border: 1px solid var(--border); border-radius: 10px; background: #fafcfc; text-align: left;
}
.owner-panel-form small { color: var(--muted); font-size: .75rem; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.edit-grid label { display: flex; flex-direction: column; gap: 3px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.edit-grid input { min-height: 34px; padding: 4px 8px; font-size: .9rem; }
.plan-hist { display: grid; gap: 3px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: .82rem; }
.pay-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 8px; border-top: 1px dashed var(--border); }
.pay-add input { min-height: 34px; padding: 4px 8px; width: auto; flex: 1 1 110px; }

/* plan limit pop-up (only when a limit is hit) + blocked buttons */
.plan-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1000;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 10px 14px;
  background: #1f2937; color: #fff; border-radius: 10px; font-size: .85rem; box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease-out;
}
.plan-toast.is-hiding { opacity: 0; transition: opacity .35s; }
.plan-toast-more { font: inherit; font-size: .78rem; font-weight: 700; color: #fde68a; background: none; border: 0; cursor: pointer; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
[data-blocked] { opacity: .45; cursor: not-allowed; }
.save-note { margin: 0; }
input.is-locked { cursor: not-allowed; }

/* settings: plan chip right under a locked field */
.field-plan-hint { display: block; margin-top: -2px; }
.field-plan-hint .upgrade-hint { margin-left: 0; }
.check-row .upgrade-hint { align-self: center; }

/* settings: plan chip inside a locked number box (right side) */
.input-chip { position: relative; }
.input-chip input { width: 100%; padding-right: 96px; }
.input-chip .upgrade-hint { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); margin: 0; }
