:root { --accent: #185a9d; --accent-dark: #123f6e; }
body { background: #f3f5f8; font-size: 14px; }
body.signed-out { background: linear-gradient(135deg, #123f6e, #185a9d 60%, #2a7bc4); min-height: 100vh; }
.cr-nav { background: var(--accent-dark); }
.cr-nav .navbar-brand { font-weight: 600; }
.brand-mark { display: inline-block; background: #fff; color: var(--accent-dark); font-weight: 800; border-radius: 6px; padding: 1px 6px; font-size: 13px; letter-spacing: .5px; }
.brand-mark.lg { font-size: 22px; padding: 6px 12px; border-radius: 10px; background: var(--accent); color: #fff; }
.cr-main { padding-top: 16px; padding-bottom: 32px; }
.cr-error { position: sticky; top: 8px; z-index: 50; }
.cr-busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; overflow: hidden; }
.cr-busy .bar { width: 35%; height: 100%; background: #ffc107; animation: slide 1s linear infinite; }
@keyframes slide { from { transform: translateX(-100%);} to { transform: translateX(300%);} }

.login-wrap { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 32px); }
.login-card { width: 380px; max-width: 95vw; border: 0; border-radius: 12px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; }
.section { color: #6c757d; font-weight: 700; letter-spacing: .5px; margin: 14px 0 8px; }
.kpis .kpi { background: #fff; border: 1px solid #e3e7ed; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; min-height: 96px; }
.kpi .t { font-size: 11px; font-weight: 700; color: #6c757d; letter-spacing: .5px; }
.kpi .v { font-size: 22px; font-weight: 700; color: #1e1e1e; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 13px; font-weight: 600; color: #6c757d; }
.kpi .d { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .h { font-size: 11px; color: #8a929b; }
.delta { font-weight: 600; }

.panel { background: #fff; border: 1px solid #e3e7ed; border-radius: 8px; overflow: hidden; }
.panel .ph { padding: 8px 12px; font-weight: 600; border-bottom: 1px solid #eef1f5; background: #fafbfc; }
.panel .ph small { font-weight: 400; }
.chart-wrap { position: relative; height: 280px; padding: 8px; }
.scroll-300 { max-height: 300px; overflow: auto; }
.scroll-400 { max-height: 400px; overflow: auto; }
.table-sm td, .table-sm th { padding: .3rem .5rem; vertical-align: middle; }
.table.clickable tbody tr { cursor: pointer; }
.table thead th { border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: #6c757d; white-space: nowrap; }
.table th.sortable { cursor: pointer; text-decoration: underline dotted; }
.filters { background: #fff; border: 1px solid #e3e7ed; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.filters label.small { margin-bottom: 2px; color: #6c757d; }
.kv td:first-child { color: #6c757d; }

@media print {
  .cr-nav, .no-print, .cr-busy { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; }
}

/* ---- phase 5 ---- */
.qr-box svg { width: 180px; height: 180px; }
.user-select-all { user-select: all; }
.print-sheet { background: #fff; border: 1px solid #e3e7ed; border-radius: 8px; padding: 24px 28px; max-width: 900px; margin: 0 auto; }
.print-lines th, .print-lines td { font-size: 13px; }
.print-lines td.check-box { text-align: center; font-size: 18px; line-height: 1; }
.sign-line { border-bottom: 1px solid #333; height: 36px; margin-bottom: 4px; }
.schedule-box label.small { margin-bottom: 0; }
body.print-mode .cr-main { padding-top: 8px; }
@media print {
  body.print-mode { background: #fff; }
  .print-sheet { border: 0; padding: 0; max-width: none; }
  .print-lines { page-break-inside: auto; }
  .print-lines tr { page-break-inside: avoid; }
  .badge { border: 1px solid #333; color: #000 !important; background: none !important; }
  a[href]:after { content: none !important; }
}
.cr-nav .nav-link { white-space: nowrap; }

/* ---- phase 6: grouped, collapsible navigation ---- */
.cr-nav .dropdown-menu { margin-top: 0; border-radius: 6px; }
.cr-nav .nav-item.active > .nav-link { font-weight: 600; }
.cr-nav .dropdown-item.active, .cr-nav .dropdown-item:active { background: var(--accent); color: #fff; }
@media (max-width: 991.98px) {
  .cr-nav .navbar-collapse { padding: 8px 0 12px; }
  .cr-nav .dropdown-menu { position: static; float: none; background: rgba(255,255,255,.06); border: 0; margin: 0 0 4px 8px; padding: 0 0 4px; }
  .cr-nav .dropdown-item { color: rgba(255,255,255,.85); padding: 6px 16px; }
  .cr-nav .dropdown-item:hover { background: rgba(255,255,255,.1); color: #fff; }
  .cr-nav .navbar-text { display: block; margin: 6px 0; }
}
.my-card { border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; padding: 18px 20px; position: relative; overflow: hidden; }
.my-card.inactive { background: linear-gradient(135deg, #6c757d, #343a40); }
.my-card .number { letter-spacing: 2px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; }
.my-card .bal { font-size: 2rem; font-weight: 600; line-height: 1; }
.my-card .tag { position: absolute; top: 12px; right: 14px; font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; opacity: .85; }
.tx-items { font-size: .85rem; color: #6c757d; }

/* ---- reports ---- */
.report-sheet { max-width: none; }
.rt { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rt th { border-bottom: 2px solid #333; padding: 4px 6px; white-space: nowrap; font-weight: 600; text-align: left; }
.rt td { padding: 2px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.rt .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rt tr.rt-group td { background: #f1f4f8; border-top: 1px solid #cfd6df; padding-top: 5px; }
.rt tr.rt-group.rt-l1 td { background: #f8f9fb; padding-left: 18px; }
.rt tr.rt-group.rt-l2 td { background: #fff; padding-left: 30px; font-style: italic; }
.rt tr.rt-total td { font-weight: 600; border-top: 1px solid #999; border-bottom: 2px solid #ddd; }
.rt tr.rt-total.rt-lg td { border-top: 2px solid #333; border-bottom: 3px double #333; font-size: 13.5px; }
.rt .rt-count { font-weight: 400; color: #6c757d; }
.rt td.rt-blank { border-bottom: 1px solid #555; min-width: 110px; }
@media print {
  .rt { font-size: 10.5px; }
  .rt thead { display: table-header-group; }      /* repeat column headings on every page */
  .rt tr { page-break-inside: avoid; }
  .rt tr.rt-group td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rt-wrap { overflow: visible !important; }
}

/* ---- web till ---- */
body.till-mode .cr-main { padding: 0; }
body.till-mode .cr-error { margin: 8px; }
.till-choose { max-width: 720px; margin: 24px auto; }
.till-choose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.till { display: flex; flex-direction: column; height: calc(100vh - 56px); background: #eef1f5; user-select: none; -webkit-user-select: none; }
.till input { user-select: text; -webkit-user-select: text; }
.till ng-container { display: contents; }
.till-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 12px; background: var(--accent); color: #fff; }
.till-top .text-muted { color: rgba(255,255,255,.65) !important; }
.till-ord { flex: 1; min-width: 160px; }
.till-topbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.till-body { flex: 1; display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 10px; padding: 10px; min-height: 0; }
.till-order { display: flex; flex-direction: column; background: #fff; border: 1px solid #e3e7ed; border-radius: 8px; min-height: 0; overflow: hidden; }
.till-lines { flex: 1; overflow-y: auto; min-height: 80px; }
.till-empty { padding: 24px 16px; text-align: center; }
.till-line { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.till-line .q { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.till-line .a { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.till-line.mod { padding-top: 3px; padding-bottom: 3px; font-size: 13px; color: #555; }
.till-line.mod .d { padding-left: 12px; }
.till-line.sent { background: #f6fbf6; }
.till-line.sel { background: #dbe9f8; }
.till-totals { border-top: 1px solid #e3e7ed; padding: 6px 12px; font-variant-numeric: tabular-nums; }
.till-totals > div { display: flex; justify-content: space-between; font-size: 13px; }
.till-totals .due { font-size: 22px; font-weight: 700; margin-top: 2px; }
.till-pad { border-top: 1px solid #e3e7ed; padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.till-pad-display { grid-column: 1 / -1; display: flex; align-items: center; background: #f4f6f9; border-radius: 6px; padding: 4px 10px; font-size: 20px; font-variant-numeric: tabular-nums; min-height: 38px; }
.till-pad-grid, .till-pad-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.till-pad-tools { grid-template-columns: repeat(2, 1fr); }
.till-pad button, .till-dialog .till-pad-grid button { border: 1px solid #d6dce4; background: #fff; border-radius: 6px; min-height: 40px; font-size: 16px; }
.till-pad-tools button { font-size: 13px; }
.till-pad button:active, .till-grid button:active, .till-tenders button:active, .till-cash button:active { filter: brightness(.9); }
.till-pad button:disabled { opacity: .4; }
.till-actions { display: flex; gap: 6px; padding: 6px; border-top: 1px solid #e3e7ed; flex-wrap: wrap; }
.till-actions .btn { flex: 1; min-height: 48px; }
.till-actions .till-pay { flex: 2; font-size: 18px; font-weight: 600; }
.till-side { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.till-scan { display: flex; gap: 6px; margin-bottom: 8px; }
.till-scan .form-control { height: 44px; font-size: 16px; }
.till-menubar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.till-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.till-grid button { min-height: 70px; border: 1px solid rgba(0,0,0,.12); border-radius: 8px; background: #fff; font-weight: 600; font-size: 14px; padding: 4px; word-break: break-word; line-height: 1.15; }
.till-grid button.blank { background: transparent; border: 1px dashed #d6dce4; }
.till-grid button.go { background: #46505e; color: #fff; }
.till-grid button.mod { background: #2f3640; color: #fff; }
.till-grid.tables button { min-height: 80px; background: #fff; }
.till-grid.tables button.busy { background: #fde9c8; }
.till-grid.tables button.mine { background: #cfe8d5; }
.till-grid.tables button.old { box-shadow: inset 0 0 0 3px #dc3545; }
.till-grid.opts { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.till-result { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f0f2f5; cursor: pointer; background: #fff; }
.till-result:hover { background: #f4f8fc; }
.till-results { margin-bottom: 8px; max-height: 60vh; overflow-y: auto; }
.till-notices { position: fixed; right: 12px; bottom: 12px; z-index: 1060; width: min(420px, calc(100vw - 24px)); }
.till-notices .alert { cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.till-modal { position: fixed; inset: 0; background: rgba(20,30,45,.45); z-index: 1050; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.till-dialog { background: #fff; border-radius: 10px; width: 100%; max-width: 520px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.till-dialog.wide { max-width: 900px; }
.till-dialog .ph { padding: 10px 14px; font-weight: 600; border-bottom: 1px solid #eef1f5; background: #fafbfc; }
.till-due { display: flex; gap: 16px; align-items: baseline; font-size: 16px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.till-due b { margin-left: auto; font-size: 24px; }
.till-tenders, .till-cash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.till-tenders button, .till-cash button { min-height: 46px; border: 1px solid #d6dce4; background: #fff; border-radius: 6px; font-weight: 600; }
.till-tenders button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.till-cash button { background: #f2f8ef; }
.till-dialog .till-pad-grid { margin-top: 6px; }
.till-holder { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid #e3e7ed; border-radius: 8px; }
.till-holder img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.till-change { font-size: 18px; }
.till-change b { display: block; font-size: 48px; font-variant-numeric: tabular-nums; }
.till-count { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
.till-count label { margin-bottom: 0; }
@media (max-width: 800px) {
  .till { height: auto; min-height: calc(100vh - 56px); }
  .till-body { grid-template-columns: 1fr; }
  .till-grid { grid-template-columns: repeat(4, 1fr); }
  .till-lines { max-height: 40vh; }
}

/* ---- register set-up ---- */
.setup-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.setup-tabs .nav-link { white-space: nowrap; }
.setup-table td { vertical-align: middle; }
.setup-table tr.setup-edit td { background: #f4f8fc; }
.setup-table .form-control-sm { min-width: 80px; }
.setup-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.setup-checks label { margin: 0; }
.cr-swatch { display: inline-block; width: 22px; height: 16px; border: 1px solid rgba(0,0,0,.2); border-radius: 3px; vertical-align: middle; }
.cr-color { width: 44px; height: 28px; padding: 0 2px; border: 1px solid #d6dce4; border-radius: 4px; background: #fff; }
