        :root {
            --background: #ffffff;
            --foreground: #141a1f;
            --card: #ffffff;
            --card-foreground: #141a1f;
            --primary: #00a88c;
            --primary-foreground: #fafafa;
            --secondary: #e3e6e8;
            --secondary-foreground: #141a1f;
            --muted: #f4f5f6;
            --muted-foreground: #484f56;
            --border: #e1e7ef;
            --input: #e1e7ef;
            --ring: #00a88c;
            --destructive: #ef4343;
            --destructive-foreground: #fafafa;
            --radius: 0.5rem;
            --shadow-sm: 0 0.125rem 0.5rem 0 hsl(0 0 0 / 0.10), 0 1px 2px -1px hsl(0 0 0 / 0.10);
            --shadow-md: 0 0.125rem 0.5rem 0 hsl(0 0 0 / 0.10), 0 2px 4px -1px hsl(0 0 0 / 0.10);
        }

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

        body {
            font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: var(--muted);
            color: var(--foreground);
            padding: 2rem 1rem;
            line-height: 1.6;
        }

        #appRoot {
            display: none;
        }

        .auth-gate {
            min-height: calc(100vh - 4rem);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .auth-card {
            width: 100%;
            max-width: 520px;
            background: var(--card);
            border-radius: var(--radius);
            padding: 2rem;
            box-shadow: var(--shadow-sm);
            border: 1px solid var(--border);
        }

        .auth-title {
            font-size: 1.6rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            color: var(--foreground);
        }

        .auth-subtitle {
            color: var(--muted-foreground);
            margin-bottom: 1.5rem;
            font-size: 0.95rem;
        }

        .auth-message {
            margin-top: 1rem;
            padding: 0.75rem 1rem;
            border-radius: var(--radius);
            font-size: 0.9rem;
            display: none;
        }

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

        .auth-message.error {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fecaca;
        }

        .auth-message.success {
            background: #dcfce7;
            color: #166534;
            border: 1px solid #bbf7d0;
        }

        .container {
            max-width: 1300px;
            margin: 0 auto;
        }

        h1 {
            font-size: 2rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--foreground);
        }

        .subtitle {
            color: var(--muted-foreground);
            margin-bottom: 2rem;
            font-size: 0.95rem;
        }

        .page-header-row {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 1rem;
        }

        .profile-menu-wrap {
            position: relative;
            flex-shrink: 0;
            margin-top: 0.1rem;
        }

        .profile-menu-btn {
            width: 2.1rem;
            height: 2.1rem;
            border: 1px solid var(--border);
            border-radius: 999px;
            background: var(--muted);
            color: var(--muted-foreground);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.15s ease;
        }

        .profile-menu-btn svg {
            width: 1rem;
            height: 1rem;
            fill: none;
            stroke: currentColor;
            stroke-width: 1.8;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .profile-menu-btn:hover {
            background: var(--background);
            color: var(--foreground);
            border-color: var(--ring);
        }

        .profile-menu-btn:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 168, 140, 0.2);
            border-color: var(--ring);
        }

        .profile-menu-popover {
            position: absolute;
            right: 0;
            top: calc(100% + 0.45rem);
            min-width: 120px;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) - 2px);
            box-shadow: var(--shadow-md);
            padding: 0.3rem;
            display: none;
            z-index: 1200;
        }

        .profile-menu-popover.open {
            display: block;
        }

        .profile-menu-item {
            width: 100%;
            border: none;
            background: transparent;
            color: var(--foreground);
            font-family: inherit;
            font-size: 0.85rem;
            text-align: left;
            border-radius: 0.45rem;
            padding: 0.45rem 0.55rem;
            cursor: pointer;
        }

        .profile-menu-item:hover {
            background: var(--muted);
        }

        .section {
            background: var(--card);
            border-radius: var(--radius);
            padding: 2rem;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow-sm);
            border: 1px solid var(--border);
        }

        .section-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 1.5rem;
            color: var(--foreground);
            padding-bottom: 0.75rem;
            border-bottom: 2px solid var(--primary);
        }

        .section-title-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            margin-bottom: 1.25rem;
            padding-bottom: 0.75rem;
            border-bottom: 2px solid var(--primary);
        }

        .section-title-inline {
            margin: 0;
            padding-bottom: 0;
            border-bottom: none;
        }

        .section-help-btn {
            width: 1.6rem;
            height: 1.6rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: var(--background);
            color: var(--muted-foreground);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.78rem;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            transition: all 0.15s ease;
            flex-shrink: 0;
        }

        .section-help-btn:hover {
            color: var(--foreground);
            border-color: var(--ring);
            background: var(--muted);
        }

        .section-help-btn:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 168, 140, 0.22);
            border-color: var(--ring);
        }

        .help-title-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--foreground);
            font-weight: 500;
            font-size: 0.9rem;
        }

        label .required {
            color: var(--destructive);
            margin-left: 0.25rem;
        }

        input, select, textarea {
            width: 100%;
            padding: 0.625rem 0.875rem;
            border: 1px solid var(--input);
            border-radius: calc(var(--radius) - 2px);
            font-size: 0.95rem;
            font-family: inherit;
            background: var(--background);
            color: var(--foreground);
            transition: all 0.2s;
        }

        input:focus, select:focus, textarea:focus {
            outline: none;
            border-color: var(--ring);
            box-shadow: 0 0 0 3px rgba(0, 168, 140, 0.1);
        }

        input:disabled, select:disabled, textarea:disabled {
            background: var(--muted);
            color: var(--muted-foreground);
            cursor: not-allowed;
        }

        select {
            cursor: pointer;
        }

        textarea {
            resize: vertical;
            min-height: 160px;
        }

        .info-grid {
            display: none;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border);
        }

        .info-grid.show {
            display: grid;
        }

        .info-item {
            padding: 0.75rem;
            background: var(--muted);
            border-radius: calc(var(--radius) - 4px);
        }

        .info-label {
            font-size: 0.8rem;
            color: var(--muted-foreground);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.025em;
            margin-bottom: 0.25rem;
        }

        .info-value {
            font-size: 0.95rem;
            color: var(--foreground);
            font-weight: 500;
        }

        .form-section {
            display: none;
        }

        .form-section.show {
            display: block;
        }

        .form-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
        }

        button[type="submit"] {
            width: 100%;
            padding: 0.75rem 1.5rem;
            background: var(--primary);
            color: var(--primary-foreground);
            border: none;
            border-radius: var(--radius);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }

        button[type="submit"]:hover {
            background: #008c75;
            transform: translateY(-1px);
            box-shadow: var(--shadow-md);
        }

        button[type="submit"]:active {
            transform: translateY(0);
        }

        button[type="submit"]:disabled {
            background: var(--secondary);
            color: var(--secondary-foreground);
            cursor: not-allowed;
            transform: none;
        }

        .message {
            padding: 1rem 1.25rem;
            border-radius: var(--radius);
            margin-top: 1.5rem;
            font-size: 0.95rem;
            display: none;
            align-items: center;
            gap: 0.75rem;
        }

        .message.show {
            display: flex;
        }

        .message.success {
            background: #d1fae5;
            color: #065f46;
            border: 1px solid #6ee7b7;
        }

        .message.error {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fca5a5;
        }

        .loading {
            display: none;
            text-align: center;
            margin-top: 1rem;
            color: var(--primary);
            font-weight: 500;
        }

        .loading.show {
            display: block;
        }

        .helper-text {
            font-size: 0.85rem;
            color: var(--muted-foreground);
            margin-top: 0.25rem;
        }

        .button-group {
            display: flex;
            gap: 0.5rem;
        }

        .toggle-btn {
            padding: 0.625rem 1rem;
            background: var(--background);
            color: var(--foreground);
            border: 2px solid var(--input);
            border-radius: calc(var(--radius) - 2px);
            font-size: 0.95rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
            min-width: 120px;
        }

        .toggle-btn:hover {
            border-color: var(--ring);
            background: var(--muted);
        }

        .toggle-btn.active {
            background: var(--primary);
            color: var(--primary-foreground);
            border-color: var(--primary);
        }

        .toggle-btn.active:hover {
            background: #008c75;
            border-color: #008c75;
        }

        .month-filter {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
        }

        .month-btn {
            flex: 1;
            min-width: 120px;
            padding: 1rem 1.5rem;
            background: var(--background);
            color: var(--foreground);
            border: 2px solid var(--border);
            border-radius: var(--radius);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }

        .month-btn:hover {
            border-color: var(--primary);
            background: var(--muted);
            transform: translateY(-2px);
            box-shadow: var(--shadow-sm);
        }

        .month-btn.active {
            background: var(--primary);
            color: var(--primary-foreground);
            border-color: var(--primary);
            box-shadow: var(--shadow-md);
        }

        .month-btn.active:hover {
            background: #008c75;
            border-color: #008c75;
        }

        .month-filter-compact-wrap {
            margin-bottom: 1rem;
        }

        .month-filter-compact {
            justify-content: flex-start;
            gap: 0.45rem;
        }

        .month-btn-compact {
            flex: 0 0 auto;
            min-width: 88px;
            padding: 0.4rem 0.65rem;
            border-width: 1px;
            border-radius: 10px;
            font-size: 0.76rem;
            font-weight: 600;
            line-height: 1.1;
        }

        .month-btn-compact:hover {
            transform: translateY(-1px);
        }

        .loading-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.95);
            z-index: 9999;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            gap: 1rem;
        }

        .loading-overlay.show {
            display: flex;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 4px solid var(--border);
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .loading-overlay p {
            color: var(--foreground);
            font-size: 1rem;
            font-weight: 500;
        }

        .searchable-dropdown {
            position: relative;
        }

        .searchable-dropdown input[type="text"] {
            padding-right: 2.5rem;
        }

        .dropdown-icon {
            position: absolute;
            right: 0.875rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted-foreground);
            pointer-events: none;
            transition: transform 0.2s;
        }

        .searchable-dropdown.open .dropdown-icon {
            transform: translateY(-50%) rotate(180deg);
        }

        .dropdown-list {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            max-height: 300px;
            overflow-y: auto;
            background: var(--background);
            border: 1px solid var(--input);
            border-radius: calc(var(--radius) - 2px);
            margin-top: 0.25rem;
            box-shadow: var(--shadow-md);
            z-index: 1000;
        }

        .dropdown-list.show {
            display: block;
        }

        .dropdown-item {
            padding: 0.875rem 1rem;
            cursor: pointer;
            transition: background 0.15s;
            border-bottom: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }

        .dropdown-id {
            font-weight: 700;
            color: var(--primary);
            font-size: 0.95rem;
        }

        .dropdown-name {
            font-weight: 600;
            color: var(--foreground);
            font-size: 0.85rem;
            line-height: 1.3;
        }

        .dropdown-account {
            color: var(--muted-foreground);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.025em;
            font-weight: 500;
        }

        .dropdown-meta {
            margin-top: 0.2rem;
            display: flex;
            flex-wrap: wrap;
            gap: 0.25rem 0.5rem;
            font-size: 0.72rem;
            color: var(--muted-foreground);
        }

        .dropdown-meta strong {
            font-weight: 700;
            color: var(--foreground);
        }

        .dropdown-status {
            margin-top: 0.2rem;
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            flex-wrap: wrap;
        }

        .status-pill {
            display: inline-block;
            padding: 0.15rem 0.55rem;
            border-radius: 999px;
            font-size: 0.72rem;
            font-weight: 700;
            line-height: 1.2;
            border: 1px solid transparent;
            text-transform: none;
        }

        .status-pill-new {
            background: #dcfce7;
            border-color: #bbf7d0;
            color: #166534;
        }

        .status-pill-existing {
            background: #e5e7eb;
            border-color: #d1d5db;
            color: #374151;
        }

        .status-pill-unknown {
            background: #f3f4f6;
            border-color: #e5e7eb;
            color: #6b7280;
        }

        .month-pill {
            display: inline-block;
            padding: 0.15rem 0.5rem;
            border-radius: 999px;
            font-size: 0.72rem;
            font-weight: 600;
            line-height: 1.2;
            background: #eff6ff;
            border: 1px solid #dbeafe;
            color: #1e3a8a;
            text-transform: none;
        }

        .detail-pill {
            display: inline-block;
            padding: 0.15rem 0.5rem;
            border-radius: 999px;
            font-size: 0.72rem;
            font-weight: 600;
            line-height: 1.2;
            background: #f3f4f6;
            border: 1px solid #e5e7eb;
            color: #374151;
            text-transform: none;
            max-width: 13rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .dropdown-item:last-child {
            border-bottom: none;
        }

        .dropdown-item:hover {
            background: var(--muted);
        }

        .dropdown-item.selected {
            background: var(--primary);
            color: var(--primary-foreground);
        }

        .dropdown-item.selected .dropdown-id,
        .dropdown-item.selected .dropdown-name,
        .dropdown-item.selected .dropdown-account {
            color: inherit;
        }

        .dropdown-empty {
            padding: 0.75rem 0.875rem;
            color: var(--muted-foreground);
            text-align: center;
            font-style: italic;
        }

        .small-spinner {
            width: 20px;
            height: 20px;
            border: 3px solid var(--border);
            border-top: 3px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @media (max-width: 640px) {
            body {
                padding: 1rem 0.5rem;
            }

            .section {
                padding: 1.5rem;
            }

            .form-row {
                grid-template-columns: 1fr;
            }

            h1 {
                font-size: 1.5rem;
            }

            .month-filter {
                flex-direction: column;
            }

            .month-btn {
                min-width: 100%;
            }

            .month-filter-compact {
                flex-direction: row;
                justify-content: flex-start;
                gap: 0.4rem;
            }

            .month-btn-compact {
                min-width: 72px;
                flex: 0 0 auto;
            }

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

            .global-actions {
                justify-content: stretch;
            }

            .export-btn {
                width: 100%;
            }

            .excel-upload-actions {
                flex-direction: column-reverse;
                align-items: stretch;
            }

            .excel-upload-cancel-btn {
                width: 100%;
            }

            #excelUploadSubmitBtn {
                width: 100%;
            }
        }

        /* History Section */
        .history-section {
            display: none;
        }

        .history-section.show {
            display: block;
        }

        .history-accordion {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .accordion-item {
            border: 1px solid var(--border);
            border-radius: var(--radius);
            overflow: hidden;
            background: var(--background);
        }

        .accordion-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.875rem 1.25rem;
            background: var(--muted);
            cursor: pointer;
            user-select: none;
            transition: background 0.2s;
            border: none;
            width: 100%;
            text-align: left;
            font-family: inherit;
            font-size: 0.95rem;
            color: var(--foreground);
        }

        .accordion-header:hover {
            background: var(--secondary);
        }

        .accordion-header-left {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            font-weight: 600;
        }

        .accordion-badge {
            display: inline-block;
            padding: 0.15rem 0.6rem;
            border-radius: 999px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .accordion-badge.latest {
            background: var(--primary);
            color: var(--primary-foreground);
        }

        .accordion-badge.updated {
            background: #dcfce7;
            color: #166534;
            border: 1px solid #bbf7d0;
        }

        .accordion-badge.changed {
            background: #fef3c7;
            color: #92400e;
        }

        .accordion-badge.no-change {
            background: var(--muted);
            color: var(--muted-foreground);
        }

        .accordion-chevron {
            width: 20px;
            height: 20px;
            transition: transform 0.25s ease;
            color: var(--muted-foreground);
            flex-shrink: 0;
        }

        .accordion-item.open .accordion-chevron {
            transform: rotate(180deg);
        }

        .accordion-body {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }

        .accordion-item.open .accordion-body {
            max-height: 2000px;
        }

        .accordion-content {
            padding: 1rem 1.25rem;
            border-top: 1px solid var(--border);
        }

        .history-fields {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 0.75rem;
        }

        .history-field {
            padding: 0.625rem 0.875rem;
            background: var(--muted);
            border-radius: calc(var(--radius) - 4px);
            border-left: 3px solid var(--border);
        }

        .history-field.changed {
            border-left-color: #f59e0b;
            background: #fffbeb;
        }

        .history-field-label {
            font-size: 0.75rem;
            color: var(--muted-foreground);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.025em;
            margin-bottom: 0.2rem;
        }

        .history-field-value {
            font-size: 0.9rem;
            color: var(--foreground);
            font-weight: 500;
            word-break: break-word;
            white-space: pre-wrap;
        }

        .history-field-value.empty {
            color: var(--muted-foreground);
            font-style: italic;
        }

        .history-change-from {
            font-size: 0.8rem;
            color: #92400e;
            margin-top: 0.25rem;
        }

        .history-empty {
            text-align: center;
            padding: 2rem;
            color: var(--muted-foreground);
        }

        /* Tab System */
        .tabs {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 2rem;
            border-bottom: 2px solid var(--border);
        }

        .tab-btn {
            padding: 0.75rem 1.5rem;
            background: transparent;
            color: var(--muted-foreground);
            border: none;
            border-bottom: 3px solid transparent;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
            margin-bottom: -2px;
        }

        .tab-btn:hover {
            color: var(--foreground);
            background: var(--muted);
        }

        .tab-btn.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }

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

        .tab-loading {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .mini-spinner {
            width: 14px;
            height: 14px;
            border: 2px solid var(--border);
            border-top: 2px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            display: inline-block;
        }

        #dashboardTabText {
            display: none;
        }

        .tab-btn:not(:disabled) #dashboardTabText {
            display: inline;
        }

        .tab-btn:not(:disabled) #dashboardTabLoading {
            display: none;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        .global-actions {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.75rem;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
        }

        .export-btn {
            padding: 0.625rem 1.25rem;
            background: var(--primary);
            color: var(--primary-foreground);
            border: none;
            border-radius: var(--radius);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }

        .export-btn:hover {
            background: #008c75;
            transform: translateY(-1px);
            box-shadow: var(--shadow-sm);
        }

        .export-btn.secondary-btn {
            background: #ffffff;
            color: #111827;
            border: 1px solid var(--primary);
        }

        .export-btn.secondary-btn:hover {
            background: #f8fafc;
            color: #111827;
            border-color: #008c75;
        }

        .export-btn:disabled {
            background: var(--secondary);
            color: var(--secondary-foreground);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .export-status {
            font-size: 0.85rem;
            color: var(--muted-foreground);
            min-height: 1.5em;
        }

        .export-status.success {
            color: #166534;
        }

        .export-status.error {
            color: #991b1b;
        }

        .export-status.info {
            color: var(--primary);
        }

        .export-status.warning {
            color: #9a520a;
        }

        .excel-upload-modal {
            position: fixed;
            inset: 0;
            z-index: 21000;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .excel-upload-modal.open {
            display: flex;
        }

        .excel-upload-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(16, 24, 40, 0.66);
        }

        .excel-upload-content {
            position: relative;
            z-index: 1;
            width: min(560px, 92vw);
            background: #ffffff;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .excel-upload-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
        }

        .excel-upload-title {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--foreground);
        }

        .excel-upload-close {
            width: 2rem;
            height: 2rem;
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) - 2px);
            background: var(--background);
            color: var(--muted-foreground);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.1rem;
            line-height: 1;
            transition: all 0.15s ease;
        }

        .excel-upload-close:hover {
            color: var(--foreground);
            border-color: var(--ring);
            background: var(--muted);
        }

        .excel-upload-close:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 168, 140, 0.2);
            border-color: var(--ring);
        }

        .excel-upload-help {
            margin: 0;
            color: var(--muted-foreground);
            font-size: 0.85rem;
        }

        .excel-upload-input {
            width: 100%;
            border: 1px solid var(--input);
            border-radius: calc(var(--radius) - 4px);
            padding: 0.55rem 0.6rem;
            background: var(--background);
            color: var(--foreground);
            font-family: inherit;
            font-size: 0.9rem;
        }

        .excel-upload-selection {
            margin: 0;
            color: var(--muted-foreground);
            font-size: 0.85rem;
        }

        .excel-upload-file-list {
            margin: 0;
            padding: 0;
            list-style: none;
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            max-height: 180px;
            overflow: auto;
        }

        .excel-upload-file-list li {
            font-size: 0.83rem;
            color: var(--foreground);
            padding: 0.45rem 0.6rem;
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) - 4px);
            background: var(--muted);
            word-break: break-word;
        }

        .excel-upload-actions {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            gap: 0.6rem;
        }

        .section-help-modal {
            position: fixed;
            inset: 0;
            display: none;
            z-index: 11100;
        }

        .section-help-modal.open {
            display: block;
        }

        .section-help-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(15, 23, 42, 0.38);
        }

        .section-help-content {
            position: relative;
            width: min(640px, calc(100% - 2rem));
            margin: 6vh auto 0;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) + 2px);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
        }

        .section-help-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            padding: 0.9rem 1rem;
            border-bottom: 1px solid var(--border);
            background: var(--background);
        }

        .section-help-title {
            margin: 0;
            font-size: 1rem;
            font-weight: 700;
            color: var(--foreground);
        }

        .section-help-close {
            width: 1.9rem;
            height: 1.9rem;
            border: 1px solid var(--border);
            border-radius: 999px;
            background: var(--background);
            color: var(--muted-foreground);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.1rem;
            line-height: 1;
            transition: all 0.15s ease;
        }

        .section-help-close:hover {
            color: var(--foreground);
            border-color: var(--ring);
            background: var(--muted);
        }

        .section-help-body {
            padding: 1rem 1.15rem 1.2rem;
            color: var(--foreground);
            font-size: 0.92rem;
            line-height: 1.45;
        }

        .section-help-body h4 {
            margin: 0.1rem 0 0.5rem;
            font-size: 1rem;
        }

        .section-help-body p {
            margin: 0 0 0.6rem;
        }

        .section-help-body ul {
            margin: 0.25rem 0 0.65rem 1.1rem;
            padding: 0;
        }

        .section-help-body li {
            margin: 0 0 0.3rem;
        }

        .excel-upload-cancel-btn {
            padding: 0.625rem 1rem;
            border: 1px solid var(--border);
            background: var(--background);
            color: var(--foreground);
            border-radius: var(--radius);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }

        .excel-upload-cancel-btn:hover {
            background: var(--muted);
        }

        .excel-upload-cancel-btn:disabled {
            cursor: not-allowed;
            color: var(--muted-foreground);
            background: var(--muted);
        }

        /* Dashboard Styles */
        .dashboard-section {
            animation: fadeIn 0.3s ease-in;
        }

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

        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }

        .kpi-card {
            background: var(--card);
            padding: 1.5rem;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            box-shadow: var(--shadow-sm);
            text-align: center;
        }

        .kpi-label-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.4rem;
        }

        .kpi-label-row .kpi-label {
            margin-bottom: 0;
        }

        .kpi-label {
            font-size: 0.85rem;
            color: var(--muted-foreground);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.025em;
            margin-bottom: 0.5rem;
        }

        .kpi-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--primary);
        }

        .kpi-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
        }

        .kpi-mini-card {
            background: var(--card);
            padding: 1rem;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            text-align: center;
        }

        .kpi-mini-label-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.35rem;
        }

        .kpi-mini-label-row .kpi-mini-label {
            margin-bottom: 0;
        }

        .kpi-mini-label {
            font-size: 0.75rem;
            color: var(--muted-foreground);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.025em;
            margin-bottom: 0.5rem;
        }

        .kpi-mini-value {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--primary);
            margin-bottom: 0.25rem;
        }

        .kpi-mini-subtitle {
            font-size: 0.85rem;
            color: var(--muted-foreground);
            font-weight: 500;
        }

        .subsection-title {
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 1rem;
            color: var(--foreground);
        }

        .status-distribution {
            display: grid;
            gap: 0.75rem;
        }

        .source-distribution {
            display: grid;
            gap: 0.75rem;
        }

        .product-chart {
            display: grid;
            gap: 0.5rem;
        }

        .account-chart {
            display: grid;
            gap: 0.5rem;
        }

        .status-bar {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .status-label {
            min-width: 100px;
            font-weight: 500;
            color: var(--foreground);
            font-size: 0.9rem;
        }

        .status-bar-container {
            flex: 1;
            height: 32px;
            background: var(--muted);
            border-radius: 4px;
            overflow: hidden;
            position: relative;
        }

        .status-bar-fill {
            height: 100%;
            background: var(--primary);
            transition: width 0.5s ease;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            padding-right: 0.5rem;
        }

        .status-count {
            color: white;
            font-weight: 600;
            font-size: 0.85rem;
        }

        .owner-chart {
            display: grid;
            gap: 0.5rem;
        }

        .owner-bar {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.5rem;
            background: var(--muted);
            border-radius: 4px;
        }

        .owner-name {
            min-width: 150px;
            font-weight: 500;
            color: var(--foreground);
            font-size: 0.9rem;
        }

        .owner-bar-container {
            flex: 1;
            height: 24px;
            background: var(--background);
            border-radius: 4px;
            overflow: hidden;
        }

        .owner-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), #008c75);
            transition: width 0.5s ease;
        }

        .owner-count {
            min-width: 40px;
            text-align: right;
            font-weight: 600;
            color: var(--foreground);
            font-size: 0.9rem;
        }

        /* Checkbox Dropdown Styles */
        .checkbox-dropdown {
            position: relative;
            background-color: var(--background);
            border: 1px solid var(--input);
            border-radius: calc(var(--radius) - 2px);
            cursor: pointer;
            user-select: none;
            margin-bottom: 0.25rem;
        }
        
        .checkbox-dropdown.active {
            border-color: var(--ring);
            box-shadow: 0 0 0 3px rgba(0, 168, 140, 0.1);
        }

        .checkbox-dropdown-label {
            display: block;
            width: 100%;
            padding: 0.625rem 2rem 0.625rem 0.875rem;
            border: none;
            background: transparent;
            color: var(--foreground);
            font-size: 0.95rem;
            font-family: inherit;
            outline: none;
            cursor: pointer;
        }

        .checkbox-dropdown-label::placeholder {
            color: var(--muted-foreground);
        }

        .checkbox-dropdown::after {
            content: "";
            position: absolute;
            right: 0.875rem;
            top: 50%;
            width: 0.5em;
            height: 0.5em;
            border-right: 2px solid var(--muted-foreground);
            border-bottom: 2px solid var(--muted-foreground);
            transform: translateY(-50%) rotate(45deg);
            transition: transform 0.2s;
            pointer-events: none;
        }

        .checkbox-dropdown.active::after {
            transform: translateY(-50%) rotate(-135deg);
        }

        .checkbox-dropdown-list {
            position: absolute;
            top: 100%;
            left: -1px;
            right: -1px;
            background: var(--background);
            border: 1px solid var(--ring);
            border-top: none;
            border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
            max-height: min(400px, 50vh);
            overflow-y: auto;
            z-index: 100;
            display: none;
            padding: 0.5rem 0;
            box-shadow: var(--shadow-md);
        }

        .checkbox-dropdown.active .checkbox-dropdown-list {
            display: block;
        }

        .checkbox-dropdown-item {
            display: flex;
            align-items: center;
            padding: 0.5rem 0.875rem;
            cursor: pointer;
            transition: background 0.2s;
        }

        .checkbox-dropdown-item:hover {
            background-color: var(--muted);
        }

        .checkbox-dropdown-item input[type="checkbox"] {
            width: auto;
            margin-right: 0.75rem;
            accent-color: var(--primary);
            cursor: pointer;
        }
        
        .checkbox-dropdown-item label {
            margin-bottom: 0;
            font-weight: normal;
            cursor: pointer;
            flex: 1;
        }

        .selected-countries-hint {
            font-size: 0.85rem;
            color: var(--primary);
            min-height: 1.5em;
            font-style: italic;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .minimal-mode .minimal-hide {
            display: none !important;
        }

        .selection-hint {
            font-size: 0.85rem;
            color: var(--primary);
            min-height: 1.5em;
            font-style: italic;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .hint-clear-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            border: 1px solid var(--border);
            background: var(--background);
            color: var(--muted-foreground);
            border-radius: 999px;
            padding: 0.12rem 0.5rem;
            font-size: 0.72rem;
            font-style: normal;
            font-weight: 600;
            cursor: pointer;
            line-height: 1.1;
        }

        .hint-clear-btn:hover {
            background: var(--muted);
            color: var(--foreground);
        }

        .dashboard-filters {
            --dashboard-filter-control-height: 3rem;
            background: linear-gradient(135deg, rgba(0, 168, 140, 0.08), rgba(0, 168, 140, 0.02));
        }

        .dashboard-search-row {
            margin-bottom: 0.75rem;
        }

        .dashboard-filter-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 0.75rem;
        }

        .dashboard-filter-grid-primary {
            grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr);
            margin-bottom: 0.35rem;
        }

        .dashboard-month-quick {
            margin-bottom: 0.75rem;
            justify-content: flex-start;
        }

        .dashboard-more-toggle-wrap {
            display: flex;
            justify-content: center;
            margin: 0.15rem 0 0.75rem;
        }

        .dashboard-more-toggle {
            border: none;
            background: transparent;
            color: var(--muted-foreground);
            font-size: 0.86rem;
            text-decoration: underline;
            text-underline-offset: 2px;
            cursor: pointer;
            padding: 0;
        }

        .dashboard-more-toggle:hover {
            color: var(--foreground);
        }

        .dashboard-additional-filters {
            display: none;
            margin-bottom: 0.75rem;
        }

        .dashboard-additional-filters.open {
            display: block;
        }

        .dashboard-search-row input,
        .dashboard-filter-grid input[type="text"],
        .dashboard-filter-grid input[type="number"],
        .dashboard-filter-grid select,
        .dashboard-filter-grid .checkbox-dropdown-label {
            min-height: var(--dashboard-filter-control-height);
            font-size: 0.95rem;
        }

        .dashboard-search-row input,
        .dashboard-filter-grid input[type="text"],
        .dashboard-filter-grid input[type="number"],
        .dashboard-filter-grid select {
            padding-top: 0.75rem;
            padding-bottom: 0.75rem;
        }

        .dashboard-compact-filter {
            min-width: 170px;
        }

        .dashboard-filter-grid .checkbox-dropdown {
            min-height: var(--dashboard-filter-control-height);
        }

        .dashboard-filter-grid .checkbox-dropdown-label {
            padding: 0.75rem 2rem 0.75rem 0.875rem;
        }

        .dashboard-filter-hint {
            font-size: 0.75rem;
            color: var(--muted-foreground);
            min-height: 1.2rem;
            margin-top: 0.15rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .dashboard-filter-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.75rem;
            margin-top: 0.85rem;
        }

        .dashboard-filter-summary {
            color: var(--muted-foreground);
            font-size: 0.85rem;
            text-align: right;
        }

        .filter-chip-row {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-top: 0.75rem;
            min-height: 1.6rem;
        }

        .filter-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: var(--background);
            padding: 0.25rem 0.6rem;
            font-size: 0.78rem;
            color: var(--foreground);
        }

        .filter-chip button {
            border: none;
            background: transparent;
            color: var(--muted-foreground);
            cursor: pointer;
            font-size: 0.85rem;
            line-height: 1;
            padding: 0;
        }

        .dashboard-chart-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 1rem;
            margin-top: 1rem;
            align-items: start;
        }

        .dashboard-chart-grid > .chart-card {
            margin-bottom: 0;
        }

        .chart-card {
            padding: 1rem;
            display: flex;
            flex-direction: column;
            min-height: 352px;
            max-height: 352px;
            overflow: hidden;
        }

        .chart-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
        }

        .chart-card .subsection-title {
            margin-bottom: 0;
            line-height: 1.2;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .chart-title-wrap {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.45rem;
            min-width: 0;
            flex: 1;
        }

        .chart-expand-btn,
        .chart-modal-close {
            width: 2rem;
            height: 2rem;
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) - 2px);
            background: var(--background);
            color: var(--muted-foreground);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.15s ease;
            flex-shrink: 0;
        }

        .chart-expand-btn:hover,
        .chart-modal-close:hover {
            color: var(--foreground);
            border-color: var(--ring);
            background: var(--muted);
        }

        .chart-expand-btn:focus-visible,
        .chart-modal-close:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 168, 140, 0.2);
            border-color: var(--ring);
        }

        .chart-expand-btn svg,
        .chart-modal-close svg {
            width: 1rem;
            height: 1rem;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .chart-card canvas {
            display: block;
            width: 100% !important;
            height: 286px !important;
            max-height: 286px !important;
            min-height: 286px !important;
        }

        .drill-table-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
            margin-bottom: 0.75rem;
        }

        .dashboard-row-count {
            font-size: 0.85rem;
            color: var(--muted-foreground);
        }

        .drill-table-wrapper {
            width: 100%;
            max-height: 460px;
            overflow: auto;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--background);
        }

        .drill-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 980px;
        }

        .drill-table th,
        .drill-table td {
            text-align: left;
            border-bottom: 1px solid var(--border);
            padding: 0.55rem 0.6rem;
            font-size: 0.82rem;
            vertical-align: top;
        }

        .drill-table th {
            font-size: 0.76rem;
            text-transform: uppercase;
            letter-spacing: 0.02em;
            color: var(--muted-foreground);
            cursor: pointer;
            user-select: none;
            white-space: nowrap;
        }

        .drill-table tr:last-child td {
            border-bottom: none;
        }

        .drill-table-empty {
            text-align: center;
            color: var(--muted-foreground);
            font-style: italic;
        }

        body.chart-modal-open {
            overflow: hidden;
        }

        .chart-modal {
            position: fixed;
            inset: 0;
            z-index: 20000;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .chart-modal.open {
            display: flex;
        }

        .chart-modal-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(16, 24, 40, 0.66);
        }

        .chart-modal-content {
            position: relative;
            width: min(1240px, 94vw);
            max-height: 92vh;
            background: #ffffff;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            box-shadow: 0 28px 72px rgba(15, 23, 42, 0.35);
            display: flex;
            flex-direction: column;
            padding: 1rem;
            gap: 0.75rem;
            z-index: 1;
        }

        .chart-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
        }

        .chart-modal-title {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--foreground);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .chart-modal-body {
            position: relative;
            height: min(78vh, 820px);
        }

        .chart-modal-body canvas {
            width: 100% !important;
            height: 100% !important;
            max-height: none !important;
            min-height: 0 !important;
        }

        @media (max-width: 1100px) {
            .dashboard-chart-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 860px) {
            .dashboard-filter-grid-primary {
                grid-template-columns: 1fr;
            }

            .dashboard-filter-actions {
                flex-direction: column;
                align-items: stretch;
            }

            .dashboard-filter-summary {
                text-align: left;
            }

            .chart-card {
                min-height: 320px;
                max-height: 320px;
            }

            .chart-card canvas {
                height: 242px !important;
                max-height: 242px !important;
                min-height: 242px !important;
            }

            .chart-modal-content {
                width: 96vw;
                max-height: 95vh;
            }

            .chart-modal-body {
                height: min(72vh, 680px);
            }
        }
