/* Shared table tools, notifications, charts, calendar and client sub-pages. Loaded after style.css. */
.table-tools { margin-bottom: 24px; }
.table-tools-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.table-tools-bar .table-search { flex: 1 1 220px; max-width: 340px; padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; }
.table-count { margin-right: auto; font-size: 0.85rem; }
.print-title { display: none; }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-alt) 45%, var(--surface)); }
.data-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table th.sortable::after { content: ' \2195'; opacity: 0.35; }
.data-table th[data-sort="asc"]::after { content: ' \25B2'; opacity: 1; }
.data-table th[data-sort="desc"]::after { content: ' \25BC'; opacity: 1; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tfoot td { font-weight: 700; background: var(--surface-alt); }

.notification-scroll { max-height: 60vh; overflow-y: auto; padding-right: 6px; }
.notification-panel { max-height: 70vh; overflow-y: auto; }
.notification-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.notification-toolbar input, .notification-toolbar select { padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; }
.notification-toolbar input { flex: 1 1 220px; }
.notification-item.read { opacity: 0.8; }

.bell-link { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--secondary); text-decoration: none; }
.bell-link:hover { border-color: var(--primary); }
.bell-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center; }
.bell-badge[hidden] { display: none; }

.client-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.client-subnav a { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 999px; color: var(--secondary); text-decoration: none; background: var(--surface); }
.client-subnav a[aria-current="page"] { background: var(--primary); color: var(--button-text); border-color: var(--primary); }
.client-header-actions { display: flex; gap: 10px; align-items: center; }
.client-page-stack { display: grid; gap: 24px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; box-shadow: var(--shadow); }
.summary-card span { display: block; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.summary-card strong { display: block; margin-top: 0.3rem; font-size: 1.4rem; }
.summary-card.due strong { color: var(--danger); }
.summary-card.paid strong { color: var(--success); }
.status-badge.paid { background: var(--success-soft); color: var(--success); }
.status-badge.unpaid, .status-badge.overdue { background: var(--danger-soft); color: var(--danger); }
.status-badge.cancelled { background: var(--surface-alt); color: var(--muted); }

.chart-grid-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 24px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; box-shadow: var(--shadow); min-width: 0; }
.chart-card h3, .chart-card h4 { margin: 0 0 0.75rem; font-size: 1rem; }
.chart-scroll { overflow-x: auto; }
.chart-scroll svg { max-width: none; height: auto; }
.chart-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.chart-donut svg { width: 150px; height: 150px; flex: none; }
.chart-center-value { font-size: 16px; font-weight: 700; fill: var(--secondary); }
.chart-center-label { font-size: 8px; fill: var(--muted); }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { font-size: 9px; fill: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.85rem; }
.chart-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

.calendar-layout { display: grid; grid-template-columns: minmax(280px, 1.2fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.calendar-header { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-weekday { text-align: center; font-size: 0.75rem; color: var(--muted); }
.calendar-cell { position: relative; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; cursor: pointer; }
.calendar-cell.empty { border: 0; background: none; cursor: default; }
.calendar-cell.today { border-color: var(--primary); font-weight: 700; }
.calendar-cell.selected { background: var(--primary); color: var(--button-text); }
.calendar-dot { position: absolute; bottom: 5px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--accent); }
.reminder-alert { margin-top: 10px; padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--warning-soft); color: var(--warning); }
.reminder-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.reminder-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.reminder-list li.done label { text-decoration: line-through; opacity: 0.6; }
.reminder-list small { color: var(--muted); }

@media (max-width: 900px) { .calendar-layout { grid-template-columns: 1fr; } }

@media print {
    body.printing-target * { visibility: hidden; }
    body.printing-target .print-target, body.printing-target .print-target * { visibility: visible; }
    body.printing-target .print-target { position: absolute; left: 0; top: 0; width: 100%; color: #000; background: #fff; }
    .print-target .table-tools-bar, .print-target .print-hide { display: none !important; }
    .print-target .print-title { display: block; margin: 0 0 12px; }
    .print-target .print-title small { font-weight: 400; font-size: 0.7em; color: #555; }
    .print-target .data-table { box-shadow: none; }
    .print-target .data-table th::after { content: none; }
    .print-target tr[hidden] { display: none !important; }
}

/* ------------------------------------------------------------------ Staff sign-in page */
/* Authentication lives on its own page (staff-login.html); the dashboards never render a form. */
.staff-auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 42%),
        radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 46%),
        var(--page);
}

.staff-auth-shell {
    width: min(460px, 100%);
}

.staff-auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: clamp(1.5rem, 4vw, 2.25rem);
    box-shadow: var(--shadow);
}

.staff-auth-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.staff-auth-brand h1 {
    margin: 0.15rem 0 0;
    font-size: clamp(1.35rem, 4vw, 1.6rem);
    line-height: 1.2;
}

.staff-auth-brand .section-kicker {
    margin: 0;
}

.staff-auth-intro {
    margin: 1rem 0 1.25rem;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.55;
}

.staff-auth-card .auth-mode-switch {
    margin-bottom: 1rem;
}

.staff-auth-card .form-card {
    border: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

.staff-auth-card .form-card[hidden],
.staff-auth-card .auth-mode-switch[hidden] {
    display: none !important;
}

.staff-auth-card .form-card h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.staff-auth-card .login-error {
    /* Only reserve space once there is a message, so an empty form has no phantom gap. */
    min-height: 0;
    margin: 0.25rem 0 0;
}

.staff-auth-card .login-error:not(:empty) {
    margin-bottom: 0.75rem;
}

.staff-auth-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

.staff-auth-footer a {
    color: var(--primary);
    text-decoration: none;
}

.staff-auth-footer a:hover,
.staff-auth-footer a:focus-visible {
    text-decoration: underline;
}

/* ------------------------------------------------------------------ Buy Goods (Till) */
.till-status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.till-status-filter .btn-secondary {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.till-status-filter .btn-secondary.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--button-text);
}

.till-dialog {
    width: min(520px, calc(100% - 2rem));
}

.till-steps {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.6;
}

.till-steps strong {
    color: var(--secondary);
}

.till-amount-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
}

.till-amount-card strong {
    font-size: 1.2rem;
    color: var(--primary);
}

#till-mpesa-code {
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-weight: 600;
}

.till-confirmation {
    text-align: center;
}

.till-confirmation-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 1.4rem;
}

.till-confirmation h2 {
    margin-bottom: 0.5rem;
}

.till-confirmation p {
    color: var(--muted);
    line-height: 1.6;
}

.status-badge.pending {
    background: var(--warning-soft);
    color: var(--warning);
}

table code {
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: var(--surface-alt);
    font-family: "Consolas", "SFMono-Regular", monospace;
    letter-spacing: 0.08em;
}

/* ------------------------------------------------------------------ Public Till checkout */
.till-page {
    padding: clamp(2rem, 6vw, 4rem) 0;
    background: var(--page);
}

.till-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: start;
}

.till-page-grid > .card {
    /* Cards size to their own content; the shorter column should not stretch to match. */
    align-self: start;
}

.till-instructions-card h1 {
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    line-height: 1.25;
    margin: 0.75rem 0 0.5rem;
}

.till-number-card {
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.till-number-card .till-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.till-number-card strong {
    display: block;
    font-size: clamp(1.5rem, 4vw, 2rem);
    letter-spacing: 0.08em;
    line-height: 1.2;
}

.till-legal {
    font-size: 0.8rem;
    line-height: 1.55;
    margin-top: 0.9rem;
}

@media (max-width: 860px) {
    .till-page-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
/* ------------------------------------------------------------------ chatbot: answers + chips */
/* Added with the intent-based chatbot. Kept here so the widget follows the theme tokens. */

.chat-answer-link {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary) !important;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 160ms var(--ease),
    color 160ms var(--ease);
}

.chat-answer-link:hover,
.chat-answer-link:focus-visible {
  background: var(--primary);
  color: var(--button-text) !important;
}

/* Quick-start suggestions shown above the input. */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem 0;
}

.chat-suggestions button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--secondary);
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition:
    border-color 160ms var(--ease),
    background-color 160ms var(--ease),
    transform 160ms var(--ease);
}

.chat-suggestions button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* Typing indicator shown while the answer is composed. */
.chat-message.is-typing {
  letter-spacing: 0.2em;
  opacity: 0.75;
  animation: omn-typing 900ms ease-in-out infinite;
}

@keyframes omn-typing {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-message.is-typing {
    animation: none;
  }
  .chat-suggestions button:hover {
    transform: none;
  }
}
/* ------------------------------------------------------------------ M-Pesa Express prompt */
/* The "prompt my phone" option inside the Bill payment dialog. */

.till-prompt-panel {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 0.9rem 1rem 1rem;
  margin: 0 0 1rem;
}

.till-prompt-panel[hidden] {
  display: none !important;
}

.till-prompt-panel legend {
  padding: 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--success);
}

.till-prompt-panel p {
  margin: 0 0 0.75rem;
  font-size: 0.86rem;
  line-height: 1.55;
}

.till-prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .till-prompt-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.till-prompt-panel .response-message {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.84rem;
}

.till-prompt-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.till-prompt-divider::before,
.till-prompt-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.till-prompt-divider[hidden] {
  display: none !important;
}
