:root {
    /* Brand Palette */
    --primary: #1E3A8A;
    --primary-dark: #172E6E;
    --primary-light: #E0E7F5;

    /* Semantic Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;

    /* Neutrals - Light Mode */
    --bg-color: #EDF0F7;
    --bg-card: #FFFFFF;
    --text-main: #1A1A2E;
    --text-muted: #64748B;
    --border: #CBD5E1;

    /* Shadow & Transition */
    --shadow-sm: 0 1px 2px rgba(30, 58, 138, 0.05);
    --shadow-md: 0 4px 8px -2px rgba(30, 58, 138, 0.15), 0 0 1px rgba(30, 58, 138, 0.2);
    --transition: all 0.2s ease-in-out;

    /* Layout */
    --sidebar-width: 250px;
}

body.dark-theme {
    /* Neutrals - Dark Mode */
    --bg-color: #0F172A;
    --bg-card: #1E293B;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border: #334155;

    --primary-light: #1E3A5F;
    --success-light: #064E3B;
    --danger-light: #450A0A;
    --warning-light: #451A03;

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.auth-loading .login-screen,
body.authenticated .login-screen,
body.unauthenticated .app-container,
body.auth-loading .app-container {
    display: none;
}

body.unauthenticated .login-screen {
    display: flex;
}

.login-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at top left, rgba(30, 58, 138, 0.16), transparent 32%), var(--bg-color);
}

.login-card {
    width: min(100%, 420px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    padding: 32px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.login-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.login-eyebrow {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-brand h1 {
    font-size: 26px;
    line-height: 1.2;
    color: var(--text-main);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.login-message {
    display: none;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
}

.login-message.show {
    display: block;
}

.login-help {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.login-help span {
    color: var(--primary);
    font-weight: 700;
}

.user-logout-btn {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
}

.role-hidden,
.role-disabled {
    display: none !important;
}

.role-readonly-control {
    opacity: 0.55;
    pointer-events: none;
}

/* App Skeleton */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
    transition: width 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer .details,
.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    height: 60px;
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    padding: 14px 0;
    justify-content: center;
}

.sidebar.collapsed .nav-item i {
    margin-right: 0;
    font-size: 22px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px 0;
    justify-content: center;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    margin-left: auto;
    padding: 4px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar-header {
    min-height: 80px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.logo-img {
    height: auto;
    width: 130px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item i {
    font-size: 20px;
    margin-right: 16px;
}

.nav-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.details .name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.details .role {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 60px;
}

.tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

.top-header {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 5;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-container {
    position: relative;
    display: inline-flex;
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 320px;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notification-dropdown.show {
    display: flex;
}

.dropdown-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
}

.outstanding-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 280px;
    overflow-y: auto;
}

.outstanding-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.outstanding-list li:last-child {
    border-bottom: none;
}

.outstanding-list li .store-code {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
}

.outstanding-list li .store-name {
    font-size: 12px;
    color: var(--text-muted);
}

.outstanding-list li.empty-notif {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 16px;
}

.alert-badge {
    background-color: var(--danger-light);
    color: var(--danger);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: pulseAlert 2s infinite;
}

@keyframes pulseAlert {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

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

.btn-loading {
    justify-content: center;
    min-width: 132px;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinCircle 0.75s linear infinite;
}

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

.btn-icon {
    padding: 8px;
    background: transparent;
    font-size: 20px;
    color: var(--text-main);
}

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

.icon-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
}

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

.badge-number {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
    transition: var(--transition);
}

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-color);
}

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

.btn-danger:hover {
    background-color: #E74C3C;
}

.action-cell {
    white-space: nowrap;
}

.action-cell-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* KPI Filter Bar */
.kpi-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dashboard-export-source {
    --bg-color: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --primary: #1E3A8A;
    --primary-light: #EFF6FF;
    --danger: #DC2626;
    --success: #10B981;
    --warning: #F59E0B;
    position: fixed;
    left: -99999px;
    top: 0;
    width: 1120px;
    background: #F8FAFC;
    color: #1E293B;
    padding: 0;
    z-index: -1;
}

.dashboard-export-sheet {
    background: #F8FAFC;
    color: #1E293B;
    font-family: 'Inter', sans-serif;
}

.dashboard-export-page {
    width: 1120px;
    height: 792px;
    padding: 24px;
    background: #F8FAFC;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.dashboard-export-page + .dashboard-export-page {
    margin-top: 24px;
}

.dashboard-export-page .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 0;
}

.dashboard-export-page .kpi-card {
    padding: 14px;
    min-height: 132px;
}

.dashboard-export-page .kpi-value-new {
    font-size: 24px;
}

.dashboard-export-kpi-wrap {
    padding: 14px;
    margin-bottom: 14px;
}

.dashboard-export-header-compact {
    margin-bottom: 14px;
}

.dashboard-export-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.dashboard-export-detail-grid-bottom {
    grid-template-columns: 0.95fr 1.05fr;
}

.dashboard-export-chart-frame {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    overflow: visible;
}

.dashboard-export-page .donut-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 14px;
    margin-top: 10px;
}

.dashboard-export-page .donut-legend-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: start;
    gap: 8px;
    min-width: 0;
    font-size: 10px;
}

.dashboard-export-page .donut-legend-left {
    min-width: 0;
    gap: 6px;
}

.dashboard-export-page .donut-legend-label {
    white-space: normal;
    line-height: 1.25;
    font-size: 10px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-export-page .donut-legend-pct {
    font-size: 10px;
    text-align: right;
    white-space: nowrap;
}

.dashboard-export-donut-layout {
    display: grid;
    grid-template-columns: 52% 48%;
    gap: 14px;
    align-items: center;
}

.dashboard-export-donut-layout .dashboard-export-chart-frame {
    min-height: 250px;
}

.dashboard-export-donut-layout .donut-legend {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 0;
    margin-top: 0;
}

.dashboard-export-donut-layout .donut-legend-item {
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 10px;
}

.dashboard-export-page-label {
    position: absolute;
    right: 24px;
    bottom: 14px;
    color: #94A3B8;
    font-size: 11px;
    font-weight: 600;
}

.dashboard-export-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 16px;
}

.dashboard-export-header h1 {
    margin: 0 0 6px;
    font-size: 26px;
    color: #0F172A;
}

.dashboard-export-meta {
    color: #64748B;
    font-size: 13px;
    line-height: 1.5;
    text-align: right;
}

.dashboard-export-section {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-export-section h2 {
    margin: 0 0 14px;
    font-size: 16px;
    color: #0F172A;
}

.dashboard-export-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-export-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}

.dashboard-export-table th,
.dashboard-export-table td {
    border-bottom: 1px solid #E2E8F0;
    padding: 5px 6px;
    text-align: left;
    vertical-align: top;
}

.dashboard-export-table th {
    background: #EFF6FF;
    color: #1E3A8A;
    font-weight: 700;
}

.dashboard-export-note {
    color: #64748B;
    font-size: 12px;
    margin-top: 10px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 180px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 88, 202, 0.15);
}

/* Views & Routing */
.views-container {
    padding: 32px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active {
    display: block;
}

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

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 1280px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.kpi-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.kpi-card-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.kpi-revisit-pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.kpi-icon-container {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

/* Colors for icon containers */
.kpi-icon-container.kpi-blue {
    background-color: var(--primary-light);
    color: var(--primary);
}

.kpi-icon-container.kpi-yellow {
    background-color: var(--warning-light);
    color: var(--warning);
}

.kpi-icon-container.kpi-red {
    background-color: var(--danger-light);
    color: var(--danger);
}

.kpi-icon-container.kpi-green {
    background-color: var(--success-light);
    color: var(--success);
}

body.dark-theme .kpi-icon-container.kpi-green {
    background-color: #064E3B;
    color: #10B981;
}

/* Badges */
.kpi-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
}

.kpi-badge-outline-blue {
    border: 1px solid var(--primary);
    background-color: transparent;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

body.dark-theme .kpi-badge-outline-blue {
    border-color: #58A6FF;
    color: #58A6FF;
}

.kpi-badge-blue {
    background-color: var(--primary-light);
    color: var(--primary);
}

.kpi-badge-yellow {
    background-color: var(--warning-light);
    color: var(--warning);
}

.kpi-badge-red {
    background-color: var(--danger-light);
    color: var(--danger);
}

.kpi-badge-green {
    background-color: var(--success-light);
    color: var(--success);
    font-weight: 700;
}

body.dark-theme .kpi-badge-green {
    background-color: #064E3B;
    color: #10B981;
}

.kpi-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.kpi-value-new {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin: 4px 0;
}

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

.kpi-subtitle-container {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.kpi-subtitle-container i {
    font-size: 14px;
}

.kpi-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-subtitle-stacked {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Footer / Progress Bar */
.kpi-card-footer {
    margin-top: auto;
    padding-top: 4px;
}

.kpi-progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.kpi-progress-fill {
    height: 100%;
    background-color: var(--success);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.kpi-currency {
    font-weight: 500;
}

/* Workspace / Widgets */
.dashboard-widgets {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

.widget {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.widget h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

.widget-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.widget-header-flex h3 {
    margin-bottom: 0;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.compact-select {
    min-width: 120px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    cursor: pointer;
}

.compact-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text-main);
    background: var(--bg-color);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.month-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.month-checkboxes label, .filter-checkboxes > label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
}

.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 8px 8px;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.donut-legend-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.donut-legend-pct {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: var(--bg-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    transition: background-color 0.3s ease;
}

.data-table td {
    font-size: 14px;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge.danger { background: var(--danger-light); color: var(--danger); }
.badge.success { background: var(--success-light); color: var(--success); }
.badge.warning { background: var(--warning-light); color: var(--warning); }
.badge.purple { background: #F3E8FF; color: #7C3AED; }


.revisit-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.revisit-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.revisit-summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
    line-height: 1;
    color: var(--text-main);
}

.revisit-summary-card.success strong { color: var(--success); }
.revisit-summary-card.danger strong { color: var(--danger); }
.revisit-summary-card.warning strong { color: var(--warning); }

.revisit-summary-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.revisit-deduction-value {
    font-weight: 700;
    white-space: nowrap;
}

.revisit-deduction-value.surplus { color: var(--success); }
.revisit-deduction-value.minus { color: var(--danger); }
.revisit-deduction-value.zero { color: var(--text-muted); }

@media (max-width: 900px) {
    .revisit-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .revisit-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Forms & Inputs */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.report-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.report-filters select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    cursor: pointer;
    min-width: 150px;
}

.report-filters select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 88, 202, 0.15);
}

.load-more-container {
    text-align: center;
    padding: 20px 0 8px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    width: 350px;
    box-shadow: var(--shadow-sm);
}

.search-box i {
    color: var(--text-muted);
    margin-right: 8px;
    font-size: 20px;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
    color: var(--text-main);
}

.report-search-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
}

.report-search-wrapper {
    position: relative;
}

.btn-report-chart {
    min-height: 42px;
    white-space: nowrap;
}

.search-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 350px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 20;
    padding: 6px 0;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
}

.search-suggestion-item:hover {
    background: var(--bg-color);
}

.search-suggestion-code {
    font-weight: 700;
    margin-right: 6px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    width: 450px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-header h3 { font-size: 18px; }

.btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body { padding: 24px; }

.modal-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

#add-plan-modal .modal-content {
    width: min(760px, calc(100vw - 32px));
}

.assignment-store-wrapper {
    position: relative;
}

.assignment-store-suggestions {
    width: 100%;
    z-index: 120;
}

.assignment-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.pic-multiselect {
    position: relative;
}

.pic-multiselect-trigger {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    cursor: pointer;
}

.pic-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.pic-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

.pic-multiselect-options {
    display: none;
    position: absolute;
    z-index: 130;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pic-multiselect-options.show {
    display: grid;
    gap: 6px;
}

.pic-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
}

.pic-option:hover,
.pic-option.selected {
    background: var(--bg-color);
}

.pic-option-id {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

@media (max-width: 640px) {
    .assignment-form-grid {
        grid-template-columns: 1fr;
    }
}

.schedule-detail-modal-content {
    width: min(620px, calc(100vw - 32px));
}

.schedule-detail-grid {
    display: grid;
    gap: 12px;
}

.schedule-detail-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-color);
}

.schedule-detail-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.schedule-detail-value {
    display: block;
    font-size: 14px;
    color: var(--text-main);
    overflow-wrap: anywhere;
}

.report-chart-modal-content {
    width: min(900px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: hidden;
}

.report-chart-modal-content .modal-body {
    max-height: calc(100vh - 136px);
    overflow-y: auto;
}

.report-chart-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 24px;
    align-items: center;
}

.report-chart-canvas-wrap {
    position: relative;
    height: 280px;
}

.report-chart-legend {
    display: grid;
    gap: 10px;
}

.report-chart-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-color);
}

.report-chart-legend-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.report-chart-legend-label span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.report-chart-legend-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.report-incomplete-list-wrap {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.report-incomplete-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.report-incomplete-list-header h4 {
    font-size: 15px;
}

.report-incomplete-list-header span {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: 999px;
}

.report-incomplete-list {
    display: grid;
    gap: 10px;
}

.report-incomplete-item {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr minmax(90px, 140px) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
}

.report-incomplete-cell {
    min-width: 0;
}

.report-incomplete-label {
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.report-incomplete-value {
    display: block;
    font-size: 13px;
    color: var(--text-main);
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .report-chart-layout,
    .report-incomplete-item {
        grid-template-columns: 1fr;
    }

    .report-search-actions,
    .report-search-wrapper,
    .btn-report-chart {
        width: 100%;
    }

    .btn-report-chart {
        justify-content: center;
    }
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    background-color: var(--bg-card);
    color: var(--text-main);
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border);
}

/* Project View */
.project-view.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.project-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.10)), var(--bg-card);
}

.project-hero h2 {
    max-width: 780px;
    margin: 8px 0 10px;
    font-size: 28px;
    line-height: 1.2;
    color: var(--text-main);
}

.project-hero p,
.project-subtitle {
    color: var(--text-muted);
    line-height: 1.6;
}

.project-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.project-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.project-kpi-card {
    display: grid;
    gap: 8px;
}

.project-kpi-card span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.project-kpi-card strong {
    font-size: 30px;
    line-height: 1;
    color: var(--text-main);
}

.project-kpi-card p {
    color: var(--text-muted);
    font-size: 13px;
}

.project-kpi-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 22px;
}

.project-kpi-icon.blue { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.project-kpi-icon.green { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.project-kpi-icon.orange { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.project-kpi-icon.purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }

.project-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
    gap: 24px;
}

.project-pipeline-list,
.project-risk-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.project-pipeline-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-color);
}

.project-pipeline-item > span {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.project-pipeline-item strong,
.project-risk-list strong,
.project-audit-table td strong {
    display: block;
    color: var(--text-main);
    font-weight: 700;
}

.project-pipeline-item p,
.project-audit-table td span {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
}

.project-pipeline-item em,
.project-risk-list em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.project-pipeline-item.active > span { color: #2563eb; border-color: rgba(37, 99, 235, 0.35); }
.project-pipeline-item.warning > span { color: #d97706; border-color: rgba(245, 158, 11, 0.45); }
.project-pipeline-item.done > span { color: #16a34a; border-color: rgba(22, 163, 74, 0.35); }

.project-risk-list > div {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border);
}

.risk-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.risk-dot.red { background: #dc2626; }
.risk-dot.orange { background: #f59e0b; }
.risk-dot.blue { background: #2563eb; }
.risk-dot.green { background: #16a34a; }
.risk-dot.purple { background: #7c3aed; }

.project-audit-table td:nth-child(3) {
    min-width: 280px;
}

.project-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.project-status.planning { background: rgba(100, 116, 139, 0.13); color: #64748b; }
.project-status.fieldwork { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.project-status.draft { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.project-status.followup { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.project-status.done { background: rgba(22, 163, 74, 0.12); color: #16a34a; }

body.dark-theme .project-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(139, 92, 246, 0.12)), var(--bg-card);
}

/* Responsive */
@media (max-width: 1024px) {
    .tables-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-widgets {
        grid-template-columns: 1fr;
    }
    .project-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .project-workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .main-content { margin-left: 0; }
    .dashboard-widgets { grid-template-columns: 1fr; }
    .tables-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; gap: 16px; align-items: stretch; }
    .search-box { width: 100%; }
    .project-hero { align-items: stretch; flex-direction: column; }
    .project-hero h2 { font-size: 24px; }
    .project-kpi-grid { grid-template-columns: 1fr; }
    .project-pipeline-item { grid-template-columns: auto 1fr; }
    .project-pipeline-item em { grid-column: 2; }
}

/* Toast Notification */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.toast i {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-success {
    background: linear-gradient(135deg, #10B981, #059669);
}

.toast-error {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
}

.toast-info {
    background: linear-gradient(135deg, #1E3A8A, #172E6E);
}

.toast-warning {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #1E3A8A;
}

.team-leaders-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.team-leader-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.team-leader-card:hover {
    box-shadow: var(--shadow-md);
}

.team-leader-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-leader-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
}

.team-leader-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
}

.team-leader-title {
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .team-leaders-grid {
        grid-template-columns: 1fr;
    }
}

/* Team View */
.team-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}

.team-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.team-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.team-filter .form-select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.team-table td {
    vertical-align: middle;
}

.team-auditor-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.team-auditor-name {
    font-weight: 600;
    color: var(--text-main);
}

.team-audit-count {
    font-weight: 700;
    color: var(--success);
}

.team-table-widget {
    margin-bottom: 24px;
}

.team-insight-layer {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card) 52%, rgba(30, 58, 138, 0.08) 100%);
    border: 1px solid rgba(30, 58, 138, 0.16);
    border-radius: 18px;
    padding: 24px;
    margin-top: 4px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.team-insight-layer::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary), var(--danger));
}

.team-insight-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.team-insight-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 22px;
    flex-shrink: 0;
}

.team-insight-eyebrow,
.team-insight-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
}

.team-insight-header h3 {
    font-size: 18px;
    margin-bottom: 4px;
    color: var(--text-main);
}

.team-insight-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.team-insight-content {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
    gap: 16px;
}

.team-insight-top-pic,
.team-insight-list {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

body.dark-theme .team-insight-top-pic,
body.dark-theme .team-insight-list {
    background: rgba(30, 41, 59, 0.78);
}

.team-insight-top-pic {
    border-color: rgba(220, 38, 38, 0.18);
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), var(--bg-card));
}

.team-insight-top-pic strong {
    display: block;
    font-size: 20px;
    color: var(--text-main);
    margin-bottom: 8px;
}

.team-insight-count {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 12px;
}

.team-insight-meta {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

.team-insight-rank-item {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 12px;
    transition: var(--transition);
}

.team-insight-rank-item:hover {
    background: var(--bg-color);
}

.team-insight-rank-item:last-child {
    border-bottom: none;
}

.team-insight-rank-no {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.team-insight-rank-item strong,
.team-insight-rank-item span {
    display: block;
}

.team-insight-rank-item strong {
    color: var(--text-main);
    font-size: 13px;
}

.team-insight-rank-item span {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.team-insight-rank-item em {
    font-style: normal;
    font-weight: 800;
    color: var(--danger);
}

.team-insight-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 12px;
}

.schedule-calendar {
    margin-bottom: 24px;
}

.schedule-calendar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.schedule-calendar-header h3 {
    margin-bottom: 4px;
}

.schedule-calendar-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.schedule-calendar-weekdays,
.schedule-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.schedule-calendar-weekdays {
    gap: 8px;
    margin-bottom: 8px;
}

.schedule-calendar-weekdays span {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.schedule-calendar-weekdays span.is-weekend {
    background: var(--danger-light);
    color: var(--danger);
}

.schedule-calendar-grid {
    gap: 8px;
}

.schedule-calendar-day {
    min-height: 128px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-color);
    overflow: hidden;
}

.schedule-calendar-day.is-weekend {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.16);
}

.schedule-calendar-day.is-weekend .schedule-calendar-day-number {
    color: var(--danger);
}

.schedule-calendar-day.is-empty {
    opacity: 0.45;
    background: transparent;
}

.schedule-calendar-day-number {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}

.schedule-calendar-events {
    display: grid;
    gap: 6px;
    max-height: 92px;
    overflow-y: auto;
}

.schedule-calendar-event {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(30, 58, 138, 0.18);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.schedule-calendar-event:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.schedule-calendar-event-title {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.schedule-calendar-event-meta,
.schedule-calendar-event-pic {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-calendar-empty {
    color: var(--text-muted);
    font-size: 11px;
    opacity: 0.75;
}

@media (max-width: 900px) {
    .team-insight-content {
        grid-template-columns: 1fr;
    }

    .schedule-calendar-day {
        min-height: 96px;
        padding: 7px;
    }

    .schedule-calendar-weekdays span,
    .schedule-calendar-event-title,
    .schedule-calendar-event-meta,
    .schedule-calendar-event-pic {
        font-size: 10px;
    }
}

/* Confirm Modal Override */
.confirm-modal .modal-header {
    background: var(--bg-card);
}

.confirm-modal .modal-header h3 {
    display: flex;
    align-items: center;
}

/* Skeleton Loader */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-color) 50%, var(--border) 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
}

.skeleton-row td {
    padding: 14px 16px;
}

/* Sortable Table Headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-th:hover {
    background-color: var(--border);
    color: var(--primary);
}

.sortable-th .sort-icon {
    display: inline-block;
    margin-left: 6px;
    opacity: 0.4;
    font-size: 11px;
    vertical-align: middle;
    transition: opacity 0.15s ease;
}

.sortable-th.sort-asc .sort-icon,
.sortable-th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--primary);
}

/* Sync button disabled state */
#btn-sync:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* =========================================================
   COMPACT TABLE STYLES — Top 5 Deduction & Detailed Store
   ========================================================= */
#top5-deduction-table th,
#recent-stores-table th {
    font-size: 10px;
    padding: 7px 10px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

#top5-deduction-table th:nth-child(1),
#top5-deduction-table td:nth-child(1) {
    width: 34px;
    padding-left: 6px;
    padding-right: 6px;
    text-align: center;
}

#top5-deduction-table th:nth-child(2),
#top5-deduction-table td:nth-child(2) {
    width: 54px;
    min-width: 54px;
    padding-left: 6px;
    padding-right: 6px;
}

#top5-deduction-table th:nth-child(2) {
    line-height: 1.05;
    white-space: normal;
}

#top5-deduction-table th:nth-child(6),
#top5-deduction-table td:nth-child(6) {
    min-width: 92px;
}

#top5-deduction-table th:nth-child(7),
#top5-deduction-table td:nth-child(7) {
    min-width: 112px;
}

#top5-deduction-table td,
#recent-stores-table td {
    font-size: 11px;
    padding: 6px 10px;
    line-height: 1.35;
    vertical-align: top;
    /* Clamp each cell to max 2 lines */
    display: table-cell;
    overflow: hidden;
    max-height: 3em;
}

#top5-deduction-table td strong,
#recent-stores-table td strong {
    font-size: 11px;
    font-weight: 700;
    display: block;
    white-space: nowrap;
}

/* Store name — allow max 2 lines then ellipsis */
#top5-deduction-table td:nth-child(3),
#recent-stores-table td:nth-child(2) {
    max-width: 140px;
}

/* Date SO — no wrap, single line */
#top5-deduction-table td:nth-child(4),
#recent-stores-table td:nth-child(3) {
    white-space: nowrap;
    font-size: 11px;
}

/* Area & AM columns in top5 — max 2 lines */
#top5-deduction-table td:nth-child(6),
#top5-deduction-table td:nth-child(7) {
    max-width: 130px;
    font-size: 11px;
    overflow-wrap: anywhere;
}

/* Badge in compact tables */
#top5-deduction-table .badge,
#recent-stores-table .badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    display: inline-block;
}

/* Total deduction value — no wrap */
#top5-deduction-table td:nth-child(5),
#recent-stores-table td:nth-child(4) span {
    white-space: nowrap;
    font-size: 11px;
}

/* Row hover stays visible */
#top5-deduction-table tbody tr:hover,
#recent-stores-table tbody tr:hover {
    background-color: var(--bg-color);
}

/* =========================================================
   TOP NAVIGATION HEADER STYLING
   ========================================================= */

/* Sidebar hidden by default */
.sidebar {
    display: none !important;
}

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

/* Header Left & Right Layout */
.top-header {
    height: 72px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-brand {
    display: flex;
    align-items: center;
}

.logo-img-top {
    height: 46px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
}

/* Navigation items in header */
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Base style for nav items */
.header-nav .nav-item {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.header-nav .nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.header-nav .nav-item.active,
.nav-item-top-btn.active {
    background-color: #EFF6FF; /* soft blue pill */
    color: #1E3A8A; /* deep blue text */
    border: none;
}

body.dark-theme .header-nav .nav-item.active,
body.dark-theme .nav-item-top-btn.active {
    background-color: #1E3A5F;
    color: #38BDF8;
}

/* Dropdown styling */
.nav-item-top-dropdown {
    position: relative;
    display: inline-block;
}

.nav-item-top-btn {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.nav-item-top-btn:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.nav-item-top-dropdown.open .dropdown-content {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-card);
    min-width: 160px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    z-index: 10;
    padding: 6px 0;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.dropdown-content .nav-item {
    display: block !important;
    width: 100%;
    padding: 10px 16px !important;
    border-radius: 0 !important;
    text-align: left;
}

.dropdown-content .nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.dropdown-content .nav-item.active {
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
}

/* Header Right Area */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search Box Pill */
.header-search {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1.5px solid var(--border);
    border-radius: 24px; /* fully rounded pill */
    padding: 8px 16px;
    width: 260px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: #3B82F6;
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.header-search i {
    color: var(--text-muted);
    margin-right: 8px;
    font-size: 16px;
}

.header-search input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 13.5px;
    font-family: inherit;
    background: transparent;
    color: var(--text-main);
}

/* Header Avatar */
.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    cursor: pointer;
    border: 2px solid var(--border);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    transition: var(--transition);
}

.header-avatar:hover {
    border-color: var(--primary);
}

/* Settings Dropdown & User Profile Dropdown */
.settings-dropdown, .user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease-in-out;
}

.settings-dropdown.show, .user-dropdown.show {
    display: flex;
}

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

.settings-menu-list {
    list-style: none;
    padding: 4px 0;
    margin: 0;
}

.dropdown-menu-item {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 16px;
    text-align: left;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.dropdown-menu-item:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.dropdown-menu-item i {
    font-size: 16px;
    color: var(--text-muted);
}

/* User Profile Dropdown */
.user-dropdown {
    width: 240px;
}

.user-dropdown-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-color);
}

.user-dropdown-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
    flex-shrink: 0;
}

.user-dropdown-details {
    display: flex;
    flex-direction: column;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.user-dropdown-role {
    font-size: 12px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .top-header {
        height: auto;
        min-height: 72px;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-left,
    .header-right {
        width: 100%;
    }

    .header-left {
        align-items: center;
        gap: 14px;
        flex-wrap: wrap;
    }

    .header-brand {
        flex-shrink: 0;
    }

    .logo-img-top {
        height: 38px;
        max-width: 132px;
    }

    .header-nav {
        flex: 1 1 100%;
        width: 100%;
        order: 2;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .header-nav::-webkit-scrollbar {
        display: none;
    }

    .header-nav .nav-item,
    .nav-item-top-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .dropdown-content {
        position: fixed;
        top: 108px;
        left: 16px;
        right: 16px;
        min-width: 0;
        width: auto;
    }

    .header-right {
        justify-content: space-between;
        gap: 10px;
    }

    .header-search {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        padding: 8px 12px;
    }

    .views-container {
        padding: 20px 14px;
    }

    .widget,
    .kpi-card {
        border-radius: 14px;
        padding: 18px;
    }

    .chart-widget .chart-container {
        height: 280px;
        min-height: 280px;
    }

    .chart-scroll-frame {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .chart-scroll-content {
        min-width: 620px;
    }

    .chart-scroll-content .chart-container {
        width: 100%;
    }

    .top-issues-chart-container {
        overflow-x: auto !important;
    }

    #topIssuesChartWrapper {
        min-width: 620px;
    }

    .donut-legend {
        gap: 8px;
        padding: 12px 0 0;
    }
}

@media (max-width: 430px) {
    .top-header {
        padding-inline: 12px;
    }

    .views-container {
        padding: 16px 10px;
    }

    .header-right {
        flex-wrap: wrap;
    }

    .header-search {
        flex-basis: 100%;
        order: 2;
    }

    .header-search + .header-icon-container {
        margin-left: auto;
    }

    .notification-dropdown,
    .settings-dropdown,
    .user-dropdown {
        position: fixed;
        top: 126px;
        left: 12px;
        right: 12px;
        width: auto;
    }

    .chart-widget .chart-container {
        height: 250px;
        min-height: 250px;
    }

    .chart-scroll-content,
    #topIssuesChartWrapper {
        min-width: 560px;
    }

    .chart-controls,
    .widget-filters {
        width: 100%;
    }

    .chart-controls .compact-select,
    .widget-filters select,
    .widget-filters button {
        flex: 1 1 auto;
        min-width: 0;
    }
}


/* Audit Report & WP Stock Opname */
.audit-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.audit-report-subtitle {
    color: var(--text-secondary);
    margin-top: 6px;
}


.audit-report-action {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    margin: 0 0 16px;
}



.audit-report-action-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.audit-report-action-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

#audit-report-table th:nth-child(2),
#audit-report-table td:nth-child(2) {
    width: 120px;
    max-width: 120px;
}

#audit-report-table th:nth-child(3),
#audit-report-table td:nth-child(3) {
    width: 360px;
    max-width: 360px;
}

#audit-report-table th:nth-child(4),
#audit-report-table td:nth-child(4),
#audit-report-table th:nth-child(5),
#audit-report-table td:nth-child(5),
#audit-report-table th:nth-child(6),
#audit-report-table td:nth-child(6),
#audit-report-table th:nth-child(7),
#audit-report-table td:nth-child(7) {
    width: 92px;
    text-align: center;
}

#audit-report-table th:nth-child(8),
#audit-report-table td:nth-child(8) {
    width: 110px;
    text-align: center;
}

#audit-report-table th:nth-child(9),
#audit-report-table td:nth-child(9) {
    width: 104px;
    text-align: center;
}

.audit-report-list-widget {
    padding: 0;
    overflow: hidden;
}

#audit-report-table th:first-child,
#audit-report-table td:first-child {
    width: 72px;
    text-align: center;
}

#audit-report-table .empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 28px;
}

.audit-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.audit-report-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.audit-report-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(0, 82, 204, 0.1);
    color: var(--primary-blue);
    display: grid;
    place-items: center;
    font-size: 28px;
    flex: 0 0 auto;
}

.audit-report-card-body {
    flex: 1;
}

.audit-report-card-body h3 {
    margin: 0 0 6px;
    color: var(--text-primary);
}

.audit-report-card-body p,
.form-help {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}


.audit-report-form-widget {
    padding: 24px;
}

.audit-report-form-widget #form-wp-stock {
    max-width: none;
}

.audit-report-form-widget .assignment-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audit-report-form-panel .form-actions {
    justify-content: flex-end;
    margin-top: 22px;
}

@media (max-width: 900px) {
    .audit-report-form-widget .assignment-form-grid {
        grid-template-columns: 1fr;
    }
}

.wp-stock-modal-content {
    max-width: 760px;
}


.wp-child-header-fields {
    display: none;
}

.wp-session-info-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
}

.wp-session-info-card div {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
}

.wp-session-info-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wp-session-info-card strong {
    display: block;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.35;
}

.wp-signature-input-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.wp-signature-input-section h4 {
    margin: 0 0 14px;
    color: var(--text-primary);
}

.wp-upload-group input[type="file"] {
    display: inline-block;
    width: auto;
    max-width: 100%;
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}


.wp-preview-section {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.wp-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.wp-preview-header h3 {
    margin: 0 0 6px;
    color: var(--text-primary);
}

.wp-preview-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.wp-preview-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--success-light);
    color: var(--success);
    font-size: 12px;
    font-weight: 700;
}

.wp-preview-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.wp-preview-meta div {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.wp-preview-meta span {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 4px;
}

.wp-preview-meta strong {
    color: var(--text-primary);
    font-size: 13px;
}

.wp-preview-table-wrap {
    max-height: 520px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.wp-preview-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.wp-report-type-badge,
.wp-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.wp-report-type-badge,
.wp-status-badge.ready {
    background: rgba(0, 82, 204, 0.1);
    color: var(--primary-blue);
}

.wp-status-badge.pending {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.audit-session-action-group {
    flex-wrap: nowrap;
}

.wp-child-status-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wp-child-status-text {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.wp-child-status-text.pending {
    color: var(--text-secondary);
}

.wp-child-status-text.completed {
    color: var(--success);
}

.wp-child-action-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.wp-child-action-btn.pending {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.wp-child-action-btn.completed {
    background: var(--success);
    color: #ffffff;
    border-color: var(--success);
}

.audit-report-action-btn.export-incomplete {
    opacity: 0.65;
    border-style: dashed;
}

.wp-child-action-btn.completed:hover {
    color: #ffffff;
}

.wp-stock-admin-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.wp-stock-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.wp-stock-section-header h4 {
    margin: 0 0 6px;
    color: var(--text-primary);
}

.wp-stock-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.wp-stock-admin-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: auto;
}

.wp-stock-admin-input-table {
    table-layout: fixed;
    min-width: 1180px;
}

.wp-stock-admin-input-table th:nth-child(1),
.wp-stock-admin-input-table td:nth-child(1) { width: 50px; }
.wp-stock-admin-input-table th:nth-child(2),
.wp-stock-admin-input-table td:nth-child(2) { width: 118px; }
.wp-stock-admin-input-table th:nth-child(3),
.wp-stock-admin-input-table td:nth-child(3) { width: 160px; }
.wp-stock-admin-input-table th:nth-child(4),
.wp-stock-admin-input-table td:nth-child(4) { width: 210px; }
.wp-stock-admin-input-table th:nth-child(5),
.wp-stock-admin-input-table td:nth-child(5) { width: 140px; }
.wp-stock-admin-input-table th:nth-child(6),
.wp-stock-admin-input-table td:nth-child(6) { width: 210px; }
.wp-stock-admin-input-table th:nth-child(8),
.wp-stock-admin-input-table td:nth-child(8) { width: 72px; }

.wp-stock-admin-input-table td {
    padding-top: 14px;
    padding-bottom: 14px;
    vertical-align: top;
}

.wp-stock-admin-input-table input,
.wp-stock-admin-input-table select,
.wp-stock-admin-input-table textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.wp-stock-admin-status-other {
    margin-top: 8px;
}

.wp-stock-admin-input-table textarea {
    min-width: 260px;
    min-height: 96px;
    resize: vertical;
}

.wp-stock-admin-input-table td:first-child,
.wp-stock-admin-input-table td:last-child {
    text-align: center;
}

.wp-stock-add-row-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.wp-stock-preview-admin-section {
    margin-bottom: 18px;
}

.wp-stock-preview-admin-section h4,
.wp-stock-preview-subtitle {
    margin: 18px 0 10px;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .wp-stock-section-header {
        flex-direction: column;
    }
}

.wp-cash-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.wp-cash-section h4 {
    margin: 0 0 14px;
    color: var(--text-primary);
}

.wp-cash-input-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: auto;
}

.wp-cash-input-table input,
.wp-cash-input-table select {
    width: 100%;
    min-width: 110px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.wp-cash-input-table td:nth-child(1),
.wp-cash-input-table td:nth-child(4),
.wp-cash-input-table td:nth-child(5) {
    text-align: center;
}

.wp-cash-input-total-row td {
    font-weight: 700;
    background: var(--bg-secondary);
    text-align: center;
}

.wp-cash-input-total-row td:first-child {
    text-align: right;
}

.wp-cash-add-row-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.wp-cash-total-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    color: var(--text-primary);
}

.wp-cash-preview-content h4 {
    margin: 18px 0 10px;
    color: var(--text-primary);
}

.wp-cash-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.wp-cash-preview-grid div {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.wp-cash-preview-grid span {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 4px;
}

.wp-cash-preview-grid strong {
    color: var(--text-primary);
    font-size: 13px;
}

.wp-summary-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.wp-summary-section h4 {
    margin: 0 0 6px;
    color: var(--text-primary);
}

.wp-summary-input-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: auto;
}

.wp-summary-input-table {
    table-layout: fixed;
    min-width: 1120px;
}

.wp-summary-input-table th:nth-child(1),
.wp-summary-input-table td:nth-child(1) { width: 50px; text-align: center; }
.wp-summary-input-table th:nth-child(2),
.wp-summary-input-table td:nth-child(2),
.wp-summary-input-table th:nth-child(3),
.wp-summary-input-table td:nth-child(3),
.wp-summary-input-table th:nth-child(4),
.wp-summary-input-table td:nth-child(4),
.wp-summary-input-table th:nth-child(5),
.wp-summary-input-table td:nth-child(5) { width: 220px; }
.wp-summary-input-table th:nth-child(6),
.wp-summary-input-table td:nth-child(6) { width: 140px; }
.wp-summary-input-table th:nth-child(7),
.wp-summary-input-table td:nth-child(7) { width: 72px; text-align: center; }

.wp-summary-input-table input,
.wp-summary-input-table textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.wp-summary-input-table textarea {
    min-height: 96px;
    resize: vertical;
}

.wp-summary-input-table td {
    padding-top: 12px;
    padding-bottom: 12px;
    vertical-align: top;
}

.wp-summary-add-row-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.wp-stock-export-source,
.wp-cash-export-source,
.wp-summary-export-source {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 210mm;
    background: #ffffff;
    color: #000000;
    font-family: Arial, sans-serif;
    z-index: -1;
}

.wp-stock-export-page,
.wp-cash-export-page {
    position: relative;
    width: 210mm;
    height: 297mm;
    box-sizing: border-box;
    padding: 10mm 10mm;
    background: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wp-summary-export-source {
    width: 297mm;
}

.wp-summary-export-page {
    position: relative;
    width: 297mm;
    height: 210mm;
    box-sizing: border-box;
    padding: 10mm 10mm;
    background: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wp-stock-export-page::before,
.wp-stock-export-page::after,
.wp-cash-export-page::before,
.wp-cash-export-page::after,
.wp-summary-export-page::before,
.wp-summary-export-page::after {
    content: '';
    position: absolute;
    pointer-events: none;
    border: 1px solid #000000;
    box-sizing: border-box;
}

.wp-stock-export-page::before,
.wp-cash-export-page::before,
.wp-summary-export-page::before {
    inset: 2.8mm;
}

.wp-stock-export-page::after,
.wp-cash-export-page::after,
.wp-summary-export-page::after {
    inset: 4.2mm;
}

.wp-stock-export-page > *,
.wp-cash-export-page > *,
.wp-summary-export-page > * {
    position: relative;
    z-index: 1;
}

.wp-stock-export-document-header {
    display: grid;
    grid-template-columns: 38mm 1fr;
    border: 1px solid #000000;
    margin-bottom: 6px;
    min-height: 32mm;
}

.wp-stock-export-logo-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #000000;
    padding: 4mm;
}

.wp-stock-export-logo {
    width: 30mm;
    height: auto;
    object-fit: contain;
    display: block;
}

.wp-stock-export-header-right {
    display: grid;
    grid-template-rows: 9mm 1fr;
    min-width: 0;
}

.wp-stock-export-title-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #000000;
    font-weight: 700;
    font-size: 12px;
    text-align: center;
}

.wp-stock-export-meta-table {
    display: grid;
    grid-template-columns: 34mm 1fr;
    font-size: 8.5px;
    line-height: 1.2;
}

.wp-stock-export-meta-table > div {
    border-bottom: 1px solid #000000;
    padding: 1.5px 4px;
    min-height: 3.3mm;
    display: flex;
    align-items: center;
}

.wp-stock-export-meta-table > div:nth-last-child(-n+2) {
    border-bottom: none;
}

.wp-stock-export-meta-table > div:nth-child(odd) {
    border-right: 1px solid #000000;
    font-weight: 600;
}

.wp-stock-export-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.5px;
    line-height: 1.15;
}

.wp-stock-export-table th,
.wp-stock-export-table td {
    border: 0.5px solid #000000;
    padding: 1.5px 2px;
    vertical-align: top;
    word-break: normal;
    overflow: hidden;
}

.wp-stock-export-table th {
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    font-size: 8.5px;
    line-height: 1.15;
    background: #f1f1f1;
}


.wp-stock-export-table tbody td {
    vertical-align: middle;
}


.wp-stock-export-table th:nth-child(5),
.wp-stock-export-table td:nth-child(5),
.wp-stock-export-table th:nth-child(6),
.wp-stock-export-table td:nth-child(6) {
    text-align: center;
    vertical-align: middle;
}

.wp-stock-export-table th:nth-child(7),
.wp-stock-export-table td:nth-child(7) {
    text-align: center;
    vertical-align: middle;
}

.wp-stock-export-table th:nth-child(1),
.wp-stock-export-table td:nth-child(1) { width: 6mm; text-align: center; }
.wp-stock-export-table th:nth-child(2),
.wp-stock-export-table td:nth-child(2) { width: 18mm; }
.wp-stock-export-table th:nth-child(3),
.wp-stock-export-table td:nth-child(3) { width: 25mm; }
.wp-stock-export-table th:nth-child(4),
.wp-stock-export-table td:nth-child(4) { width: 42mm; }
.wp-stock-export-table th:nth-child(5),
.wp-stock-export-table td:nth-child(5) { width: 12mm; }
.wp-stock-export-table th:nth-child(6),
.wp-stock-export-table td:nth-child(6) { width: 12mm; }
.wp-stock-export-table th:nth-child(7),
.wp-stock-export-table td:nth-child(7) { width: 20mm; }
.wp-stock-export-table th:nth-child(8),
.wp-stock-export-table td:nth-child(8) { width: auto; }

.wp-stock-admin-export-table th:nth-child(1),
.wp-stock-admin-export-table td:nth-child(1) { width: 6mm; text-align: center; }
.wp-stock-admin-export-table th:nth-child(2),
.wp-stock-admin-export-table td:nth-child(2) { width: 18mm; }
.wp-stock-admin-export-table th:nth-child(3),
.wp-stock-admin-export-table td:nth-child(3) { width: 25mm; }
.wp-stock-admin-export-table th:nth-child(4),
.wp-stock-admin-export-table td:nth-child(4) { width: 42mm; }
.wp-stock-admin-export-table th:nth-child(5),
.wp-stock-admin-export-table td:nth-child(5) { width: 20mm; }
.wp-stock-admin-export-table th:nth-child(6),
.wp-stock-admin-export-table td:nth-child(6) { width: 18mm; }
.wp-stock-admin-export-table th:nth-child(7),
.wp-stock-admin-export-table td:nth-child(7) {
    width: auto;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}

.wp-stock-admin-export-table th:nth-child(7) {
    text-align: center;
}

.wp-stock-admin-export-table td:nth-child(7) {
    text-align: left;
}

.wp-stock-number {
    text-align: center;
}

.wp-stock-total-row td {
    font-weight: 700;
    background: #f5f5f5;
}

.wp-stock-signature-layout {
    display: grid;
    grid-template-columns: 3fr 1fr;
    align-items: end;
    gap: 5mm;
    margin-top: auto;
    padding-top: 6mm;
    font-size: 8.5px;
}

.wp-stock-signature-left-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-self: end;
    gap: 0;
}

.wp-stock-signature-card {
    border: 0.5px solid #000000;
    height: 32mm;
    display: flex;
    flex-direction: column;
    text-align: center;
    background: #ffffff;
}


.wp-stock-signature-left-grid .wp-stock-signature-card + .wp-stock-signature-card {
    border-left: none;
}

.wp-stock-signature-ack-wrap {
    display: flex;
    flex-direction: column;
    gap: 2mm;
}

.wp-stock-signature-ack-card {
    height: 32mm;
}

.wp-stock-signature-label,
.wp-stock-signature-date-outside,
.wp-stock-signer-name,
.wp-stock-signer-title {
    padding: 2px 4px;
    min-height: 5mm;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-stock-signature-label,
.wp-stock-signer-name {
    border-bottom: 0.5px solid #000000;
}

.wp-stock-signature-date-outside {
    justify-content: flex-end;
    text-align: right;
    min-height: 5mm;
    padding: 0;
}

.wp-stock-signature-label {
    font-weight: 600;
}

.wp-stock-signature-space {
    flex: 1;
    min-height: 10mm;
    border-bottom: 0.5px solid #000000;
}

.wp-stock-signer-name {
    font-weight: 600;
}

.wp-stock-signer-title {
    font-style: italic;
}

.wp-stock-export-table td:nth-child(3),
.wp-stock-export-table td:nth-child(7) {
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wp-stock-export-table td:nth-child(4),
.wp-stock-export-table td:nth-child(8) {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}

.wp-stock-export-table td:nth-child(8) {
    text-align: center;
    vertical-align: middle;
}

.wp-stock-admin-export-table td:nth-child(3),
.wp-stock-admin-export-table td:nth-child(4),
.wp-stock-admin-export-table td:nth-child(5),
.wp-stock-admin-export-table td:nth-child(6),
.wp-stock-admin-export-table td:nth-child(7) {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}

.wp-stock-export-table tbody tr {
    height: 7mm;
}

.wp-stock-export-table thead tr {
    height: 9mm;
}

.wp-summary-export-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8px;
    line-height: 1.16;
}

.wp-summary-export-table th,
.wp-summary-export-table td {
    border: 0.5px solid #000000;
    padding: 1.2px 1.5px;
    vertical-align: middle;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
}

.wp-summary-export-table th {
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    background: #f1f1f1;
}

.wp-summary-export-table th:nth-child(1),
.wp-summary-export-table td:nth-child(1) { width: 7mm; text-align: center; }
.wp-summary-export-table th:nth-child(2),
.wp-summary-export-table td:nth-child(2) { width: 42mm; }
.wp-summary-export-table th:nth-child(3),
.wp-summary-export-table td:nth-child(3) { width: 32mm; }
.wp-summary-export-table th:nth-child(4),
.wp-summary-export-table td:nth-child(4) { width: 32mm; }
.wp-summary-export-table th:nth-child(5),
.wp-summary-export-table td:nth-child(5) { width: 42mm; }
.wp-summary-export-table th:nth-child(6),
.wp-summary-export-table td:nth-child(6) { width: 16mm; text-align: center; }
.wp-summary-export-table th:nth-child(7),
.wp-summary-export-table td:nth-child(7) { width: 16mm; }
.wp-summary-export-table th:nth-child(8),
.wp-summary-export-table td:nth-child(8) {
    width: 46mm;
    text-align: center;
}
.wp-summary-export-table th:nth-child(9),
.wp-summary-export-table td:nth-child(9) { width: 28mm; text-align: center; }
.wp-summary-export-table th:nth-child(10),
.wp-summary-export-table td:nth-child(10) { width: 14mm; text-align: center; }


.wp-stock-export-section-title,
.wp-cash-export-section-title {
    margin: 5px 0 3px;
    font-size: 9px;
    font-weight: 700;
}

.wp-cash-export-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.4px;
    line-height: 1.34;
    margin-bottom: 4px;
}

.wp-cash-export-table th,
.wp-cash-export-table td {
    border: 0.25px solid #777777;
    padding: 4.2px 2.4px;
    vertical-align: middle;
    word-break: break-word;
}

.wp-cash-export-table th {
    text-align: center;
    font-weight: 700;
    background: #DDEBFF;
}

.wp-cash-export-table th:nth-child(1),
.wp-cash-export-table td:nth-child(1) {
    width: 6mm;
    text-align: center;
}

.wp-cash-export-table td:nth-child(3),
.wp-cash-export-table td:nth-child(4),
.wp-cash-export-table td:nth-child(5) {
    text-align: center;
}

.wp-cash-total-row td {
    font-weight: 700;
    background: #f5f5f5;
}

.wp-cash-deposit-export-table td {
    border: none;
    background: #ffffff;
}

.wp-cash-question-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.4px;
    line-height: 1.22;
    margin: 2px 0 4px;
}

.wp-cash-question-table td {
    border: none;
    background: #ffffff;
    padding: 2px 0;
    text-align: left;
    vertical-align: top;
}

.wp-cash-question-table td:first-child {
    width: 42%;
}

.wp-cash-question-table td:last-child {
    width: 58%;
    font-weight: 700;
    text-align: left;
}

.wp-cash-deposit-layout {
    display: grid;
    grid-template-columns: 1fr 42mm;
    gap: 5mm;
    align-items: stretch;
}

.wp-cash-deposit-layout .wp-cash-question-table {
    margin: 2px 0 4px;
}

.wp-cash-audit-note-box {
    border: 0.25px solid #777777;
    padding: 3px 4px;
    font-size: 8.4px;
    line-height: 1.22;
    min-height: 22mm;
}

.wp-cash-audit-note-box div {
    font-weight: 700;
    margin-bottom: 4px;
}

.wp-cash-audit-note-box strong {
    font-weight: 400;
}

.wp-cash-total-row td:nth-child(2),
.wp-cash-nominal-cell {
    text-align: center;
}

.wp-cash-signature-layout {
    display: grid;
    grid-template-columns: 44mm 42mm;
    align-items: end;
    justify-content: space-between;
    gap: 8mm;
    margin-top: auto;
    padding-top: 4mm;
    font-size: 8.5px;
}
