/* ============================================================
   POS Admin Portal — Main Stylesheet
   Primary: #3F51B5  Accent: #FF6B35  Surface: #F5F7FA
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #3F51B5;
    --primary-dark: #303F9F;
    --primary-light: #7986CB;
    --primary-xlight: #E8EAF6;
    --accent: #FF6B35;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --info: #2196F3;
    --dark: #263238;
    --text: #37474F;
    --text-muted: #78909C;
    --border: #E0E6ED;
    --surface: #F5F7FA;
    --white: #FFFFFF;
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .08);
    --shadow: 0 4px 16px rgba(63, 81, 181, .12);
    --shadow-lg: 0 8px 32px rgba(63, 81, 181, .18);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --transition: .2s ease;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--surface);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
}

button, input, select, textarea {
    font-family: inherit;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

/* AUTH */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A237E 0%, var(--primary) 60%, var(--primary-light) 100%);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.auth-bg-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-bg-shapes span {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
}

.auth-bg-shapes span:nth-child(1) {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
}

.auth-bg-shapes span:nth-child(2) {
    width: 250px;
    height: 250px;
    bottom: -50px;
    left: -80px;
}

.auth-bg-shapes span:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 40%;
    left: 10%;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    animation: slideUp .4s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo .logo-mark {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .875rem;
}

.auth-logo .logo-mark svg {
    width: 38px;
    height: 38px;
    fill: white;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -.5px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: .85rem;
    margin-top: .25rem;
}

.auth-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: .875rem;
    margin-bottom: 1.75rem;
    margin-top: .25rem;
}

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-bottom: 1.75rem;
}

.step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all .3s;
}

.step.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.step.done {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-line {
    flex: 1;
    max-width: 40px;
    height: 2px;
    background: var(--border);
}

.step-line.done {
    background: var(--success);
}

.otp-inputs {
    display: flex;
    gap: .75rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.otp-inputs input {
    width: 52px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all .2s;
    color: var(--dark);
    background: var(--surface);
}

.otp-inputs input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-xlight);
}

.otp-inputs input.filled {
    border-color: var(--primary);
    background: var(--primary-xlight);
}

.resend-row {
    text-align: center;
    margin-top: 1rem;
    font-size: .875rem;
    color: var(--text-muted);
}

.resend-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.resend-btn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

/* APP SHELL */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1A237E 0%, #283593 50%, var(--primary) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .25s ease;
}

.sidebar-logo {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .875rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    flex-shrink: 0;
}

.sidebar-logo .logo-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo .logo-icon svg {
    width: 26px;
    height: 26px;
    fill: white;
}

.sidebar-logo .logo-text {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.3px;
    line-height: 1.1;
}

.sidebar-logo .logo-text small {
    display: block;
    font-size: .68rem;
    font-weight: 400;
    opacity: .6;
    letter-spacing: .5px;
}

.branch-switcher {
    margin: 1rem .875rem .25rem;
    background: rgba(255, 255, 255, .1);
    border-radius: var(--radius-sm);
    padding: .6rem 1rem;
    cursor: pointer;
    transition: background .2s;
    border: 1px solid rgba(255, 255, 255, .12);
}

.branch-switcher:hover {
    background: rgba(255, 255, 255, .18);
}

.branch-switcher .bs-label {
    font-size: .68rem;
    opacity: .55;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: .2rem;
}

.branch-switcher .bs-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .875rem;
    font-weight: 600;
}

.branch-switcher .bs-current svg {
    width: 14px;
    height: 14px;
    opacity: .7;
}

.sidebar-nav {
    flex: 1;
    padding: .5rem 0;
}

.nav-section {
    padding: .75rem 1.5rem .2rem;
}

.nav-section-title {
    font-size: .63rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: .45;
    font-weight: 700;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: rgba(255, 255, 255, .72);
    font-size: .875rem;
    font-weight: 500;
    transition: all .2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, .1);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, .15);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: white;
    border-radius: 0 3px 3px 0;
}

.nav-link .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: .8;
}

.nav-link .label {
    flex: 1;
}

.nav-link .badge-dot {
    background: var(--accent);
    color: white;
    font-size: .63rem;
    padding: .1rem .4rem;
    border-radius: 20px;
    font-weight: 700;
}

.nav-link .arrow {
    width: 14px;
    height: 14px;
    opacity: .55;
    transition: transform .2s;
    flex-shrink: 0;
}

.nav-link[aria-expanded="true"] .arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    background: rgba(0, 0, 0, .18);
    display: none;
}

.nav-submenu.open {
    display: block;
}

.nav-submenu .nav-link {
    padding-left: 3.25rem;
    font-size: .82rem;
    color: rgba(255, 255, 255, .58);
}

.nav-submenu .nav-link:hover, .nav-submenu .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, .08);
}

.nav-submenu .nav-link.active::before {
    display: none;
}

.sidebar-user {
    padding: .875rem 1.125rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    flex-shrink: 0;
    color: white;
}

.sidebar-user .u-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .u-name {
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .u-role {
    font-size: .7rem;
    opacity: .55;
}

.logout-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, .2);
}

.logout-btn svg {
    width: 15px;
    height: 15px;
}

/* MAIN */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.topbar-toggle:hover {
    background: var(--surface);
}

.topbar-toggle svg {
    width: 20px;
    height: 20px;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .625rem;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all .2s;
    position: relative;
}

.topbar-btn:hover {
    background: var(--surface);
    color: var(--primary);
}

.topbar-btn svg {
    width: 20px;
    height: 20px;
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    transition: background .2s;
}

.topbar-user:hover {
    background: var(--surface);
}

.topbar-user .t-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-xlight);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
}

.topbar-user .t-name {
    font-size: .875rem;
    font-weight: 600;
    color: var(--dark);
}

.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -.4px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .3rem;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .sep {
    opacity: .4;
}

.breadcrumb .current {
    color: var(--primary);
    font-weight: 500;
}

.page-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* FILTER BAR */
.filter-bar {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.filter-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-spacer {
    flex: 1;
}

.date-range-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.date-input {
    padding: .4rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .83rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color .2s;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-xlight);
}

.date-sep {
    color: var(--text-muted);
    font-size: .8rem;
}

.quick-dates {
    display: flex;
    gap: .35rem;
}

.qd-btn {
    padding: .28rem .65rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: .73rem;
    font-weight: 600;
    cursor: pointer;
    background: white;
    color: var(--text-muted);
    transition: all .2s;
}

.qd-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.qd-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.branch-filter-select {
    padding: .4rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .83rem;
    color: var(--text);
    background: var(--surface);
}

.branch-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: box-shadow .2s, transform .2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-color, var(--primary));
}

.stat-card.green {
    --card-color: var(--success);
}

.stat-card.orange {
    --card-color: var(--accent);
}

.stat-card.red {
    --card-color: var(--danger);
}

.stat-card.cyan {
    --card-color: var(--info);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card .stat-icon {
    background: var(--primary-xlight);
    color: var(--primary);
}

.stat-card.green .stat-icon {
    background: #E8F5E9;
    color: var(--success);
}

.stat-card.orange .stat-icon {
    background: #FBE9E7;
    color: var(--accent);
}

.stat-card.red .stat-icon {
    background: #FFEBEE;
    color: var(--danger);
}

.stat-card.cyan .stat-icon {
    background: #E3F2FD;
    color: var(--info);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-body {
    flex: 1;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.1;
    letter-spacing: -.5px;
}

.stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

.stat-change {
    font-size: .73rem;
    font-weight: 600;
    margin-top: .45rem;
    display: flex;
    align-items: center;
    gap: .25rem;
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

.stat-change svg {
    width: 12px;
    height: 12px;
}

/* CARDS */
.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.card-title svg {
    width: 17px;
    height: 17px;
    color: var(--primary);
}

.card-body {
    padding: 1.25rem;
}

.card-body.p-0 {
    padding: 0;
}

/* CHARTS */
.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dash-grid .span-2 {
    grid-column: 1 / -1;
}

.chart-container {
    position: relative;
}

/* TABLES */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

thead th {
    padding: .7rem 1rem;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    transition: background .15s;
}

tbody tr:hover {
    background: #F8FAFF;
}

tbody td {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: .35rem;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-xlight);
}

.btn-icon.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #FFEBEE;
}

.btn-icon svg {
    width: 14px;
    height: 14px;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .18rem .55rem;
    border-radius: 20px;
    font-size: .71rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-xlight);
    color: var(--primary);
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-warning {
    background: #FFF8E1;
    color: #E65100;
}

.badge-danger {
    background: #FFEBEE;
    color: #B71C1C;
}

.badge-info {
    background: #E3F2FD;
    color: #0D47A1;
}

.badge-dark {
    background: #ECEFF1;
    color: #37474F;
}

/* FORMS */
.form-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.form-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, var(--primary-xlight), white);
}

.form-card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.form-card-header h2 svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.form-card-body {
    padding: 1.5rem;
}

.form-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.col-full {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.form-group label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: .3rem;
}

.required {
    color: var(--danger);
}

.hint {
    font-size: .73rem;
    color: var(--text-muted);
}

.form-control, .form-select {
    width: 100%;
    padding: .575rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    color: var(--text);
    background: white;
    transition: all .2s;
    appearance: none;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-xlight);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    font-size: .73rem;
    color: var(--danger);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.input-wrap {
    position: relative;
}

.input-wrap .i-icon {
    position: absolute;
    left: .875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrap .i-icon svg {
    width: 16px;
    height: 16px;
}

.input-wrap .form-control {
    padding-left: 2.5rem;
}

.input-wrap.right .i-icon {
    left: auto;
    right: .875rem;
}

.input-wrap.right .form-control {
    padding-left: .875rem;
    padding-right: 2.5rem;
}

.toggle-pw {
    position: absolute;
    right: .875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.toggle-pw svg {
    width: 17px;
    height: 17px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(63, 81, 181, .3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(63, 81, 181, .4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: .35rem .875rem;
    font-size: .8rem;
}

.btn-lg {
    padding: .8rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

/* PAGINATION */
.tbl-footer {
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-wrap: wrap;
}

.tbl-footer .pag-info {
    flex: 1;
    font-size: .8rem;
    color: var(--text-muted);
}

.page-link {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    background: white;
    text-decoration: none;
}

.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-xlight);
}

.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* TABLE TOOLBAR */
.tbl-toolbar {
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: .475rem .875rem .475rem 2.2rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    background: var(--surface);
    transition: all .2s;
    color: var(--text);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-xlight);
}

.search-box .s-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box .s-icon svg {
    width: 15px;
    height: 15px;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .2);
    transform: scale(.95) translateY(20px);
    transition: transform .25s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-lg {
    max-width: 720px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all .2s;
}

.modal-close:hover {
    background: var(--surface);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
}

/* TOAST */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
    padding: .875rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    min-width: 300px;
    max-width: 380px;
    pointer-events: auto;
    transform: translateX(130%);
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
}

.toast.hide {
    transform: translateX(130%);
    transition: transform .25s ease;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast-icon {
    flex-shrink: 0;
    margin-top: .1rem;
}

.toast-icon svg {
    width: 19px;
    height: 19px;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast .toast-icon {
    color: var(--primary);
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--dark);
}

.toast-msg {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .15rem;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: .25;
    animation: toast-progress 4s linear forwards;
}

.toast.success .toast-bar {
    color: var(--success);
}

.toast.error .toast-bar {
    color: var(--danger);
}

/* DROPDOWN */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: all .2s;
}

.dropdown-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .575rem 1rem;
    font-size: .875rem;
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--surface);
    color: var(--primary);
}

.dropdown-item.danger:hover {
    background: #FFEBEE;
    color: var(--danger);
}

.dropdown-item svg {
    width: 15px;
    height: 15px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: .25rem 0;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state svg {
    width: 52px;
    height: 52px;
    color: #CBD5E0;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: .95rem;
    color: var(--dark);
    margin-bottom: .4rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: .85rem;
}

/* SECTION DIVIDER */
.section-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: .875rem;
    margin-top: 1.5rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.section-title:first-child {
    margin-top: 0;
}

/* ALERT */
.alert {
    padding: .875rem 1.125rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1rem;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: .05rem;
}

.alert-info {
    background: #E3F2FD;
    color: #0D47A1;
    border: 1px solid #90CAF9;
}

.alert-success {
    background: #E8F5E9;
    color: #1B5E20;
    border: 1px solid #A5D6A7;
}

.alert-danger {
    background: #FFEBEE;
    color: #B71C1C;
    border: 1px solid #EF9A9A;
}

.alert-warning {
    background: #FFF8E1;
    color: #E65100;
    border: 1px solid #FFCC80;
}

/* RESPONSIVE */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, .5);
    opacity: 0;
    transition: opacity .25s;
}

.sidebar-overlay.show {
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.show {
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dash-grid {
        grid-template-columns: 1fr;
    }

    .dash-grid .span-2 {
        grid-column: span 1;
    }

    .quick-dates {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .otp-inputs input {
        width: 44px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* DETAIL TABLE — key/value info display used on all show pages */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    padding: .7rem 1.25rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface);
    display: flex;
    align-items: center;
}

.detail-value {
    padding: .7rem 1.25rem;
    font-size: .875rem;
    color: var(--text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
}

@media (max-width: 560px) {
    .detail-row {
        grid-template-columns: 1fr;
    }

    .detail-label {
        padding-bottom: .2rem;
        border-bottom: none;
    }

    .detail-value {
        padding-top: .2rem;
    }
}

/* UTILS */
.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: .5rem;
}

.gap-2 {
    gap: 1rem;
}

.flex-1 {
    flex: 1;
}

.text-right {
    text-align: right;
}

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

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fs-sm {
    font-size: .8rem;
}

.mt-1 {
    margin-top: .5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: .5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.w-100 {
    width: 100%;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes toast-progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade {
    animation: fadeIn .3s ease;
}



/* ============================================================
   FILTER PANEL  — add to app.css
   Used on Transactions, Dispatches, Cashings, etc.
   ============================================================ */

/* ── Container ───────────────────────────────────────────── */
.filter-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

/* ── Header row (always visible) ─────────────────────────── */
.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .875rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-panel-header:hover { background: var(--surface); }

.filter-panel-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.filter-panel-icon {
    width: 34px;
    height: 34px;
    background: var(--primary-xlight);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.filter-panel-icon svg { width: 16px; height: 16px; }

.filter-panel-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.filter-panel-subtitle {
    font-size: .73rem;
    color: var(--text-muted);
    margin-top: .05rem;
}

.filter-panel-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

/* "N active" pill next to the title */
.filter-active-count {
    display: inline-flex;
    align-items: center;
    padding: .1rem .5rem;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .02em;
}

/* ── Chips (collapsed summary) ───────────────────────────── */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    background: var(--primary-xlight);
    color: var(--primary);
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Show/Hide toggle button ─────────────────────────────── */
.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-toggle-btn svg {
    width: 13px;
    height: 13px;
    transition: transform .25s;
}

.filter-panel.open .filter-toggle-btn svg { transform: rotate(180deg); }

/* ── Expandable body ─────────────────────────────────────── */
.filter-panel-body {
    display: none;
    border-top: 1px solid var(--border);
    padding: 1.25rem;
    background: #FAFBFD;
}

.filter-panel.open .filter-panel-body {
    display: block;
    animation: filterSlideDown .2s ease;
}

@keyframes filterSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Quick date preset strip ─────────────────────────────── */
.filter-presets {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
}

.filter-preset-label {
    font-size: .71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text-muted);
    margin-right: .2rem;
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .22rem .65rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: white;
    font-size: .73rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}

.preset-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-xlight);
}

.preset-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ── Filter field grid ───────────────────────────────────── */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.filter-field label {
    font-size: .73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .3rem;
}

.filter-field label svg { width: 12px; height: 12px; opacity: .65; }

/* Inputs */
.filter-input,
.filter-select {
    width: 100%;
    padding: .5rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--text);
    background: white;
    transition: all .2s;
    appearance: none;
    font-family: inherit;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-xlight);
}

.filter-input::placeholder { color: #B0BEC5; }

/* Custom select arrow */
.filter-select-wrap { position: relative; }

.filter-select-wrap::after {
    content: '';
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

.filter-select-wrap .filter-select { padding-right: 2rem; }

/* ── Action row ──────────────────────────────────────────── */
.filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .625rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-result-hint {
    flex: 1;
    font-size: .78rem;
    color: var(--text-muted);
}

.filter-result-hint strong { color: var(--primary); font-weight: 700; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .filter-chips { display: none; }           /* too cramped on mobile */
    .filter-panel-subtitle { display: none; }
}

@media (max-width: 480px) {
    .filter-grid { grid-template-columns: 1fr; }
    .filter-panel-header { gap: .5rem; }
}

/* ── St Modal ─────────────────────────────────────────────────────────────── */
.st-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 9999; display: flex; align-items: center;
    justify-content: center; padding: 1rem;
}
.st-modal {
    background: #fff; border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    padding: 2rem 1.75rem 1.75rem; max-width: 540px; width: 100%;
}
.st-modal-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: #FEF3C7; display: flex; align-items: center;
    justify-content: center; margin: 0 auto 1rem;
}
.st-modal-icon svg { width: 26px; height: 26px; }
.st-modal-title {
    font-size: 1.1rem; font-weight: 800; color: var(--dark, #111);
    text-align: center; margin: 0 0 .625rem;
}
.st-modal-body {
    font-size: .875rem; color: var(--dark, #374151);
    text-align: center; line-height: 1.6; margin: 0 0 1rem;
}
.st-modal-warn {
    display: flex; align-items: flex-start; gap: .4rem;
    font-size: .78rem; color: #92400E; background: #FEF9C3;
    border: 1px solid #FDE68A; border-radius: 8px;
    padding: .625rem .875rem; margin: .75rem 0 1.25rem; line-height: 1.5;
}
.st-modal-warn svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: .15rem; }
.st-modal-impact {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px; overflow: hidden; font-size: .8rem;
}
.st-modal-actions {
    display: flex; gap: .75rem; justify-content: flex-end;
}
