:root {
    --primary: #8db600;
    --primary-dark: #7aa000;
    --primary-light: #a3cc1a;
    --secondary: #1c384e;
    --secondary-dark: #0f2435;
    --accent: #ee5d3f;
    --white: #ffffff;
    --bg: #f8f9fa;
    --text: #1c384e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --sidebar-bg: #1c384e;
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --sidebar-bg-active: rgba(141, 182, 0, 0.15);
    --radius: 8px;
    --app-header-height: 84px;
    --app-footer-height: 58px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    font-weight: 500;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--sidebar-text);
    background: var(--sidebar-bg);
}

.sidebar-header {
    height: var(--app-header-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header .logo {
    max-width: 150px;
    max-height: 38px;
}

.sidebar-brand-text {
    max-width: 100%;
    text-align: center;
    line-height: 1.15;
}

.sidebar-brand-name {
    overflow: hidden;
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-brand-tagline {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.65);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-left: 3px solid transparent;
    color: var(--sidebar-text);
    font-size: 14px;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: var(--white);
    background: var(--sidebar-bg-active);
    border-left-color: var(--primary);
}

.sidebar-nav .nav-link i { width: 20px; font-size: 16px; }

.app-sidebar .sidebar-section {
    padding: 16px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.app-sidebar .nav-group {
    margin-bottom: 1px;
}

.app-sidebar .nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 14px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    text-align: left;
    font-family: inherit;
}

.app-sidebar .nav-group-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.app-sidebar .nav-group-toggle.active {
    color: var(--white);
    border-left-color: var(--primary);
}

.app-sidebar .nav-group-toggle i:first-child {
    font-size: 16px;
    width: 20px;
}

.app-sidebar .nav-group-toggle span {
    flex: 1;
}

.app-sidebar .nav-group-toggle .chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.app-sidebar .nav-group-toggle .chevron.rotated {
    transform: rotate(180deg);
}

.app-sidebar .nav-group-children {
    background: rgba(0, 0, 0, 0.15);
}

.app-sidebar .nav-child-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 8px 52px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.app-sidebar .nav-child-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.app-sidebar .nav-child-link.active {
    background: var(--sidebar-bg-active);
    color: var(--white);
    border-left-color: var(--primary);
    font-weight: 500;
}

.app-sidebar .soon-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    margin-left: auto;
}

.app-sidebar .nav-child-link .soon-dot {
    margin-left: 6px;
}

.app-sidebar .sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.app-sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.app-sidebar .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-footer {
    min-height: var(--app-footer-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    opacity: 0.7;
}

.sidebar-footer a {
    color: var(--sidebar-text);
    text-decoration: none;
}

.app-topbar,
.app-content,
.app-footer {
    margin-left: 260px;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    min-height: var(--app-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.app-topbar .breadcrumb {
    margin: 0;
    font-size: 13px;
}

.search-area {
    flex: 1;
    max-width: 400px;
}

.search-area .form-control {
    background: var(--bg);
    border-color: var(--border);
    font-size: 13px;
}

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

.notification-btn {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
}

.notification-btn .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent);
    font-size: 9px;
}

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

.user-info .name {
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
}

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

.app-content {
    min-height: calc(100vh - var(--app-header-height) - var(--app-footer-height));
    padding: 24px;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    color: var(--secondary);
    font-size: 22px;
    font-weight: 600;
}

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

.app-footer {
    min-height: var(--app-footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    color: var(--text-muted);
    background: var(--white);
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
}

/* Settings section layout */
.settings-wrapper {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    min-height: calc(100vh - 200px);
}

.settings-sidebar {
    flex: 0 0 230px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    overflow: hidden;
    position: sticky;
    top: calc(var(--app-header-height) + 16px);
}

.settings-sidebar-header {
    padding: 16px 20px;
    background: var(--secondary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.settings-nav-link {
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.settings-nav-link:hover {
    background: var(--bg);
    color: var(--secondary);
}

.settings-nav-link.active {
    background: rgba(141, 182, 0, 0.08);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.settings-nav-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.settings-content {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    padding: 28px;
    min-width: 0;
}

.settings-page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.settings-page-header h2 {
    color: var(--secondary);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.settings-page-header .description {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.settings-form .form-group {
    margin-bottom: 18px;
}

.settings-form .form-group label {
    font-weight: 500;
    font-size: 13px;
    color: var(--secondary);
    margin-bottom: 6px;
    display: block;
}

.settings-form .helper-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.settings-form .form-control,
.settings-form .form-select {
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
}

.settings-form .form-control:focus,
.settings-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(141, 182, 0, 0.1);
}

.settings-form .form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

/* Dashboard */
.dashboard-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.sample-data-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.kpi-section-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin: 24px 0 12px;
}

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

.kpi-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    padding: 20px;
    border-left: 4px solid var(--primary);
}

.kpi-card.money { border-left-color: #8db600; }
.kpi-card.compliance { border-left-color: #ee5d3f; }
.kpi-card.clients { border-left-color: #1c384e; }
.kpi-card.operational { border-left-color: #f0a020; }

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1.1;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.kpi-sub.up { color: #16a34a; }
.kpi-sub.down { color: #dc2626; }
.kpi-sub.alert { color: var(--accent); font-weight: 600; }

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.charts-row-2,
.lists-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.lists-row {
    margin-top: 24px;
}

.chart-card,
.list-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    padding: 20px;
}

.chart-card h3,
.list-card h3 {
    font-size: 15px;
    color: var(--secondary);
    font-weight: 600;
    margin: 0 0 16px;
}

.list-card h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-card canvas {
    max-height: 280px;
}

.deadline-item,
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.deadline-item:last-child,
.activity-item:last-child {
    border-bottom: none;
}

.deadline-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.deadline-badge.gst { background: #fef3c7; color: #92400e; }
.deadline-badge.pf { background: #dbeafe; color: #1e40af; }
.deadline-badge.esi { background: #fce7f3; color: #9d174d; }
.deadline-badge.tds { background: #e0e7ff; color: #3730a3; }
.deadline-badge.income-tax { background: #d1fae5; color: #065f46; }

.deadline-info {
    flex: 1;
}

.deadline-client {
    font-size: 14px;
    font-weight: 500;
    color: var(--secondary);
}

.deadline-service {
    font-size: 12px;
    color: var(--text-muted);
}

.deadline-due {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

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

.activity-text {
    flex: 1;
    font-size: 13px;
    color: var(--text);
}

.activity-text strong {
    color: var(--secondary);
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
}

.upload-preview {
    margin: 10px 0;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-preview img {
    max-height: 60px;
    max-width: 200px;
    background: white;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.badge-uploaded {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
}

.auth-left {
    position: relative;
    overflow: hidden;
    flex: 0 0 58%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 60px;
    color: var(--white);
    background: linear-gradient(135deg, #6f9000 0%, #8db600 60%, #a3cc1a 100%);
}

.auth-left::before,
.auth-left::after,
.decorative-circle {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.auth-left::before { width: 350px; height: 350px; top: 60px; left: 20%; }
.auth-left::after { width: 200px; height: 200px; bottom: 100px; left: 30%; }
.decorative-circle.c1 { width: 150px; height: 150px; top: 30%; left: 5%; }
.decorative-circle.c2 { width: 100px; height: 100px; bottom: 20%; right: 15%; }

.brand-block,
.hero-block,
.footer-line {
    position: relative;
    z-index: 1;
}

.auth-left .brand-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.brand-block .logo {
    height: 60px;
}

.platform-badge {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    font-size: 13px;
}

.hero-eyebrow {
    margin-bottom: 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero-headline {
    max-width: 640px;
    margin-bottom: 16px;
    font-size: 44px;
    line-height: 1.15;
    font-weight: 700;
}

.hero-subtitle {
    max-width: 520px;
    font-size: 15px;
    line-height: 1.5;
    opacity: 0.9;
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 28px;
}

.feature-card {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.08);
}

.feature-card .title {
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
}

.feature-card .description {
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.85;
}

.footer-line {
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 12px;
    opacity: 0.85;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--white);
}

.auth-form-container {
    width: 100%;
    max-width: 380px;
}

.form-logo {
    margin-bottom: 24px;
    text-align: center;
}

.form-logo img {
    height: 50px;
}

.form-title {
    margin-bottom: 4px;
    text-align: center;
    color: var(--secondary);
    font-size: 26px;
    font-weight: 700;
}

.form-subtitle {
    margin-bottom: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.form-label {
    margin-bottom: 6px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
}

.auth-form-container .form-control {
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: #f4f6fa;
    font-size: 14px;
}

.auth-form-container .form-control:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(141, 182, 0, 0.1);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
}

.auth-footer-link {
    margin-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.clients-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.client-filter-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 180px auto auto;
    gap: 10px;
    margin-bottom: 16px;
}

.client-search {
    position: relative;
}

.client-search i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.client-search .form-control {
    padding-left: 36px;
}

.data-panel,
.detail-panel {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
}

.client-table {
    margin-bottom: 0;
}

.client-table th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.table-primary-link {
    color: var(--secondary);
    font-weight: 600;
    text-decoration: none;
}

.table-primary-link:hover {
    color: var(--primary-dark);
}

.table-subtext {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
}

.status-badge,
.compliance-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active,
.compliance-badge.on {
    color: #3f6212;
    background: #ecfccb;
}

.status-badge.inactive,
.compliance-badge.off {
    color: #6b7280;
    background: #f3f4f6;
}

.empty-table,
.placeholder-strip {
    padding: 22px;
    color: var(--text-muted);
    text-align: center;
}

.pagination-row {
    margin-top: 14px;
}

.form-section-title {
    margin: 20px 0 12px;
    color: var(--secondary);
    font-size: 14px;
    font-weight: 700;
}

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

.flag-check,
.contact-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
}

.contacts-editor {
    display: grid;
    gap: 10px;
}

.contact-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr)) 96px auto;
    gap: 10px;
    align-items: center;
}

.client-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.client-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    gap: 16px;
}

.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.detail-panel-header h2 {
    margin: 0;
    color: var(--secondary);
    font-size: 18px;
    font-weight: 700;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.detail-list span,
.address-block span {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 12px;
}

.detail-list strong {
    color: var(--text);
    font-size: 14px;
}

.compliance-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.address-block p,
.notes-text {
    margin: 0;
    color: var(--text);
    line-height: 1.6;
}

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

.contact-card {
    display: grid;
    grid-template-columns: 1fr minmax(120px, auto) minmax(160px, auto);
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

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

.summary-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
}

.summary-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.summary-card strong {
    color: var(--secondary);
    font-size: 24px;
}

.status-badge.invoice-muted { color: #4b5563; background: #f3f4f6; }
.status-badge.invoice-active { color: #1d4ed8; background: #dbeafe; }
.status-badge.invoice-warning { color: #92400e; background: #fef3c7; }
.status-badge.invoice-success { color: #166534; background: #dcfce7; }
.status-badge.invoice-danger { color: #991b1b; background: #fee2e2; }

.invoice-items-editor {
    display: grid;
    gap: 10px;
}

.invoice-item-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 110px 140px 150px auto;
    gap: 10px;
    align-items: center;
}

.line-amount {
    color: var(--secondary);
    font-size: 14px;
    font-weight: 700;
    text-align: right;
}

.invoice-total-panel {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fbfcfd;
}

.invoice-total-panel span,
.invoice-totals-readonly span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.invoice-total-panel strong,
.invoice-totals-readonly strong {
    color: var(--secondary);
    font-size: 15px;
}

.invoice-total-row strong {
    font-size: 20px;
}

.invoice-balance-large {
    color: var(--secondary);
    font-size: 34px;
    font-weight: 700;
}

.invoice-totals-readonly {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    text-align: right;
}

.payment-form {
    display: grid;
    grid-template-columns: 170px 150px 160px minmax(180px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fbfcfd;
}

.status-change-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.period-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(360px, auto);
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
}

.period-panel span,
.period-label {
    color: var(--text-muted);
    font-size: 12px;
}

.period-actions,
.custom-period-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-link {
    min-width: 64px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    text-align: center;
    text-decoration: none;
}

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

.onboarding-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
}

.onboarding-panel h2 {
    margin-bottom: 4px;
    color: var(--secondary);
    font-size: 20px;
}

.onboarding-panel p {
    margin: 0;
    color: var(--text-muted);
}

.live-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi-card.outstanding {
    border-left: 4px solid var(--accent);
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--text-muted);
    text-align: center;
}

.dashboard-table-card h3 a {
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
}

@media (max-width: 992px) {
    .auth-left { display: none; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row,
    .charts-row-2,
    .lists-row { grid-template-columns: 1fr; }
    .client-filter-bar,
    .client-detail-grid,
    .contact-row,
    .contact-card { grid-template-columns: 1fr; }
    .flag-grid,
    .invoice-summary-grid,
    .invoice-item-row,
    .payment-form,
    .period-panel,
    .invoice-total-panel,
    .invoice-totals-readonly { grid-template-columns: 1fr; }
    .period-actions,
    .custom-period-form,
    .onboarding-panel { flex-wrap: wrap; }
    .live-kpi-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-topbar,
    .app-content,
    .app-footer { margin-left: 0; }
}

@media (max-width: 576px) {
    .dashboard-greeting {
        align-items: flex-start;
        flex-direction: column;
    }

    .kpi-grid { grid-template-columns: 1fr; }
    .clients-header { flex-direction: column; }
    .flag-grid,
    .detail-list { grid-template-columns: 1fr; }
}
