:root {
    --brand-950: #0b2d38;
    --brand-900: #123b4a;
    --brand-800: #185268;
    --brand-700: #176c7d;
    --brand-600: #16839a;
    --brand-100: #dff4f6;
    --brand-50: #effafb;
    --ink-950: #14232b;
    --ink-800: #2c3d45;
    --ink-650: #50636c;
    --ink-500: #71828a;
    --line: #dce5e8;
    --line-strong: #c9d6da;
    --surface: #ffffff;
    --surface-soft: #f7fafb;
    --canvas: #eef3f5;
    --blue: #3478f6;
    --blue-soft: #e9f1ff;
    --teal: #138b7b;
    --teal-soft: #e4f6f2;
    --amber: #b96914;
    --amber-soft: #fff2dc;
    --rose: #bc4151;
    --rose-soft: #ffecef;
    --violet: #7357b5;
    --violet-soft: #f0ebff;
    --success: #16794b;
    --success-soft: #e7f6ed;
    --warning: #9a5b0b;
    --warning-soft: #fff4db;
    --danger: #b4232f;
    --danger-soft: #ffeaec;
    --info: #176c7d;
    --info-soft: #e7f6f8;
    --shadow-sm: 0 2px 8px rgba(20, 35, 43, .06);
    --shadow-md: 0 12px 32px rgba(20, 35, 43, .10);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --sidebar-width: 272px;
    --topbar-height: 72px;
    --font-sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; color-scheme: light; }

body {
    margin: 0;
    color: var(--ink-950);
    background: var(--canvas);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible {
    outline: 3px solid rgba(52, 120, 246, .34);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    z-index: 2000;
    top: 10px;
    left: 12px;
    padding: 9px 14px;
    color: #fff;
    background: var(--brand-900);
    border-radius: var(--radius-sm);
    transform: translateY(-150%);
    transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }

/* Application shell */
.app-layout { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.app-workspace { min-width: 0; display: flex; min-height: 100vh; flex-direction: column; }
.page-main { flex: 1; min-width: 0; }
.page-container { width: min(1500px, 100%); margin: 0 auto; padding: 28px 32px 40px; }
.app-footer {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 32px;
    color: var(--ink-500);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .62);
    font-size: 12px;
}

/* Sidebar */
.app-sidebar {
    position: sticky;
    z-index: 100;
    top: 0;
    height: 100vh;
    display: flex;
    min-width: 0;
    flex-direction: column;
    color: #d9e8ec;
    background: linear-gradient(180deg, var(--brand-950) 0%, #102f3b 58%, #0c2934 100%);
    box-shadow: 6px 0 24px rgba(11, 45, 56, .08);
}
.sidebar-brand { min-height: 86px; display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand-link { display: flex; min-width: 0; flex: 1; align-items: center; gap: 12px; color: #fff; }
.brand-mark, .login-brand-mark {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    color: var(--brand-950);
    background: linear-gradient(135deg, #a8e6e8, #fff);
    border-radius: 13px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.72), 0 7px 16px rgba(0,0,0,.14);
    font-size: 20px;
    font-weight: 800;
}
.brand-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.brand-copy strong { font-size: 16px; letter-spacing: .03em; }
.brand-copy small { margin-top: 2px; overflow: hidden; color: #a9c2ca; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-close { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; color: #d9e8ec; border: 0; background: transparent; border-radius: 9px; cursor: pointer; }
.sidebar-close:hover { background: rgba(255,255,255,.10); }
.sidebar-close svg { width: 21px; }
.sidebar-nav { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 16px 12px 22px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.nav-section + .nav-section { margin-top: 20px; }
.nav-section-title { display: block; padding: 0 12px 7px; color: #789ba6; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.nav-section--workflow { position: relative; }
.nav-section--workflow::before {
    position: absolute;
    top: 26px;
    bottom: 11px;
    left: 22px;
    width: 1px;
    background: rgba(112, 221, 225, .13);
    content: "";
}
.nav-section--collapsible > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 9px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.nav-section--collapsible > summary::-webkit-details-marker { display: none; }
.nav-section--collapsible > summary:hover { color: #b9d4db; }
.nav-section--collapsible > summary svg { width: 14px; transition: transform .16s ease; }
.nav-section--collapsible[open] > summary svg { transform: rotate(180deg); }
.nav-section-body { padding-top: 1px; }
.nav-link {
    position: relative;
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    padding: 9px 12px;
    color: #c7dbe1;
    border-radius: 10px;
    font-weight: 600;
    transition: color .16s ease, background .16s ease, transform .16s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-link.is-active { color: #fff; background: linear-gradient(90deg, rgba(36, 166, 179, .28), rgba(36, 166, 179, .12)); }
.nav-link.is-active::before { position: absolute; left: 0; width: 3px; height: 24px; background: #70dde1; border-radius: 0 4px 4px 0; content: ""; }
.nav-link.is-disabled { color: #78959e; cursor: not-allowed; }
.nav-link.is-disabled:hover { color: #78959e; background: transparent; }
.nav-icon { width: 21px; height: 21px; flex: 0 0 auto; }
.nav-icon svg { width: 100%; height: 100%; }
.nav-badge { margin-left: auto; padding: 1px 6px; color: #8faab3; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.09); }
.period-chip { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 11px; }
.period-dot { width: 9px; height: 9px; flex: 0 0 auto; background: #55d2aa; border: 2px solid rgba(85,210,170,.24); border-radius: 50%; box-shadow: 0 0 0 4px rgba(85,210,170,.10); }
.period-chip span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.period-chip small { color: #87aab4; font-size: 10px; }
.period-chip strong { color: #dcecef; font-size: 12px; }
.sidebar-overlay { display: none; }

/* Topbar */
.app-topbar {
    position: sticky;
    z-index: 80;
    top: 0;
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 10px 32px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}
.topbar-left, .topbar-actions, .user-summary { display: flex; align-items: center; }
.topbar-left { min-width: 0; gap: 12px; }
.mobile-menu-button { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; color: var(--ink-800); border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; }
.mobile-menu-button svg { width: 22px; }
.topbar-location { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--ink-500); }
.topbar-location svg { width: 13px; }
.topbar-location strong { overflow: hidden; color: var(--ink-950); text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { gap: 18px; }
.help-link { display: flex; align-items: center; gap: 7px; color: var(--ink-650); font-weight: 600; }
.help-link:hover { color: var(--brand-700); }
.help-link svg { width: 20px; }
.user-summary { gap: 10px; padding-left: 18px; border-left: 1px solid var(--line); }
.user-avatar { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; color: var(--brand-900); background: var(--brand-100); border-radius: 50%; font-weight: 800; }
.user-copy { display: flex; flex-direction: column; line-height: 1.3; }
.user-copy strong { max-width: 140px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-copy small { margin-top: 2px; color: var(--ink-500); font-size: 10px; }
.logout-form { margin: 0; }
.text-button { padding: 5px 7px; color: var(--ink-500); border: 0; background: transparent; border-radius: 7px; cursor: pointer; }
.text-button:hover { color: var(--danger); background: var(--danger-soft); }

/* Messages */
.message-stack { display: grid; gap: 10px; margin-bottom: 20px; }
.alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 11px; padding: 13px 14px; border: 1px solid; border-radius: 11px; box-shadow: var(--shadow-sm); transition: opacity .2s ease, transform .2s ease; }
.alert.is-leaving { opacity: 0; transform: translateY(-7px); }
.alert--success { color: var(--success); background: var(--success-soft); border-color: #bde3cc; }
.alert--warning { color: var(--warning); background: var(--warning-soft); border-color: #efd49e; }
.alert--error { color: var(--danger); background: var(--danger-soft); border-color: #efbdc2; }
.alert--info { color: var(--info); background: var(--info-soft); border-color: #bbdfe3; }
.alert-icon { width: 21px; height: 21px; margin-top: 1px; }
.alert-icon svg { width: 100%; height: 100%; }
.alert-content { color: var(--ink-800); }
.alert-close { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; margin: -3px -4px -3px 0; color: currentColor; border: 0; background: transparent; border-radius: 7px; cursor: pointer; opacity: .72; }
.alert-close:hover { background: rgba(255,255,255,.58); opacity: 1; }
.alert-close svg { width: 17px; }
.settlement-warning-details {
    margin-top: 10px;
    overflow: hidden;
    color: var(--ink-800);
    background: #fffaf0;
    border: 1px solid #ecd9ad;
    border-radius: 10px;
}
.settlement-warning-details > summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 9px 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.settlement-warning-details > summary::-webkit-details-marker { display: none; }
.settlement-warning-details > summary:hover { background: #fff6df; }
.settlement-warning-icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    color: #9a6615;
    background: #f9e8bd;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
}
.settlement-warning-copy { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.settlement-warning-copy strong { font-size: 12px; }
.settlement-warning-copy small { color: #8a6b37; font-size: 10px; }
.settlement-warning-action { display: inline-flex; align-items: center; gap: 5px; color: #8a621f; font-size: 10px; font-weight: 700; white-space: nowrap; }
.settlement-warning-action svg { width: 14px; transition: transform .16s ease; }
.settlement-warning-action-open { display: none; }
.settlement-warning-details[open] .settlement-warning-action-closed { display: none; }
.settlement-warning-details[open] .settlement-warning-action-open { display: inline; }
.settlement-warning-details[open] .settlement-warning-action svg { transform: rotate(180deg); }
.settlement-warning-body { padding: 10px 12px 12px; background: #fff; border-top: 1px solid #f0e2c2; }
.settlement-warning-body > p { margin: 0 0 8px; color: var(--ink-500); font-size: 10px; }
.settlement-warning-body ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 28px;
    max-height: 220px;
    margin: 0;
    overflow-y: auto;
    padding: 0 6px 0 20px;
}
.settlement-warning-body li { padding-right: 8px; color: var(--ink-650); font-size: 10px; line-height: 1.55; }
.settlement-history-details { overflow: hidden; padding: 0; }
.settlement-history-details > summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 11px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.settlement-history-details > summary::-webkit-details-marker { display: none; }
.settlement-history-details > summary:hover { background: var(--surface-soft); }
.settlement-history-version {
    display: inline-flex;
    min-width: 42px;
    height: 30px;
    align-items: center;
    justify-content: center;
    color: var(--brand-800);
    background: var(--brand-50);
    border: 1px solid #c9e8eb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}
.settlement-history-copy { display: flex; min-width: 0; align-items: baseline; gap: 9px; }
.settlement-history-copy strong { font-size: 14px; }
.settlement-history-copy small { overflow: hidden; color: var(--ink-500); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.settlement-history-action { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-700); font-size: 10px; font-weight: 700; white-space: nowrap; }
.settlement-history-action svg { width: 14px; transition: transform .16s ease; }
.settlement-history-action-open { display: none; }
.settlement-history-details[open] .settlement-history-action-closed { display: none; }
.settlement-history-details[open] .settlement-history-action-open { display: inline; }
.settlement-history-details[open] .settlement-history-action svg { transform: rotate(180deg); }
.settlement-history-body { border-top: 1px solid var(--line); }
.settlement-history-table-wrap { max-height: 340px; overflow: auto; }
.settlement-history-table-wrap table { min-width: 760px; }
.settlement-history-table-wrap thead { position: sticky; z-index: 1; top: 0; }
.settlement-history-table-wrap th,
.settlement-history-table-wrap td { padding: 9px 16px; font-size: 11px; }
.settlement-history-table-wrap td:first-child { width: 110px; }
.settlement-history-table-wrap td:first-child strong { display: inline; }
.settlement-history-table-wrap td:first-child small { display: inline; margin-left: 7px; }
.settlement-history-body .project-pagination { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.person-result-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -3px 0 14px;
    padding: 9px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.person-result-search-field { position: relative; display: block; width: min(460px, 100%); }
.person-result-search-field svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 17px;
    color: var(--ink-500);
    pointer-events: none;
    transform: translateY(-50%);
}
.person-result-search-field svg circle,
.person-result-search-field svg path { stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.person-result-search-field input {
    width: 100%;
    min-height: 36px;
    padding: 7px 12px 7px 37px;
    color: var(--ink-800);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: none;
}
.person-result-search-field input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(72,145,166,.14); }
.person-result-search .button { min-height: 36px; }
.person-result-search-clear { padding: 7px 5px; color: var(--ink-500); font-size: 11px; font-weight: 700; }
.person-result-search-clear:hover { color: var(--brand-700); }
.person-result-search-count { margin-left: auto; color: var(--ink-500); font-size: 10px; white-space: nowrap; }

@media (max-width: 860px) {
    .settlement-warning-copy { flex-direction: column; gap: 1px; }
    .settlement-warning-body ul { grid-template-columns: 1fr; }
    .settlement-history-copy { flex-direction: column; gap: 1px; }
    .person-result-search { flex-wrap: wrap; }
    .person-result-search-field { width: 100%; }
    .person-result-search-count { margin-left: 0; }
}

/* Common components */
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--brand-700); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; color: var(--brand-800); background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; font-weight: 700; cursor: pointer; transition: transform .14s ease, background .14s ease, box-shadow .14s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.button[aria-busy="true"] { cursor: wait; opacity: .72; pointer-events: none; transform: none; }
.button svg { width: 19px; }
.button--primary { color: #fff; background: linear-gradient(135deg, var(--brand-700), var(--brand-600)); box-shadow: 0 7px 18px rgba(22, 108, 125, .24); }
.button--primary:hover { background: linear-gradient(135deg, var(--brand-800), var(--brand-700)); box-shadow: 0 9px 22px rgba(22, 108, 125, .29); }
.button--secondary { color: var(--brand-800); background: #fff; border-color: #bdd1d7; }
.button--secondary:hover { background: var(--brand-50); }
.button--large { min-height: 50px; padding: 11px 20px; font-size: 15px; }
.button--small { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.button--block { width: 100%; }
.panel { min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 18px; line-height: 1.35; }
.subtle-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-700); font-size: 12px; font-weight: 700; white-space: nowrap; }
.subtle-link:hover { color: var(--brand-900); }
.subtle-link svg { width: 16px; }
.info-pill { padding: 4px 9px; color: var(--brand-700); background: var(--brand-50); border: 1px solid #c9e8eb; border-radius: 999px; font-size: 10px; font-weight: 700; }

/* Dashboard */
.welcome-panel { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 4px 2px; }
.welcome-panel h1 { margin: 0 0 5px; font-size: clamp(24px, 3vw, 32px); line-height: 1.25; letter-spacing: -.03em; }
.welcome-panel p:last-child { margin: 0; color: var(--ink-650); }
.welcome-status { display: flex; min-width: 190px; align-items: center; gap: 11px; padding: 11px 14px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-sm); }
.status-dot { width: 10px; height: 10px; flex: 0 0 auto; background: #e5a23b; border-radius: 50%; box-shadow: 0 0 0 5px rgba(229,162,59,.14); }
.welcome-status span:last-child { display: flex; flex-direction: column; line-height: 1.4; }
.welcome-status small { color: var(--ink-500); font-size: 10px; }
.welcome-status strong { font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { position: relative; display: grid; min-height: 132px; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; overflow: hidden; padding: 19px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.metric-card::after { position: absolute; right: -24px; bottom: -42px; width: 110px; height: 110px; background: currentColor; border-radius: 50%; content: ""; opacity: .045; }
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-card--blue { color: var(--blue); }
.metric-card--teal { color: var(--teal); }
.metric-card--amber { color: var(--amber); }
.metric-card--rose { color: var(--rose); }
.metric-icon { display: inline-flex; width: 47px; height: 47px; align-items: center; justify-content: center; background: currentColor; border-radius: 13px; color: #fff; font-size: 17px; font-weight: 800; }
.metric-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.metric-copy small { color: var(--ink-650); font-size: 12px; font-style: normal; }
.metric-copy strong { margin: 3px 0; color: var(--ink-950); font-size: 28px; line-height: 1.1; }
.metric-copy em { overflow: hidden; color: var(--ink-500); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.metric-arrow { width: 18px; color: var(--ink-500); }
.dashboard-ranking-section {
    position: relative;
    margin-bottom: 20px;
    padding: 18px;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(226, 240, 243, .86), rgba(247, 250, 251, .94) 48%, rgba(231, 243, 245, .82));
    border: 1px solid rgba(197, 216, 221, .58);
    border-radius: 22px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 10px 28px rgba(20, 35, 43, .035);
}
.dashboard-ranking-section::before,
.dashboard-ranking-section::after {
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    content: "";
    pointer-events: none;
}
.dashboard-ranking-section::before { top: -150px; left: 26%; background: rgba(255, 255, 255, .36); }
.dashboard-ranking-section::after { right: -120px; bottom: -165px; background: rgba(177, 218, 224, .16); }
.dashboard-ranking-section > * { position: relative; z-index: 1; }
.dashboard-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 3px 14px;
}
.dashboard-section-heading h2 { margin: 1px 0 0; font-size: 21px; line-height: 1.35; }
.ranking-period-chip {
    padding: 6px 11px;
    color: var(--brand-700);
    background: rgba(255, 255, 255, .76);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(185, 211, 216, .44), 0 4px 12px rgba(20, 35, 43, .035);
    font-size: 10px;
    font-weight: 700;
}
.dashboard-ranking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 16px; }
.ranking-card {
    overflow: hidden;
    padding: 0;
    background: rgba(255, 255, 255, .94);
    border-color: rgba(255, 255, 255, .76);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(27, 63, 74, .075);
}
.ranking-card::before { display: block; height: 3px; background: linear-gradient(90deg, #77c9d0, rgba(119, 201, 208, .08)); content: ""; }
.ranking-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px 15px;
    background: linear-gradient(135deg, rgba(245, 251, 252, .96), rgba(255, 255, 255, .92));
}
.ranking-card-head h3 { margin: 1px 0 2px; font-size: 19px; line-height: 1.35; }
.ranking-card-head > div > span { color: var(--ink-500); font-size: 10px; }
.ranking-count {
    flex: 0 0 auto;
    padding: 5px 10px;
    color: var(--ink-650);
    background: rgba(255, 255, 255, .86);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(199, 215, 220, .52);
    font-size: 10px;
    font-weight: 700;
}
.ranking-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 14px;
    list-style: none;
}
.ranking-list li {
    position: relative;
    display: grid;
    grid-template-columns: 32px 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 59px;
    margin: 0;
    padding: 9px 11px;
    border-radius: 11px;
}
.ranking-list li:nth-child(-n+3) {
    min-height: 150px;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    align-content: center;
    gap: 7px;
    overflow: hidden;
    padding: 20px 9px 14px;
    background: linear-gradient(155deg, #f5fafb, #edf5f6);
    border: 1px solid rgba(211, 225, 229, .6);
    border-radius: 15px;
    text-align: center;
}
.ranking-list li:nth-child(1) { background: linear-gradient(155deg, #fff9e9, #fff1cc); border-color: rgba(229, 188, 97, .34); box-shadow: 0 8px 20px rgba(177, 126, 29, .08); }
.ranking-list li:nth-child(2) { background: linear-gradient(155deg, #f7f9fa, #eaf0f2); }
.ranking-list li:nth-child(3) { background: linear-gradient(155deg, #fff7f2, #f7e7dc); border-color: rgba(190, 132, 93, .22); }
.ranking-list li:nth-child(-n+3)::before { position: absolute; right: -28px; bottom: -34px; width: 90px; height: 90px; background: rgba(255, 255, 255, .38); border-radius: 50%; content: ""; }
.ranking-list li:nth-child(n+4) {
    grid-column: 1 / -1;
    min-height: 54px;
    padding: 8px 12px;
    background: #f8fafb;
    border-radius: 12px;
}
.ranking-list li:nth-child(n+4) + li { margin-top: -2px; }
.ranking-list li.is-current { background: linear-gradient(90deg, rgba(223, 244, 246, .72), rgba(239, 250, 251, .38)); border-top-color: transparent; }
.ranking-number {
    display: inline-flex;
    width: 29px;
    height: 29px;
    align-items: center;
    justify-content: center;
    color: var(--ink-650);
    background: var(--surface-soft);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
}
.ranking-list li:nth-child(-n+3) .ranking-number { position: absolute; top: 11px; left: 11px; z-index: 1; width: 31px; height: 31px; border-radius: 11px; }
.ranking-number--1 { color: #fff; background: linear-gradient(145deg, #e4ad3d, #bd7c16); box-shadow: 0 5px 12px rgba(177, 126, 29, .2); }
.ranking-number--2 { color: #61717a; background: #edf2f4; }
.ranking-number--3 { color: #9a5b38; background: #f8e9df; }
.ranking-avatar {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    color: var(--brand-800);
    background: var(--brand-50);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
}
.ranking-list li:nth-child(-n+3) .ranking-avatar { width: 53px; height: 53px; color: var(--brand-800); background: rgba(255, 255, 255, .86); box-shadow: 0 7px 16px rgba(20, 35, 43, .07); font-size: 15px; }
.ranking-person { min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.ranking-person strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-person small { overflow: hidden; color: var(--ink-500); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-list li:nth-child(-n+3) .ranking-person { width: 100%; align-items: center; }
.ranking-list li:nth-child(-n+3) .ranking-person strong,
.ranking-list li:nth-child(-n+3) .ranking-person small { max-width: 100%; }
.ranking-me { padding: 3px 7px; color: var(--brand-700); background: #fff; border-radius: 999px; font-size: 9px; font-weight: 800; }
.ranking-list li:nth-child(-n+3) .ranking-me { position: absolute; top: 12px; right: 11px; z-index: 1; }
.ranking-current {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 12px;
    margin: 5px 14px 14px;
    padding: 11px 13px;
    color: var(--brand-800);
    background: linear-gradient(90deg, var(--brand-50), rgba(239, 250, 251, .48));
    border-radius: 11px;
}
.ranking-current span { grid-row: 1 / 3; font-size: 11px; font-weight: 700; }
.ranking-current strong { font-size: 13px; text-align: right; }
.ranking-current small { color: var(--ink-500); font-size: 9px; text-align: right; }
.ranking-empty {
    position: relative;
    min-height: 302px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 13px;
    overflow: hidden;
    padding: 28px;
    color: var(--ink-500);
    background: radial-gradient(circle at 50% 38%, rgba(223, 244, 246, .78), rgba(255, 255, 255, 0) 42%);
    text-align: center;
}
.ranking-empty::before { position: absolute; width: 150px; height: 150px; border: 1px solid rgba(84, 163, 177, .09); border-radius: 50%; content: ""; }
.ranking-empty > span { z-index: 1; display: inline-flex; width: 66px; height: 66px; align-items: center; justify-content: center; color: #fff; background: linear-gradient(145deg, #6bbcc6, var(--brand-700)); border: 7px solid rgba(255, 255, 255, .88); border-radius: 50%; box-shadow: 0 10px 24px rgba(23, 108, 125, .16); font-size: 17px; font-weight: 800; }
.ranking-empty div { z-index: 1; display: flex; max-width: 280px; flex-direction: column; }
.ranking-empty strong { color: var(--ink-800); }
.ranking-empty small { margin-top: 3px; font-size: 10px; line-height: 1.65; }
.dashboard-task-panel { margin-bottom: 20px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 20px; margin-bottom: 20px; }
.task-list { margin: 0; padding: 0; list-style: none; }
.task-list li { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.task-list li:first-child { padding-top: 4px; border-top: 0; }
.task-marker { width: 9px; height: 9px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 4px var(--blue-soft); }
.task-marker--warning { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.task-marker--urgent { background: var(--rose); box-shadow: 0 0 0 4px var(--rose-soft); }
.task-main { min-width: 0; display: flex; flex-direction: column; }
.task-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-main small { overflow: hidden; color: var(--ink-500); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.task-due { padding: 3px 8px; color: var(--amber); background: var(--amber-soft); border-radius: 999px; font-size: 10px; font-weight: 700; }
.empty-state { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--ink-500); text-align: left; }
.empty-state > span { display: inline-flex; width: 50px; height: 50px; align-items: center; justify-content: center; color: var(--success); background: var(--success-soft); border-radius: 50%; }
.empty-state svg { width: 25px; }
.empty-state strong { color: var(--ink-800); }
.empty-state p { margin: 2px 0 0; font-size: 12px; }
.readiness-list { margin: 0; padding: 0; list-style: none; counter-reset: none; }
.readiness-list li { position: relative; display: grid; grid-template-columns: 29px minmax(0,1fr); gap: 11px; padding: 8px 0 12px; }
.readiness-list li:not(:last-child)::after { position: absolute; top: 37px; bottom: -2px; left: 14px; width: 1px; background: var(--line); content: ""; }
.readiness-list li > span { z-index: 1; display: inline-flex; width: 29px; height: 29px; align-items: center; justify-content: center; color: var(--brand-700); background: var(--brand-50); border: 1px solid #c9e8eb; border-radius: 50%; font-size: 11px; font-weight: 800; }
.readiness-list div { display: flex; flex-direction: column; line-height: 1.45; }
.readiness-list strong { font-size: 13px; }
.readiness-list small { margin-top: 2px; color: var(--ink-500); font-size: 10px; }
.quick-panel { margin-bottom: 20px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.quick-grid > a { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; transition: border-color .14s ease, background .14s ease, transform .14s ease; }
.quick-grid > a:hover { border-color: var(--line-strong); background: var(--surface-soft); transform: translateY(-1px); }
.quick-grid > a > svg { width: 17px; color: var(--ink-500); }
.quick-icon { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 10px; font-size: 13px; font-weight: 800; }
.quick-icon--blue { color: var(--blue); background: var(--blue-soft); }
.quick-icon--green { color: var(--teal); background: var(--teal-soft); }
.quick-icon--amber { color: var(--amber); background: var(--amber-soft); }
.quick-icon--violet { color: var(--violet); background: var(--violet-soft); }
.quick-grid div { min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.quick-grid strong { font-size: 13px; }
.quick-grid small { overflow: hidden; color: var(--ink-500); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.notice-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 16px 18px; color: var(--brand-900); background: linear-gradient(90deg, var(--brand-50), #fff); border: 1px solid #c8e4e7; border-radius: var(--radius-md); }
.notice-icon { display: inline-flex; width: 37px; height: 37px; align-items: center; justify-content: center; color: var(--brand-700); background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); }
.notice-icon svg { width: 20px; }
.notice-card strong { color: var(--brand-900); }
.notice-card p { margin: 1px 0 0; color: var(--ink-650); font-size: 12px; }
.notice-card > a { color: var(--brand-700); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* Shared business-page foundations */
.card {
    min-width: 0;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
}
.page-heading h1 { margin: 0 0 5px; font-size: clamp(24px, 3vw, 32px); line-height: 1.25; letter-spacing: -.03em; }
.page-heading p:last-child { margin: 0; color: var(--ink-650); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--brand-700), var(--brand-600)); border-color: transparent; box-shadow: 0 7px 18px rgba(22,108,125,.20); }
.button-primary:hover { color: #fff; background: linear-gradient(135deg, var(--brand-800), var(--brand-700)); }
.button-ghost { color: var(--ink-650); background: #fff; border-color: var(--line-strong); }
.button-ghost:hover { color: var(--brand-800); background: var(--brand-50); }
.button-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.settlement-period-actions { flex: 0 0 auto; flex-wrap: nowrap; }
.button-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button-danger:hover { color: #fff; background: #92202a; border-color: #92202a; }
.button-danger:disabled { cursor: not-allowed; opacity: .45; }
.button-danger-outline { color: var(--danger); background: #fff; border-color: #e7bcc0; }
.button-danger-outline:hover { color: #92202a; background: #fff6f6; border-color: var(--danger); }
.alert-info { color: var(--info); background: var(--info-soft); border-color: #bbdfe3; }
.alert-error { color: var(--danger); background: var(--danger-soft); border-color: #efbdc2; }
.filter-bar { display: grid; grid-template-columns: minmax(220px,1.4fr) repeat(2,minmax(150px,.8fr)) auto; align-items: end; gap: 14px; margin-bottom: 16px; }
.filter-bar.allocation-filter { grid-template-columns: minmax(210px,1.15fr) minmax(220px,1fr) repeat(2,minmax(145px,.65fr)) auto; }
.filter-bar.people-filter { grid-template-columns: minmax(240px,1.4fr) minmax(170px,.55fr) auto; }
.filter-bar.account-filter { grid-template-columns: minmax(240px,1.2fr) minmax(170px,.55fr) minmax(150px,.45fr) auto; }
.filter-bar label, .field { min-width: 0; display: flex; flex-direction: column; gap: 6px; color: var(--ink-800); font-weight: 700; }
.filter-bar label > span, .field > span { font-size: 12px; }
.filter-bar input, .filter-bar select, .field input, .field select, .field textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 11px;
    color: var(--ink-950);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    font-weight: 400;
    transition: border-color .14s ease, box-shadow .14s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.filter-bar input:focus, .filter-bar select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(22,131,154,.10); }
.field b { color: var(--danger); }
.field small { color: var(--ink-500); font-size: 10px; font-weight: 400; }
.field em { color: var(--danger); font-size: 11px; font-style: normal; font-weight: 500; }
.field div.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 12px; padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.field div.choice-grid > div { min-width: 0; }
.field div.choice-grid label { display: flex; align-items: center; gap: 7px; color: var(--ink-800); font-size: 12px; font-weight: 500; cursor: pointer; }
.field div.choice-grid input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--brand-700); }
.check-field { display: inline-flex; min-height: 42px; align-items: center; gap: 9px; padding: 8px 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; color: var(--ink-800); font-size: 12px; font-weight: 500; cursor: pointer; }
.check-field input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--brand-700); }
.field-span-2 { grid-column: 1 / -1; }
.account-origin-note { margin-bottom: 16px; }
.people-account-table { min-width: 1040px; }
.account-table { min-width: 1120px; }
.people-account-table td .status + .status { margin-left: 4px; }
.account-table td .status + .status { margin-left: 4px; }
.role-card-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.role-card { display: flex; flex-direction: column; gap: 15px; }
.role-card .card-heading { margin-bottom: 0; }
.role-card .card-heading p { margin: 3px 0 0; color: var(--ink-500); font-size: 10px; }
.role-description { min-height: 42px; margin: 0; color: var(--ink-650); font-size: 12px; }
.permission-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.role-members { display: flex; flex-direction: column; gap: 4px; padding: 11px 13px; background: var(--surface-soft); border-radius: 9px; }
.role-members span { color: var(--ink-500); font-size: 10px; }
.role-members strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.role-card .form-actions { margin-top: auto; }
.role-permission-summary { margin-bottom: 18px; }
.account-choice-grid { max-height: 360px; overflow-y: auto; }
.permission-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-top: 18px; }
.permission-heading h2 { margin-bottom: 4px; }
.permission-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.permission-legend span { padding: 4px 8px; color: var(--brand-800); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 999px; font-size: 10px; }
.permission-tree { display: grid; gap: 14px; margin-top: 12px; }
.permission-group { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.permission-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.permission-group-heading h3 { margin: 0; font-size: 14px; }
.permission-group-heading p { margin: 3px 0 0; color: var(--ink-500); font-size: 10px; }
.permission-select-all { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; color: var(--ink-650); font-size: 11px; font-weight: 650; cursor: pointer; }
.permission-select-all input,
.permission-action input { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand-700); }
.permission-action-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; }
.permission-action { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 13px 15px; border-bottom: 1px solid var(--line); cursor: pointer; }
.permission-action:nth-child(odd) { border-right: 1px solid var(--line); }
.permission-action:hover { background: var(--brand-50); }
.permission-action span { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.permission-action strong { color: var(--ink-800); font-size: 12px; }
.permission-action small { color: var(--ink-500); font-size: 10px; line-height: 1.55; }
.searchable-select { position: relative; width: 100%; }
.field .searchable-select-input { padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-500) 50%), linear-gradient(135deg, var(--ink-500) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.field .searchable-select-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.searchable-select-results { position: absolute; z-index: 80; top: calc(100% + 5px); right: 0; left: 0; display: none; max-height: 260px; overflow-y: auto; padding: 5px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 14px 30px rgba(20,35,43,.16); }
.searchable-select.is-open .searchable-select-results { display: flex; flex-direction: column; }
.searchable-select-option { width: 100%; padding: 9px 10px; color: var(--ink-800); background: transparent; border: 0; border-radius: 7px; text-align: left; cursor: pointer; }
.searchable-select-option:hover, .searchable-select-option:focus { color: var(--brand-800); background: var(--brand-50); outline: none; }
.searchable-select-empty { padding: 12px 10px; color: var(--ink-500); font-size: 11px; font-weight: 400; text-align: center; }
.person-picker-control { position: relative; display: flex; width: 100%; min-width: 0; }
.field .person-picker-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.person-picker-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 9px 12px; color: var(--ink-800); background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; text-align: left; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.person-picker-trigger:hover { background: var(--brand-50); border-color: var(--brand-300); }
.person-picker-trigger:focus-visible { border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(72,145,166,.16); outline: none; }
.person-picker-trigger.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180,35,47,.10); }
.person-picker-trigger.is-empty .person-picker-trigger-label { color: var(--ink-500); font-weight: 400; }
.person-picker-trigger-label { min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.person-picker-trigger-action { flex: 0 0 auto; margin-left: 12px; color: var(--brand-700); font-size: 12px; font-weight: 700; }
.person-picker-clear { position: absolute; z-index: 2; top: 50%; right: 66px; display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; padding: 0; color: var(--ink-500); background: #fff; border: 0; border-radius: 50%; font-size: 18px; cursor: pointer; transform: translateY(-50%); }
.person-picker-clear[hidden] { display: none !important; }
.person-picker-clear:hover { color: var(--danger); background: var(--danger-soft); }
.person-picker-modal[hidden] { display: none !important; }
.person-picker-modal { position: fixed; z-index: 1400; inset: 0; display: grid; place-items: center; padding: 24px; }
.person-picker-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; background: rgba(13,31,40,.56); border: 0; cursor: default; backdrop-filter: blur(2px); }
.person-picker-dialog { position: relative; display: flex; width: min(720px, 100%); max-height: min(760px, calc(100vh - 48px)); flex-direction: column; overflow: hidden; background: #fff; border: 1px solid rgba(255,255,255,.7); border-radius: 18px; box-shadow: 0 28px 70px rgba(9,29,38,.28); animation: person-picker-enter .18s ease-out; }
@keyframes person-picker-enter { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.person-picker-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.person-picker-header h2 { margin: 2px 0 4px; color: var(--ink-900); font-size: 24px; }
.person-picker-header p:last-child { margin: 0; color: var(--ink-500); font-size: 12px; }
.person-picker-close { display: inline-flex; width: 38px; height: 38px; flex: 0 0 auto; align-items: center; justify-content: center; padding: 0; color: var(--ink-600); background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 26px; line-height: 1; cursor: pointer; }
.person-picker-close:hover { color: var(--ink-900); background: var(--surface); }
.person-picker-search-wrap { padding: 18px 24px 10px; }
.person-picker-search-wrap label { display: block; margin-bottom: 7px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.person-picker-search-wrap input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; }
.person-picker-status { padding: 0 24px 10px; color: var(--ink-500); font-size: 11px; }
.person-picker-results { min-height: 260px; flex: 1 1 auto; overflow-y: auto; padding: 0 14px 14px; }
.person-picker-option { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 12px; color: var(--ink-800); background: #fff; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.person-picker-option:first-child { border-top: 1px solid var(--line); }
.person-picker-option:hover, .person-picker-option:focus-visible { background: var(--brand-50); outline: none; }
.person-picker-option.is-current { background: var(--brand-50); }
.person-picker-option:disabled { color: var(--ink-500); background: var(--surface); cursor: not-allowed; }
.person-picker-option-main { min-width: 0; }
.person-picker-option-main strong { display: block; color: inherit; font-size: 14px; }
.person-picker-option-main small { display: block; margin-top: 4px; color: var(--ink-500); font-size: 11px; }
.person-picker-option-badge { flex: 0 0 auto; padding: 4px 8px; color: var(--brand-800); background: var(--brand-100); border-radius: 999px; font-size: 10px; font-weight: 700; }
.person-picker-empty { padding: 50px 18px; color: var(--ink-500); text-align: center; }
.person-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: var(--surface); border-top: 1px solid var(--line); }
.person-picker-footer span { color: var(--ink-500); font-size: 11px; }
body.person-picker-open { overflow: hidden; }
@media (max-width: 640px) {
    .person-picker-modal { align-items: end; padding: 0; }
    .person-picker-dialog { width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; }
    .person-picker-header, .person-picker-footer { padding-right: 18px; padding-left: 18px; }
    .person-picker-search-wrap { padding-right: 18px; padding-left: 18px; }
    .person-picker-status { padding-right: 18px; padding-left: 18px; }
}
.table-card { overflow-x: auto; padding: 0; }
.table-card > .card-heading {
    margin-bottom: 0;
    padding: 20px 22px 17px;
}
.project-list-controls { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; padding: 16px 18px; }
.project-filter-bar { flex: 1 1 auto; margin-bottom: 0; }
.project-bulk-entry,
.project-bulk-form { flex: 0 0 auto; }
.project-bulk-entry[hidden] { display: none !important; }
.project-bulk-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 42px; }
.project-bulk-toolbar[hidden], .project-selection-column[hidden] { display: none !important; }
.project-bulk-toolbar span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.project-bulk-toolbar b { color: var(--text); }
.project-selection-column { width: 52px; min-width: 52px; padding-right: 8px; padding-left: 16px; text-align: center; }
.project-row-checkbox, .project-select-all input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand-700); cursor: pointer; }
.project-select-all { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; cursor: pointer; }
.project-select-all span { font-size: 12px; font-weight: 700; }
.project-selected-summary { padding: 0 2px; }
tbody tr.is-selected { background: var(--brand-50); }
.project-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 12px 16px; }
.project-pagination > span { color: var(--muted); font-size: 12px; }
.project-pagination-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.project-page-number { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: var(--brand-800); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; font-weight: 700; }
.project-page-number:hover { color: var(--brand-900); background: var(--brand-100); border-color: var(--brand-300); text-decoration: none; }
.project-page-number.is-current { color: #fff; background: var(--brand-700); border-color: var(--brand-700); }
.project-page-ellipsis { color: var(--muted); padding: 0 3px; }
table { width: 100%; border-collapse: collapse; }
.milestone-table { min-width: 1280px; table-layout: fixed; }
.milestone-table th,
.milestone-table td { overflow-wrap: anywhere; }
.milestone-table th:nth-child(1) { width: 5%; }
.milestone-table th:nth-child(2),
.milestone-table th:nth-child(3) { width: 9%; }
.milestone-table th:nth-child(4) { width: 10%; }
.milestone-table th:nth-child(5) { width: 11%; }
.milestone-table th:nth-child(6) { width: 13%; }
.milestone-table th:nth-child(7),
.milestone-table th:nth-child(8),
.milestone-table th:nth-child(10) { width: 8%; }
.milestone-table th:nth-child(9),
.milestone-table th:nth-child(11) { width: 7%; }
.milestone-table th:nth-child(12) { width: 5%; }
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}
.muted { color: var(--ink-500); }
.master-detail-table { min-width: 1020px; table-layout: fixed; }
.master-detail-table th,
.master-detail-table td { overflow-wrap: anywhere; }
.master-detail-table .master-detail-expander-column {
    width: 50px;
    padding-right: 7px;
    padding-left: 15px;
    text-align: center;
}
.master-row { background: #fff; transition: background .16s ease; }
.master-row.has-details { cursor: default; }
.master-row.is-expanded { background: var(--brand-50); }
.master-row.is-expanded td { border-bottom-color: var(--brand-200); }
.master-row-actions { white-space: nowrap; }
.master-row-actions a {
    display: inline-block;
    margin-right: 10px;
}
.master-row-actions a:last-child { margin-right: 0; }
.master-detail-toggle,
.master-detail-toggle-placeholder {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.master-detail-toggle {
    color: var(--brand-700);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.master-detail-toggle:hover,
.master-detail-toggle:focus-visible {
    color: var(--brand-900);
    background: var(--brand-100);
    border-color: var(--brand-300);
    outline: none;
}
.master-detail-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .16s ease;
}
.master-detail-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.master-detail-row[hidden] { display: none; }
.master-detail-row > td {
    padding: 0;
    background: #f5f9fa;
    border-bottom: 1px solid var(--line-strong);
}
.master-detail-row:hover > td { background: #f5f9fa; }
.master-detail-panel { padding: 18px 20px 20px 50px; }
.master-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}
.master-detail-heading > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}
.master-detail-heading strong { color: var(--ink-850); font-size: 13px; }
.master-detail-heading small,
.master-detail-heading > span { color: var(--ink-500); font-size: 10px; }
.master-detail-table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.detail-table { min-width: 900px; table-layout: auto; }
.detail-table th { background: #edf3f5; }
.detail-table tbody tr:last-child td { border-bottom: 0; }
.detail-table td { padding-top: 11px; padding-bottom: 11px; }
.milestone-detail-wrap { overflow-x: visible; }
.milestone-detail-table { min-width: 0; table-layout: fixed; }
.milestone-detail-table th:nth-child(1) { width: 30%; }
.milestone-detail-table th:nth-child(2) { width: 19%; }
.milestone-detail-table th:nth-child(3) { width: 13%; }
.milestone-detail-table th:nth-child(4) { width: 29%; }
.milestone-detail-table th:nth-child(5) { width: 9%; }
.detail-field-line {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-top: 4px;
    line-height: 1.55;
}
.detail-field-line:first-child { margin-top: 0; }
.detail-field-line b {
    flex: 0 0 auto;
    color: var(--ink-500);
    font-size: 10px;
    font-weight: 700;
}
.milestone-impact-cell > small { margin-top: 4px; }
.text-danger { color: var(--danger) !important; }
.milestone-deduction-guide {
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
}
.milestone-deduction-guide > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 20px;
    cursor: pointer;
    list-style: none;
}
.milestone-deduction-guide > summary::-webkit-details-marker { display: none; }
.milestone-deduction-guide > summary > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.milestone-deduction-guide > summary small {
    color: var(--ink-500);
    font-size: 11px;
}
.milestone-deduction-guide-action {
    color: var(--brand-700);
    font-size: 12px;
    font-weight: 700;
}
.milestone-deduction-guide[open] .milestone-deduction-guide-action::before { content: "收起"; }
.milestone-deduction-guide[open] .milestone-deduction-guide-action { font-size: 0; }
.milestone-deduction-guide[open] .milestone-deduction-guide-action::before { font-size: 12px; }
.milestone-deduction-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    padding: 14px 20px;
    color: var(--ink-650);
    background: var(--brand-50);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}
.milestone-deduction-formula strong { color: var(--brand-900); }
.milestone-deduction-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding: 20px;
}
.milestone-deduction-group {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.milestone-deduction-group h3 {
    margin: 0;
    padding: 13px 15px;
    color: var(--ink-850);
    font-size: 14px;
}
.milestone-rule-table { min-width: 0; table-layout: fixed; }
.milestone-rule-table th,
.milestone-rule-table td {
    padding: 9px 10px;
    font-size: 11px;
    text-align: center;
}
.milestone-rule-table th:first-child { text-align: left; }
.milestone-node-rate-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 12px 14px;
    background: var(--surface-soft);
}
.milestone-node-rate-list span {
    padding: 5px 8px;
    color: var(--ink-650);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 10px;
}
.allocation-detail-wrap { overflow-x: visible; }
.allocation-detail-table { min-width: 0; table-layout: fixed; }
.allocation-detail-table th:nth-child(1) { width: 24%; }
.allocation-detail-table th:nth-child(2) { width: 24%; }
.allocation-detail-table th:nth-child(3) { width: 18%; }
.allocation-detail-table th:nth-child(4) { width: 16%; }
.allocation-detail-table th:nth-child(5) { width: 18%; }
.milestone-master-table th:nth-child(2) { width: 22%; }
.milestone-master-table th:nth-child(3) { width: 16%; }
.milestone-master-table th:nth-child(4),
.milestone-master-table th:nth-child(5) { width: 16%; }
.milestone-master-table th:nth-child(6) { width: 13%; }
.allocation-master-table { min-width: 0; width: 100%; }
.allocation-master-table th:nth-child(1) { width: 4%; }
.allocation-master-table th:nth-child(2) { width: 20%; }
.allocation-master-table th:nth-child(3) { width: 15%; }
.allocation-master-table th:nth-child(4) { width: 14%; }
.allocation-master-table th:nth-child(5) { width: 23%; }
.allocation-master-table th:nth-child(6) { width: 12%; }
.allocation-master-table th:nth-child(7) { width: 12%; }
.stage-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.stage-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    color: var(--ink-500);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 10px;
    white-space: nowrap;
}
.stage-pill b { color: var(--ink-700); }
.stage-pill.is-assigned {
    color: var(--brand-800);
    background: var(--brand-50);
    border-color: var(--brand-200);
}
.stage-pill.is-frozen {
    color: var(--success);
    background: var(--success-soft);
    border-color: rgba(30, 131, 93, .18);
}
.allocation-summary-grid .metric.card small { color: var(--ink-500); font-size: 10px; }
.allocation-stage-card { margin-bottom: 20px; }
.allocation-stage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.allocation-stage-item { display: flex; min-width: 0; flex-direction: column; gap: 7px; padding: 15px 16px; color: inherit; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; font: inherit; text-align: left; }
.allocation-stage-item > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.allocation-stage-item > div b { color: var(--brand-800); font-size: 15px; }
.allocation-stage-item > div span { color: var(--ink-500); font-size: 11px; font-weight: 700; }
.allocation-stage-item > strong { color: var(--ink-850); font-size: 16px; }
.allocation-stage-item > small { color: var(--ink-500); font-size: 10px; line-height: 1.55; }
.allocation-stage-item > em { color: var(--brand-700); font-size: 10px; font-style: normal; font-weight: 700; }
.allocation-stage-item.is-assigned { background: var(--brand-50); border-color: var(--brand-100); }
.allocation-stage-item.is-frozen { background: #f1f5f6; border-color: var(--line-strong); }
.allocation-stage-select { cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.allocation-stage-select:hover { border-color: var(--brand-300); transform: translateY(-1px); }
.allocation-stage-select:focus-visible { outline: 3px solid rgba(49, 135, 153, .2); outline-offset: 2px; }
.allocation-stage-select.is-selected { border-color: var(--brand-600); box-shadow: 0 0 0 2px rgba(49, 135, 153, .13); }
.allocation-stage-detail-card { min-height: 220px; }
.allocation-stage-panel { display: grid; gap: 14px; }
.allocation-stage-panel[hidden] { display: none; }
.allocation-stage-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.allocation-stage-detail-meta span { padding: 5px 9px; color: var(--ink-600); background: var(--surface-soft); border-radius: 999px; font-size: 10px; font-weight: 700; }
.allocation-editor-card { display: grid; gap: 18px; }
.allocation-editor-heading { margin-bottom: 0; }
.allocation-change-scope-field > label:first-child { font-size: 12px; }
.allocation-sync-option { display: flex; width: fit-content; align-items: center; gap: 9px; margin-top: 4px; padding: 9px 12px; color: var(--brand-800); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; }
.allocation-sync-option[hidden] { display: none; }
.field .allocation-sync-option input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; margin: 0; padding: 0; accent-color: var(--brand-700); box-shadow: none; }
.allocation-scope-notice { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: var(--ink-700); background: #eef8fa; border: 1px solid #cfe8ed; border-radius: 10px; font-size: 12px; }
.allocation-scope-notice strong { flex: 0 0 auto; color: var(--brand-700); }
.allocation-pending-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-color: #ead9a7; background: #fffdf7; }
.allocation-pending-card h2 { margin: 9px 0 5px; font-size: 18px; }
.allocation-pending-card p { margin: 0; color: var(--ink-600); }
.allocation-pending-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 10px; }
.allocation-pending-actions form { margin: 0; }
.allocation-ratio-meter { display: grid; gap: 8px; padding: 14px 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; }
.allocation-ratio-meter > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.allocation-ratio-meter > div:first-child span { color: var(--ink-650); font-size: 11px; font-weight: 700; }
.allocation-ratio-meter > div:first-child strong { color: var(--warning); font-size: 19px; }
.allocation-ratio-track { height: 7px; overflow: hidden; background: #dfe8eb; border-radius: 999px; }
.allocation-ratio-track span { display: block; width: 0; height: 100%; background: var(--warning); border-radius: inherit; transition: width .16s ease, background .16s ease; }
.allocation-ratio-meter p { margin: 0; color: var(--ink-500); font-size: 10px; }
.allocation-ratio-meter.is-complete > div:first-child strong,
.allocation-ratio-meter.is-complete p { color: var(--success); }
.allocation-ratio-meter.is-complete .allocation-ratio-track span { background: var(--success); }
.allocation-ratio-meter.is-over > div:first-child strong,
.allocation-ratio-meter.is-over p { color: var(--danger); }
.allocation-ratio-meter.is-over .allocation-ratio-track span { background: var(--danger); }
.allocation-line-list { display: grid; gap: 10px; }
.allocation-line-row { display: grid; grid-template-columns: minmax(300px, 1fr) 210px auto; align-items: end; gap: 12px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.allocation-line-row[hidden] { display: none !important; }
.allocation-line-row .field { min-width: 0; }
.percentage-input { position: relative; }
.percentage-input input { padding-right: 38px; }
.percentage-input > span { position: absolute; top: 50%; right: 14px; color: var(--ink-500); font-size: 12px; font-weight: 700; transform: translateY(-50%); }
.allocation-remove-button { min-height: 42px; padding: 0 8px; color: var(--danger); background: transparent; border: 0; font-size: 11px; font-weight: 700; cursor: pointer; }
.allocation-remove-button:hover { text-decoration: underline; }
.allocation-form-actions { padding-top: 16px; border-top: 1px solid var(--line); }
.allocation-readonly-list { display: grid; gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.allocation-readonly-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; background: #fff; }
.allocation-readonly-list > div > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.allocation-readonly-list small { color: var(--ink-500); font-size: 10px; }
.allocation-readonly-list b { color: var(--brand-800); font-size: 15px; white-space: nowrap; }
.allocation-revision-card { margin-top: 20px; }
th, td { padding: 13px 15px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { color: var(--ink-650); background: var(--surface-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
td { color: var(--ink-800); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfd; }
td > small { display: block; margin-top: 2px; color: var(--ink-500); font-size: 10px; }
td.empty-state { display: table-cell; min-height: 0; padding: 42px 16px; color: var(--ink-500); text-align: center; }
.primary-link { color: var(--brand-700); font-weight: 800; }
.primary-link:hover { color: var(--brand-900); text-decoration: underline; }
.status { display: inline-flex; align-items: center; padding: 3px 8px; color: var(--ink-650); background: #edf2f4; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-complete, .status-ready, .status-scorable, .status-scored { color: var(--success); background: var(--success-soft); }
.status-incomplete, .status-draft, .status-pending { color: var(--warning); background: var(--warning-soft); }
.status-locked { color: var(--brand-800); background: var(--brand-100); }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.project-info-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.project-info-grid > div { display: flex; min-width: 0; flex-direction: column; gap: 5px; padding: 14px 16px; background: #fff; }
.project-info-grid span { color: var(--ink-500); font-size: 11px; }
.project-info-grid strong { overflow-wrap: anywhere; color: var(--ink-850); font-size: 13px; font-weight: 700; }
.scoring-reference-section .card-heading p { max-width: 820px; margin: 5px 0 0; color: var(--ink-500); font-size: 11px; line-height: 1.65; }
.scoring-reference-list { display: grid; gap: 14px; }
.scoring-reference-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.scoring-reference-card.is-pending { border-color: #efd49e; }
.scoring-reference-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.scoring-reference-heading > div { display: flex; min-width: 0; align-items: center; gap: 10px; }
.scoring-reference-heading h3 { margin: 0; color: var(--ink-850); font-size: 14px; line-height: 1.45; }
.scoring-reference-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; background: var(--line); }
.scoring-reference-field { display: flex; min-width: 0; min-height: 78px; flex-direction: column; gap: 7px; padding: 14px 16px; background: #fff; }
.scoring-reference-field.is-wide { grid-column: 1 / -1; min-height: auto; }
.scoring-reference-field > span { color: var(--ink-500); font-size: 11px; }
.scoring-reference-field > strong { overflow-wrap: anywhere; color: var(--ink-850); font-size: 13px; font-weight: 700; line-height: 1.7; }
.scoring-reference-field:nth-child(2):not(.is-wide) > strong { color: var(--brand-800); font-size: 16px; }
.scoring-supporting-info { margin-top: 14px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 9px; white-space: nowrap; }
.table-actions form { margin: 0; }
.link-button { padding: 0; border: 0; background: none; font: inherit; font-weight: 800; cursor: pointer; }
.danger-link { color: #b5473b; }
.danger-link:hover { color: #8f2f27; text-decoration: underline; }
.tree-position { display: flex; align-items: center; gap: 7px; padding-left: calc(var(--tree-depth) * 24px); }
.tree-branch { color: var(--ink-400); font-size: 15px; }
.metric.card { display: flex; min-height: 105px; flex-direction: column; justify-content: center; gap: 5px; }
.metric.card span { color: var(--ink-500); font-size: 11px; }
.metric.card strong { font-size: 19px; line-height: 1.35; }
.content-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-heading > div { min-width: 0; }
.card-heading h2, .form-section > h2 { margin: 0; font-size: 17px; line-height: 1.4; }
.card-heading p { margin: 5px 0 0; color: var(--ink-500); font-size: 11px; line-height: 1.65; }
.card-heading > span,
.card-heading > a { flex: 0 0 auto; margin-top: 3px; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.card-heading > span { color: var(--ink-500); }
.card-heading > a { color: var(--brand-700); font-weight: 700; }
.card-heading > a:hover { color: var(--brand-900); text-decoration: underline; }
.project-detail-grid { margin-top: 20px; align-items: stretch; }
.project-detail-grid > .card { display: flex; min-height: 235px; flex-direction: column; }
.project-detail-grid .card-heading { margin-bottom: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.project-detail-grid .timeline { flex: 1 1 auto; }
.project-detail-grid .project-detail-empty { min-height: 0; flex: 1 1 auto; margin: 0; padding: 28px 16px; text-align: center; }
.timeline { display: grid; }
.timeline-item { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.timeline-item:first-child { border-top: 0; }
.timeline-item > b { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; color: var(--brand-700); background: var(--brand-50); border-radius: 50%; font-size: 11px; }
.timeline-item div { min-width: 0; }
.timeline-item p, .history-row p { margin: 2px 0 0; color: var(--ink-500); font-size: 11px; }
.timeline-item > span { color: var(--brand-700); font-weight: 800; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.history-row:first-of-type { border-top: 0; }
.history-row b { color: var(--brand-800); white-space: nowrap; }
.form-layout { display: grid; gap: 18px; }
.form-section > h2 { margin-bottom: 16px; }
.section-help { margin: -8px 0 16px; color: var(--ink-500); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px 20px; }
.form-grid.one-column { grid-template-columns: 1fr; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.narrow-form, .confirm-card { width: min(720px,100%); }
.milestone-editor-shell { display: grid; width: min(900px, 100%); gap: 16px; margin: 0 auto; }
.milestone-editor-shell > .alert { margin: 0; }
.milestone-form-card { width: 100%; }
.milestone-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.milestone-form-card .form-actions { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.confirm-card { margin: clamp(40px,8vh,90px) auto; text-align: center; }
.confirm-card h1 { margin-top: 0; }
.confirm-card .form-actions { justify-content: center; }

/* Project import drawer */
.project-import-open,
.person-result-drawer-open,
.settlement-quick-edit-drawer-open,
.product-custom-detail-drawer-open,
.adjustment-detail-drawer-open { overflow: hidden; }
.project-import-drawer[hidden] { display: none; }
.project-import-drawer { position: fixed; z-index: 1200; inset: 0; }
.project-import-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    background: rgba(9, 29, 36, .46);
    border: 0;
    cursor: default;
    opacity: 0;
    transition: opacity .18s ease;
}
.project-import-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(780px, 94vw);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--canvas);
    border-left: 1px solid var(--line-strong);
    box-shadow: -18px 0 48px rgba(11, 45, 56, .18);
    transform: translateX(100%);
    transition: transform .2s ease;
}
.project-import-drawer.is-open .project-import-backdrop { opacity: 1; }
.project-import-drawer.is-open .project-import-panel { transform: translateX(0); }
.project-import-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 21px 24px 19px;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(20, 35, 43, .04);
}
.project-import-header h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.project-import-header p:last-child { margin: 3px 0 0; color: var(--ink-500); font-size: 11px; }
.project-import-close {
    width: 38px;
    height: 38px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    color: var(--ink-650);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}
.project-import-close:hover { color: var(--brand-800); background: var(--brand-50); }
.project-import-close svg { width: 20px; }
.project-import-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 24px 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}
.project-import-loading {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-500);
    text-align: center;
}

/* Product customization detail drawer */
.product-custom-detail-drawer .project-import-panel { width: min(1040px, 96vw); }
.product-custom-detail { display: grid; gap: 18px; }
.product-custom-detail-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.product-custom-detail-summary-grid .metric {
    min-height: 108px;
    padding: 18px;
    box-shadow: none;
}
.product-custom-detail-summary-grid .metric strong { font-size: 20px; }

@media (max-width: 860px) {
    .product-custom-detail-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-custom-detail-drawer .project-import-content { padding-inline: 16px; }
    .product-custom-detail-drawer .custom-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-custom-detail-drawer .custom-detail-calculation { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .product-custom-detail-summary-grid,
    .product-custom-detail-drawer .custom-detail-grid { grid-template-columns: 1fr; }
    .product-custom-detail-drawer .custom-detail-grid__wide { grid-column: auto; }
    .product-custom-detail-drawer .custom-detail-calculation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-custom-detail-drawer .custom-detail-card__header { gap: 14px; padding-inline: 16px; }
    .product-custom-detail-drawer .custom-detail-grid { padding-inline: 16px; }
    .product-custom-detail-drawer .custom-detail-calculation { margin-inline: 16px; }
    .product-custom-detail-drawer .custom-detail-source { padding-inline: 16px; }
}

/* Settlement person result drawer */
.person-result-drawer .project-import-panel { width: min(1280px, 96vw); }
.person-result-detail { display: grid; gap: 18px; }
.person-result-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.person-result-detail-heading h3 { margin: 2px 0 0; font-size: 22px; line-height: 1.3; }
.person-result-detail-heading p:last-child { margin: 5px 0 0; color: var(--ink-500); font-size: 11px; }
.person-result-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.person-result-summary-grid .metric { min-height: 112px; padding: 18px; box-shadow: none; }
.person-result-summary-grid .metric strong { font-size: 20px; }
.person-result-line-card { margin: 0; overflow: hidden; box-shadow: none; }
.person-result-line-card .card-heading { padding: 18px 18px 14px; }
.person-result-line-card { overflow-x: auto; }
.person-result-line-card table { min-width: 1120px; table-layout: fixed; }
.person-result-line-card th,
.person-result-line-card td { padding: 12px 10px; font-size: 11px; vertical-align: top; }
.person-result-line-card th:first-child { width: 18%; }
.person-result-line-card th:nth-child(2),
.person-result-line-card th:nth-child(3) { width: 9%; }
.person-result-line-card th:nth-child(4) { width: 9%; }
.person-result-line-card td strong { display: block; }
.person-result-line-card td small { margin-top: 3px; }

/* Settlement result quick editor */
.settlement-quick-edit-drawer { z-index: 1240; }
.settlement-quick-edit-drawer .project-import-backdrop { background: rgba(9, 29, 36, .58); }
.settlement-quick-edit-drawer .project-import-panel { width: min(980px, 96vw); }
.settlement-quick-editor { display: grid; gap: 16px; }
.settlement-quick-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.settlement-quick-summary > div {
    display: flex;
    min-width: 0;
    min-height: 92px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 15px 17px;
    background: #fff;
}
.settlement-quick-summary span { color: var(--ink-500); font-size: 10px; }
.settlement-quick-summary strong { overflow-wrap: anywhere; font-size: 17px; line-height: 1.35; }
.settlement-quick-summary small { color: var(--ink-500); font-size: 9px; }
.settlement-quick-form { display: grid; gap: 16px; }
.settlement-quick-reason { padding: 17px 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.settlement-quick-score-list { display: grid; gap: 12px; }
.settlement-quick-score-row { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.settlement-quick-score-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.settlement-quick-score-heading h3 { margin: 0; font-size: 15px; }
.settlement-quick-score-heading p { margin: 2px 0 0; color: var(--ink-500); font-size: 10px; }
.settlement-quick-score-reference { display: flex; flex-direction: column; align-items: flex-end; }
.settlement-quick-score-reference span { color: var(--brand-700); font-size: 11px; font-weight: 800; }
.settlement-quick-score-reference small { color: var(--ink-500); font-size: 9px; }
.settlement-quick-score-fields { display: grid; grid-template-columns: minmax(150px, .3fr) minmax(320px, 1fr); gap: 14px; padding: 15px 16px; }
.settlement-quick-score-fields input { font-weight: 800; }
.settlement-quick-rule-details { padding: 10px 16px 12px; background: var(--surface-soft); border-top: 1px solid var(--line); }
.settlement-quick-rule-details summary { color: var(--brand-700); font-size: 10px; font-weight: 800; cursor: pointer; }
.settlement-quick-rule-details p { margin: 8px 0 0; color: var(--ink-650); font-size: 10px; line-height: 1.6; }
.settlement-quick-scope-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .55fr); gap: 16px; padding: 17px 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.settlement-quick-sync-field { align-content: start; }
.settlement-quick-sync-field > small { color: var(--ink-500); font-size: 10px; }
.settlement-quick-allocation-card { margin: 0; box-shadow: none; }
.settlement-quick-allocation-card .card-heading { margin-bottom: 14px; }
.settlement-quick-allocation-card input[name$="-DELETE"] { display: none; }
.settlement-quick-actions { z-index: 3; bottom: 0; }
.settlement-quick-success { min-height: 360px; }
.settlement-quick-success small { display: block; margin-top: 8px; color: var(--ink-500); }

.score-view-tabs {
    display: flex;
    gap: 4px;
    width: fit-content;
    margin: -8px 0 18px;
    padding: 4px;
    background: rgba(218, 231, 235, .62);
    border-radius: 14px;
    box-shadow: inset 0 1px 2px rgba(23, 55, 67, .035);
}
.score-view-tab {
    padding: 9px 19px;
    color: var(--ink-650);
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.score-view-tab:hover { color: var(--brand-700); background: rgba(255, 255, 255, .58); }
.score-view-tab.is-active {
    color: var(--brand-800);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 4px 14px rgba(23, 55, 67, .07);
}
.score-period-toolbar {
    margin-bottom: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(247, 251, 252, .88));
    border-color: rgba(199, 215, 220, .52);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(20, 35, 43, .045);
}
.score-period-form { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.score-period-form > label {
    position: relative;
    display: grid;
    gap: 8px;
    min-width: min(440px, 100%);
    color: var(--ink-650);
    font-size: 11px;
    font-weight: 700;
}
.score-period-form > label > span { padding-left: 3px; }
.score-period-form > label::after {
    position: absolute;
    right: 17px;
    bottom: 18px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--ink-500);
    border-bottom: 1.5px solid var(--ink-500);
    content: "";
    pointer-events: none;
    transform: rotate(45deg);
}
.score-period-form select {
    width: 100%;
    min-height: 48px;
    padding: 9px 44px 9px 15px;
    color: var(--ink-950);
    appearance: none;
    background: rgba(255, 255, 255, .88);
    border: 0;
    border-radius: 13px;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(190, 208, 213, .58), 0 4px 14px rgba(20, 35, 43, .035);
    cursor: pointer;
    transition: box-shadow .16s ease, background .16s ease;
}
.score-period-form select:hover {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(142, 181, 190, .68), 0 5px 16px rgba(20, 35, 43, .05);
}
.score-period-form select:focus {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--brand-600), 0 0 0 4px rgba(22, 131, 154, .09);
}
.score-period-current {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 2px 10px;
    min-width: 250px;
    padding: 10px 13px;
    background: rgba(232, 242, 244, .58);
    border-radius: 13px;
    text-align: right;
}
.score-period-current .status { grid-row: 1 / 3; }
.score-period-current strong { color: var(--ink-950); font-size: 13px; line-height: 1.35; }
.score-period-current small { color: var(--ink-500); font-size: 10px; }
.score-people-filter { grid-template-columns: minmax(280px, 1fr) auto; }

@media (max-width: 860px) {
    .person-result-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .person-result-drawer .project-import-content { padding-inline: 16px; }
    .settlement-quick-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settlement-quick-score-fields,
    .settlement-quick-scope-grid { grid-template-columns: 1fr; }
    .settlement-quick-edit-drawer .project-import-content { padding-inline: 16px; }
    .score-period-form { align-items: stretch; flex-direction: column; }
    .score-period-current { text-align: left; }
}

/* Settlement adjustment summary and detail drawer */
.adjustment-breakdown-card { overflow: hidden; }
.adjustment-summary-row { transition: background .15s ease; }
.adjustment-summary-row:hover { background: var(--brand-50); }
.adjustment-category-link { color: var(--ink-900); font-size: 14px; font-weight: 700; }
.adjustment-category-link:hover { color: var(--brand-700); }
.score-positive { color: #187657; }
.score-negative { color: #b14a45; }
.adjustment-detail-drawer .project-import-panel { width: min(1180px, 97vw); }
.adjustment-detail { display: grid; gap: 18px; }
.adjustment-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}
.adjustment-detail-heading h3 { margin: 2px 0 0; font-size: 22px; line-height: 1.3; }
.adjustment-detail-heading p:last-child { max-width: 780px; margin: 5px 0 0; color: var(--ink-500); font-size: 11px; }
.adjustment-detail-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.adjustment-detail-summary-grid .metric { min-height: 108px; padding: 18px; box-shadow: none; }
.adjustment-detail-summary-grid .metric strong { font-size: 20px; }
.adjustment-detail-line-card { margin: 0; overflow: hidden; box-shadow: none; }
.adjustment-detail-line-card .card-heading { padding: 18px 18px 14px; }
.adjustment-detail-line-card table { table-layout: fixed; }
.adjustment-detail-line-card th,
.adjustment-detail-line-card td { padding: 12px 10px; font-size: 11px; vertical-align: top; }
.adjustment-detail-line-card th:first-child { width: 18%; }
.adjustment-detail-line-card th:nth-child(2) { width: 11%; }
.adjustment-detail-line-card th:nth-child(3) { width: 8%; }
.adjustment-detail-line-card th:nth-child(4),
.adjustment-detail-line-card th:nth-child(5) { width: 8%; }
.adjustment-detail-line-card th:nth-child(6) { width: 30%; }
.adjustment-direction {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
}
.adjustment-direction--add { color: #176c51; background: #e8f6f0; }
.adjustment-direction--deduct { color: #9b413d; background: #faeceb; }

@media (max-width: 860px) {
    .adjustment-detail-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .adjustment-detail-drawer .project-import-content { padding-inline: 16px; }
}
.project-import-step { display: grid; gap: 18px; }
.project-import-step-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}
.project-import-step-heading h3 { margin: 0; font-size: 18px; line-height: 1.35; }
.project-import-step-heading p { margin: 3px 0 0; color: var(--ink-500); font-size: 11px; }
.project-import-step-number {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid #c9e8eb;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
}
.project-import-upload-form {
    display: grid;
    gap: 18px;
    padding: 21px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.project-import-file-field input[type="file"] { min-height: 52px; padding: 9px; }
.project-import-file-field input[type="file"]::file-selector-button {
    height: 32px;
    margin-right: 10px;
    padding: 5px 12px;
    color: var(--brand-800);
    background: var(--brand-50);
    border: 1px solid #c9e8eb;
    border-radius: 7px;
    font-weight: 700;
    cursor: pointer;
}
.project-import-hint,
.project-import-callout {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    color: var(--ink-650);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 11px;
}
.project-import-hint strong,
.project-import-callout strong { color: var(--ink-800); font-size: 12px; }
.project-import-callout p { margin: 0; }
.project-import-callout--error { color: var(--danger); background: var(--danger-soft); border-color: #efbdc2; }
.project-import-callout--error strong { color: var(--danger); }
.project-import-callout--warning { color: var(--warning); background: var(--warning-soft); border-color: #efd49e; }
.project-import-callout--warning strong { color: var(--warning); }
.project-import-callout--success { color: var(--success); background: var(--success-soft); border-color: #bde3cc; }
.project-import-callout--success strong { color: var(--success); }
.project-import-actions,
.project-import-secondary-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.project-import-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 11px;
}
.project-import-metrics > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 13px 14px;
    background: #fff;
}
.project-import-metrics span { color: var(--ink-500); font-size: 10px; }
.project-import-metrics strong { margin: 1px 0; font-size: 20px; line-height: 1.25; }
.project-import-metrics small { color: var(--ink-500); font-size: 9px; }
.project-import-metrics .is-error { color: var(--danger); background: var(--danger-soft); }
.project-import-metrics .is-warning { color: #8a5a13; background: var(--warning-soft); }
.project-import-sheet-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.project-import-sheet-summary span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    color: var(--ink-650);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 10px;
}
.project-import-sheet-summary strong { color: var(--ink-800); }
.project-import-issues {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.project-import-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 17px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
}
.project-import-section-heading h4 { margin: 0; font-size: 14px; }
.project-import-section-heading p { margin: 2px 0 0; color: var(--ink-500); font-size: 10px; }
.project-import-section-heading > span { color: var(--ink-500); font-size: 9px; }
.project-import-issue-list { display: grid; }
.project-import-issue + .project-import-issue { border-top: 1px solid var(--line); }
.project-import-issue summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
}
.project-import-issue summary::-webkit-details-marker { display: none; }
.project-import-issue summary:hover { background: var(--brand-50); }
.project-import-issue summary > span:first-child { min-width: 0; display: flex; flex-direction: column; }
.project-import-issue summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-import-issue summary small { color: var(--ink-500); font-size: 9px; }
.project-import-issue-body { display: grid; gap: 8px; padding: 2px 16px 14px; }
.project-import-issue-body p {
    display: grid;
    grid-template-columns: minmax(74px, .2fr) minmax(0, 1fr);
    gap: 9px;
    margin: 0;
    padding: 9px 10px;
    color: var(--warning);
    background: var(--warning-soft);
    border-radius: 8px;
    font-size: 10px;
}
.project-import-issue-body p.is-error { color: var(--danger); background: var(--danger-soft); }
.project-import-issue-body p strong { color: currentColor; }
.project-import-row-resolution {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px;
    color: var(--ink-650);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 10px;
}
.project-import-row-resolution > span { line-height: 1.6; }
.project-import-row-resolution form { flex: 0 0 auto; }
.project-import-row-resolution.is-resolved { color: var(--ink-500); }
.project-import-confirm {
    position: sticky;
    bottom: -12px;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 14px;
    padding: 14px;
    background: rgba(255, 255, 255, .97);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(20, 35, 43, .13);
    backdrop-filter: blur(9px);
}
.project-import-confirm .check-field { min-height: 38px; }
.project-import-confirm .button { grid-column: 2; grid-row: 1 / 3; }
.project-import-confirm--extra .button { grid-row: 1 / 4; }
.project-import-confirm-error {
    min-height: 13px;
    margin: 0;
    color: var(--danger);
    font-size: 10px;
}
.project-import-success {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--success);
    text-align: center;
}
.project-import-success > span {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: #fff;
    background: var(--success);
    border-radius: 50%;
    font-size: 27px;
    font-weight: 800;
}
.project-import-success strong { font-size: 20px; }
.project-import-success p { margin: 4px 0 0; color: var(--ink-500); }

.custom-detail-list { display: grid; gap: 16px; }
.custom-detail-card { padding: 0; overflow: hidden; }
.custom-detail-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 22px 17px;
    border-bottom: 1px solid var(--line);
}
.custom-detail-card__header h2 { margin: 3px 0 2px; font-size: 18px; }
.custom-detail-card__header p { margin: 0; color: var(--ink-500); }
.custom-detail-index {
    display: inline-flex;
    color: var(--brand-700);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
}
.custom-detail-score { flex: 0 0 auto; text-align: right; }
.custom-detail-score span,
.custom-detail-grid span,
.custom-detail-calculation span { display: block; color: var(--ink-500); font-size: 10px; }
.custom-detail-score strong { display: block; margin-top: 2px; color: var(--brand-800); font-size: 20px; }
.custom-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 4px 22px;
}
.custom-detail-grid > div { min-width: 0; padding: 13px 16px 13px 0; }
.custom-detail-grid strong { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: 12px; }
.custom-detail-grid small { display: block; margin-top: 4px; color: var(--warning); }
.custom-detail-grid__wide { grid-column: span 2; }
.custom-detail-calculation {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    margin: 2px 22px 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--line);
}
.custom-detail-calculation > div { padding: 12px 13px; background: var(--brand-50); }
.custom-detail-calculation strong { display: block; margin-top: 3px; font-size: 12px; }
.custom-detail-calculation small { display: block; margin-top: 3px; color: var(--ink-500); font-size: 9px; }
.custom-detail-source {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 18px;
    padding: 11px 22px;
    color: var(--ink-500);
    background: var(--surface-soft);
    border-top: 1px solid var(--line);
    font-size: 10px;
}

/* Scoring workbench */
.score-workbench { display: grid; gap: 18px; }
.score-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 0; overflow: hidden; }
.score-summary > div { position: relative; display: flex; min-height: 106px; flex-direction: column; justify-content: center; padding: 19px 21px; }
.score-summary > div + div { border-left: 1px solid var(--line); }
.score-summary span { color: var(--ink-500); font-size: 11px; }
.score-summary strong { margin: 2px 0; font-size: 24px; line-height: 1.25; }
.score-summary small { color: var(--ink-500); font-size: 10px; }
.score-total-box { color: var(--brand-800); background: var(--brand-50); }
.score-total-box.is-over { color: var(--danger); background: var(--danger-soft); }
.score-form-status { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 10px; padding: 11px 14px; color: var(--ink-650); background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.score-form-status > span { width: 9px; height: 9px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 4px var(--blue-soft); }
.score-form-status p { margin: 0; font-size: 12px; }
.score-form-status.is-ready { color: var(--success); background: var(--success-soft); border-color: #bde3cc; }
.score-form-status.is-ready > span { background: var(--success); box-shadow: 0 0 0 4px rgba(22,121,75,.12); }
.score-form-status.is-warning { color: var(--warning); background: var(--warning-soft); border-color: #efd49e; }
.score-form-status.is-warning > span { background: var(--warning); box-shadow: 0 0 0 4px rgba(154,91,11,.12); }
.score-form-status.is-error { color: var(--danger); background: var(--danger-soft); border-color: #efbdc2; }
.score-form-status.is-error > span { background: var(--danger); box-shadow: 0 0 0 4px rgba(180,35,47,.12); }
.score-list { display: grid; gap: 16px; }
.score-card { padding: 0; overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease; }
.score-card.is-deviated { border-color: #e7c276; }
.score-card.is-invalid { border-color: #e4a4ab; box-shadow: 0 0 0 3px rgba(180,35,47,.06); }
.score-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.score-card-heading > div:first-child { min-width: 0; display: flex; align-items: center; gap: 12px; }
.score-card-heading h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.score-card-heading p { margin: 2px 0 0; color: var(--ink-500); font-size: 11px; }
.step-number { display: inline-flex; width: 35px; height: 35px; flex: 0 0 auto; align-items: center; justify-content: center; color: var(--brand-700); background: var(--brand-50); border: 1px solid #c9e8eb; border-radius: 50%; font-size: 12px; font-weight: 800; }
.score-reference { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.score-reference span { color: var(--brand-700); font-size: 12px; font-weight: 800; }
.score-reference b { color: var(--ink-500); font-size: 10px; }
.score-na-badge { display: inline-flex; margin-left: 7px; padding: 2px 7px; color: var(--ink-650); background: #edf2f4; border-radius: 999px; font-size: 9px; font-weight: 700; }
.rule-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 15px 20px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.rule-panel p { margin: 0; color: var(--ink-650); font-size: 12px; }
.rule-panel p:only-child { grid-column: 1 / -1; }
.rule-panel strong { display: block; margin-bottom: 3px; color: var(--ink-800); font-size: 10px; }
.score-entry { display: grid; grid-template-columns: minmax(180px,.34fr) minmax(300px,1fr); gap: 18px; padding: 18px 20px 20px; }
.score-entry .field { align-content: start; }
.score-value-field input { font-size: 17px; font-weight: 800; }
.field-feedback { min-height: 16px; color: var(--ink-500); font-size: 10px; font-weight: 400; }
.score-card.is-deviated [data-comment-feedback] { color: var(--warning); font-weight: 700; }
.score-card.is-invalid .field-feedback.is-error { color: var(--danger); font-weight: 700; }
.score-card [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(180,35,47,.08); }
.sticky-actions { position: sticky; z-index: 30; bottom: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 13px 15px; background: rgba(255,255,255,.96); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(20,35,43,.14); backdrop-filter: blur(10px); }
.sticky-actions > div { min-width: 0; display: flex; flex: 1; flex-direction: column; margin-right: 12px; line-height: 1.4; }
.sticky-actions > div strong { font-size: 12px; }
.sticky-actions > div small { color: var(--ink-500); font-size: 10px; }

/* Login */
.guest-main { min-height: 100vh; }
.guest-message-layer { position: fixed; z-index: 50; top: 20px; right: 20px; width: min(430px, calc(100vw - 40px)); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.12fr) minmax(440px, .88fr); background: #f4f8f9; }
.login-intro { position: relative; display: flex; align-items: center; overflow: hidden; padding: 64px clamp(48px, 7vw, 112px); color: #fff; background: linear-gradient(145deg, #0b2d38 0%, #125064 58%, #147685 100%); }
.login-intro::before { position: absolute; top: -20%; right: -14%; width: 460px; height: 460px; border: 1px solid rgba(255,255,255,.10); border-radius: 50%; content: ""; }
.login-intro::after { position: absolute; right: 12%; bottom: -35%; width: 540px; height: 540px; background: radial-gradient(circle, rgba(105,224,218,.16), transparent 68%); content: ""; }
.login-intro-inner { position: relative; z-index: 2; max-width: 610px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(70px, 11vh, 130px); font-size: 17px; font-weight: 800; letter-spacing: .05em; }
.login-brand-mark { width: 45px; height: 45px; }
.login-intro .eyebrow { color: #79dce0; }
.login-intro h1 { margin: 10px 0 20px; font-size: clamp(40px, 5vw, 66px); line-height: 1.15; letter-spacing: -.05em; }
.login-lead { max-width: 580px; margin: 0; color: #c8e2e7; font-size: 16px; line-height: 1.9; }
.login-benefits { display: grid; max-width: 560px; gap: 18px; margin: 48px 0 0; padding: 0; list-style: none; }
.login-benefits li { display: grid; grid-template-columns: 39px minmax(0,1fr); align-items: start; gap: 14px; }
.login-benefits li > span { display: inline-flex; width: 37px; height: 37px; align-items: center; justify-content: center; color: #79dce0; border: 1px solid rgba(121,220,224,.32); border-radius: 50%; font-size: 10px; font-weight: 800; }
.login-benefits div { display: flex; flex-direction: column; }
.login-benefits strong { font-size: 14px; }
.login-benefits small { margin-top: 2px; color: #a9cbd2; font-size: 12px; }
.login-pattern { position: absolute; right: -100px; bottom: -130px; width: 390px; height: 390px; border: 76px solid rgba(255,255,255,.035); border-radius: 42% 58% 66% 34%; transform: rotate(22deg); }
.login-panel { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; padding: 52px clamp(30px, 6vw, 92px) 28px; }
.login-card { width: min(440px, 100%); }
.login-card-head { margin-bottom: 28px; }
.version-badge { display: inline-flex; margin-bottom: 19px; padding: 4px 10px; color: var(--brand-700); background: var(--brand-50); border: 1px solid #c8e7ea; border-radius: 999px; font-size: 10px; font-weight: 800; }
.login-card-head h2 { margin: 0 0 8px; font-size: 30px; line-height: 1.25; letter-spacing: -.03em; }
.login-card-head p { margin: 0; color: var(--ink-500); }
.form-error-summary { display: flex; flex-direction: column; margin-bottom: 18px; padding: 12px 14px; color: var(--danger); background: var(--danger-soft); border: 1px solid #efbdc2; border-radius: 10px; font-size: 12px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: inline-block; margin-bottom: 7px; color: var(--ink-800); font-weight: 700; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { width: 100%; height: 50px; padding: 10px 62px 10px 45px; color: var(--ink-950); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; transition: border-color .14s ease, box-shadow .14s ease; }
.input-wrap input::placeholder { color: #a0adb3; }
.input-wrap input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(22,131,154,.10); }
.has-error .input-wrap input { border-color: var(--danger); }
.input-icon { position: absolute; z-index: 1; left: 15px; width: 20px; color: var(--ink-500); pointer-events: none; }
.input-icon svg { width: 100%; }
.password-toggle { position: absolute; right: 9px; padding: 6px 8px; color: var(--brand-700); border: 0; background: transparent; border-radius: 7px; font-size: 11px; font-weight: 700; cursor: pointer; }
.password-toggle:hover { background: var(--brand-50); }
.field-help, .field-error { display: block; margin-top: 6px; font-size: 10px; }
.field-help { color: var(--ink-500); }
.field-error { color: var(--danger); }
.login-support { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; margin-top: 24px; padding: 12px 14px; color: var(--ink-650); background: #eef4f6; border-radius: 10px; }
.login-support svg { width: 20px; color: var(--brand-700); }
.login-support p { margin: 0; font-size: 11px; line-height: 1.6; }
.login-support strong { color: var(--ink-800); }
.login-footer { margin: 48px 0 0; color: var(--ink-500); font-size: 11px; }

/* Responsive */
@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .quick-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .login-intro { padding-inline: 52px; }
    .login-intro h1 { font-size: 46px; }
}

@media (max-width: 960px) {
    .app-layout { display: block; }
    .app-sidebar { position: fixed; left: 0; transform: translateX(-102%); transition: transform .22s ease; }
    .sidebar-open .app-sidebar { transform: translateX(0); }
    .sidebar-close, .mobile-menu-button { display: inline-flex; }
    .sidebar-overlay { position: fixed; z-index: 90; inset: 0; display: block; visibility: hidden; background: rgba(9,29,36,.48); border: 0; opacity: 0; transition: opacity .22s ease, visibility .22s ease; }
    .sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
    .sidebar-open { overflow: hidden; }
    .app-topbar { padding-inline: 22px; }
    .page-container { padding-inline: 22px; }
    .app-footer { padding-inline: 22px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-ranking-grid { grid-template-columns: 1fr; }
    .content-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .project-info-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .scoring-reference-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .filter-bar { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .project-list-controls { align-items: stretch; flex-direction: column; }
    .project-bulk-entry, .project-bulk-form { align-self: flex-end; }
    .filter-bar.account-filter, .filter-bar.people-filter, .filter-bar.allocation-filter { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .role-card-grid { grid-template-columns: 1fr; }
    .score-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .score-summary > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
    .score-summary > div:nth-child(4) { border-top: 1px solid var(--line); }
    .allocation-stage-grid { grid-template-columns: 1fr; }
    .custom-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .custom-detail-calculation { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .login-layout { grid-template-columns: 1fr; }
    .login-intro { display: none; }
    .login-panel { min-height: 100vh; }
}

@media (max-width: 680px) {
    .permission-heading,
    .permission-group-heading { align-items: stretch; flex-direction: column; }
    .permission-legend { justify-content: flex-start; }
    .permission-action-grid { grid-template-columns: 1fr; }
    .permission-action:nth-child(odd) { border-right: 0; }
    .app-topbar { min-height: 64px; padding-inline: 14px; }
    .topbar-location > span, .topbar-location > svg, .help-link span, .user-copy, .text-button { display: none; }
    .topbar-actions { gap: 10px; }
    .help-link { width: 38px; height: 38px; justify-content: center; border: 1px solid var(--line); border-radius: 50%; }
    .user-summary { padding-left: 10px; }
    .logout-form { display: none; }
    .page-container { padding: 20px 14px 32px; }
    .app-footer { flex-direction: column; align-items: flex-start; gap: 2px; padding-inline: 14px; }
    .welcome-panel { align-items: flex-start; flex-direction: column; }
    .dashboard-ranking-section { padding: 13px; border-radius: 18px; }
    .dashboard-section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .ranking-card-head { padding: 17px 16px 14px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading .button-group, .page-heading > .button { align-self: flex-start; }
    .custom-detail-card__header { align-items: stretch; flex-direction: column; padding: 17px 16px 14px; }
    .custom-detail-score { text-align: left; }
    .custom-detail-grid { grid-template-columns: 1fr; padding-inline: 16px; }
    .custom-detail-grid__wide { grid-column: auto; }
    .custom-detail-calculation { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-inline: 16px; }
    .custom-detail-source { flex-direction: column; padding-inline: 16px; }
    .settlement-period-actions { flex-wrap: wrap; }
    .welcome-status { width: 100%; }
    .metric-grid, .quick-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 112px; }
    .task-list li { grid-template-columns: auto minmax(0,1fr) auto; }
    .task-list .task-due { display: none; }
    .task-list .button { grid-column: 2 / 4; justify-self: start; }
    .panel { padding: 18px 16px; }
    .panel.ranking-card { padding: 0; }
    .ranking-list { grid-template-columns: 1fr; gap: 0; padding: 5px; }
    .ranking-list li,
    .ranking-list li:nth-child(-n+3),
    .ranking-list li:nth-child(n+4) {
        min-height: 59px;
        grid-column: auto;
        grid-template-columns: 32px 36px minmax(0, 1fr) auto;
        place-items: stretch;
        align-items: center;
        align-content: normal;
        gap: 11px;
        margin: 0;
        padding: 9px 8px;
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 11px;
        box-shadow: none;
        text-align: left;
    }
    .ranking-list li + li { margin-top: 0; border-top: 1px solid rgba(220, 229, 232, .72); }
    .ranking-list li:nth-child(-n+3)::before { display: none; }
    .ranking-list li:nth-child(-n+3) .ranking-number { position: static; width: 29px; height: 29px; }
    .ranking-list li:nth-child(-n+3) .ranking-avatar { width: 36px; height: 36px; font-size: 12px; }
    .ranking-list li:nth-child(-n+3) .ranking-person { align-items: flex-start; }
    .ranking-list li:nth-child(-n+3) .ranking-me { position: static; }
    .ranking-list li.is-current,
    .ranking-list li:nth-child(-n+3).is-current { background: linear-gradient(90deg, rgba(223, 244, 246, .72), rgba(239, 250, 251, .38)); }
    .ranking-empty { min-height: 230px; }
    .card { padding: 18px 16px; }
    .table-card { padding: 0; }
    .table-card > .card-heading { padding: 18px 16px 15px; }
    .master-detail-panel { padding: 15px 14px 17px 44px; }
    .master-detail-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
    .milestone-deduction-groups { grid-template-columns: 1fr; padding: 14px; }
    .milestone-deduction-formula { align-items: flex-start; flex-direction: column; }
    .project-detail-grid > .card { min-height: 215px; }
    .summary-grid, .form-grid, .filter-bar, .project-info-grid { grid-template-columns: 1fr; }
    .scoring-reference-section .card-heading, .scoring-reference-heading { align-items: flex-start; flex-direction: column; }
    .scoring-reference-grid { grid-template-columns: 1fr; }
    .allocation-editor-heading { align-items: stretch; flex-direction: column; }
    .allocation-editor-heading .button { width: 100%; }
    .allocation-pending-card, .allocation-pending-actions { align-items: stretch; flex-direction: column; }
    .allocation-line-row { grid-template-columns: 1fr auto; align-items: end; }
    .allocation-person-field { grid-column: 1 / -1; }
    .project-bulk-toolbar { flex-wrap: wrap; justify-content: flex-start; }
    .project-bulk-entry, .project-bulk-form { align-self: stretch; }
    .filter-bar.account-filter, .filter-bar.people-filter, .filter-bar.allocation-filter { grid-template-columns: 1fr; }
    .field div.choice-grid { grid-template-columns: 1fr; }
    .score-card-heading { align-items: flex-start; flex-direction: column; }
    .score-reference { width: 100%; align-items: flex-start; padding-left: 47px; }
    .rule-panel, .score-entry { grid-template-columns: 1fr; }
    .sticky-actions { bottom: 6px; flex-wrap: wrap; }
    .sticky-actions > div { width: 100%; flex-basis: 100%; margin-right: 0; }
    .sticky-actions .button { flex: 1; }
    .project-import-panel { width: 100vw; }
    .project-import-header { padding: 17px 16px 15px; }
    .project-import-content { padding: 17px 14px 22px; }
    .project-import-step-heading { grid-template-columns: auto minmax(0, 1fr); }
    .project-import-step-heading > .status { grid-column: 2; justify-self: start; }
    .project-import-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .project-import-section-heading { flex-direction: column; }
    .project-import-issue-body p { grid-template-columns: 1fr; gap: 2px; }
    .project-import-row-resolution { align-items: stretch; flex-direction: column; }
    .project-import-row-resolution .button { width: 100%; }
    .project-import-secondary-actions { align-items: stretch; flex-direction: column; }
    .project-import-secondary-actions .button { width: 100%; }
    .project-import-confirm { position: static; grid-template-columns: 1fr; }
    .project-import-confirm .button { width: 100%; grid-column: 1; grid-row: auto; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; }
    .form-actions .button { width: 100%; }
    .notice-card { grid-template-columns: auto minmax(0,1fr); align-items: start; }
    .notice-card > a { grid-column: 2; }
    .login-panel { padding: 36px 20px 24px; }
    .login-card-head h2 { font-size: 27px; }
    .login-footer { margin-top: 34px; text-align: center; }
    .guest-message-layer { top: 12px; right: 12px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
    .app-sidebar, .app-topbar, .app-footer, .sidebar-overlay, .project-import-drawer, .button, .notice-card > a { display: none !important; }
    .app-layout { display: block; }
    .page-container { max-width: none; padding: 0; }
    body { background: #fff; }
    .panel, .metric-card { box-shadow: none; break-inside: avoid; }
}
