:root {
    --ink: #12324d;
    --ink-soft: #335977;
    --muted: #6b8499;
    --blue: #0e6fb8;
    --blue-deep: #084f89;
    --blue-light: #e8f4ff;
    --sky: #39a4e6;
    --line: #bcd6e9;
    --glass: rgba(255, 255, 255, .84);
    --shadow: 0 14px 34px rgba(3, 38, 76, .28);
    --radius: 3px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    color: var(--ink);
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background:
        radial-gradient(circle at 12% 6%, rgba(139, 216, 255, .55), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(20, 112, 180, .5), transparent 42%),
        linear-gradient(135deg, #0a3c6c 0%, #0a5f9c 44%, #1078b8 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,.14), transparent 38%, rgba(0,28,60,.12));
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; color: #123c60; font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.glass-panel, .setup-window, .login-window, .app-shell {
    background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(232,244,255,.8));
    border: 1px solid rgba(255,255,255,.92);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.9);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.panel-pad { padding: 22px 24px; }

.aero-titlebar {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    color: #fff;
    background: linear-gradient(180deg, #2b94d8 0%, #0b68ac 52%, #075694 100%);
    border-bottom: 1px solid #064b80;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

.aero-title { font-size: 13px; font-weight: 600; letter-spacing: .4px; }
.aero-badge, .aero-tag {
    font-size: 10px;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,.88);
    border: 1px solid rgba(255,255,255,.42);
    padding: 1px 6px;
    border-radius: 2px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 14px;
    border: 1px solid #2b82c4;
    border-radius: 2px;
    color: #fff;
    background: linear-gradient(180deg, #43a9e8 0%, #0f74bd 50%, #075da0 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 2px 5px rgba(4,51,91,.22);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,37,72,.3); }
.btn-primary { border-color: #075da0; }
.btn-light {
    color: #174d78;
    border-color: #9fc5df;
    background: linear-gradient(180deg, #fff 0%, #e8f3fc 100%);
    box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(4,51,91,.14);
}
.btn-danger {
    border-color: #a83232;
    background: linear-gradient(180deg, #e06a6a 0%, #bf3535 52%, #a52727 100%);
}
.btn-small { min-height: 27px; padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; }

.input, select.input, textarea.input {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    background: #fff;
    border: 1px solid #9dbfd6;
    border-radius: 2px;
    box-shadow: inset 0 1px 2px rgba(7,58,97,.1);
    outline: none;
}
.input:focus {
    border-color: #1c8bd4;
    box-shadow: 0 0 0 2px rgba(40,150,220,.22), inset 0 1px 2px rgba(7,58,97,.08);
}
.input[readonly] { background: #f1f6fa; color: #5c7488; }
textarea.input { resize: vertical; line-height: 1.6; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-field.span-2, .form-grid > .field-cell.span-2 { grid-column: 1 / -1; }
.field-label { display: block; margin-bottom: 5px; color: #244f73; font-weight: 600; }
.req { color: #c62f2f; margin-left: 3px; }
.choice-group { display: flex; flex-wrap: wrap; gap: 8px 10px; padding-top: 3px; }
.choice {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    color: #254e6d;
    background: #f3f9fd;
    border: 1px solid #c3dbea;
    border-radius: 2px;
    cursor: pointer;
}
.choice:hover { background: #e6f3fc; border-color: #8fbdda; }
.choice input { margin: 0; accent-color: #0e6fb8; }
.field-error { margin-top: 4px; color: #b52b2b; font-size: 12px; }

.notice {
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid;
    border-left-width: 4px;
    border-radius: 2px;
    background: #fff;
}
.notice-success { border-color: #a8d7bd; border-left-color: #2a9b64; color: #1b6a45; background: #eef9f3; }
.notice-error { border-color: #e2b3b3; border-left-color: #c23636; color: #962727; background: #fff1f1; }
.notice-info { border-color: #a9cde6; border-left-color: #1479bd; color: #155f93; background: #eff7fd; }
.notice-warn { border-color: #e3cf9f; border-left-color: #c2921f; color: #85631a; background: #fffaf0; }

.meta-label { display: block; color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 2px; background: #fff; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
    padding: 10px 12px;
    color: #16486f;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    background: linear-gradient(180deg, #edf6fd 0%, #dcecf8 100%);
    border-bottom: 1px solid #b9d3e6;
}
table.data-table td { padding: 10px 12px; border-bottom: 1px solid #dce9f2; vertical-align: middle; }
table.data-table tbody tr:hover { background: #f4faff; }
table.data-table tbody tr:last-child td { border-bottom: none; }
.table-empty { padding: 30px; text-align: center; color: var(--muted); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid;
    border-radius: 2px;
    font-size: 12px;
    line-height: 1.5;
}
.tag-blue { color: #0c609b; border-color: #9cc8e4; background: #e9f5fd; }
.tag-green { color: #18734d; border-color: #9ed2b8; background: #eaf8f1; }
.tag-red { color: #a32d2d; border-color: #e0aaaa; background: #fdeeee; }
.tag-gray { color: #5e7180; border-color: #c5d2dc; background: #f2f5f7; }

.action-links { display: flex; flex-wrap: wrap; gap: 6px; }
.action-links form { display: inline; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
    position: relative;
    padding: 16px 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(233,245,255,.84));
    border: 1px solid rgba(255,255,255,.95);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius);
    box-shadow: 0 7px 18px rgba(4,45,84,.16);
}
.stat-card.green { border-left-color: #2d9a66; }
.stat-card.red { border-left-color: #c43b3b; }
.stat-card.gold { border-left-color: #c89320; }
.stat-number { font-size: 28px; font-weight: 600; color: #0b527f; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: rgba(236,246,254,.75);
    border: 1px solid #c9deed;
    border-radius: 2px;
}
.filter-bar .input { width: auto; min-width: 150px; }
.filter-bar label { color: var(--ink-soft); font-weight: 600; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
    display: inline-block;
    padding: 8px 16px;
    color: #356185;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 2px 2px 0 0;
    font-weight: 600;
}
.tab:hover { text-decoration: none; background: rgba(232,244,255,.8); }
.tab.active { color: #0b5f99; background: #fff; border-color: var(--line); border-bottom-color: #fff; margin-bottom: -1px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th, .detail-table td { padding: 9px 12px; border: 1px solid #cfdfeb; vertical-align: top; }
.detail-table th { width: 190px; text-align: left; color: #24537a; background: #eef6fc; font-weight: 600; }
.detail-table td { background: #fff; }
.detail-section-title {
    margin: 20px 0 10px;
    padding-left: 9px;
    border-left: 3px solid var(--blue);
    font-size: 15px;
    color: #174d78;
    font-weight: 600;
}

.flow-list { margin: 0; padding: 0; list-style: none; }
.flow-step {
    position: relative;
    margin-left: 7px;
    padding: 0 0 16px 20px;
    border-left: 2px solid #bdd7e9;
}
.flow-step:last-child { border-left-color: transparent; padding-bottom: 0; }
.flow-step::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    background: #d8e9f5;
    border: 2px solid #6fa9d1;
    border-radius: 2px;
}
.flow-step.approved::before { background: #cfe9d9; border-color: #3b9b6a; }
.flow-step.rejected::before { background: #f4d4d4; border-color: #c44545; }
.flow-step.skipped::before { background: #e6ebef; border-color: #9baebc; }
.flow-step-title { font-weight: 600; color: #234f72; }
.flow-step-meta { color: var(--muted); font-size: 12px; }
.flow-opinion { margin-top: 4px; padding: 7px 10px; background: #f3f9fd; border-left: 2px solid #9fc8e2; }

.template-preview {
    display: block;
    max-width: 100%;
    max-height: 460px;
    margin: 0 auto;
    object-fit: contain;
    background: #fff;
    border: 1px solid #c4d9e8;
    box-shadow: 0 4px 12px rgba(5,52,93,.14);
}
.preview-box { padding: 12px; background: #eef5fa; border: 1px solid #cadcea; }
.preview-caption { margin-top: 8px; text-align: center; color: var(--muted); font-size: 12px; }
.template-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.template-thumb {
    width: 74px;
    height: 88px;
    object-fit: cover;
    border: 1px solid #bfd6e7;
    background: #fff;
    cursor: pointer;
}
.template-thumb:hover { border-color: var(--blue); }

.approver-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.approver-step { padding: 12px; background: #f1f8fd; border: 1px solid #c8deed; border-left: 3px solid var(--blue); }
.approver-step.fixed { border-left-color: #7294ad; }
.approver-step-label { display: block; margin-bottom: 6px; font-weight: 600; color: #24537a; }
.fixed-text { color: #4c6c84; }

.opinion-input { width: 100%; min-height: 30px; padding: 5px 8px; border: 1px solid #a9c8dd; border-radius: 2px; font-family: inherit; font-size: 12px; }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    background: #d43f3f;
    border: 1px solid #a92d2d;
    border-radius: 9px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

.notice-item { padding: 13px 16px; border-bottom: 1px solid #dce9f2; background: #fff; }
.notice-item.unread { background: #f2f9ff; border-left: 3px solid var(--blue); }
.notice-item-title { font-weight: 600; color: #1c527b; }
.notice-item-meta { color: var(--muted); font-size: 12px; }
.notice-item-content { margin-top: 4px; color: #3b5e77; }

.setup-body { display: flex; align-items: center; justify-content: center; padding: 36px 18px; }
.setup-window { width: min(720px, 100%); overflow: hidden; }
.setup-content { padding: 28px 32px; }
.setup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0; }
.setup-grid > div { padding: 10px 12px; background: #f1f8fd; border: 1px solid #c9deed; }
.setup-footer { padding: 12px 20px; color: #5f7a90; font-size: 12px; text-align: center; background: rgba(226,240,251,.78); border-top: 1px solid #c8dceb; }
.setup-help { margin-top: 16px; color: var(--muted); font-size: 12px; }
.setup-help pre { overflow-x: auto; padding: 12px; color: #234c6d; background: #f2f7fb; border: 1px solid #cadcea; }

.login-shell {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    margin: 6vh auto;
    display: grid;
    grid-template-columns: 44% 56%;
    min-height: 560px;
    overflow: hidden;
}
.login-brand {
    position: relative;
    padding: 46px 40px;
    color: #eaf6ff;
    background:
        linear-gradient(160deg, rgba(255,255,255,.12), transparent 42%),
        linear-gradient(145deg, #064677 0%, #0a6eb3 62%, #126fae 100%);
    border-right: 1px solid #06446f;
}
.login-brand::after {
    content: "";
    position: absolute;
    right: -70px;
    bottom: -90px;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(255,255,255,.18);
    transform: rotate(28deg);
}
.login-brand h1 { margin: 26px 0 10px; color: #fff; font-size: 26px; line-height: 1.4; }
.login-brand .brand-sub { color: #bfe1f7; font-size: 14px; letter-spacing: 1px; }
.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    color: #0a5e9c;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(180deg, #fff, #c9e6fa);
    border: 1px solid rgba(255,255,255,.9);
    box-shadow: 0 6px 16px rgba(0,35,70,.3);
}
.brand-list { margin-top: 42px; padding: 0; list-style: none; }
.brand-list li { position: relative; padding: 7px 0 7px 18px; color: #d9edfb; }
.brand-list li::before { content: ""; position: absolute; left: 0; top: 15px; width: 7px; height: 7px; background: #77c6f2; border: 1px solid #d9f1ff; }
.login-form-wrap { display: flex; flex-direction: column; justify-content: center; padding: 46px 52px; background: rgba(255,255,255,.66); }
.login-form-wrap h2 { margin-bottom: 4px; font-size: 22px; }
.login-form .input { min-height: 42px; }
.login-form .form-field { margin-bottom: 16px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1440px, calc(100% - 36px));
    margin: 18px auto;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    overflow: hidden;
}
.sidebar {
    display: flex;
    flex-direction: column;
    color: #dceefa;
    background: linear-gradient(180deg, rgba(8,70,120,.97), rgba(6,51,91,.95));
    border-right: 1px solid #06436f;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.14); }
.sidebar-brand .brand-mark { width: 38px; height: 38px; font-size: 14px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; }
.sidebar-brand span { display: block; color: #9fc8e3; font-size: 11px; letter-spacing: .8px; }
.nav { flex: 1; padding: 14px 10px; }
.nav-group-title { margin: 14px 8px 6px; color: #8bbcdc; font-size: 11px; letter-spacing: 1px; }
.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    margin-bottom: 3px;
    color: #d7ebf9;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: 2px;
    font-size: 13px;
}
.nav-link:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.1); }
.nav-link.active { color: #fff; background: rgba(42,148,214,.36); border-color: rgba(255,255,255,.16); border-left-color: #6fc4f4; }
.sidebar-foot { padding: 12px 16px; color: #8fb9d6; font-size: 11px; border-top: 1px solid rgba(255,255,255,.12); }
.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(232,244,255,.7));
    border-bottom: 1px solid #c7dceb;
}
.topbar-title { font-size: 17px; font-weight: 600; color: #174d78; }
.topbar-sub { color: var(--muted); font-size: 12px; }
.user-box { display: flex; align-items: center; gap: 10px; }
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(180deg, #3b9cd9, #0a67a9);
    border: 1px solid #0a5e99;
    border-radius: 2px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { color: #174d78; font-weight: 600; }
.user-meta { color: var(--muted); font-size: 11px; }
.content { flex: 1; padding: 22px 24px 28px; }
.page-footer { padding: 12px 24px; color: #5f7a90; font-size: 12px; text-align: center; background: rgba(226,240,251,.72); border-top: 1px solid #c8dceb; }

.print-title { display: none; }

@media (max-width: 980px) {
    .login-shell { grid-template-columns: 1fr; margin: 14px auto; }
    .login-brand { padding: 28px; }
    .login-brand h1 { font-size: 21px; }
    .brand-list { display: none; }
    .login-form-wrap { padding: 30px; }
    .app-shell { grid-template-columns: 1fr; width: calc(100% - 20px); margin: 10px auto; }
    .sidebar { flex-direction: column; }
    .nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
    .nav-group-title, .sidebar-foot { display: none; }
    .nav-link { flex: 1 1 auto; justify-content: center; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid, .approver-grid { grid-template-columns: 1fr; }
    .setup-grid { grid-template-columns: 1fr; }
}

@media print {
    @page { size: A4; margin: 16mm; }
    body { background: #fff; color: #000; }
    body::before, .sidebar, .topbar, .page-footer, .no-print { display: none !important; }
    .app-shell, .glass-panel { border: none; box-shadow: none; background: #fff; backdrop-filter: none; }
    .content { padding: 0; }
    .print-title { display: block; margin-bottom: 14px; font-size: 20px; text-align: center; }
    .detail-table th, .detail-table td { border-color: #999; background: #fff; }
    .flow-step { break-inside: avoid; }
}
