:root {
  --navy: #0b1739;
  --navy-2: #12234c;
  --blue: #2667ff;
  --blue-dark: #1e50cc;
  --cyan: #16b8c4;
  --orange: #f59e0b;
  --red: #dc4c64;
  --green: #1a9b70;
  --ink: #17213b;
  --muted: #6d7891;
  --line: #e5e9f2;
  --surface: #ffffff;
  --background: #f3f6fb;
  --shadow: 0 18px 45px rgba(19, 37, 75, 0.09);
  --radius: 16px;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--background); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.overline { margin: 0 0 12px; color: #86b9ff; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.overline.dark { color: var(--blue); }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, 1.15fr) minmax(380px, .85fr); background: #fff; }
.login-visual { position: relative; min-height: 100vh; overflow: hidden; display: flex; align-items: center; color: #fff; padding: 9vw; background: radial-gradient(circle at 78% 24%, rgba(38, 103, 255, .42), transparent 23%), linear-gradient(145deg, #081431, #112958 68%, #0e3c61); }
.world-grid { position: absolute; inset: 0; opacity: .25; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 48px 48px; transform: perspective(500px) rotateX(58deg) scale(1.6) translateY(22%); transform-origin: bottom; }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border: 1px solid rgba(111, 181, 255, .28); border-radius: 50%; }
.login-visual::before { width: 520px; height: 520px; right: -180px; top: -120px; }
.login-visual::after { width: 300px; height: 300px; left: -130px; bottom: -100px; }
.login-visual-content { position: relative; z-index: 1; max-width: 680px; }
.login-visual h1 { font-size: clamp(40px, 5vw, 68px); line-height: 1.15; letter-spacing: -.04em; margin: 0 0 28px; }
.login-visual-content > p:not(.overline) { color: #bfcee9; font-size: 18px; line-height: 1.8; max-width: 540px; }
.route-line { display: flex; align-items: center; margin-top: 52px; width: 310px; }
.route-line span { width: 10px; height: 10px; border: 2px solid #64dbe0; background: var(--navy); border-radius: 50%; box-shadow: 0 0 20px #64dbe0; }
.route-line i { flex: 1; height: 1px; background: linear-gradient(90deg, #64dbe0, #4285ff); }
.login-panel { display: grid; place-items: center; padding: 50px; }
.login-card { width: min(420px, 100%); }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: linear-gradient(140deg, var(--blue), var(--cyan)); font-size: 13px; font-weight: 900; letter-spacing: -.04em; box-shadow: 0 8px 24px rgba(38,103,255,.3); }
.brand-mark.large { width: 58px; height: 58px; margin-bottom: 28px; border-radius: 16px; font-size: 17px; }
.login-card h2 { margin: 6px 0 8px; font-size: 34px; letter-spacing: -.03em; }
.login-card .muted { margin: 0 0 36px; }
.login-card > .field-label { margin-top: 16px; }
.field-label { display: block; margin: 0 0 9px; color: #35405c; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #d9deea; border-radius: 10px; background: #fff; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
input, select { height: 44px; padding: 0 13px; }
textarea { min-height: 92px; resize: vertical; padding: 12px 13px; }
input:focus, select:focus, textarea:focus { border-color: #789cff; box-shadow: 0 0 0 3px rgba(38,103,255,.11); }
input[readonly] { background: #f5f7fb; color: #5b6680; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 68px; height: 50px; }
.password-toggle { position: absolute; right: 7px; top: 7px; color: var(--blue); font-size: 12px; }
.primary-button, .secondary-button { height: 42px; border-radius: 10px; padding: 0 17px; border: 0; font-size: 14px; font-weight: 700; transition: transform .15s, background .2s, box-shadow .2s; white-space: nowrap; }
.primary-button { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(38,103,255,.2); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.secondary-button { color: #40506f; background: #fff; border: 1px solid var(--line); }
.secondary-button:hover { border-color: #b8c4d9; background: #f8faff; }
.login-button { width: 100%; height: 50px; margin-top: 20px; display: flex; justify-content: center; align-items: center; gap: 12px; }
.login-error { min-height: 20px; margin: 14px 0 0; color: var(--red); font-size: 13px; text-align: center; }
.dev-hint { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 18px 20px; background: var(--navy); color: #fff; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; }
.brand span { margin-top: 3px; color: #8897b9; font-size: 11px; letter-spacing: .08em; }
.nav-list { flex: 1; padding: 22px 0; overflow-y: auto; }
.nav-section-label { padding: 10px 13px 8px; color: #657598; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.nav-item, .nav-action { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 10px; padding: 11px 13px; background: transparent; color: #aab5cd; font-size: 13px; text-align: left; }
.nav-item { margin: 2px 0; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { box-shadow: inset 3px 0 #4b86ff; }
.nav-icon { width: 22px; color: #7790bd; font-size: 16px; text-align: center; }
.nav-item.active .nav-icon { color: #79a8ff; }
.sidebar-foot { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.09); }
.secure-note { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; padding: 10px; border-radius: 10px; background: rgba(28, 177, 136, .1); }
.secure-note > span { color: #58ddb4; }
.secure-note strong, .secure-note small { display: block; }
.secure-note strong { color: #c9f5e8; font-size: 11px; }
.secure-note small { color: #688d86; font-size: 9px; margin-top: 2px; }
.nav-action { justify-content: center; }
.nav-action:hover { color: #fff; }

.main-area { min-width: 0; }
.topbar { min-height: 86px; display: flex; align-items: center; gap: 20px; padding: 14px 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.page-heading { min-width: 200px; }
.page-heading p { margin: 0 0 4px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.topbar-actions { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.global-search { width: min(260px, 24vw); position: relative; }
.global-search span { position: absolute; left: 13px; top: 9px; color: #8a96ac; font-size: 18px; }
.global-search input { height: 42px; padding-left: 38px; background: #f6f8fc; border-color: transparent; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: #66728b; }
.icon-button:hover { background: #eef2f8; }
.menu-button { display: none; font-size: 21px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding-left: 10px; border-left: 1px solid var(--line); }
.user-chip > span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #1b2b53; font-size: 12px; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: 12px; }
.user-chip small { color: var(--green); font-size: 9px; margin-top: 2px; }
.content { padding: 28px 34px 44px; min-height: calc(100vh - 86px); outline: 0; }

.welcome-strip { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.welcome-strip h2 { margin: 0 0 7px; font-size: 25px; letter-spacing: -.03em; }
.welcome-strip p { margin: 0; color: var(--muted); font-size: 13px; }
.date-chip { display: flex; align-items: center; gap: 8px; color: #50607e; font-size: 12px; }
.date-chip span { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi-card { position: relative; overflow: hidden; min-height: 148px; padding: 19px; border: 1px solid #e6eaf2; border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 30px rgba(27, 43, 83, .045); }
.kpi-card::after { content: ""; position: absolute; width: 78px; height: 78px; right: -22px; top: -25px; border-radius: 50%; background: var(--tint, #edf3ff); }
.kpi-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--tint, #edf3ff); color: var(--tone, var(--blue)); font-size: 16px; }
.kpi-value { margin-top: 19px; font-size: 27px; font-weight: 750; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.compact { font-size: 19px; line-height: 1.3; }
.kpi-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: #8691a7; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 18px; }
.panel { border: 1px solid #e6eaf2; border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 30px rgba(27,43,83,.04); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 19px 21px; border-bottom: 1px solid #edf0f5; }
.panel-header h3 { margin: 0 0 5px; font-size: 15px; }
.panel-header p { margin: 0; color: var(--muted); font-size: 11px; }
.panel-link { border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; }
.workflow { padding: 22px; }
.workflow-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.workflow-step { position: relative; text-align: center; }
.workflow-step:not(:last-child)::after { content: ""; position: absolute; height: 2px; left: calc(50% + 24px); right: calc(-50% + 24px); top: 20px; background: #dde5f2; }
.workflow-circle { position: relative; z-index: 1; width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; color: var(--blue); background: #edf3ff; border: 5px solid #fff; box-shadow: 0 0 0 1px #ccdcff; font-weight: 800; font-size: 12px; }
.workflow-step.complete .workflow-circle { background: var(--blue); color: #fff; box-shadow: 0 0 0 1px var(--blue); }
.workflow-step h4 { margin: 0; font-size: 12px; }
.workflow-step p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.workflow-bars { margin-top: 28px; display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 36px; align-items: center; gap: 11px; font-size: 11px; }
.bar-track { height: 7px; overflow: hidden; border-radius: 999px; background: #edf1f7; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.bar-row strong { text-align: right; }
.alerts-list { padding: 8px 20px 14px; }
.alert-item { display: flex; align-items: flex-start; gap: 11px; padding: 13px 0; border-bottom: 1px solid #edf0f5; }
.alert-item:last-child { border-bottom: 0; }
.alert-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(245,158,11,.11); }
.alert-dot.red { background: var(--red); box-shadow: 0 0 0 4px rgba(220,76,100,.1); }
.alert-dot.green { background: var(--green); box-shadow: 0 0 0 4px rgba(26,155,112,.1); }
.alert-item strong, .alert-item span { display: block; }
.alert-item strong { margin-bottom: 3px; font-size: 11px; }
.alert-item span { color: var(--muted); font-size: 10px; line-height: 1.45; }

.module-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.module-intro h2 { margin: 0 0 6px; font-size: 20px; }
.module-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.summary-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.summary-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #62708c; font-size: 10px; }
.summary-chip strong { color: var(--ink); font-size: 12px; margin-left: 4px; }
.table-panel { overflow: hidden; }
.table-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 17px; border-bottom: 1px solid var(--line); }
.result-count { color: var(--muted); font-size: 11px; }
.result-count strong { color: var(--ink); }
.table-scroll { overflow: auto; max-height: calc(100vh - 280px); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
.data-table th { position: sticky; top: 0; z-index: 2; padding: 12px 14px; border-bottom: 1px solid #dfe4ee; background: #f8faff; color: #74809a; font-size: 10px; font-weight: 800; letter-spacing: .02em; text-align: left; }
.data-table td { max-width: 300px; padding: 13px 14px; border-bottom: 1px solid #edf0f5; color: #34405b; overflow: hidden; text-overflow: ellipsis; }
.data-table tbody tr:hover td { background: #f9fbff; }
.data-table td.numeric, .data-table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .primary-cell { color: #193263; font-weight: 700; }
.row-actions { display: flex; gap: 5px; }
.row-button { border: 0; border-radius: 6px; padding: 5px 8px; background: #edf3ff; color: var(--blue); font-size: 10px; }
.row-button.danger { background: #fff0f2; color: var(--red); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: #fff5df; color: #a36600; font-size: 10px; font-weight: 700; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { background: #eaf9f3; color: #11815b; }
.badge.info { background: #edf3ff; color: #2b63d8; }
.badge.danger { background: #fff0f2; color: #c93f57; }
.empty-state { padding: 75px 20px; text-align: center; }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 16px; background: #edf3ff; color: var(--blue); font-size: 24px; }
.empty-state h3 { margin: 0 0 7px; font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 28px; background: rgba(7, 16, 40, .55); backdrop-filter: blur(3px); }
.modal { width: min(960px, 100%); max-height: calc(100vh - 56px); overflow: hidden; display: flex; flex-direction: column; border-radius: 18px; background: #fff; box-shadow: 0 28px 90px rgba(4,13,35,.28); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 21px 25px 18px; border-bottom: 1px solid var(--line); }
.modal-header .overline { margin-bottom: 5px; font-size: 9px; }
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-close { font-size: 25px; line-height: 1; }
#record-form { overflow: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 20px; padding: 24px 25px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { display: block; margin-bottom: 7px; color: #495570; font-size: 11px; font-weight: 700; }
.required-star { color: var(--red); }
.form-hint { margin: 5px 0 0; color: #9aa3b5; font-size: 9px; }
.form-field input[type="file"] { height: auto; min-height: 54px; padding: 8px; border-style: dashed; background: #f8faff; color: #69758e; }
.form-field input[type="file"]::file-selector-button { height: 34px; margin-right: 11px; padding: 0 13px; border: 0; border-radius: 8px; background: #e8efff; color: var(--blue); font-weight: 700; cursor: pointer; }
.attachment-list { display: grid; gap: 7px; margin-top: 10px; }
.attachment-empty { padding: 9px 11px; border-radius: 8px; background: #f6f8fc; color: #98a2b5; font-size: 10px; }
.attachment-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid #e3e8f2; border-radius: 9px; background: #fff; }
.attachment-item a { overflow: hidden; color: var(--blue); font-size: 11px; font-weight: 700; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item a:hover { text-decoration: underline; }
.attachment-item span { color: #8792a8; font-size: 9px; }
.attachment-item button { padding: 3px 7px; border: 0; border-radius: 6px; background: #fff0f2; color: var(--red); font-size: 9px; }
.approval-history { display: grid; gap: 8px; padding: 4px 0; }
.approval-history-item { padding: 10px 12px; border-left: 3px solid #7ba2ff; border-radius: 0 8px 8px 0; background: #f6f8fc; }
.approval-history-item > div { display: flex; justify-content: space-between; gap: 15px; }
.approval-history-item strong { color: #34405b; font-size: 11px; }
.approval-history-item time { color: #909aae; font-size: 9px; }
.approval-history-item p { margin: 5px 0 0; color: #68758e; font-size: 10px; line-height: 1.45; }
.row-actions { min-width: max-content; }
.row-button:disabled, .primary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.modal-footer { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 25px; border-top: 1px solid var(--line); background: #fafbfe; }
.modal-footer p { margin: 0; color: var(--muted); font-size: 10px; }
.modal-footer div { display: flex; gap: 9px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 9px; }
.toast { min-width: 250px; max-width: 360px; padding: 13px 15px; border-radius: 10px; color: #fff; background: #172849; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .25s ease; }
.toast.error { background: #9f2940; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 218px minmax(0,1fr); }
  .sidebar { padding-left: 13px; padding-right: 13px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .content { padding-left: 24px; padding-right: 24px; }
  .user-chip div { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 30px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 244px; transition: transform .25s; box-shadow: 18px 0 50px rgba(6,17,44,.25); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar { min-height: 76px; padding: 12px 16px; gap: 10px; }
  .page-heading { min-width: 0; flex: 1; }
  .page-heading h1 { font-size: 17px; }
  .topbar-actions { flex: 0; }
  .global-search, .secondary-button#export-button, .user-chip { display: none; }
  .content { padding: 20px 16px 36px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .module-intro { align-items: flex-start; flex-direction: column; }
  .table-scroll { max-height: calc(100vh - 270px); }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 132px; }
  .workflow-steps { grid-template-columns: repeat(2, 1fr); gap: 22px 0; }
  .workflow-step:nth-child(2)::after { display: none; }
  .form-grid { grid-template-columns: 1fr; padding: 19px; }
  .form-field.full { grid-column: auto; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal-footer { padding: 12px 19px; }
  .modal-footer p { display: none; }
  .modal-footer div { width: 100%; }
  .modal-footer button { flex: 1; }
  #add-button { width: 42px; padding: 0; overflow: hidden; font-size: 0; }
  #add-button::before { content: "+"; font-size: 22px; }
  .welcome-strip { align-items: flex-start; }
  .date-chip { display: none; }
}
