:root {
    --bg: #f4f7f8;
    --surface: #ffffff;
    --surface-soft: #eef5f4;
    --text: #172328;
    --muted: #65757c;
    --border: #d8e2e4;
    --accent: #087f8c;
    --accent-dark: #076570;
    --green: #207a55;
    --amber: #a36506;
    --red: #b33131;
    --shadow: 0 8px 24px rgba(23,35,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img, .sidebar-brand img { width: 88px; height: 34px; object-fit: contain; }
.login-screen { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: #f7faf9; }
.login-header { height: 72px; padding: 0 40px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--surface); }
.login-main { display: grid; place-items: center; padding: 32px 20px; background: #edf3f2; }
.login-panel { width: min(440px, 100%); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.system-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.system-switch a { padding: 9px 12px; border-radius: 4px; text-align: center; color: var(--muted); text-decoration: none; font-weight: 650; }
.system-switch a.active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 4px rgba(23,35,40,.1); }
.login-heading { margin: 30px 0 24px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; margin: 0 0 8px; }
.login-heading h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.login-heading p:last-child { margin: 10px 0 0; color: var(--muted); }
label { display: block; margin: 14px 0 6px; color: #34464d; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid #cbd8da; border-radius: 5px; padding: 9px 11px; color: var(--text); background: #fff; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(8,127,140,.18); border-color: var(--accent); }
button.primary, button.secondary, button.danger { min-height: 38px; border: 1px solid transparent; border-radius: 5px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; }
button.primary { color: #fff; background: var(--accent); }
button.primary:hover { background: var(--accent-dark); }
button.secondary { color: #294047; background: #fff; border-color: var(--border); }
button.danger { color: var(--red); background: #fff; border-color: #e9bcbc; }
button.wide { width: 100%; margin-top: 22px; }
button svg { width: 17px; height: 17px; }
.locale-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 5px; background: #fff; }
.locale-switch button { border: 0; background: transparent; min-width: 38px; padding: 5px 7px; border-radius: 3px; color: var(--muted); }
.locale-switch button.active { background: var(--surface-soft); color: var(--accent-dark); font-weight: 800; }
.login-footer { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #102b31; color: #fff; overflow-y: auto; }
.sidebar-brand { min-height: 72px; display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.13); }
.sidebar-brand img { filter: brightness(0) invert(1); }
.sidebar-brand div { display: grid; min-width: 0; }
.sidebar-brand strong { font-size: 14px; }
.sidebar-brand span { font-size: 11px; color: #a9c3c7; }
.sidebar nav { flex: 1; padding: 12px 10px; }
.nav-label { margin: 18px 10px 6px; color: #789ba1; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 9px 11px; border: 0; border-radius: 5px; color: #c9dadd; background: transparent; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: #087f8c; color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.sidebar-user { display: grid; grid-template-columns: 34px minmax(0,1fr) 34px 34px; align-items: center; gap: 5px; padding: 14px 10px; border-top: 1px solid rgba(255,255,255,.13); }
.sidebar-user div:nth-child(2) { min-width: 0; display: grid; }
.sidebar-user strong, .sidebar-user span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user span { color: #9fb9bd; font-size: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e4f0ef; color: #075f69; font-weight: 800; }
.icon-button { width: 34px; height: 34px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: inherit; display: grid; place-items: center; }
.icon-button:hover { background: rgba(127,155,160,.15); }
.icon-button svg { width: 18px; height: 18px; }
.workspace { min-width: 0; }
.topbar { height: 72px; padding: 0 28px; display: flex; align-items: center; gap: 14px; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar select { width: 190px; }
.page { display: none; padding: 24px 28px 40px; }
.page.active { display: block; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(150px,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 17px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; border-top: 3px solid var(--accent); color: var(--text); text-align: left; }
.kpi:hover { border-color: #9fc4c4; box-shadow: 0 3px 12px rgba(23,35,40,.07); }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin-top: 8px; font-size: 27px; }
.content-grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: 1.4fr 1fr; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.panel-header { min-height: 52px; padding: 0 16px; display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 15px; }
.page-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-toolbar > div { display: flex; gap: 8px; }
.search-wrap { position: relative; width: min(320px, 50vw); }
.search-wrap svg { position: absolute; left: 11px; top: 11px; width: 17px; color: var(--muted); }
.search-wrap input { padding-left: 36px; }
.table-panel { overflow: hidden; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { height: 42px; padding: 9px 12px; text-align: left; color: #506268; background: #f5f8f8; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #e8eeee; vertical-align: middle; max-width: 300px; }
tbody tr:hover { background: #f7fbfa; }
.empty-cell { padding: 42px; text-align: center; color: var(--muted); }
.actions { display: flex; gap: 6px; white-space: nowrap; }
.actions button { min-height: 30px; padding: 5px 8px; font-size: 12px; }
.badge { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: #e8f3f2; color: #246a62; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.warning { color: #8a5604; background: #fff0d1; }
.badge.danger { color: #a32d2d; background: #fde5e5; }
.badge.success { color: #1f704e; background: #dff2e8; }
.region-bars { padding: 12px 16px 18px; }
.region-row { display: grid; grid-template-columns: 130px 1fr 48px; gap: 10px; align-items: center; padding: 8px 0; }
.bar { height: 8px; border-radius: 4px; background: #e4ecec; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.action-list { padding: 10px 16px 18px; }
.action-list button { width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; display: flex; justify-content: space-between; color: var(--text); }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(12,29,34,.55); }
.modal { width: min(760px, 100%); max-height: 92vh; display: grid; grid-template-rows: auto 1fr auto; background: #fff; border-radius: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.24); }
.modal > header, .modal > footer { min-height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal > footer { justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); border-bottom: 0; }
.modal h2 { margin: 0; font-size: 18px; }
.modal-body { overflow-y: auto; padding: 16px 18px 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; }
.form-full { grid-column: 1 / -1; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.detail-item { padding: 10px; background: #f6f9f9; border: 1px solid var(--border); border-radius: 5px; }
.detail-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.attachment-list { display: grid; gap: 7px; margin-top: 10px; }
.attachment-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: 5px; }
.attachment-row > div { display: grid; gap: 3px; min-width: 0; }
.attachment-row span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.section-title { margin: 22px 0 9px; font-size: 14px; }
.form-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-section h3 { margin: 0; font-size: 14px; }
.form-section p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.timeline { display: grid; gap: 8px; }
.timeline-item { padding: 10px 12px; border-left: 3px solid var(--accent); background: #f5f9f8; }
.timeline-item strong { display: block; margin-bottom: 5px; }
.timeline-item span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.timeline-item p { margin: 6px 0 0; color: #46585e; font-size: 12px; }
.inline-note { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.check-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
.check-stack { display: grid; gap: 8px; margin-top: 13px; }
.check-option { min-height: 34px; margin: 0; padding: 7px 9px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-weight: 600; }
.check-option input { width: 16px; min-height: 16px; margin: 0; }
.permission-table { margin-top: 9px; border: 1px solid var(--border); border-radius: 5px; overflow-x: auto; }
.permission-row { min-width: 610px; display: grid; grid-template-columns: 180px repeat(5, 1fr); align-items: center; border-bottom: 1px solid var(--border); }
.permission-row:last-child { border-bottom: 0; }
.permission-row > strong, .permission-row > span { padding: 7px; font-size: 11px; }
.permission-row.header { color: var(--muted); background: #f5f8f8; text-transform: capitalize; }
.permission-row .check-option { justify-content: center; border: 0; padding: 4px; }
.region-chip { cursor: pointer; text-align: left; }
.region-chip:hover { border-color: var(--accent); }
.region-strip { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; margin-bottom: 14px; }
.region-chip { padding: 12px; border: 1px solid var(--border); border-radius: 5px; background: #fff; }
.region-chip strong, .region-chip span { display: block; }
.region-chip span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 11px 14px; color: #fff; background: #24434a; border-radius: 5px; box-shadow: var(--shadow); }
.toast.error { background: var(--red); }
.mobile-only { display: none; }
@media (max-width: 1050px) {
    .kpi-grid { grid-template-columns: repeat(2,1fr); }
    .two-columns { grid-template-columns: 1fr; }
    .region-strip { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 760px) {
    .login-header { padding: 0 18px; }
    .brand span { display: none; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -260px; width: 244px; z-index: 50; transition: left .2s ease; }
    .sidebar.open { left: 0; }
    .mobile-only { display: grid; }
    .topbar { padding: 0 14px; }
    .topbar-actions > select { display: none; }
    .page { padding: 18px 14px 32px; }
    .page-toolbar { align-items: stretch; flex-direction: column; }
    .page-toolbar > div { justify-content: flex-end; }
    .search-wrap { width: 100%; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .form-full { grid-column: auto; }
    .region-strip { grid-template-columns: 1fr; }
    .modal-backdrop { padding: 8px; }
    .modal { max-height: 98vh; }
    .check-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
    .login-panel { padding: 24px 18px; }
    .login-heading h1 { font-size: 25px; }
    .kpi-grid { grid-template-columns: 1fr; }
}
