/* ===== Douban Movie Design System ===== */
:root {
    /* Authentic Douban Movie Colors */
    /* Backgrounds */
    --bg-primary: #ffffff;
    /* Pure white for main content */
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f3f5;
    --bg-card: #ffffff;
    --bg-hover: #fafafa;
    --sidebar-bg: #f0f3f5;
    /* Matches table header */
    --sidebar-hover: #e8eef3;
    --sidebar-section: #e0e8ed;

    /* Douban Signature Blue */
    --accent-primary: #3377aa;
    /* Douban link blue */
    --accent-primary-hover: #2a5f8a;
    --accent-light: #e3f2fd;
    --accent-border: #d0e4f5;

    /* Douban Green (for success states) */
    --douban-green: #00b51d;
    --douban-green-hover: #009917;
    --douban-green-light: #e8f8ea;

    /* Text Colors */
    --text-primary: #111111;
    /* Douban primary text */
    --text-secondary: #666666;
    /* Douban secondary/meta text */
    --text-tertiary: #999999;
    --text-muted: #cccccc;
    --text-sidebar: #111111;
    /* Dark text on light sidebar */
    --text-sidebar-muted: #666666;
    /* Secondary text on sidebar */

    /* Section Headers */
    --header-green: #007722;
    /* Douban section header green */

    /* Semantic Colors */
    --success: #00b51d;
    --success-bg: #e8f8ea;
    --error: #e54847;
    --error-bg: #ffebee;
    --warning: #f57c00;
    --info: #3377aa;

    /* Spacing - Compact */
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.25rem;
    --spacing-2xl: 1.5rem;

    /* Layout */
    --sidebar-width: 280px;

    /* Border */
    --border-color: #eeeeee;
    /* Douban divider color */
    --border-light: #f0f0f0;
    --border-sidebar: #d0dae5;
    --border-input: #cccccc;
    --radius: 2px;
    /* Douban uses minimal radius */

    /* Shadows - Very Subtle (Douban style) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition: 200ms ease;
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 13px;
    overflow-x: hidden;
}

/* ===== Admin Layout ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-sidebar);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-sidebar);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #e0e8ed;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #b8c5d0;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #b8b8b8;
}

/* Sidebar Header */
.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-sidebar);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.sidebar-header .logo-icon {
    width: 42px;
    height: 42px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.sidebar-header h1,
.sidebar-header .brand-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: var(--text-sidebar-muted);
    margin-top: 2px;
}

.language-switcher {
    display: inline-flex;
    gap: 4px;
    margin-top: 6px;
}

.lang-button {
    border: 1px solid var(--border-sidebar);
    background: transparent;
    color: var(--text-sidebar-muted);
    font: inherit;
    font-size: 11px;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.lang-button:hover,
.lang-button.is-active {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: rgba(51, 119, 170, 0.06);
}

/* Sidebar Sections */
.sidebar-section {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-sidebar);
}

.sidebar-section-compact {
    padding-top: var(--spacing-md);
    padding-bottom: var(--spacing-md);
}

.sidebar-section-accent {
    background: rgba(51, 119, 170, 0.04);
}

.sidebar-section-aux {
    opacity: 0.92;
}

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

/* Drop Zone Compact */
.drop-zone-compact {
    background: var(--sidebar-section);
    border: 1px dashed var(--border-sidebar);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}

.drop-zone-compact:hover {
    border-color: var(--accent-primary);
    background: var(--sidebar-hover);
}

.drop-zone-compact.drag-over {
    border-color: var(--douban-green);
    background: rgba(0, 181, 29, 0.1);
    border-style: solid;
}

.upload-icon-small {
    width: 32px;
    height: 32px;
    color: var(--text-tertiary);
    margin: 0 auto var(--spacing-sm);
}

.drop-zone-compact:hover .upload-icon-small {
    color: var(--accent-primary);
}

.drop-hint {
    font-size: 12px;
    color: var(--text-sidebar-muted);
    margin-bottom: var(--spacing-md);
}

/* PayLah Secondary Drop Zone */
.drop-zone-secondary {
    border-style: dotted;
    opacity: 0.9;
}

.drop-zone-secondary:hover {
    opacity: 1;
}

.drop-zone-aux {
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.4);
}

.upload-icon-aux {
    width: 24px;
    height: 24px;
    margin-bottom: var(--spacing-xs);
}

.drop-hint-aux {
    font-size: 11px;
    margin-bottom: var(--spacing-sm);
}



/* Description match styling */
.desc-matched {
    color: var(--accent-primary) !important;
    font-weight: 500;
}

.desc-unmatched {
    color: #e54847 !important;
    /* Same as balance-invalid */
    font-weight: 600;
    background-color: rgba(229, 72, 71, 0.08);
}

/* Compact Stats */
.stat-compact {
    background: var(--sidebar-section);
    border-radius: var(--radius);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-compact:last-child {
    margin-bottom: 0;
}

.stat-compact .stat-label {
    font-size: 11px;
    color: var(--text-sidebar-muted);
}

.stat-value-small {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-primary);
}

.form-label {
    display: block;
    font-size: 11px;
    color: var(--text-sidebar-muted);
    margin-bottom: var(--spacing-xs);
}

.text-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: #f7f9fa;
    color: var(--text-primary);
    font: inherit;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(51, 119, 170, 0.1);
}

.helper-text {
    margin-top: var(--spacing-sm);
    font-size: 11px;
    color: var(--text-sidebar-muted);
    line-height: 1.4;
}

.credit-summary {
    padding: var(--spacing-sm) 0;
}

.credit-balance-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 12px;
}

.credit-balance-line strong {
    color: var(--accent-primary);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
    margin-bottom: var(--spacing-sm);
}

.btn-block:last-child {
    margin-bottom: 0;
}

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

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

.btn-primary:active {
    transform: translateY(1px);
}

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

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

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--bg-hover);
}

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

#downloadMoneyWizBtn {
    background: var(--bg-card);
    color: var(--accent-primary);
    border-color: var(--accent-border);
}

#downloadMoneyWizBtn:hover {
    background: #f7fbfe;
    color: var(--accent-primary-hover);
    border-color: var(--accent-primary);
}

.btn-secondary:disabled,
.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}



/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-sidebar);
    text-align: center;
}

.sidebar-footer p {
    font-size: 10px;
    color: var(--text-sidebar-muted);
}

.footer-links {
    margin-bottom: var(--spacing-xs);
}

.footer-links a {
    color: var(--accent-primary);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: var(--spacing-lg);
    min-height: 100vh;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-lg);
}

.breadcrumb a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition);
}

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

.breadcrumb .separator {
    margin: 0 var(--spacing-xs);
    color: var(--text-muted);
}

.breadcrumb .current {
    color: var(--text-secondary);
}

/* Welcome Message */
.welcome-message {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: var(--spacing-2xl);
    text-align: center;
    margin-top: var(--spacing-2xl);
}

.welcome-icon {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin: 0 auto var(--spacing-lg);
}

.welcome-message h1,
.welcome-message h2 {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.welcome-message p {
    font-size: 13px;
    color: var(--text-tertiary);
}

.landing-copy {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-light);
    text-align: left;
    display: grid;
    gap: var(--spacing-xl);
}

.landing-section h3 {
    margin-bottom: var(--spacing-sm);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.landing-section p {
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
    color: var(--text-secondary);
}

.landing-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
}

.landing-list li {
    margin-bottom: var(--spacing-xs);
    line-height: 1.6;
}

.faq-item + .faq-item {
    margin-top: var(--spacing-md);
}

.faq-item h4 {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.faq-item p {
    margin-bottom: 0;
}

.landing-more-link {
    margin-top: var(--spacing-md);
    font-size: 12px;
}

.landing-more-link a {
    color: var(--accent-primary);
    text-decoration: none;
}

.landing-more-link a:hover {
    text-decoration: underline;
}

.nav-link-block {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--border-sidebar);
    background: var(--sidebar-section);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition);
}

.nav-link-block:hover,
.nav-link-block.is-active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--sidebar-hover);
}

.content-page {
    margin-top: var(--spacing-xl);
}

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--spacing-2xl);
}

.content-card h1,
.content-card h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.content-intro {
    margin-bottom: var(--spacing-xl);
    color: var(--text-secondary);
    line-height: 1.7;
}

.content-card .faq-item {
    padding: var(--spacing-lg) 0;
    border-top: 1px solid var(--border-light);
}

.content-card .faq-item:first-of-type {
    border-top: none;
    padding-top: 0;
}

.content-card .faq-item h3,
.step-item h3,
.content-note h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.content-card .faq-item p,
.step-item p,
.content-note p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.step-list {
    display: grid;
    gap: var(--spacing-lg);
}

.step-item {
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.step-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.content-note {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

/* Processing Status */
.processing-status {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--spacing-xl);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto var(--spacing-md);
    animation: spin 0.8s linear infinite;
}

.processing-status p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Error Message */
.error-message {
    background: var(--error-bg);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.error-message svg {
    width: 24px;
    height: 24px;
    color: var(--error);
    flex-shrink: 0;
}

.error-message h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--error);
}

.error-message p {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Results Section */
.results-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.results-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    row-gap: var(--spacing-sm);
}

.results-header h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-primary);
    margin: 0;
}

.results-stats {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
    max-width: 100%;
    text-align: right;
}

.stat-badge {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--sidebar-section);
    border-radius: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
}

.stat-badge strong {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Table */
.table-container {
    overflow-x: auto;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
}

#resultsTable thead {
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

#resultsTable th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-weight: 500;
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

#resultsTable tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition);
}

#resultsTable tbody tr:hover {
    background: var(--bg-tertiary);
}

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

#resultsTable td {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    font-size: 12px;
}

#resultsTable td:nth-child(1) {
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 85px;
}

#resultsTable td:nth-child(2) {
    max-width: 300px;
}

#resultsTable td:nth-child(3),
#resultsTable td:nth-child(4),
#resultsTable td:nth-child(5) {
    font-family: 'Courier New', monospace;
    text-align: right;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 75px;
}

/* Right-align headers for amount columns */
#resultsTable th:nth-child(3),
#resultsTable th:nth-child(4),
#resultsTable th:nth-child(5) {
    text-align: right;
}

/* Currency column - center aligned */
#resultsTable th:nth-child(6),
#resultsTable td:nth-child(6) {
    text-align: center;
    min-width: 50px;
    font-weight: 500;
    color: var(--text-secondary);
}

.editable-cell {
    min-width: 180px;
}

.cell-input {
    width: 100%;
    min-width: 150px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

#resultsTable tbody tr:hover .cell-input,
.cell-input:not(:placeholder-shown),
.cell-input:focus {
    background: #f7f9fa;
    color: var(--text-primary);
}

.cell-input:focus {
    outline: none;
    border-color: var(--border-input);
    background: #ffffff;
    box-shadow: none;
}

.category-cell {
    position: relative;
}

.category-dropdown {
    position: fixed;
    min-width: 220px;
    max-width: 360px;
    max-height: 240px;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-sidebar);
    box-shadow: var(--shadow-md);
    z-index: 40;
}

.category-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.category-dropdown-item:hover,
.category-dropdown-item.is-active {
    background: var(--bg-hover);
}

.category-dropdown-empty {
    padding: 8px 12px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.category-input.review-needed {
    border-color: #e2c28d;
    background: #fcf7ee;
}

.row-review {
    background: #fcfaf5;
}

.row-memory td {
    background-image: linear-gradient(0deg, rgba(51, 119, 170, 0.03), rgba(51, 119, 170, 0.03));
}

.row-edited td {
    background-image: linear-gradient(0deg, rgba(0, 181, 29, 0.035), rgba(0, 181, 29, 0.035));
}

.status-note {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--text-tertiary);
}

.inline-hint {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-bottom: 1px solid #efe4cf;
    background: #faf6ed;
    color: #8a6221;
    font-size: 12px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    z-index: 30;
}

.modal-card {
    width: min(840px, 100%);
    max-height: 85vh;
    overflow: hidden;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-sidebar);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.modal-card-narrow {
    width: min(460px, 100%);
}

.modal-header,
.modal-toolbar,
.modal-actions {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-header p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.icon-button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.modal-toolbar {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 12px;
    color: var(--text-secondary);
}

.modal-list {
    padding: 0;
    overflow: auto;
    border-top: 1px solid var(--border-light);
}

.modal-list-shell {
    padding: 0 var(--spacing-lg) var(--spacing-lg);
}

.modal-list-header,
.modal-item {
    display: grid;
    grid-template-columns: auto 90px 1fr 90px 1fr;
    gap: var(--spacing-md);
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
}

.modal-list-header {
    font-size: 11px;
    color: var(--text-sidebar-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-bottom: none;
}

.modal-item {
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    cursor: pointer;
}

.modal-item:hover {
    background: var(--bg-hover);
}

.modal-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

.modal-actions {
    border-bottom: none;
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

.purchase-packages {
    padding: var(--spacing-lg);
    display: grid;
    gap: var(--spacing-md);
}

.purchase-package {
    border: 1px solid var(--border-sidebar);
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: left;
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition);
    display: grid;
    gap: 4px;
}

.purchase-package:hover {
    border-color: var(--accent-primary);
    background: #f7f9fb;
}

.purchase-package strong {
    font-size: 18px;
    font-weight: 600;
}

.purchase-package span {
    font-size: 13px;
    color: var(--text-primary);
}

.purchase-package em {
    font-style: normal;
    color: var(--text-secondary);
    font-size: 11px;
}

.purchase-package--recommended {
    border-color: var(--accent-primary);
    background: var(--accent-light);
    position: relative;
}

.purchase-package--recommended:hover {
    background: #daeaf7;
    border-color: var(--accent-primary-hover);
}

.purchase-package-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 4px;
    width: fit-content;
}

/* Balance validation colors */
.balance-valid {
    color: var(--accent-primary) !important;
    /* Douban blue */
    font-weight: 600;
}

.balance-invalid {
    color: #e54847 !important;
    /* Coral red - coordinated with blue */
    font-weight: 600;
    background-color: rgba(229, 72, 71, 0.08);
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Animations ===== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .sidebar-header h1,
    .sidebar-header .brand-name {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        max-height: none;
    }

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

    .admin-layout {
        flex-direction: column;
    }

    .table-container {
        max-height: 500px;
    }

    .results-header {
        align-items: flex-start;
    }

    .results-stats {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .modal-item {
        grid-template-columns: auto 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--spacing-md);
    }

    #resultsTable {
        font-size: 11px;
    }

    #resultsTable th,
    #resultsTable td {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}


/* ===== Wabi-Sabi Local Theme Overrides ===== */
:root {
    --bg-primary: #f3efe6;
    --bg-secondary: #ece5d8;
    --bg-tertiary: #e6dece;
    --bg-card: rgba(250, 246, 239, 0.92);
    --bg-hover: #efe7d7;
    --sidebar-bg: rgba(231, 223, 209, 0.94);
    --sidebar-hover: #ddd2bf;
    --sidebar-section: rgba(245, 239, 229, 0.82);

    --accent-primary: #586b52;
    --accent-primary-hover: #465540;
    --accent-light: #dfe7db;
    --accent-border: #aebb9b;

    --douban-green: #6f7f59;
    --douban-green-hover: #596647;
    --douban-green-light: #e6ecdf;

    --text-primary: #2e2923;
    --text-secondary: #5f564c;
    --text-tertiary: #8b7f71;
    --text-muted: #b3a696;
    --text-sidebar: #312b25;
    --text-sidebar-muted: #6e6357;

    --header-green: #5b6c4f;

    --success: #61744f;
    --success-bg: #e5ecdf;
    --error: #a45f4f;
    --error-bg: #f3e7e2;
    --warning: #a77a45;
    --info: #6f7d66;

    --border-color: rgba(111, 96, 77, 0.18);
    --border-light: rgba(111, 96, 77, 0.1);
    --border-sidebar: rgba(111, 96, 77, 0.16);
    --border-input: rgba(111, 96, 77, 0.22);
    --radius: 16px;

    --shadow-sm: 0 8px 18px rgba(77, 61, 43, 0.05);
    --shadow-md: 0 18px 38px rgba(77, 61, 43, 0.08);
    --shadow-lg: 0 28px 58px rgba(77, 61, 43, 0.1);
    --transition: 180ms ease;
}

body {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.45), transparent 28%),
        radial-gradient(circle at bottom right, rgba(182, 166, 145, 0.14), transparent 30%),
        linear-gradient(180deg, #f5f1e9 0%, #efe8dc 100%);
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(120, 102, 83, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 102, 83, 0.02) 1px, transparent 1px);
    background-size: 26px 26px;
    opacity: 0.22;
    mix-blend-mode: multiply;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(238, 232, 221, 0.98) 0%, rgba(228, 219, 203, 0.98) 100%);
    border-right: 1px solid var(--border-sidebar);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.35);
}

.sidebar-header,
.sidebar-section,
.sidebar-footer {
    border-color: var(--border-sidebar);
}

.sidebar-header {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.sidebar-header .logo-icon {
    width: 46px;
    height: 46px;
    color: #7f6d58;
    filter: saturate(0.65);
}

.sidebar-header .brand-name {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.sidebar-header .subtitle {
    margin-top: 4px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.language-switcher {
    gap: 6px;
    margin-top: 10px;
}

.lang-button,
.nav-link-block,
.stat-compact,
.drop-zone-compact,
.text-input,
.content-card,
.welcome-message,
.results-section,
.processing-status,
.modal-card,
.category-dropdown {
    backdrop-filter: blur(6px);
}

.lang-button {
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(255, 252, 247, 0.6);
}

.lang-button:hover,
.lang-button.is-active {
    background: rgba(88, 107, 82, 0.08);
}

.section-title {
    font-size: 10px;
    letter-spacing: 0.16em;
    color: #74695d;
}

.drop-zone-compact,
.stat-compact,
.nav-link-block,
.text-input,
.purchase-package {
    border-radius: 14px;
    border-style: solid;
    background: rgba(252, 248, 241, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.drop-zone-compact {
    border-style: dashed;
    padding: 1rem;
}

.drop-zone-compact:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.upload-icon-small,
.upload-icon-aux,
.welcome-icon {
    color: #8a7a67;
}

.text-input {
    background: rgba(255, 251, 245, 0.88);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.text-input:focus,
.cell-input:focus {
    border-color: rgba(88, 107, 82, 0.45);
    box-shadow: 0 0 0 3px rgba(88, 107, 82, 0.08);
}

.btn-primary,
.btn-secondary,
.purchase-package {
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: linear-gradient(180deg, #66795d 0%, #52624c 100%);
    border-color: #52624c;
    box-shadow: 0 10px 24px rgba(82, 98, 76, 0.16);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #5d6f55 0%, #465540 100%);
}

.btn-secondary,
#downloadMoneyWizBtn,
#downloadDbsBtn {
    background: rgba(255, 250, 243, 0.85);
    color: var(--text-primary);
    border-color: rgba(111, 96, 77, 0.18);
}

.btn-secondary:hover,
#downloadMoneyWizBtn:hover,
#downloadDbsBtn:hover {
    background: #f3ecdf;
    color: var(--accent-primary-hover);
}

.main-content {
    padding: 1.5rem 1.75rem 2rem;
}

.breadcrumb {
    color: #7e7264;
    letter-spacing: 0.04em;
}

.welcome-message,
.content-card,
.results-section,
.processing-status,
.modal-card {
    background:
        linear-gradient(180deg, rgba(251, 247, 240, 0.96) 0%, rgba(246, 240, 231, 0.94) 100%);
    border: 1px solid rgba(118, 102, 83, 0.16);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
}

.welcome-message {
    position: relative;
    overflow: hidden;
    text-align: left;
}

.welcome-message::after,
.content-card::after,
.results-section::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 38%);
}

.welcome-message h1,
.content-card h1,
.content-card h2 {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.welcome-message h1,
.welcome-message h2 {
    font-size: 28px;
    line-height: 1.25;
}

.welcome-message > p {
    max-width: 720px;
    font-size: 15px;
    color: var(--text-secondary);
}

.landing-copy {
    gap: 1.4rem;
    border-top: 1px solid rgba(111, 96, 77, 0.12);
}

.landing-section h3,
.content-card .faq-item h3,
.step-item h3,
.content-note h3 {
    color: #40372d;
    font-weight: 600;
}

.landing-section p,
.content-card .faq-item p,
.step-item p,
.content-note p,
.landing-list li {
    color: #5d564d;
}

.landing-list {
    padding-left: 1.1rem;
}

.landing-list li::marker {
    color: #8a7a67;
}

.content-note,
.step-item,
.content-card .faq-item,
.results-header,
.modal-header,
.modal-toolbar,
.modal-actions {
    border-color: rgba(111, 96, 77, 0.12);
}

.inline-hint {
    background: rgba(167, 122, 69, 0.09);
    border-bottom-color: rgba(167, 122, 69, 0.15);
    color: #7b5c31;
}

.results-header,
#resultsTable thead {
    background: rgba(227, 218, 201, 0.62);
}

.results-header h2,
.stat-badge strong,
.stat-value-small,
.credit-balance-line strong,
.balance-valid {
    color: #55684f !important;
}

.stat-badge {
    background: rgba(255, 251, 245, 0.74);
    border: 1px solid rgba(111, 96, 77, 0.12);
    border-radius: 999px;
    padding: 5px 12px;
}

.table-container {
    background: rgba(255, 251, 245, 0.52);
}

#resultsTable tbody tr:hover {
    background: rgba(227, 219, 204, 0.34);
}

#resultsTable td:nth-child(3),
#resultsTable td:nth-child(4),
#resultsTable td:nth-child(5) {
    font-family: "SFMono-Regular", "Cascadia Mono", "IBM Plex Mono", "Courier New", monospace;
}

.cell-input {
    border-radius: 12px;
}

.row-review {
    background: rgba(247, 238, 220, 0.46);
}

.row-memory td {
    background-image: linear-gradient(0deg, rgba(88, 107, 82, 0.05), rgba(88, 107, 82, 0.05));
}

.row-edited td {
    background-image: linear-gradient(0deg, rgba(125, 141, 92, 0.055), rgba(125, 141, 92, 0.055));
}

.modal-overlay {
    background: rgba(44, 37, 31, 0.28);
    backdrop-filter: blur(4px);
}

.modal-card,
.purchase-package,
.category-dropdown {
    border-radius: 22px;
}

.purchase-package {
    padding: 1.1rem 1.2rem;
}

.purchase-package:hover {
    background: #f2eadc;
    box-shadow: var(--shadow-sm);
}

.icon-button {
    border-radius: 999px;
    background: rgba(255, 251, 245, 0.82);
    border: 1px solid rgba(111, 96, 77, 0.12);
}

@media (max-width: 768px) {
    body::before {
        opacity: 0.14;
    }

    .welcome-message,
    .content-card,
    .results-section,
    .processing-status,
    .modal-card {
        border-radius: 20px;
    }

    .welcome-message h1,
    .welcome-message h2 {
        font-size: 23px;
    }
}


/* ===== Wabi-Sabi Detail Refinements ===== */
.sidebar-header {
    position: relative;
}

.sidebar-header::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(111, 96, 77, 0.2), transparent);
}

.sidebar-header .logo-icon {
    padding: 7px;
    background:
        linear-gradient(180deg, rgba(255, 250, 243, 0.9), rgba(241, 232, 217, 0.95));
    border: 1px solid rgba(111, 96, 77, 0.18);
    border-radius: 18px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        0 10px 24px rgba(92, 73, 50, 0.08);
}

.sidebar-header .brand-name {
    position: relative;
    display: inline-block;
    padding-right: 1.2rem;
}

.sidebar-header .brand-name::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    transform: translateY(-50%);
    background: radial-gradient(circle at 35% 35%, #8f9a7b, #5f6f58 72%);
    box-shadow: 0 0 0 4px rgba(95, 111, 88, 0.08);
}

.welcome-message {
    padding-top: 2rem;
}

.welcome-message::before {
    content: "";
    position: absolute;
    top: 1.1rem;
    left: 1.5rem;
    width: 72px;
    height: 1px;
    background: linear-gradient(90deg, rgba(88, 107, 82, 0.5), transparent);
}

.welcome-icon {
    padding: 12px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 250, 243, 0.92), rgba(239, 230, 215, 0.98));
    border: 1px solid rgba(111, 96, 77, 0.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 14px 30px rgba(92, 73, 50, 0.08);
}

.welcome-message h1 {
    max-width: 12ch;
}

.welcome-message .landing-section:first-child h3 {
    position: relative;
    padding-left: 0.9rem;
}

.welcome-message .landing-section:first-child h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.28em;
    width: 6px;
    height: 1.2em;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(88, 107, 82, 0.78), rgba(88, 107, 82, 0.2));
}

#resultsTable tbody tr {
    transition:
        background-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

#resultsTable tbody tr:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.editable-cell {
    min-width: 190px;
}

.cell-input {
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(111, 96, 77, 0.08);
    background: rgba(255, 250, 243, 0.35);
}

#resultsTable tbody tr:hover .cell-input {
    background: rgba(255, 251, 246, 0.88);
    border-color: rgba(111, 96, 77, 0.12);
}

.cell-input:focus {
    background: rgba(255, 253, 249, 0.98);
    color: #2f2a24;
    border-color: rgba(88, 107, 82, 0.45);
    box-shadow:
        0 0 0 4px rgba(88, 107, 82, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.cell-input:not(:placeholder-shown) {
    background: rgba(250, 245, 237, 0.85);
}

.category-input.review-needed {
    border-color: rgba(168, 136, 81, 0.42);
    background:
        linear-gradient(180deg, rgba(252, 246, 233, 0.98), rgba(248, 239, 220, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.status-note {
    margin-top: 5px;
    font-size: 10px;
    letter-spacing: 0.04em;
}

.category-dropdown {
    border: 1px solid rgba(111, 96, 77, 0.15);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(251, 247, 240, 0.98), rgba(244, 237, 226, 0.97));
    box-shadow: 0 22px 46px rgba(77, 61, 43, 0.14);
    padding: 6px;
}

.category-dropdown-item {
    border-radius: 12px;
    padding: 10px 12px;
}

.modal-card {
    position: relative;
    overflow: hidden;
}

.modal-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.24), transparent 34%);
}

.modal-header h3 {
    font-size: 18px;
    letter-spacing: 0.01em;
}

.modal-header p {
    margin-top: 6px;
    line-height: 1.6;
}

.purchase-packages {
    gap: 14px;
    padding: 1.1rem;
    background: rgba(232, 223, 208, 0.22);
}

.purchase-package {
    border-radius: 18px;
    transition:
        transform var(--transition),
        border-color var(--transition),
        background-color var(--transition),
        box-shadow var(--transition);
}

.purchase-package:hover {
    transform: translateY(-2px);
}

.purchase-package strong {
    font-size: 22px;
    letter-spacing: 0.01em;
}

.purchase-package span {
    line-height: 1.5;
}

.purchase-package em {
    margin-top: 2px;
    letter-spacing: 0.03em;
}

.modal-actions {
    background: rgba(255, 251, 245, 0.65);
}

.icon-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.icon-button:hover {
    background: rgba(243, 236, 223, 0.92);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .sidebar-header .brand-name {
        padding-right: 0.95rem;
    }

    .welcome-message {
        padding-top: 1.6rem;
    }

    .welcome-message h1 {
        max-width: none;
    }

    .cell-input {
        min-height: 36px;
    }

    .purchase-packages {
        padding: 0.9rem;
    }
}

/* ── Demo CTA ──────────────────────────────────────────────────────────────── */
.demo-cta {
    margin-top: var(--spacing-sm);
    text-align: center;
}

.demo-divider {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-demo {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1.5px dashed var(--accent-primary);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    font-family: inherit;
    background: var(--accent-light);
    color: var(--accent-primary);
    width: 100%;
    margin-bottom: var(--spacing-xs);
}

.btn-demo:hover {
    background: var(--accent-primary);
    color: white;
    border-style: solid;
}

.btn-demo:active {
    transform: translateY(1px);
}

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

.demo-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.4;
}
