/* ===========================
   UP Master — shadcn UI Dark Theme
   Inter Font · Accent #ed1a3b
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* shadcn Dark Palette */
    --background: #09090b;
    --foreground: #fafafa;
    --card: #0a0a0c;
    --card-foreground: #fafafa;

    /* Primary / Accent */
    --primary: #ed1a3b;
    --primary-foreground: #ffffff;
    --primary-hover: #d4162f;
    --primary-light: rgba(237, 26, 59, 0.12);

    /* Secondary Colors */
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --purple: #a855f7;
    --purple-bg: rgba(168, 85, 247, 0.12);

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Border & Ring */
    --border: #27272a;
    --border-color: #27272a;
    --border-dim: rgba(255, 255, 255, 0.06);
    --input: #27272a;
    --ring: #ed1a3b;

    /* Muted */
    --muted: #27272a;
    --muted-foreground: #a1a1aa;
    --secondary: #27272a;

    /* Destructive */
    --destructive: #dc2626;

    /* Radius & Transition */
    --radius: 0.5rem;
    --transition: all 0.15s ease;
}

/* ===========================
   Light Theme Override
   =========================== */
[data-theme="light"] {
    --background: #f8f9fa;
    --foreground: #18181b;
    --card: #ffffff;
    --card-foreground: #18181b;

    --primary: #ed1a3b;
    --primary-foreground: #ffffff;
    --primary-hover: #d4162f;
    --primary-light: rgba(237, 26, 59, 0.08);

    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.1);
    --yellow: #d97706;
    --yellow-bg: rgba(217, 119, 6, 0.1);
    --blue: #2563eb;
    --blue-bg: rgba(37, 99, 235, 0.1);
    --purple: #9333ea;
    --purple-bg: rgba(147, 51, 234, 0.1);

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;

    --border: #e4e4e7;
    --border-color: #e4e4e7;
    --border-dim: rgba(0, 0, 0, 0.06);
    --input: #e4e4e7;
    --ring: #ed1a3b;

    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --secondary: #f4f4f5;

    --destructive: #dc2626;
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    border-right-color: #e4e4e7;
}

[data-theme="light"] .sidebar-nav a:hover,
[data-theme="light"] .sidebar-nav a.active {
    background: #f4f4f5;
}

[data-theme="light"] .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #f4f4f5;
    color: #18181b;
    border-color: #d4d4d8;
}

[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .data-table th {
    background: #f4f4f5;
    color: #52525b;
}

[data-theme="light"] .data-table tr:hover {
    background: #f9fafb;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    z-index: 999;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    min-height: 100vh;
    color: var(--foreground);
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   App Layout
   =========================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    width: 220px;
    background: var(--card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-brand h1 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-brand small {
    font-size: 0.6875rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.125rem;
}

.sidebar-nav {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: var(--transition);
}

.sidebar-nav a:hover {
    background: var(--muted);
    color: var(--foreground);
}

.sidebar-nav a.active {
    background: var(--primary-light);
    border-color: rgba(237, 26, 59, 0.2);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav a .icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

.page-header p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Utility */
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

/* ===========================
   Cards
   =========================== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.75rem;
    letter-spacing: -0.025em;
}

/* ===========================
   Wallet Sections
   =========================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    margin-bottom: 0.5rem;
}

.section-header:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.section-header .section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.section-header .section-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.section-content {
    display: none;
    padding: 0.5rem 0;
}

.section-content.open {
    display: block;
}

.wallets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

/* Section Dots */
.section-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.section-dot.company {
    background: var(--primary);
}

.section-dot.others {
    background: var(--yellow);
}

.section-dot.wallet {
    background: var(--green);
}

/* ===========================
   Wallet Summary Banner
   =========================== */
.wallet-summary-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.wsb-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.wsb-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.wsb-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.wsb-value.positive {
    color: var(--foreground);
}

.wsb-value.negative {
    color: var(--destructive);
}

.wsb-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.wsb-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.wsb-chip b {
    color: var(--foreground);
    margin-left: 0.125rem;
}

/* ===========================
   Wallet Cards — Premium Grid
   =========================== */
.wcard {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.wcard:hover {
    border-color: var(--muted-foreground);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcard--company {
    border-top-color: var(--primary);
}

.wcard--others {
    border-top-color: var(--yellow);
}

.wcard--wallet {
    border-top-color: var(--green);
}

.wcard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.wcard-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
}

.wcard-del {
    background: none;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0.125rem;
}

.wcard:hover .wcard-del {
    opacity: 0.5;
}

.wcard-del:hover {
    opacity: 1 !important;
}

.wcard-bal {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--foreground);
    margin-bottom: 0.75rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.wcard-bal.zero {
    color: var(--muted-foreground);
    opacity: 0.4;
}

.wcard-bal.negative {
    color: var(--destructive);
}

.wcard-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: auto;
}

.wcard-actions button,
.wcard-actions a.wcard-link-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.375rem 0.125rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius);
    line-height: 1;
    text-decoration: none;
}

.wcard-actions button span,
.wcard-actions a.wcard-link-btn span {
    font-size: 0.875rem;
}

.wcard-actions button:hover,
.wcard-actions a.wcard-link-btn:hover {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--muted-foreground);
}

.section-total {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Section Collapse */
.section-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.35s ease, opacity 0.3s ease;
    opacity: 1;
}

.section-body.collapsed {
    max-height: 0;
    opacity: 0;
}

.collapse-icon {
    transition: transform 0.25s ease;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.section-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* ===========================
   Tables
   =========================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.6875rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--muted);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 1rem;
}

/* ===========================
   Form Elements
   =========================== */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
    width: 100%;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(237, 26, 59, 0.2);
}

.form-group select option {
    background: var(--background);
    color: var(--foreground);
}

/* Receipt Preview */
.receipt-preview {
    margin-top: 0.5rem;
}

.receipt-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    object-fit: contain;
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background: transparent;
    color: var(--destructive);
    border-color: var(--destructive);
}

.btn-danger:hover {
    background: var(--destructive);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--muted);
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
}

/* ===========================
   Modals
   =========================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 500;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.15s ease-out;
}

.modal-box.wide {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ===========================
   P&L Dashboard
   =========================== */
.pnl-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.pnl-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    border-top: 2px solid var(--border);
}

.pnl-card.income {
    border-top-color: var(--green);
}

.pnl-card.expense {
    border-top-color: var(--primary);
}

.pnl-card.profit {
    border-top-color: var(--purple);
}

.pnl-card .pnl-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.pnl-card .pnl-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.pnl-card.income .pnl-value {
    color: var(--green);
}

.pnl-card.expense .pnl-value {
    color: var(--primary);
}

.pnl-card.profit .pnl-value {
    color: var(--purple);
}

/* ===========================
   Payroll
   =========================== */
.payroll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
}

.payroll-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: var(--transition);
}

.payroll-card:hover {
    border-color: var(--muted-foreground);
}

.payroll-card h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.payroll-card .amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

/* ===========================
   Notes Grid
   =========================== */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.note-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: var(--transition);
    cursor: pointer;
    height: 250px;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.note-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    font-weight: 500;
}

.note-preview {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 7;
    -webkit-box-orient: vertical;
    flex: 1;
    line-height: 1.5;
}

.note-preview img {
    display: none;
}

/* Note Editor */
.note-editor {
    min-height: 300px;
    max-height: 60vh;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-y: auto;
    color: var(--foreground);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
}

.note-editor:focus {
    border-color: var(--ring);
    outline: none;
    box-shadow: 0 0 0 2px rgba(237, 26, 59, 0.2);
}

.note-editor img {
    max-width: 100%;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: block;
    transition: var(--transition);
}

.note-editor img:hover {
    border-color: var(--primary);
}

/* ===========================
   Mobile Navigation
   =========================== */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.mobile-nav {
    display: none;
    gap: 0.25rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

.mobile-nav-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    white-space: nowrap;
}

.mobile-nav-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* ===========================
   Animations
   =========================== */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .hamburger-btn {
        display: block;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 3rem 1rem 1rem;
    }

    .mobile-nav {
        display: flex;
    }

    .pnl-summary {
        grid-template-columns: 1fr;
    }

    .wallet-card,
    .payroll-card {
        padding: 0.75rem;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    .modal-box {
        width: 95%;
        padding: 1rem;
    }

    .data-table {
        font-size: 0.75rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 0.375rem 0.5rem;
    }
}

/* ===========================
   Employee Modal Redesign
   =========================== */
.emp-modal-section {
    border: 1px solid var(--border);
    border-radius: var(--radius, 0.5rem);
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.emp-modal-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-dim);
}

.emp-modal-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.25rem;
}

.input-with-calc {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-calc input {
    flex: 1;
    min-width: 80px;
}

.calc-amount {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

/* Statutory Breakdown Table */
.statutory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.statutory-table thead th {
    text-align: right;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.statutory-table thead th:first-child {
    text-align: left;
}

.statutory-table tbody td,
.statutory-table tfoot td {
    padding: 0.5rem 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--border-dim);
}

.statutory-table tbody td:first-child,
.statutory-table tfoot td:first-child {
    text-align: left;
}

.stat-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-total-row {
    border-top: 2px solid var(--border) !important;
}

.stat-total-row td {
    font-weight: 700;
    color: var(--foreground);
    border-bottom: none !important;
}

.stat-net-row td {
    font-weight: 800;
    font-size: 1rem;
    color: var(--green);
    border-top: 2px solid var(--border);
    padding-top: 0.75rem;
}

.stat-context-row td {
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-bottom: 1px dashed var(--border-dim);
}

/* ===========================
   Category List — Chip Style
   =========================== */
.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.875rem;
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--transition);
}

.category-tag:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.remove-cat {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.125rem;
    transition: var(--transition);
}

.remove-cat:hover {
    color: var(--destructive);
}

/* ===========================
   P&L Expense Breakdown Rows
   =========================== */
.category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    background: var(--muted);
}

.category-row:hover {
    background: var(--card);
    border-color: var(--muted-foreground);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.cat-name {
    font-weight: 500;
    color: var(--foreground);
    font-size: 0.875rem;
}

.cat-amount {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

/* P&L negative profit */
.pnl-card.profit.negative {
    border-top-color: var(--destructive);
}

.pnl-card.profit.negative .pnl-value {
    color: var(--destructive);
}

/* ===========================
   Wallet Balance Colors
   =========================== */
.wallet-balance {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.wallet-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.125rem;
}

/* ===========================
   Month Picker (P&L / Statement)
   =========================== */
.month-picker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.month-picker input[type="month"] {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
}

/* ===========================
   Statement Filter Row
   =========================== */
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 180px;
}

/* ===========================
   Run Payroll Modal
   =========================== */

/* Section Headers */
.rp-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--muted);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rp-section-title.utilities {
    border-left-color: var(--purple, #a855f7);
}

.rp-section-title.variable {
    border-left-color: #f59e0b;
}

/* Employee / Utility Rows */
.run-payroll-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.run-payroll-row:hover {
    border-color: var(--muted-foreground);
    background: rgba(255, 255, 255, 0.04);
}

.run-payroll-row:last-child {
    margin-bottom: 0;
}

/* Employee Info (name + type) */
.run-payroll-row .emp-info {
    flex: 0 0 160px;
    min-width: 120px;
}

.run-payroll-row .emp-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.run-payroll-row .emp-type {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Input Fields */
.run-payroll-row .emp-inputs {
    flex: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
    min-width: 0;
}

.run-payroll-row .emp-inputs label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.run-payroll-row .emp-inputs input[type="number"] {
    padding: 0.375rem 0.5rem;
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
    width: 70px;
    outline: none;
    transition: var(--transition);
    font-variant-numeric: tabular-nums;
}

.run-payroll-row .emp-inputs input[type="number"]:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(237, 26, 59, 0.15);
}

.run-payroll-row .emp-inputs input[type="file"] {
    font-size: 0.6875rem;
    max-width: 120px;
    color: var(--text-muted);
}

/* Net Pay Amount */
.run-payroll-row .emp-net {
    flex: 0 0 auto;
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--green);
    white-space: nowrap;
    text-align: right;
    min-width: 100px;
    font-variant-numeric: tabular-nums;
    padding: 0.25rem 0.625rem;
    background: rgba(34, 197, 94, 0.08);
    border-radius: var(--radius);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

/* Payroll Breakdown / Totals */
.payroll-breakdown {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
}

.payroll-breakdown .payroll-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-dim);
}

.payroll-breakdown .payroll-row:last-child {
    border-bottom: none;
}

.payroll-breakdown .payroll-row span:last-child {
    font-weight: 600;
    color: var(--foreground);
    font-variant-numeric: tabular-nums;
}

.payroll-breakdown .payroll-row.total {
    border-top: 2px solid var(--border);
    border-bottom: none;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.payroll-breakdown .payroll-row.total span {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--foreground);
}

.payroll-breakdown .payroll-row.total span:last-child {
    color: var(--primary);
    font-size: 1rem;
}

/* ===========================
   Run Payroll — Employee/Utility Rows
   =========================== */
.rp-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.run-payroll-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: var(--transition);
    flex-wrap: wrap;
}

.run-payroll-row:hover {
    border-color: var(--muted-foreground);
}

.run-payroll-row .emp-info {
    flex: 1;
    min-width: 140px;
}

.run-payroll-row .emp-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
}

.run-payroll-row .emp-type {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.run-payroll-row .emp-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.run-payroll-row .emp-inputs label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.run-payroll-row .emp-inputs input {
    width: 80px;
    padding: 0.375rem 0.5rem;
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
    font-variant-numeric: tabular-nums;
}

.run-payroll-row .emp-inputs input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(237, 26, 59, 0.2);
}

.run-payroll-row .emp-net {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--green);
    min-width: 100px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.run-payroll-row .file-input-sm {
    width: 120px;
    font-size: 0.6875rem;
}

/* ===========================
   Pending Payment Notifications
   =========================== */
.notification-bar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--yellow-bg);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid var(--yellow);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.notif-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.notif-text {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
}

.notif-amount {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--yellow);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pending-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.pending-item:hover {
    border-color: var(--muted-foreground);
}

.pending-info {
    flex: 1;
    min-width: 0;
}

.pending-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
}

.pending-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.pending-amount {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--green);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-right: 0.5rem;
}

/* ===========================
   Payroll Wizard Steps
   =========================== */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.25rem;
    padding: 0.75rem 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--muted);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: default;
    opacity: 0.5;
}

.wizard-step.active {
    background: var(--primary);
    border-color: var(--primary);
    opacity: 1;
}

.wizard-step.completed {
    background: rgba(34, 197, 94, 0.12);
    border-color: var(--green);
    opacity: 1;
}

.wizard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--foreground);
}

.wizard-step.active .wizard-step-num {
    background: rgba(255,255,255,0.25);
    color: var(--primary-foreground);
}

.wizard-step.completed .wizard-step-num {
    background: var(--green);
    color: #fff;
}

.wizard-step-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--foreground);
}

.wizard-step.active .wizard-step-label {
    color: var(--primary-foreground);
}

.wizard-step.completed .wizard-step-label {
    color: var(--green);
}

.wizard-step-line {
    width: 2rem;
    height: 2px;
    background: var(--border);
    flex-shrink: 0;
}

.wizard-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0.75rem;
    padding: 0;
}

.wizard-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Expandable employee breakdown */
.emp-expand-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.emp-expand-toggle:hover {
    color: var(--primary);
}

.emp-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.emp-breakdown {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.02);
    border-top: 1px solid var(--border-dim);
    border-radius: 0 0 var(--radius) var(--radius);
}

.emp-breakdown.open {
    display: block;
}

.emp-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.emp-breakdown-table td {
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
}

.emp-breakdown-table td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    width: 40%;
}

.emp-breakdown-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.emp-breakdown-table tr.bd-total td {
    border-top: 1px solid var(--border);
    font-weight: 700;
    color: var(--foreground);
    padding-top: 0.375rem;
}

/* Summary employee mini-cards */
.summary-emp-card {
    padding: 0.5rem 0.75rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.375rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
}

.summary-emp-card .se-name {
    font-weight: 600;
}

.summary-emp-card .se-amounts {
    display: flex;
    gap: 1rem;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.summary-emp-card .se-net {
    font-weight: 700;
    color: var(--green);
}

@media (max-width: 768px) {
    .wizard-steps {
        gap: 0;
    }
    .wizard-step {
        padding: 0.375rem 0.625rem;
    }
    .wizard-step-label {
        font-size: 0.625rem;
    }
    .wizard-step-line {
        width: 1rem;
    }
}
/* Independent payment arrangement sections */
.arrange-section { border-top: 1px solid var(--border); padding-top: 1.25rem; margin-top: 1.5rem; }
.arrange-section > .btn { margin-top: 0.75rem; }
.arrange-status { color: var(--text-muted); font-size: 0.8rem; }

.statement-wallet-summary { margin-bottom: 1.5rem; padding: 1.25rem; border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: 10px; }
.statement-wallet-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
.statement-wallet-actions { min-width: 300px; }
.statement-period-totals { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; border-top:1px solid var(--border); padding-top:1rem; margin-top:1rem; }
.statement-period-totals small { display:block; color:var(--text-muted); margin-bottom:.35rem; }
.statement-period-totals strong { display:block; }
@media(max-width:600px) { .statement-wallet-actions { width:100%; min-width:0; } .statement-period-totals { grid-template-columns:1fr; } }

/* Payment navigation: retain readable link colours before and after visiting. */
a.payment-notice, a.payment-notice:visited {
    display:flex; align-items:center; justify-content:space-between; gap:1.25rem;
    padding:1.1rem 1.4rem; border:1px solid var(--border); border-left:4px solid var(--yellow);
    border-radius:12px; background:var(--yellow-bg); color:var(--text-primary); text-decoration:none;
    transition:border-color .15s ease, background .15s ease;
}
a.payment-notice:hover { border-color:var(--yellow); }
a.payment-notice > span:first-child { font-size:.9rem; font-weight:600; }
.payment-notice-totals { display:flex; align-items:center; gap:1.5rem; flex-wrap:wrap; }
.payment-notice-totals > span:not(.payment-notice-action) { display:grid; gap:.2rem; color:var(--text-secondary); font-size:.72rem; text-transform:uppercase; letter-spacing:.06em; }
.payment-notice-totals strong { color:var(--text-primary); font-size:1rem; letter-spacing:0; font-variant-numeric:tabular-nums; }
.payment-notice-action { display:inline-flex; align-items:center; gap:.65rem; padding:.6rem .85rem; border:1px solid var(--border); border-radius:8px; color:var(--text-primary); background:var(--card); font-size:.8rem; font-weight:600; white-space:nowrap; }
.payment-notice-action > span { color:var(--yellow); font-size:1.1rem; }
.payment-wallet-overview { display:flex; align-items:center; gap:.75rem 1.5rem; flex-wrap:wrap; padding:1rem 1.15rem; margin:1rem 0 .85rem; background:var(--secondary); border:1px solid var(--border); border-radius:10px; font-size:.85rem; font-variant-numeric:tabular-nums; }
.payment-wallet-name { flex-basis:100%; font-size:.95rem; }
.payment-wallet-overview > span { color:var(--text-secondary); }
.payment-wallet-overview .payment-wallet-held { color:var(--yellow); }
a.statement-shortcut, a.statement-shortcut:visited { display:inline-flex; align-items:center; gap:.75rem; padding:.65rem .95rem; border:1px solid var(--border); border-radius:8px; color:var(--text-primary); background:var(--secondary); font-size:.82rem; font-weight:600; text-decoration:none; transition:border-color .15s ease, background .15s ease; }
a.statement-shortcut > span { color:var(--primary); font-size:1rem; }
a.statement-shortcut:hover { border-color:var(--primary); background:var(--primary-light); }
a.statement-shortcut:focus-visible, a.payment-notice:focus-visible { outline:2px solid var(--primary); outline-offset:4px; }
@media(max-width:850px) { a.payment-notice { align-items:flex-start; flex-direction:column; gap:1rem; } .payment-notice-totals { width:100%; gap:1rem; } .payment-notice-action { margin-left:auto; } }
@media(max-width:480px) { .payment-notice-action { margin-left:0; } .payment-wallet-overview { align-items:flex-start; flex-direction:column; gap:.6rem; } }
