:root {
    --bg: #f5f8f2;
    --panel: #ffffff;
    --ink: #102015;
    --muted: #647062;
    --line: #dfe8d7;
    --marvin-dark: #102015;
    --marvin-green: #94c83d;
    --marvin-green-dark: #5f8f22;
    --marvin-soft: #eef8df;
    --primary: var(--marvin-green);
    --primary-dark: var(--marvin-dark);
    --primary-soft: var(--marvin-soft);
    --sidebar: #08120b;
    --sidebar-2: #102015;
    --danger: #b42318;
    --success: #4f8f22;
    --shadow: 0 18px 45px rgba(16, 32, 21, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    font-family: ui-sans-serif, Inter, "SF Pro Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    color: #fff;
    padding: 20px 16px;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,.08);
}
.brand {
    display: grid;
    gap: 10px;
    margin-bottom: 22px;
    padding: 6px 6px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
    width: 168px;
    max-width: 100%;
    height: auto;
    background: rgba(255, 255, 255, .96);
    border-radius: 8px;
    padding: 8px 12px;
}
.brand span {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.sidebar nav { display: grid; gap: 6px; }
.nav-link, .nav-group summary {
    color: #eef8df;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-link:hover, .nav-group summary:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.nav-link.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: 0 10px 28px rgba(16, 32, 21, .24);
}
.nav-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 7px;
    display: inline-grid;
    place-items: center;
    background: rgba(255,255,255,.1);
    color: var(--marvin-green);
    font-size: 14px;
    line-height: 1;
}
.nav-link.active .nav-icon {
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.nav-group summary::after {
    content: "›";
    margin-left: auto;
    color: rgba(238, 248, 223, .7);
    font-size: 20px;
    line-height: 1;
    transition: transform .16s ease;
}
.nav-group[open] summary::after {
    transform: rotate(90deg);
}
.nav-group[open] summary {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.nav-group[open] {
    background: rgba(255,255,255,.035);
    border-radius: 8px;
    padding-bottom: 6px;
}
.nav-group[open] .nav-link {
    margin: 4px 6px 0 42px;
    min-height: 36px;
    padding: 8px 10px;
    color: #dfe8d7;
    font-size: 13px;
    font-weight: 700;
}
.nav-group[open] .nav-link.active {
    color: var(--primary-dark);
}
.content {
    margin-left: 280px;
    padding: 28px;
    min-height: 100vh;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    background: rgba(255,255,255,.74);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .04);
    backdrop-filter: blur(12px);
}
.topbar h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 850;
}
.topbar form { display: flex; gap: 12px; align-items: center; }
.sidebar-toggle {
    display: none;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 20px;
}
.immersive-mode {
    overflow: hidden;
    background: #07100a;
}
.immersive-content {
    min-height: 100vh;
}
.panel, .login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
h2 { margin: 0 0 12px; font-size: 17px; line-height: 1.25; font-weight: 850; }
.btn, button {
    border: 0;
    background: var(--primary);
    color: var(--marvin-dark);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    box-shadow: 0 10px 24px rgba(148, 200, 61, .22);
}
.btn:hover, button:hover {
    background: var(--primary-dark);
    color: #fff;
}
.btn.secondary {
    background: #f7faf3;
    color: var(--ink);
    box-shadow: none;
    border: 1px solid var(--line);
}
.btn.secondary:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert.success { color: var(--success); background: #ecfdf3; border-color: #abefc6; }
.alert.danger { color: var(--danger); background: #fef3f2; border-color: #fecdca; }
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stats article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.stats span { color: var(--muted); display: block; margin-bottom: 8px; }
.stats strong { font-size: 26px; letter-spacing: 0; }
.table-wrap { overflow-x: auto; }
.list-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}
.list-filter-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 10px;
    grid-column: 1 / -1;
}
.table-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
[data-ajax-target] {
    transition: opacity .18s ease;
}
[data-ajax-target].is-loading {
    opacity: .55;
}
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th {
    font-size: 12px;
    color: var(--muted);
    background: #f8fafc;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions button {
    background: transparent;
    color: var(--danger);
    padding: 0;
}
.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}
.status-paid { background: #ecfdf3; color: #067647; }
.status-partial { background: #fff4e5; color: #b54708; }
.status-unpaid { background: var(--primary-soft); color: var(--primary-dark); }
.status-overdue { background: #fef3f2; color: #b42318; }
.money-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.money-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}
.money-grid span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}
.money-grid strong { font-size: 20px; }
.dashboard-filter {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) repeat(2, minmax(160px, .8fr)) auto;
    align-items: end;
    gap: 12px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.compact-list {
    display: grid;
    gap: 10px;
}
.compact-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}
.compact-row:first-child {
    border-top: 0;
    padding-top: 0;
}
.compact-row span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}
.compact-row .right {
    text-align: right;
    min-width: 130px;
}
.mini-list {
    display: grid;
    gap: 6px;
    min-width: 260px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}
.mini-list div {
    display: grid;
    grid-template-columns: 72px minmax(120px, 1fr) auto;
    gap: 8px;
    align-items: start;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}
.mini-list div:first-child {
    border-top: 0;
    padding-top: 0;
}
.mini-list strong,
.mini-list span {
    color: var(--ink);
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.avatar.large {
    width: 84px;
    height: 84px;
    font-size: 28px;
}
.identity-head {
    display: flex;
    align-items: center;
    gap: 14px;
}
.photo-preview {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}
.photo-preview img {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
}
.empty { text-align: center; color: var(--muted); padding: 28px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-grid.one { grid-template-columns: 1fr; }
label { display: grid; gap: 7px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
.full { grid-column: 1 / -1; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.check input { width: auto; }
.autocomplete-field {
    position: relative;
    display: block;
}
.autocomplete-input-wrap {
    position: relative;
    display: block;
}
.autocomplete-input-wrap input {
    padding-right: 42px;
}
.autocomplete-x {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--muted);
    box-shadow: none;
    font-size: 20px;
    line-height: 1;
}
.autocomplete-x:hover {
    background: #e2e8f0;
    color: var(--ink);
}
.autocomplete-results {
    position: absolute;
    z-index: 20;
    inset: calc(100% + 4px) 0 auto;
    display: grid;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}
.autocomplete-option {
    width: 100%;
    display: grid;
    justify-content: stretch;
    gap: 2px;
    min-height: auto;
    padding: 10px;
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    box-shadow: none;
    text-align: left;
}
.autocomplete-option:hover {
    background: #f8fafc;
}
.autocomplete-option span,
.autocomplete-empty {
    color: var(--muted);
    font-size: 13px;
}
.autocomplete-empty {
    padding: 10px;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.import-strip {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    gap: 12px;
}
.import-strip p {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 13px;
}
.detail-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px 16px;
}
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 700; }
.permission-box, .checkbox-grid {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}
fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 12px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}
.login-card { width: min(420px, 100%); }
.login-card h1 { margin: 0 0 8px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.login-logo {
    width: 190px;
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 14px;
}
.setting-logo-preview {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.setting-logo-preview img {
    max-width: 180px;
    max-height: 72px;
    object-fit: contain;
}
.honor-receipt {
    width: min(920px, 100%);
    margin: 0 auto 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 26px;
    box-shadow: var(--shadow);
}
.receipt-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--ink);
}
.receipt-head span,
.receipt-grid span,
.receipt-note span,
.signature-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.receipt-head h2 {
    margin: 5px 0 0;
    font-size: 28px;
}
.receipt-stamp {
    border: 2px solid var(--success);
    color: var(--success);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .08em;
}
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.receipt-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}
.receipt-grid strong,
.receipt-grid small {
    display: block;
}
.receipt-table tfoot th {
    background: var(--primary-soft);
    color: var(--ink);
    font-size: 13px;
}
.receipt-note {
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.receipt-note p {
    margin: 6px 0 0;
}
.signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 40px;
    margin-top: 42px;
}
.signature-grid div {
    min-height: 112px;
    display: grid;
    align-content: end;
    text-align: center;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}
.color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid var(--line);
}
.pos-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}
.pos-products,
.pos-cart {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
}
.pos-cart {
    position: sticky;
    top: 18px;
}
.pos-toolbar {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.pos-toolbar p {
    margin: 4px 0 0;
}
.pos-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.category-filter {
    background: #f8fafc;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
    white-space: nowrap;
}
.category-filter.active {
    background: var(--cat-color, var(--primary));
    color: #fff;
    border-color: transparent;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.product-tile {
    min-height: 190px;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 10px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
    text-align: left;
}
.product-tile:hover {
    background: #f8fafc;
}
.product-tile img,
.product-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    background: var(--primary-soft);
    display: grid;
    place-items: center;
    color: var(--primary-dark);
    font-size: 36px;
    font-weight: 900;
}
.product-tile strong {
    line-height: 1.2;
}
.product-tile span {
    color: var(--primary-dark);
    font-weight: 850;
}
.product-tile small {
    color: var(--muted);
}
.pos-cart form {
    display: grid;
    gap: 12px;
}
.cart-items {
    display: grid;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}
.cart-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #f8fafc;
}
.cart-row span {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}
.qty-tools {
    display: grid;
    grid-template-columns: 34px 28px 34px;
    gap: 5px;
    align-items: center;
    text-align: center;
}
.qty-tools button {
    min-height: 34px;
    padding: 0;
}
.cart-total {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}
.cart-total span,
.cart-total small {
    display: block;
    color: var(--muted);
}
.cart-total strong {
    display: block;
    margin: 4px 0;
    font-size: 28px;
}
.pos-pay {
    min-height: 56px;
    font-size: 18px;
}
.receipt-mini {
    width: min(340px, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
    color: #111827;
}
.receipt-mini h2,
.receipt-mini p {
    text-align: center;
    margin: 0 0 6px;
}
.receipt-mini hr {
    border: 0;
    border-top: 1px dashed #94a3b8;
    margin: 12px 0;
}
.receipt-mini-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.receipt-mini-row span {
    white-space: nowrap;
}
.receipt-mini-row div span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}
.receipt-mini-row.total {
    font-size: 18px;
}
.receipt-mini .center {
    text-align: center;
}
.commerce-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}
.commerce-shell > .panel:nth-child(1),
.commerce-shell > .panel:nth-child(2) {
    grid-column: 1;
}
.commerce-summary {
    position: sticky;
    top: 18px;
    grid-column: 2;
    grid-row: 1 / span 2;
    display: grid;
    gap: 10px;
}
.commerce-summary span,
.commerce-summary p {
    color: var(--muted);
    margin: 0;
}
.commerce-summary strong {
    font-size: 28px;
}
.commerce-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
}
.catalog-search {
    margin-bottom: 14px;
}
.catalog-search input {
    min-height: 46px;
    font-size: 15px;
}
.commerce-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}
.commerce-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 10px;
}
.commerce-card img,
.commerce-card .product-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    object-fit: cover;
}
.commerce-card div span,
.commerce-card p,
.commerce-price small {
    color: var(--muted);
}
.commerce-card p {
    margin: 0;
    min-height: 42px;
}
.commerce-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.commerce-price strong {
    color: var(--primary-dark);
}
.muted { color: var(--muted); }
.card-list {
    display: grid;
    gap: 10px;
}
.card-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}
.card-row .identity-head {
    min-width: 0;
    text-align: left;
}
.card-row .identity-head > div {
    min-width: 0;
}
.card-row strong {
    display: block;
    text-align: left;
}
.card-row span {
    display: block;
    color: var(--muted);
    margin-top: 3px;
    text-align: left;
}
.card-check {
    justify-content: center;
    padding: 0;
}
.id-card-print {
    display: grid;
    place-items: center;
    padding: 16px;
}
.batch-card-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(324px, 324px));
    justify-content: center;
    gap: 20px;
    padding: 16px;
}
.batch-card-item {
    display: grid;
    place-items: center;
    break-inside: avoid;
    page-break-inside: avoid;
}
.id-card {
    width: 324px;
    height: 204px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8faf9;
    border: 1px solid #d0d5dd;
    box-shadow: 0 18px 45px rgba(16, 24, 40, .16);
    display: block;
    color: var(--ink);
    position: relative;
}
.id-card, .id-card * {
    box-sizing: border-box;
}
.id-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 74px;
    background: var(--card-primary, var(--marvin-green));
    border-bottom-left-radius: 62% 24%;
    border-bottom-right-radius: 62% 24%;
}
.id-card::after {
    content: "";
    position: absolute;
    left: -28px;
    right: -28px;
    top: 52px;
    height: 38px;
    background: var(--card-accent, #1f2524);
    border-bottom-left-radius: 58% 100%;
    border-bottom-right-radius: 58% 100%;
}
.id-card-top {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: start;
    padding: 14px 0 0 20px;
}
.id-card-logo {
    display: block;
    width: 112px;
    height: auto;
    max-height: 24px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
.id-card-photo-wrap {
    position: absolute;
    left: 22px;
    top: 70px;
    z-index: 3;
    display: grid;
    place-items: center;
    margin-top: 0;
}
.id-card-photo, .id-card-initial {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    background: #e6f4f1;
    color: var(--primary-dark);
    display: grid;
    place-items: center;
    font-size: 32px;
    font-weight: 800;
    border: 4px solid var(--card-primary, var(--marvin-green));
}
.id-card-body {
    position: absolute;
    left: 122px;
    right: 86px;
    top: 92px;
    z-index: 3;
    display: grid;
    place-items: start;
    padding: 0;
    text-align: left;
}
.id-card-body h2 {
    margin: 0;
    max-width: 116px;
    font-size: 16px;
    line-height: 1.08;
    color: #111827;
}
.id-card-body p {
    margin: 5px 0 5px;
    color: var(--card-primary, var(--marvin-green));
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .03em;
}
.id-card-body strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 116px;
    margin-bottom: 0;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--card-primary, var(--marvin-green));
    color: #fff;
    font-size: 10px;
    letter-spacing: .02em;
}
.qr-code {
    position: absolute;
    left: auto;
    right: 18px;
    bottom: 26px;
    transform: none;
    width: 66px;
    height: 66px;
    padding: 2px;
    background: #fff;
    border: 0;
}
.id-card-branch {
    position: absolute;
    left: auto;
    right: 18px;
    bottom: 8px;
    transform: none;
    z-index: 4;
    color: var(--muted);
    font-size: 8px;
    white-space: nowrap;
}
.public-card-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    padding: 18px;
}
.public-card {
    width: min(360px, calc(100vw - 28px));
    aspect-ratio: 5 / 9;
    min-height: 560px;
    background: #f8faf9;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    position: relative;
    text-align: center;
    box-shadow: 0 18px 45px rgba(16, 24, 40, .12);
}
.public-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 38%;
    background: var(--card-primary, var(--marvin-green));
    border-bottom-left-radius: 62% 24%;
    border-bottom-right-radius: 62% 24%;
}
.public-card::after {
    content: "";
    position: absolute;
    left: -10%;
    right: -10%;
    top: 27%;
    height: 14%;
    background: var(--card-accent, #1f2524);
    border-bottom-left-radius: 58% 100%;
    border-bottom-right-radius: 58% 100%;
}
.public-card-top {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    padding-top: 26px;
}
.public-card-logo {
    display: block;
    width: 178px;
    height: auto;
    max-height: 34px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
.public-card-person {
    position: relative;
    z-index: 3;
    margin-top: 18px;
}
.public-card-photo, .public-card-initial {
    width: 166px;
    height: 166px;
    border-radius: 50%;
    object-fit: cover;
    margin: 36px auto 22px;
    background: #e6f4f1;
    color: var(--primary-dark);
    display: grid;
    place-items: center;
    font-size: 48px;
    font-weight: 800;
    border: 8px solid var(--card-primary, var(--marvin-green));
}
.public-card h1 {
    margin: 0 22px 6px;
    color: #111827;
    font-size: 28px;
    line-height: 1.08;
}
.public-card p {
    margin: 0 0 10px;
    color: var(--card-primary, var(--marvin-green));
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .02em;
}
.public-card-person strong {
    display: inline-flex;
    justify-content: center;
    min-width: 248px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--card-primary, var(--marvin-green));
    color: #fff;
    font-size: 18px;
    letter-spacing: .02em;
}
.public-card-qr {
    position: relative;
    z-index: 3;
    width: 118px;
    height: 118px;
    margin-top: 26px;
}
.public-card-details-panel {
    width: min(360px, calc(100vw - 28px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}
.public-card-action {
    width: 100%;
    margin-bottom: 12px;
}
.public-card-details {
    display: grid;
    gap: 7px;
    text-align: left;
}
.public-card-details div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 7px;
    font-size: 12px;
}
.public-card-details span {
    color: var(--muted);
}
.public-card-details strong {
    text-align: right;
    overflow-wrap: anywhere;
}
.message-preview {
    max-width: 360px;
    white-space: pre-line;
    color: var(--muted);
    font-size: 13px;
}

.portal-body {
    background: #eef6f3;
    color: var(--ink);
}
.portal-shell {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 18px 14px 86px;
}
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}
.portal-header h1 {
    margin: 4px 0 0;
    font-size: 24px;
}
.portal-header span, .portal-card span, .portal-list-item span {
    color: var(--muted);
    font-size: 13px;
}
.student-switcher {
    display: block;
    margin: 0 -14px 14px;
    padding: 0 14px 4px;
}
.student-switcher select {
    background: #fff;
    font-weight: 800;
}
.student-switcher a {
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
}
.student-switcher a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.portal-nav {
    position: fixed;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 24px));
    display: grid;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 14px 36px rgba(16, 24, 40, .16);
    z-index: 10;
}
.portal-nav.student-nav {
    grid-template-columns: repeat(7, 1fr);
}
.portal-nav.tutor-nav {
    grid-template-columns: repeat(3, 1fr);
}
.portal-nav a {
    min-height: 44px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    border-radius: 8px;
}
.portal-nav a.active {
    background: #e6f4f1;
    color: var(--primary-dark);
}
.portal-card, .identity-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 14px;
}
.identity-card {
    display: flex;
    align-items: center;
    gap: 14px;
}
.identity-card h2, .portal-card h2 {
    margin: 0 0 4px;
    font-size: 18px;
}
.portal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.portal-metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}
.portal-metric strong {
    display: block;
    margin-top: 8px;
    font-size: 18px;
}
.portal-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 10px;
}
.portal-section-head h2 {
    margin: 0;
}
.portal-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 12px 0;
}
.portal-list-item:first-child {
    border-top: 0;
    padding-top: 0;
}
.portal-link-item {
    color: var(--ink);
}
.portal-link-item:hover {
    color: var(--primary-dark);
}
.portal-right {
    text-align: right;
    min-width: 110px;
}
.portal-money-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.portal-money-row div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.compact {
    margin: 0;
}
.student-evaluation-list {
    display: grid;
    gap: 12px;
}
.student-evaluation-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
    display: grid;
    gap: 10px;
}
.progress-card .portal-section-head {
    align-items: flex-start;
}
.progress-note {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
}
.progress-note span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 4px;
}
.progress-note p {
    margin: 0;
    white-space: pre-line;
}
.cbt-take-form {
    display: grid;
    gap: 12px;
}
.cbt-question-card {
    scroll-margin-top: 16px;
}
.cbt-question-text {
    white-space: pre-line;
    line-height: 1.55;
}
.cbt-options {
    display: grid;
    gap: 10px;
}
.cbt-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
    font-weight: 700;
}
.cbt-option input {
    width: auto;
    margin-top: 3px;
}

.scan-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 2fr) auto;
    align-items: end;
    gap: 14px;
}
.scan-input input {
    min-height: 52px;
    font-size: 18px;
    font-weight: 800;
}
.scan-result-grid {
    display: grid;
    grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.scan-student-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 18px;
    display: grid;
    gap: 14px;
}
.scan-student-card h2 {
    margin-bottom: 6px;
}
.scan-student-card p {
    margin: 4px 0;
}
.tablet-attendance {
    height: 100dvh;
    margin: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, .56fr);
    gap: 14px;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 10%, rgba(148, 200, 61, .22), transparent 28%),
        linear-gradient(135deg, #07100a 0%, #102015 52%, #182b18 100%);
    color: #fff;
}
.tablet-scan-stage,
.tablet-result-panel {
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
    backdrop-filter: blur(18px);
}
.tablet-scan-stage {
    min-height: 0;
    padding: 14px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
}
.tablet-floating-actions {
    display: grid;
    grid-template-columns: max-content minmax(220px, 1fr) auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(16, 32, 21, .52);
    color: rgba(255, 255, 255, .82);
    font-weight: 800;
}
.scan-waiting p,
.tablet-result p {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, .74);
}
.tablet-session-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, .82);
}
.tablet-session-picker select,
.tablet-manual-scan input {
    border-color: rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .94);
    color: var(--marvin-dark);
}
.tablet-session-picker select {
    min-height: 42px;
    padding: 8px 10px;
}
.camera-frame {
    position: relative;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border: 1px solid rgba(148, 200, 61, .45);
    border-radius: 8px;
    background: #050806;
}
.camera-frame video {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    display: block;
}
.scanner-reticle {
    position: absolute;
    inset: 17% 22%;
    border: 2px solid rgba(148, 200, 61, .9);
    border-radius: 8px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .28), 0 0 34px rgba(148, 200, 61, .24);
}
.scanner-line {
    position: absolute;
    left: 24%;
    right: 24%;
    top: 22%;
    height: 3px;
    background: var(--marvin-green);
    box-shadow: 0 0 20px rgba(148, 200, 61, .9);
    animation: scan-line 2.2s ease-in-out infinite;
}
.camera-status {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(16, 32, 21, .82);
    color: #fff;
    font-weight: 800;
}
.tablet-manual-scan {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}
.tablet-result-panel {
    min-height: 0;
    padding: 18px;
    display: grid;
    align-content: center;
    height: 100%;
}
.scan-waiting {
    text-align: center;
    display: grid;
    justify-items: center;
    gap: 12px;
}
.pulse-dot {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: var(--marvin-green);
    box-shadow: 0 0 0 0 rgba(148, 200, 61, .52);
    animation: pulse-scan 1.7s infinite;
}
.tablet-result {
    display: grid;
    gap: 18px;
    justify-items: center;
    text-align: center;
}
.tablet-result-photo {
    width: 148px;
    height: 148px;
    border-radius: 50%;
    border: 6px solid var(--marvin-green);
    overflow: hidden;
    background: #fff;
    color: var(--marvin-dark);
    display: grid;
    place-items: center;
    font-size: 48px;
    font-weight: 900;
}
.tablet-result-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tablet-result small {
    color: var(--marvin-green);
    font-weight: 900;
    letter-spacing: .08em;
}
.tablet-result h2 {
    margin: 4px 0 0;
    font-size: 30px;
    color: #fff;
}
.tablet-result.danger small {
    color: #fda29b;
}
.tablet-result-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.tablet-result-grid div {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, .08);
    text-align: left;
}
.tablet-result-grid span {
    display: block;
    color: rgba(255, 255, 255, .64);
    font-size: 12px;
    font-weight: 800;
}
.tablet-result-grid strong {
    display: block;
    margin-top: 4px;
    color: #fff;
}
.tablet-result-message {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(148, 200, 61, .14);
    color: #fff;
    font-weight: 800;
}
@keyframes scan-line {
    0%, 100% { transform: translateY(0); opacity: .55; }
    50% { transform: translateY(34vh); opacity: 1; }
}
@keyframes pulse-scan {
    0% { box-shadow: 0 0 0 0 rgba(148, 200, 61, .52); }
    70% { box-shadow: 0 0 0 28px rgba(148, 200, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(148, 200, 61, 0); }
}

@media (max-width: 840px) {
    .sidebar {
        position: fixed;
        z-index: 50;
        inset: 0 auto 0 0;
        width: min(82vw, 310px);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 18px 0 50px rgba(0, 0, 0, .24);
    }
    .sidebar-open .sidebar {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: inline-flex;
    }
    .sidebar-open::after {
        content: "";
        position: fixed;
        z-index: 40;
        inset: 0;
        background: rgba(8, 18, 11, .46);
    }
    .content { margin-left: 0; padding: 16px; }
    .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
    .topbar > div,
    .topbar form {
        width: 100%;
    }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .dashboard-filter, .dashboard-grid, .list-filter { grid-template-columns: 1fr; }
    .import-strip { grid-template-columns: 1fr; }
    .scan-form, .scan-result-grid { grid-template-columns: 1fr; }
    .tablet-attendance {
        height: auto;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        margin: 0;
        padding: 12px;
        overflow: auto;
    }
    .tablet-scan-stage {
        min-height: 70dvh;
    }
    .tablet-floating-actions {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .tablet-session-picker {
        grid-template-columns: 1fr;
    }
    .tablet-result-panel { min-height: auto; }
    .pos-shell { grid-template-columns: 1fr; }
    .pos-cart { position: static; }
    .commerce-shell { grid-template-columns: 1fr; }
    .commerce-shell > .panel:nth-child(1),
    .commerce-shell > .panel:nth-child(2),
    .commerce-summary { grid-column: 1; grid-row: auto; }
    .commerce-summary { position: static; }
}

@media (max-width: 620px) {
    .card-row {
        align-items: stretch;
        flex-direction: column;
    }
    .portal-header {
        align-items: stretch;
        flex-direction: column;
    }
    .portal-grid {
        grid-template-columns: 1fr;
    }
    .portal-list-item {
        align-items: stretch;
        flex-direction: column;
    }
    .portal-right {
        text-align: left;
    }
    .portal-nav {
        width: min(560px, calc(100% - 12px));
        bottom: 6px;
        padding: 5px;
    }
    .portal-nav a {
        min-height: 42px;
        font-size: 11px;
    }
}

@media print {
    .sidebar, .topbar, .no-print, .actions { display: none !important; }
    .content { margin: 0; padding: 0; display: grid; place-items: start; }
    body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .panel { border: 0; padding: 0; page-break-inside: avoid; }
    .honor-receipt {
        width: 19cm;
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: .8cm;
        box-shadow: none;
    }
    .receipt-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: .25cm;
    }
    .receipt-grid div {
        padding: .25cm;
        background: #fff;
    }
    .signature-grid {
        break-inside: avoid;
    }
    .receipt-mini {
        width: 72mm;
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: 4mm;
        box-shadow: none;
    }
    .id-card-print { padding: 0; place-items: start; }
    .batch-card-sheet {
        width: 21cm;
        grid-template-columns: repeat(2, 8.56cm);
        justify-content: start;
        align-content: start;
        gap: .45cm .55cm;
        padding: .6cm;
    }
    .id-card {
        width: 8.56cm;
        height: 5.4cm;
        box-shadow: none;
        break-inside: avoid;
    }
    .id-card::before { height: 1.96cm; }
    .id-card::after {
        left: -.74cm;
        right: -.74cm;
        top: 1.38cm;
        height: 1cm;
    }
    .id-card-top { padding: .37cm 0 0 .53cm; }
    .id-card-logo {
        width: 2.96cm;
        max-height: .64cm;
    }
    .id-card-photo-wrap {
        left: .58cm;
        top: 1.85cm;
        margin-top: 0;
    }
    .id-card-photo, .id-card-initial {
        width: 2.22cm;
        height: 2.22cm;
        font-size: 32px;
        border-width: .11cm;
    }
    .id-card-body {
        left: 3.23cm;
        right: 2.28cm;
        top: 2.43cm;
        padding: 0;
    }
    .id-card-body h2 {
        max-width: 3.07cm;
        font-size: 16px;
    }
    .id-card-body p {
        margin: .13cm 0;
        font-size: 10px;
    }
    .id-card-body strong {
        min-width: 3.07cm;
        margin-bottom: 0;
        padding: .13cm .24cm;
        font-size: 10px;
    }
    .qr-code {
        right: .48cm;
        bottom: .69cm;
        width: 1.75cm;
        height: 1.75cm;
        padding: .05cm;
    }
    .id-card-branch {
        right: .48cm;
        bottom: .21cm;
        font-size: 8px;
    }
}
