:root {
    --blue: #1677ff;
    --blue-dark: #0958d9;
    --cyan: #13c2c2;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --surface: #ffffff;
    --canvas: #f5f7fb;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 10px 30px rgba(31, 41, 55, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Microsoft YaHei", "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.install-page, .login-page { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 32px 18px; background: #eef4fb; }
.install-card, .login-card { width: min(760px, 100%); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 34px; }
.login-card { width: min(460px, 100%); }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-lockup h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
.brand-lockup p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--blue); border-radius: 8px; font-weight: 800; font-size: 25px; }
.brand-mark.small { width: 34px; height: 34px; font-size: 20px; }
.install-steps { display: flex; gap: 8px; margin: 28px 0; }
.install-steps span { flex: 1; padding: 11px 8px; text-align: center; color: var(--muted); background: #f3f4f6; font-size: 13px; border-bottom: 2px solid #d1d5db; }
.install-steps span.active { color: var(--blue-dark); background: #eaf3ff; border-color: var(--blue); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 22px; }
.section-heading.compact { margin: 28px 0 18px; }
.section-heading h2 { margin: 5px 0 0; font-size: 21px; }
.section-heading p { max-width: 330px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.eyebrow { color: var(--blue-dark); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stack-form { display: grid; gap: 18px; }
.stack-form label, .form-grid label { display: grid; gap: 7px; color: #374151; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; padding: 11px 12px; color: var(--ink); background: #fff; border: 1px solid #d1d5db; border-radius: 5px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 18px; }
.btn { min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 5px; font-weight: 700; }
.btn-primary { color: #fff; background: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { color: #374151; background: #fff; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.message { padding: 11px 13px; border-radius: 5px; font-size: 13px; line-height: 1.5; }
.message.error { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }
.message.success { color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; }
.install-done { text-align: center; padding: 40px 0 20px; }
.success-icon { width: 56px; height: 56px; margin: 0 auto 18px; display: grid; place-items: center; color: #fff; background: var(--success); border-radius: 50%; font-size: 28px; }
.install-done h2 { margin: 0 0 10px; }
.install-done p, .login-note { color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-note { margin: 18px 0 0; text-align: center; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 245px; display: flex; flex-direction: column; color: #e6f4ff; background: #0b1f33; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 23px 20px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand strong { display: block; font-size: 16px; }
.sidebar-brand span { display: block; margin-top: 3px; color: #91a7bb; font-size: 11px; }
.sidebar-nav { flex: 1; padding: 18px 11px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 13px; margin-bottom: 4px; color: #b9c9d8; background: transparent; border: 0; border-radius: 5px; text-align: left; }
.nav-item:hover, .nav-item.active { color: #fff; background: #153955; }
.nav-item.active { box-shadow: inset 3px 0 0 var(--cyan); }
.nav-icon { width: 18px; color: #75d4d4; text-align: center; font-size: 18px; }
.nav-divider { height: 1px; margin: 18px 8px; background: rgba(255,255,255,.12); }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; color: #0b1f33; background: #a7f3d0; border-radius: 50%; font-weight: 800; }
.user-chip-text { min-width: 0; }
.user-chip-text strong, .user-chip-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-text strong { font-size: 13px; }
.user-chip-text span { margin-top: 3px; color: #91a7bb; font-size: 11px; }
.logout-button { width: 100%; padding: 9px; color: #b9c9d8; background: transparent; border: 1px solid #34506a; border-radius: 5px; }
.logout-button:hover { color: #fff; border-color: #75d4d4; }
.main-panel { min-width: 0; flex: 1; }
.topbar { min-height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 30px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 5px 0 0; font-size: 23px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.connection-state { color: var(--muted); font-size: 12px; }
.state-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: var(--success); border-radius: 50%; }
.icon-button { width: 34px; height: 34px; color: #374151; background: #fff; border: 1px solid var(--line); border-radius: 5px; font-size: 19px; }
.content-area { padding: 28px 30px 44px; }
.view-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.view-header h2 { margin: 4px 0 0; font-size: 20px; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
#quickSummary { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stat-card { padding: 19px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { margin-top: 11px; font-size: 30px; font-weight: 800; }
.stat-card.blue { border-top: 3px solid var(--blue); }
.stat-card.cyan { border-top: 3px solid var(--cyan); }
.stat-card.amber { border-top: 3px solid #f59e0b; }
.stat-card.green { border-top: 3px solid var(--success); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 0; font-size: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 150px; padding: 8px 10px; }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid #eef0f3; text-align: left; vertical-align: top; font-size: 13px; }
th { color: #4b5563; background: #f9fafb; font-size: 12px; white-space: nowrap; }
td { color: #4b5563; }
tr:last-child td { border-bottom: 0; }
.table-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid #eef0f3; color: var(--muted); font-size: 13px; }
.pager-actions { display: flex; gap: 8px; align-items: center; }
.rate-input { max-width: 120px; }
.settlement-preview, .company-preview { color: var(--ink); font-weight: 800; }
.cell-title { color: var(--ink); font-weight: 700; }
.cell-muted { color: #9ca3af; }
.cell-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.attachment-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.central-control-lines { display: grid; gap: 4px; min-width: 220px; }
.status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status.pending { color: #92400e; background: #fffbeb; }
.status.approved, .status.active { color: #166534; background: #f0fdf4; }
.status.rejected, .status.inactive { color: #991b1b; background: #fef2f2; }
.status.offline { color: #4b5563; background: #f3f4f6; }
.empty-state { padding: 52px 20px; color: var(--muted); text-align: center; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(15,23,42,.42); }
.modal { width: min(900px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 7px; box-shadow: 0 20px 60px rgba(15,23,42,.2); }
.file-preview-modal { width: min(1180px, 92vw); height: min(760px, 86vh); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-close { color: var(--muted); background: transparent; border: 0; font-size: 24px; }
.modal-body { padding: 22px; }
.file-preview-body { flex: 1; min-height: 0; padding: 0; background: #f3f6fb; }
.file-preview-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 22px; border-top: 1px solid var(--line); }
.file-input { display: grid; gap: 6px; }
.file-input small { color: var(--muted); font-weight: 400; }
.file-input input { padding: 8px; }
.file-current-actions { margin-top: -2px; }
.link { color: var(--blue-dark); text-decoration: none; }
.link:hover { text-decoration: underline; }
.notice { padding: 13px 15px; color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 5px; font-size: 13px; line-height: 1.6; }
.loading-box { padding: 42px; color: var(--muted); text-align: center; }
.panel-body { padding: 18px; }
.check-field { display: flex !important; align-items: center; justify-content: space-between; padding: 11px 0; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quick-bill-console { overflow: hidden; }
.quick-data-bar { display: grid; grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(150px, .65fr)); gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.quick-data-bar label { display: grid; gap: 7px; color: #374151; font-size: 13px; font-weight: 700; }
.quick-data-tabs { display: flex; gap: 8px; flex-wrap: wrap; padding: 13px 18px; background: #f9fafb; }
.quick-console { overflow: hidden; }
.quick-console-head { display: grid; grid-template-columns: minmax(420px, 1fr) auto; gap: 16px; align-items: end; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.quick-console-head label { display: grid; gap: 7px; color: #374151; font-size: 13px; font-weight: 700; }
.quick-console-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.quick-tab { min-height: 38px; padding: 0 16px; color: #374151; background: #fff; border: 1px solid #d1d5db; border-radius: 5px; font-weight: 700; }
.quick-tab:hover { background: #f9fafb; }
.quick-tab.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.quick-project-strip { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; background: #f9fafb; border-bottom: 1px solid var(--line); }
.quick-project-strip h3 { margin: 4px 0 0; font-size: 18px; }
.quick-config-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.quick-pane { padding: 18px; }
.compact-form { gap: 14px; }
.compact-notice { margin-top: 14px; }
.compact-actions { margin-top: 16px; }
.quick-switches { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding-top: 23px; color: #374151; font-size: 13px; font-weight: 700; }
.quick-switches label { display: inline-flex; gap: 8px; align-items: center; }
.quick-switches input { width: auto; }
.permission-board { display: grid; gap: 14px; }
.permission-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.permission-section { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.permission-title { margin-bottom: 10px; color: var(--ink); font-size: 14px; font-weight: 800; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.permission-option { display: flex !important; align-items: flex-start; gap: 8px; padding: 8px; background: #f9fafb; border: 1px solid var(--line); border-radius: 4px; font-weight: 400 !important; }
.permission-option input { width: auto; margin-top: 3px; }
.permission-option span { display: grid; gap: 3px; }
.permission-option small { color: var(--muted); font-size: 12px; line-height: 1.45; }
@media (max-width: 1000px) { .sidebar { width: 205px; } .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; }
    .sidebar-nav { display: flex; gap: 5px; overflow-x: auto; padding: 9px; }
    .nav-item { width: auto; flex: 0 0 auto; margin: 0; white-space: nowrap; }
    .nav-divider, .sidebar-footer { display: none; }
    .topbar, .content-area { padding-left: 16px; padding-right: 16px; }
    .section-heading, .view-header { display: block; }
    .section-heading p { margin-top: 10px; }
    .form-grid.two, .form-grid.four, .stats-grid, .quick-data-bar { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .view-actions { margin-top: 14px; }
    .quick-console-head, .quick-project-strip { display: block; }
    .quick-console-actions, .quick-config-state { justify-content: flex-start; margin-top: 12px; }
    .install-card, .login-card { padding: 24px 18px; }
    .permission-grid { grid-template-columns: 1fr; }
}
