:root {
  --canvas: #f5f7f7;
  --paper: #ffffff;
  --paper-soft: #fafcfc;
  --ink: #111516;
  --ink-soft: #3d4749;
  --muted: #788285;
  --line: #e4e9e9;
  --line-strong: #cfd7d7;
  --mint: #50dfba;
  --mint-deep: #0c806a;
  --mint-soft: #e8f9f4;
  --cyan: #65c8ef;
  --blue: #327ab2;
  --amber: #a26d15;
  --amber-soft: #fff4df;
  --red: #b7444d;
  --red-soft: #fff0f1;
  --green: #167654;
  --green-soft: #e9f7f1;
  --shadow: 0 24px 70px rgba(18, 39, 37, .14);
  --header-height: 74px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--canvas); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-shell { min-height: 100vh; }

.sidebar { height: var(--header-height); padding: 0 max(28px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; gap: 42px; position: sticky; top: 0; z-index: 40; color: var(--ink); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.brand { min-width: 238px; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; display: grid; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px); place-content: center; gap: 3px; flex: 0 0 auto; background: var(--ink); border-radius: 50%; transform: rotate(8deg); }
.brand-mark i { display: block; background: white; border-radius: 1px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--mint); }
.brand > div { min-width: 0; display: grid; gap: 2px; }
.brand strong { font-size: 15px; white-space: nowrap; }
.brand div span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.nav { display: flex; align-items: stretch; align-self: stretch; gap: 6px; }
.nav-item { min-width: 108px; padding: 0 15px; display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; color: #566164; background: transparent; border: 0; font-size: 13px; }
.nav-item > span { width: 18px; color: #8a9496; font-size: 16px; text-align: center; }
.nav-item:hover { color: var(--ink); }
.nav-item.active { color: var(--ink); font-weight: 650; }
.nav-item.active::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: -1px; height: 3px; background: var(--mint); border-radius: 3px 3px 0 0; }
.nav-item.active > span { color: var(--mint-deep); }
.sidebar-foot { margin-left: auto; min-height: 32px; padding: 0 12px; display: flex; align-items: center; gap: 8px; color: #526062; background: #f7faf9; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #99a2a3; }
.status-dot.online { background: #32c895; box-shadow: 0 0 0 4px rgba(50,200,149,.12); }
.status-dot.offline { background: #df6670; box-shadow: 0 0 0 4px rgba(223,102,112,.12); }

.main { min-height: calc(100vh - var(--header-height)); }
.topbar { min-height: 132px; max-width: 1480px; margin: 0 auto; padding: 30px 32px 24px; display: flex; align-items: center; justify-content: space-between; gap: 28px; position: relative; overflow: hidden; }
.topbar::after { content: ""; width: 42px; height: 42px; position: absolute; right: 350px; top: 21px; background: rgba(80,223,186,.28); border: 1px solid rgba(20,164,133,.28); box-shadow: 35px 22px 0 rgba(101,200,239,.15), 70px -8px 0 rgba(255,255,255,.8), 70px -8px 0 1px rgba(50,122,178,.12); transform: rotate(45deg); border-radius: 7px; pointer-events: none; }
.title-row { display: flex; align-items: center; gap: 13px; min-width: 0; position: relative; z-index: 1; }
.page-kicker { display: block; margin-bottom: 5px; color: var(--mint-deep); font-size: 9px; font-weight: 720; }
.title-row h1 { margin: 0; color: var(--ink); font-size: 31px; line-height: 1.15; font-weight: 720; }
.title-row p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 9px; position: relative; z-index: 2; }
.content { max-width: 1480px; margin: 0 auto; padding: 0 32px 48px; }
.view { display: none; }
.view.active { display: block; animation: appear .22s ease-out; }
@keyframes appear { from { opacity: .3; transform: translateY(4px); } }

.button { min-height: 39px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; font-weight: 620; white-space: nowrap; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.button:hover { border-color: #aebaba; background: #fbfdfd; transform: translateY(-1px); }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button-primary { color: white; background: var(--ink); border-color: var(--ink); }
.button-primary:hover { color: white; background: #252a2b; border-color: #252a2b; }
.button-primary::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px rgba(80,223,186,.75); }
.button-secondary { background: rgba(255,255,255,.88); }
.button-danger { color: var(--red); background: white; border-color: #edc9cc; }
.button-danger:hover { background: var(--red-soft); border-color: #dfa4a9; }
.button-success { color: #082b21; background: var(--mint); border-color: var(--mint); }
.button-success:hover { color: #082b21; background: #68e7c5; border-color: #68e7c5; }
.icon-button { width: 39px; height: 39px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; color: #667174; background: rgba(255,255,255,.88); border: 1px solid var(--line); border-radius: 50%; font-size: 19px; line-height: 1; transition: .16s ease; }
.icon-button:hover { color: var(--ink); border-color: #b7c2c2; background: white; transform: translateY(-1px); }
.icon-button.small { width: 31px; height: 31px; border-color: transparent; background: transparent; }
.menu-button { display: none; }
.spinner { width: 15px; height: 15px; display: inline-block; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.metrics { min-height: 118px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; background: #edf8f5; border: 1px solid #dcebe7; border-radius: 8px; overflow: hidden; }
.metrics::after { content: ""; width: 48px; height: 48px; position: absolute; right: 26px; bottom: -24px; background: rgba(80,223,186,.2); border: 1px solid rgba(12,128,106,.2); box-shadow: -29px -23px 0 rgba(101,200,239,.13), -58px 4px 0 rgba(255,255,255,.55); transform: rotate(45deg); border-radius: 7px; pointer-events: none; }
.metric { min-width: 0; padding: 23px 24px; display: grid; grid-template-columns: 1fr auto; column-gap: 10px; position: relative; z-index: 1; border-right: 1px solid rgba(26,93,79,.11); }
.metric:last-child { border-right: 0; padding-right: 130px; }
.metric > span { color: #49625c; font-size: 12px; }
.metric strong { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--ink); font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; font-weight: 700; }
.metric small { margin-top: 10px; color: #789089; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel { margin-top: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.panel-head, .panel-title { min-height: 67px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.panel-title { padding: 21px 23px; }
.panel-title h2 { margin: 0; font-size: 18px; font-weight: 680; }
.panel-actions { display: flex; align-items: center; gap: 10px; }
.danger-action { color: #bd3440; border-color: #e7c5c9; }
.danger-action:hover { color: #98252f; border-color: #d89aa2; background: #fff3f4; }
#collect-button.stop-action { color: white; border-color: #c8404c; background: #c8404c; }
.panel-title p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.segmented { display: inline-flex; padding: 4px; background: #f0f3f3; border-radius: 999px; }
.segmented button { height: 32px; padding: 0 14px; color: #737e80; background: transparent; border: 0; border-radius: 999px; font-size: 12px; }
.segmented button.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(28,53,50,.08); font-weight: 650; }
.segmented button span { color: var(--mint-deep); }
.filters { padding: 16px 22px; display: flex; align-items: center; justify-content: flex-start; gap: 10px; background: var(--paper-soft); border-bottom: 1px solid var(--line); }
.filters > label { width: 220px; flex: 0 0 220px; }
.filters .filter-submit { flex: 0 0 auto; min-height: 39px; }
.filters input, .filters select, .settings-form input, .settings-form select, .modal input, .modal select, .modal textarea, .review-note textarea { width: 100%; min-height: 39px; padding: 8px 12px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; }
.filters select { appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%231b2524' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; background-size: 10px 7px; }
.filters input:focus, .filters select:focus, .settings-form input:focus, .settings-form select:focus, .modal input:focus, .modal select:focus, .modal textarea:focus, .review-note textarea:focus { border-color: #45bea1; box-shadow: 0 0 0 3px rgba(80,223,186,.14); }
.search { position: relative; }
.search > span { position: absolute; left: 13px; top: 9px; color: #8b9698; font-size: 17px; }
.search input { padding-left: 37px; }

.table-wrap { position: relative; min-height: 238px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 45px; padding: 0 16px; color: #849093; background: white; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; font-weight: 620; white-space: nowrap; }
.data-table td { height: 72px; padding: 11px 16px; border-bottom: 1px solid #edf0f0; color: #465154; vertical-align: middle; }
.data-table tbody tr { transition: background .14s ease; }
.notice-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover, .data-table tbody tr:focus { background: #f3fbf8; outline: none; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.notice-table th:nth-child(1) { width: 25%; }
.notice-table th:nth-child(2) { width: 10%; }
.notice-table th:nth-child(3) { width: 10%; }
.notice-table th:nth-child(4) { width: 9%; }
.notice-table th:nth-child(5) { width: 11%; }
.notice-table th:nth-child(6) { width: 9%; }
.notice-table th:nth-child(7) { width: 9%; }
.notice-table th:nth-child(8) { width: 10%; }
.notice-table th:nth-child(8) { width: 10%; }
.notice-table th:last-child { width: 64px; padding-right: 28px; }
.project-name { display: block; color: var(--ink); white-space: normal; overflow: visible; font-size: 13px; line-height: 1.5; font-weight: 650; overflow-wrap: anywhere; }
.subtext { display: block; margin-top: 6px; color: #929c9e; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-code { color: #354143; font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.package-status { display: block; margin-top: 6px; color: var(--green); font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.package-failure { color: var(--amber); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.package-section { padding-top: 0; }
.package-section-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.package-section-head h3 { margin: 0; }
.package-section-head > span { color: var(--muted); font-size: 10px; }
.package-group + .package-group { margin-top: 24px; }
.package-group-title { min-height: 35px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.package-group-title strong { font-size: 12px; }
.package-group-title span { color: var(--muted); font-size: 9px; }
.package-item { min-width: 0; border-bottom: 1px solid var(--line); }
.package-item[open] { padding-bottom: 18px; }
.package-heading { min-height: 66px; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.package-heading::-webkit-details-marker { display: none; }
.package-heading:hover .package-title strong { color: var(--mint-deep); }
.package-chevron { width: 18px; height: 18px; display: grid; place-items: center; color: #829092; transition: transform .18s ease; }
.package-chevron::before { content: "›"; font-size: 20px; line-height: 1; }
.package-item[open] .package-chevron { transform: rotate(90deg); }
.package-title { min-width: 0; display: grid; gap: 4px; }
.package-title strong { color: var(--ink); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.package-title small { color: #7b8789; font-size: 10px; overflow-wrap: anywhere; }
.package-body { padding-left: 28px; }
.package-source { margin-top: 14px; padding-top: 12px; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; color: #657174; border-top: 1px dashed var(--line); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.package-source b { color: #829092; font-size: 10px; }
.package-content { margin-top: 14px; }
.recognition-path { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.recognition-path h4 { margin: 0 0 12px; font-size: 12px; }
.recognition-path ol { margin: 0; padding-left: 22px; }
.recognition-path li { padding: 6px 0; color: #657174; font-size: 11px; line-height: 1.7; }
.recognition-path li b { display: block; color: #354143; }
.recognition-path li span { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.recognition-path a { color: var(--mint-deep); }
.package-field-group + .package-field-group { margin-top: 13px; }
.package-record-label { margin-bottom: 7px; color: var(--mint-deep); font-size: 9px; font-weight: 700; }
.package-fields { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.package-field-row { min-width: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); background: #fff; border-bottom: 1px solid var(--line); }
.package-field-continuation dd { grid-column: 1 / -1; }
.package-field-row:last-child { border-bottom: 0; }
.package-field-row dt, .package-field-row dd { min-width: 0; margin: 0; padding: 9px 10px; line-height: 1.65; overflow-wrap: anywhere; }
.package-field-row dt { color: #6f7b7d; background: #f5f8f7; font-size: 10px; font-weight: 650; border-right: 1px solid var(--line); }
.package-field-row dd { color: #354143; font-size: 11px; white-space: pre-wrap; }
.package-match { color: #513d0b; background: #fff0aa; border-bottom: 1px solid #c49b37; }
.package-rules { margin: 2px 0 16px; padding: 11px 13px; background: #f2faf8; border: 1px solid #dcebe7; border-radius: 7px; overflow-wrap: anywhere; }
.package-rules h5 { margin: 0 0 8px; font-size: 12px; }
.package-rules ul { margin: 0; padding-left: 20px; }
.package-rules li { margin-top: 8px; line-height: 1.7; }
.package-rules li span { display: block; color: #657174; white-space: pre-wrap; }
.source-label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.source-mark { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 2px; background: #93a0a2; transform: rotate(45deg); }
.source-mark.sgcc, .source-mark.ecp, .source-mark.sgcc-ecp { background: #19a989; }
.source-mark.sgcc-etp, .source-mark.etp { background: #4d9ed1; }
.source-mark.csg { background: #d18b43; }
.badge { min-height: 25px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 10px; white-space: nowrap; }
.badge.success { color: var(--green); background: var(--green-soft); }
.badge.danger { color: var(--red); background: var(--red-soft); }
.badge.warning { color: var(--amber); background: var(--amber-soft); }
.badge.neutral { color: #687376; background: #eef1f1; }
.row-action { padding-right: 28px !important; text-align: right; }

.state-box { min-height: 210px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.state-box.inline { min-height: 160px; }
.state-box strong { margin-top: 8px; color: var(--ink-soft); }
.state-box p { max-width: 420px; margin: 7px 0 0; font-size: 12px; line-height: 1.6; }
.state-icon { width: 35px; height: 35px; display: grid; place-items: center; color: var(--mint-deep); background: var(--mint-soft); border-radius: 50%; font-size: 16px; }
.muted { color: #939d9f; }

#view-rules > .panel { background: transparent; border: 0; overflow: visible; }
#view-rules .panel-title { padding: 7px 0 19px; border: 0; }
.rule-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rule-item { min-height: 170px; padding: 20px; display: grid; grid-template-columns: 1fr auto; gap: 20px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.rule-item:hover { border-color: #c9d8d5; box-shadow: 0 12px 30px rgba(27,65,59,.06); }
.rule-heading { display: flex; align-items: center; gap: 9px; }
.rule-heading h3 { margin: 0; font-size: 14px; }
.rule-line { margin-top: 15px; display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tags span { padding: 4px 8px; color: #176f5c; background: var(--mint-soft); border-radius: 999px; font-size: 10px; }
.tags span.muted-tag { color: #745d60; background: #f5eeee; }
.rule-meta { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; color: var(--muted); font-size: 10px; }
.rule-meta b { color: var(--ink); font-size: 21px; }

.run-table th:nth-child(1) { width: 15%; }
.run-table th:nth-child(2) { width: 17%; }
.run-table th:nth-child(3) { width: 9%; }
.run-table th:nth-child(4) { width: 8%; }
.run-table th:nth-child(5) { width: 8%; }
.run-table th:nth-child(6) { width: 24%; }
.run-table th:nth-child(7) { width: 7%; }
.run-table th:nth-child(8) { width: 12%; }
.run-log-cell .button { padding: 7px 10px; font-size: 11px; white-space: nowrap; }
.run-table td { white-space: normal; overflow-wrap: anywhere; }
.result-text { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.run-log-modal { width: min(1100px, 92vw); max-width: 92vw; }
#run-log-content { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 65vh; overflow-y: auto; font-size: 12px; line-height: 1.7; }

.settings-form { max-width: 960px; margin-left: auto; margin-right: auto; }
.settings-form fieldset { margin: 0; padding: 25px 23px; border: 0; border-bottom: 1px solid var(--line); }
.settings-form legend { float: left; width: 100%; padding: 0; margin: 0 0 16px; color: var(--ink); font-size: 14px; font-weight: 680; }
.settings-form legend + * { clear: both; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid label, .modal-body > label { display: grid; gap: 8px; color: #526063; font-size: 11px; font-weight: 620; }
.span-2 { grid-column: span 2; }
.field-hint { color: #929c9e; font-size: 10px; font-weight: 400; }
.form-actions { padding: 17px 23px; display: flex; align-items: center; justify-content: flex-end; gap: 17px; background: var(--paper-soft); }
.form-actions span { color: var(--muted); font-size: 11px; }

.drawer-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(13,20,20,.25); backdrop-filter: blur(5px); }
.drawer { position: fixed; z-index: 60; inset: 0 0 0 auto; width: 80vw; display: flex; flex-direction: column; background: white; box-shadow: var(--shadow); transform: translateX(102%); transition: transform .26s ease; }
.drawer.open { transform: translateX(0); }
.drawer-head { min-height: 112px; padding: 24px 25px; display: flex; justify-content: space-between; gap: 18px; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.drawer-head::after { content: ""; width: 32px; height: 32px; position: absolute; right: 92px; top: 18px; background: rgba(80,223,186,.2); border: 1px solid rgba(12,128,106,.15); box-shadow: 27px 20px 0 rgba(101,200,239,.12); transform: rotate(45deg); border-radius: 5px; }
.drawer-head > div { min-width: 0; position: relative; z-index: 1; max-height: 22vh; overflow-y: auto; overflow-wrap: anywhere; }
.drawer-head { flex-shrink: 0; }
.drawer-head > button { flex-shrink: 0; }
.drawer-body { min-height: 0; }
.drawer-foot { flex-shrink: 0; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--mint-deep); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.drawer-head h2 { margin: 0; font-size: 19px; line-height: 1.45; }
.drawer-body { flex: 1; padding: 22px 25px 34px; overflow-y: auto; }
.drawer-loading { min-height: 250px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.drawer-foot { padding: 15px 25px 19px; background: #fafcfc; border-top: 1px solid var(--line); }
.detail-summary { padding: 17px; display: grid; grid-template-columns: 82px 1fr; gap: 18px; background: #f2faf8; border: 1px solid #dcebe7; border-radius: 8px; }
.detail-summary dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 20px; }
.detail-summary dl > div { min-width: 0; }
.detail-summary dt { color: #829092; font-size: 9px; }
.detail-summary dd { margin: 4px 0 0; color: var(--ink-soft); line-height: 1.5; overflow-wrap: anywhere; }
.reference-line { margin-top: 14px; display: flex; align-items: flex-start; gap: 10px; color: #829092; font-size: 9px; line-height: 1.5; }
.reference-line b { flex: 0 0 auto; color: #657174; font-weight: 650; }
.reference-line > div { display: flex; flex-wrap: wrap; gap: 5px; }
.reference-line a, .reference-line > div > span { padding: 3px 7px; color: #176f5c; background: var(--mint-soft); border-radius: 999px; text-decoration: none; overflow-wrap: anywhere; }
.reference-line a:hover { color: #0b5949; background: #d9f4ec; }
.reference-line.compact { margin-top: 5px; display: block; }
.reference-line.compact > b { display: none; }
.reference-line.compact a, .reference-line.compact > div > span { padding: 0; color: #758184; background: transparent; border-radius: 0; }
.detail-section { padding: 21px 2px; border-bottom: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 13px; font-size: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h3 { margin: 0; }
.detail-content { color: #475356; white-space: pre-wrap; line-height: 1.8; overflow-wrap: anywhere; }
.announcement-field > [data-section-heading] { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.announcement-field > [data-section-heading]::-webkit-details-marker { display: none; }
.announcement-field > [data-section-heading] small { margin-left: auto; color: var(--mint-deep); }
.announcement-field[open] > [data-section-heading] .package-chevron { transform: rotate(90deg); }
.announcement-field .detail-content { margin-top: 16px; }
.reason-list { margin-top: 12px; display: grid; gap: 7px; }
.reason-list > div { min-height: 36px; padding: 8px 11px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #176f5c; background: var(--mint-soft); border-radius: 6px; }
.reason-list span { font-weight: 650; }
.reason-list small { color: #62837c; font-size: 9px; }
.reason-list b { margin-left: auto; }
.reason-list .reason-reference { width: 100%; padding-top: 6px; color: #6f7d7a; border-top: 1px solid rgba(12,128,106,.12); }
.attachment-list { display: grid; gap: 7px; }
.attachment-list a, .attachment-list > div { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 9px; color: var(--ink-soft); background: #f7f9f9; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; }
.attachment-list a:hover { border-color: #aadbcf; background: var(--mint-soft); }
.attachment-list b { margin-left: auto; }
.source-link { margin-top: 19px; display: inline-flex; align-items: center; gap: 7px; color: var(--mint-deep); font-weight: 650; text-decoration: none; }
.review-note { display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.review-note textarea { resize: vertical; }
.review-actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 8px; }

.modal { width: min(540px, calc(100vw - 28px)); padding: 0; color: var(--ink); background: white; border: 0; border-radius: 8px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(13,20,20,.34); backdrop-filter: blur(5px); }
.modal-head { padding: 20px 22px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; display: grid; gap: 17px; }
.modal textarea { resize: vertical; }
.modal-actions { padding: 15px 22px; display: flex; justify-content: flex-end; gap: 8px; background: var(--paper-soft); border-top: 1px solid var(--line); }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { width: min(370px, calc(100vw - 40px)); min-height: 52px; padding: 11px 14px; display: flex; align-items: center; gap: 11px; color: #24443b; background: rgba(255,255,255,.96); border: 1px solid #cde4de; border-left: 4px solid var(--mint); border-radius: 8px; box-shadow: var(--shadow); opacity: 0; transform: translateY(9px); transition: .2s ease; }
.toast.error { color: #653c40; border-color: #efd1d3; border-left-color: var(--red); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast > span { font-weight: 700; }
.toast p { margin: 0; line-height: 1.45; }
.scrim { display: none; }

@media (max-width: 1120px) {
  .sidebar { gap: 18px; }
  .brand { min-width: 205px; }
  .nav-item { min-width: auto; padding-inline: 11px; }
  .topbar::after { display: none; }
  .metric:last-child { padding-right: 24px; }
  .metrics::after { opacity: .45; }
  .filters { align-items: center; }
  .filter-submit { display: inline-flex; }
  .notice-table { min-width: 860px; }
  .run-table { min-width: 820px; }
}

@media (max-width: 780px) {
  .sidebar { width: min(286px, calc(100vw - 52px)); height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; align-items: stretch; gap: 15px; position: fixed; inset: 0 auto 0 0; transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: translateX(0); }
  .brand { min-width: 0; padding: 4px 7px 16px; border-bottom: 1px solid var(--line); }
  .nav { display: grid; align-self: auto; gap: 4px; }
  .nav-item { min-height: 45px; padding: 0 12px; justify-content: flex-start; border-radius: 7px; }
  .nav-item.active { background: var(--mint-soft); }
  .nav-item.active::after { display: none; }
  .sidebar-foot { margin: auto 5px 0; align-self: flex-start; }
  .scrim { position: fixed; inset: 0; z-index: 35; display: block; background: rgba(13,20,20,.25); backdrop-filter: blur(4px); }
  .topbar { min-height: 104px; padding: 18px 16px; align-items: center; }
  .title-row h1 { font-size: 23px; }
  .title-row p { display: none; }
  .menu-button { display: inline-grid; }
  .top-actions { gap: 6px; }
  .top-actions .button { width: 39px; min-width: 39px; padding: 0; }
  .top-actions .button span:last-child { display: none; }
  .top-actions a.button { display: none; }
  .button-primary::before { display: none; }
  .content { padding: 0 12px 30px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 96px; padding: 17px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid rgba(26,93,79,.11); }
  .metric:last-child { padding-right: 17px; }
  .metric strong { font-size: 30px; }
  .metrics::after { display: none; }
  .panel-head { min-height: 61px; }
  .filters { padding: 14px; }
  .filters > label { width: 190px; flex-basis: 190px; }
  .search { grid-column: 1 / -1; }
  .table-wrap { overflow: visible; }
  .notice-table, .run-table { min-width: 0; table-layout: auto; }
  .data-table thead { display: none; }
  .data-table tbody { padding: 0 12px 10px; display: grid; }
  .data-table tbody tr { position: relative; padding: 17px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 15px; border-bottom: 1px solid var(--line); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table td { height: auto; padding: 0; display: block; border: 0; font-size: 11px; }
  .data-table td::before { content: attr(data-label); margin-bottom: 5px; display: block; color: #919b9d; font-size: 9px; }
  .notice-table td:first-child { grid-column: 1 / -1; padding-right: 34px; }
  .project-name { white-space: normal; line-height: 1.5; }
  .row-action { position: absolute; right: 14px; top: 12px; padding-right: 0 !important; }
  .row-action::before { display: none !important; }
  .run-table tbody tr { grid-template-columns: 1fr 1fr; }
  .run-table td:nth-child(1), .run-table td:nth-child(5) { grid-column: 1 / -1; }
  #view-rules .panel-title { align-items: flex-start; }
  .rule-list { grid-template-columns: 1fr; }
  .rule-item { min-height: 156px; }
  .settings-form { margin-top: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .drawer { width: 100vw; }
  .drawer-head { min-height: 98px; padding: 18px 16px; }
  .drawer-head h2 { font-size: 16px; }
  .drawer-head::after { opacity: .45; }
  .drawer-body { padding: 16px; }
  .drawer-foot { padding: 13px 16px 16px; }
  .package-section-head { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; }
  .package-group-title { align-items: flex-start; padding: 8px 0; flex-direction: column; justify-content: center; gap: 3px; }
  .package-heading { min-height: 72px; }
  .package-body { padding-left: 0; }
  .package-fields { grid-template-columns: 1fr; }
  .package-field-row { grid-template-columns: 104px minmax(0, 1fr); }
  .package-field-row:last-child { border-bottom: 0; }
  .detail-summary { grid-template-columns: 72px 1fr; padding: 14px; gap: 14px; }
  .detail-summary dl { grid-template-columns: 1fr; gap: 9px; }
  .detail-summary dl > div:nth-child(3) { display: none; }
}

@media (max-width: 430px) {
  .topbar { padding-inline: 12px; }
  .title-row { gap: 9px; }
  .title-row h1 { font-size: 20px; }
  .content { padding-inline: 10px; }
  .metric { grid-template-columns: 1fr; }
  .metric strong { grid-row: auto; grid-column: auto; margin-top: 9px; }
  .metric small { margin-top: 6px; }
  .segmented button { padding: 0 10px; }
  .panel-head { padding-inline: 10px; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters > label { width: 100%; flex-basis: auto; }
  .search { grid-column: auto; }
  .rule-item { grid-template-columns: 1fr; gap: 14px; }
  .rule-meta { padding-top: 12px; flex-direction: row; align-items: center; border-top: 1px solid var(--line); }
}

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

.login-page { display: grid; place-items: center; min-height: 100vh; background: #f4f6f7; }
.login-main { width: min(100% - 40px, 380px); padding: 32px 0; }
.login-main h1 { font-size: 28px; margin-bottom: 32px; letter-spacing: 0; }
.login-main label { display: grid; gap: 8px; margin: 18px 0; }
.login-main input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; outline: none; }
.login-main input:focus { border-color: var(--mint-deep); box-shadow: 0 0 0 3px var(--mint-soft); }
.login-main button { width: 100%; }
#login-error { min-height: 24px; color: #b42332; }
.check-line { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.settings-form .check-line input { width: 18px; height: 18px; min-height: 18px; }
#password-form { margin-top: 24px; }
#mail-test { margin-top: 16px; }

/* Independent collapsible settings cards */
#settings-form, #password-form { background: transparent; border: 0; box-shadow: none; }
.settings-card { background: #fff; border: 1px solid #dfe5e6; border-radius: 12px; margin: 0 0 18px; overflow: hidden; }
.settings-card > [data-section-heading] { cursor: pointer; padding: 20px 24px; font-weight: 600; }
.settings-card[open] > [data-section-heading] { border-bottom: 0; }
.settings-card-body { padding: 20px 24px; border-top: 1px solid #e7ecec; }
.settings-card-body > label { display: grid; gap: 10px; }
.settings-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 20px; }
.settings-card-actions span { color: #69777a; font-size: 13px; }

#settings-form > .panel-title { border-bottom: 0; }

/* Settings controls inspired by StepFun's restrained account form. */
.settings-form input:not([type="checkbox"]), .settings-form select, .settings-form textarea {
  box-sizing: border-box; width: 100%; min-height: 42px; padding: 11px 13px;
  font: inherit; font-size: 14px; font-weight: 400; line-height: 1.5;
  color: #202124; background: #fff; border: 1px solid #e3e3e5;
  border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.025); outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.settings-form textarea { min-height: 120px; resize: vertical; }
.settings-form input::placeholder, .settings-form textarea::placeholder { color: #99999f; }
.settings-form input:not([type="checkbox"]):hover, .settings-form select:hover, .settings-form textarea:hover { border-color: #c6c6cb; }
.settings-form input:not([type="checkbox"]):focus, .settings-form select:focus, .settings-form textarea:focus { border-color: #737378; box-shadow: 0 0 0 3px rgba(0,0,0,.045); }
.settings-form input[readonly] { background: #f7f7f8; color: #64646b; }
.keyword-intro { margin: 0 0 24px; }
.keyword-config { padding: 24px 0; }
.keyword-config + .keyword-config { border-top: 1px solid #ededf0; }
.keyword-config-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.keyword-config-heading h3 { margin: 0; font-size: 15px; font-weight: 600; color: #25252a; }
.keyword-config-heading p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: #85858d; }
.keyword-source { display: grid; place-items: center; flex-shrink: 0; width: 48px; height: 40px; border-radius: 8px; background: #f3f3f5; color: #68686f; font-size: 11px; font-weight: 600; letter-spacing: .4px; }
.keyword-settings .settings-card-actions { margin-top: 0; padding-top: 20px; border-top: 1px solid #ededf0; }
.collection-mode { display: inline-flex; flex-wrap: wrap; max-width: 100%; align-items: center; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 999px; background: #f0f3f3; }
.mode-option { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 2px solid transparent; border-radius: 999px; cursor: pointer; color: #737e80; }
.mode-option:has(input:checked) { border-color: #0874d1; background: #fff; color: #202326; box-shadow: 0 2px 8px rgba(28,53,50,.08); }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option span { display: block; }
.mode-option strong { font-size: 12px; font-weight: 650; white-space: nowrap; }
.mode-option small { display: none; }
.collection-fields label[hidden] { display: none; }

.hit-value { color: #168578; font-weight: 600; }
.notice-table td:not(:first-child) { overflow-wrap: anywhere; white-space: normal; }
.notice-table td:first-child .project-name, .notice-table td:first-child .subtext, .notice-table td:first-child .package-status { display: block; max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.notice-table td { height: auto; min-height: 72px; }
.settings-card:has(.collection-mode) .settings-card-body { padding: 18px 22px 20px; background: linear-gradient(180deg, #fbfcfc 0%, #fff 100%); }
.collection-mode { grid-template-columns: repeat(2, minmax(0, 260px)); justify-content: start; }
.collection-fields { max-width: 820px; gap: 14px; }
.collection-fields label { padding: 12px 14px; background: #fff; border: 1px solid #eceef0; border-radius: 9px; }
@media (max-width: 600px) { .settings-card-body { padding: 18px; } .keyword-config { padding: 20px 0; } }

.rule-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.rule-actions .button { min-height: 34px; padding: 6px 14px; white-space: nowrap; }
.rule-actions .delete-rule { color: #c43e48; border-color: #ecd5d8; background: #fff; }
.rule-actions .delete-rule:hover { color: #a82832; border-color: #dba5ad; background: #fff3f4; }
.rule-enabled { display: flex; align-items: center; gap: 8px; width: fit-content; margin: 0 22px 20px; min-height: 28px; font-size: 13px; cursor: pointer; }
.rule-enabled input[type="checkbox"] { flex: 0 0 16px; width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; accent-color: var(--mint-deep); cursor: pointer; }
.rule-enabled input[type="checkbox"]:focus-visible { outline: 2px solid var(--mint-deep); outline-offset: 3px; }

.rule-main { min-width: 0; }
.rule-heading { align-items: flex-start; flex-wrap: wrap; }
.rule-heading h3 { overflow-wrap: anywhere; line-height: 1.65; }
.rule-period { margin-top: 10px; color: #405c54; font-size: 12px; }
.rule-source { margin-top: 5px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

.field-compat-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.field-compat-toolbar input { flex: 1; min-width: 0; max-width: 440px; }
.field-compat-toolbar > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.field-compat-toolbar > button { margin-left: auto; white-space: nowrap; }
.field-compat-head, .field-compat-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) 140px; gap: 18px; align-items: center; }
.field-compat-head { padding: 10px 12px; color: var(--muted); font-size: 11px; background: #f5f7f7; border-radius: 6px; }
.field-compat-list { max-height: 440px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.field-compat-row { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.field-compat-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.field-compat-name strong { font-size: 13px; overflow-wrap: anywhere; }
.field-match-badge { font-size: 10px; color: #25715d; background: #edf7f3; padding: 3px 6px; border-radius: 4px; white-space: nowrap; }
.field-aliases { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.field-aliases > span { padding: 4px 7px; border-radius: 5px; background: #f3f5f5; font-size: 12px; overflow-wrap: anywhere; }
.field-more { background: transparent; border: none; color: #19765c; padding: 4px; font-size: 12px; }
.field-row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.field-row-actions .button { min-height: 32px; padding: 6px 12px; font-size: 12px; }
.field-delete { color: #c43e48; }
.field-empty { padding: 24px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.field-compat-footer { position: sticky; bottom: 0; background: white; margin-top: 0; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.field-compat-footer > span { flex: 1; min-width: 120px; }
.field-compat-footer [hidden] { display: none; }
.field-warning { padding: 10px 12px; margin: 0; border-radius: 6px; background: #fff7e7; color: #886323; font-size: 12px; line-height: 1.6; }
.field-error { margin: 0; color: #c43e48; font-size: 12px; }
.field-error:empty { display: none; }
.field-editor-note { margin-right: auto; align-self: center; font-size: 11px; color: var(--muted); }
@media(max-width: 650px) {
  .field-compat-toolbar { flex-wrap: wrap; }
  .field-compat-toolbar input { flex-basis: 100%; max-width: none; }
  .field-compat-head { display: none; }
  .field-compat-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 14px 0; }
  .field-aliases { grid-column: 1 / -1; grid-row: 2; }
  .field-row-actions { grid-column: 2; grid-row: 1; }
  #field-editor-dialog .modal-actions { flex-wrap: wrap; }
  .field-editor-note { flex-basis: 100%; }
}

.anchor-head, .anchor-row { grid-template-columns: minmax(180px, 1fr) minmax(160px, 2fr) 70px; }
.anchor-row .field-compat-name small { flex-basis: 100%; color: var(--muted); font-size: 11px; line-height: 1.6; }
@media(max-width: 650px) {
  .anchor-row { grid-template-columns: minmax(0, 1fr) auto; }
  #anchor-editor-dialog .modal-actions { flex-wrap: wrap; }
}

/* Rule workspace */
.rules-tabs { display:flex; gap:8px; padding:0 24px 20px; border-bottom:1px solid var(--line); }
.rules-tabs button { border:0; border-radius:24px; padding:10px 20px; background:#f2f5f4; color:var(--muted); cursor:pointer; }
.rules-tabs button.active { background:#111918; color:white; }
.rules-layout { display:grid; grid-template-columns:210px minmax(0,1fr); }
.rules-side { padding:24px 14px; border-right:1px solid var(--line); }
.rules-side button { width:100%; text-align:left; border:0; background:transparent; padding:14px 12px; border-radius:10px; margin-bottom:6px; cursor:pointer; color:var(--muted); }
.rules-side button.active { color:#137665; background:#eaf6f1; font-weight:650; }
.rules-content { min-width:0; padding:24px; }
.rules-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; }
.rules-toolbar h3 { margin:0 0 8px; font-size:18px; }.rules-toolbar p { margin:0; color:var(--muted); font-size:12px; }
.rule-searchbar { display:flex; gap:12px; align-items:center; margin-bottom:20px; }.rule-searchbar input { flex:1; min-width:0; }.rule-searchbar span { white-space:nowrap; color:var(--muted); }
.rules-content .rule-list { grid-template-columns:minmax(0,1fr); padding:0; max-height:650px; overflow:auto; }
.rules-content .settings-form { border:0; margin:0; padding:0; }.rules-content .settings-card { margin:0; }
.rules-content [hidden], .rules-side [hidden] { display:none !important; }
@media(max-width:800px) { .rules-layout { grid-template-columns:minmax(0,1fr); }.rules-side { border-right:0; border-bottom:1px solid var(--line); padding:12px; }.rules-side>div:not([hidden]) { display:flex; flex-wrap:wrap; }.rules-side button { width:auto; }.rules-content { padding:16px; }.rules-toolbar { align-items:flex-start; flex-wrap:wrap; } }

.settings-card > [data-section-heading], .package-heading, .announcement-field > [data-section-heading] { cursor: default; }
.package-chevron { display:none; }
