:root {
    --canvas: #f3f5f1;
    --surface: #ffffff;
    --surface-soft: #f8f9f6;
    --ink: #182522;
    --muted: #697572;
    --border: #dce2dc;
    --border-strong: #c9d1ca;
    --primary: #145c52;
    --primary-dark: #0d473f;
    --primary-soft: #e2f0eb;
    --amber: #c67d19;
    --amber-soft: #fff2d9;
    --blue: #2f718f;
    --blue-soft: #e5f1f6;
    --red: #ad453e;
    --red-soft: #fae9e6;
    --green: #287456;
    --green-soft: #e4f3ea;
    --shadow: 0 8px 24px rgba(26, 44, 38, 0.06);
    --sidebar-width: 248px;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 24px 16px 16px;
    background: #112e2a;
    color: #d7e5e0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand,
.login-brand,
.mobile-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand {
    min-height: 48px;
    margin: 0 8px 26px;
    color: #ffffff;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: #d6a247;
    color: #102b27;
    font-weight: 800;
    font-size: 19px;
}

.brand-mark-light {
    width: 42px;
    height: 42px;
    background: #f0b453;
}

.brand strong,
.login-brand strong,
.mobile-brand strong {
    display: block;
    font-size: 17px;
    letter-spacing: 0.02em;
}

.brand small,
.login-brand small {
    display: block;
    margin-top: 1px;
    color: #91aaa3;
    font-size: 9px;
    letter-spacing: 0.17em;
}

.brand small {
    white-space: nowrap;
}

.main-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow-y: auto;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 43px;
    padding: 9px 12px;
    border-radius: 7px;
    color: #b9cbc5;
    transition: color 160ms ease, background-color 160ms ease;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.11);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -16px;
    width: 3px;
    height: 23px;
    border-radius: 0 4px 4px 0;
    background: #e4ae4e;
}

.nav-badge {
    margin-left: auto;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: #e4ae4e;
    color: #1d2c28;
    font-size: 11px;
}

.nav-section-label {
    margin: 19px 12px 7px;
    color: #738f86;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.sidebar-footer {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer form {
    margin: 0;
}

.nav-button {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.main-shell {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    z-index: 25;
    top: 0;
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.page-heading {
    min-width: 0;
}

.page-heading h1 {
    margin-bottom: 2px;
    font-size: 21px;
    line-height: 1.25;
    letter-spacing: 0;
}

.page-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
}

.topbar-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 18px;
}

.today-label {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 7px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.user-chip:hover {
    border-color: var(--border-strong);
}

.avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.avatar-square {
    border-radius: 7px;
}

.user-chip strong,
.user-chip small {
    display: block;
    line-height: 1.3;
}

.user-chip strong {
    font-size: 12px;
}

.user-chip small {
    color: var(--muted);
    font-size: 10px;
}

.page-content {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 26px 30px 42px;
}

.mobile-menu {
    display: none !important;
}

.sidebar-scrim {
    display: none;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    min-height: 118px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(20, 38, 32, 0.03);
}

.metric-card.metric-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.metric-icon {
    width: 44px;
    height: 44px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green);
}

.metric-primary .metric-icon {
    background: rgba(255, 255, 255, 0.13);
    color: #ffffff;
}

.metric-icon svg {
    width: 21px;
    height: 21px;
}

.metric-icon.tone-amber {
    color: var(--amber);
    background: var(--amber-soft);
}

.metric-icon.tone-blue {
    color: var(--blue);
    background: var(--blue-soft);
}

.metric-icon.tone-red {
    color: var(--red);
    background: var(--red-soft);
}

.metric-card p,
.metric-card small {
    margin-bottom: 0;
}

.metric-card p {
    color: var(--muted);
    font-size: 12px;
}

.metric-primary p {
    color: #bcd7d0;
}

.metric-card strong {
    display: block;
    min-height: 34px;
    margin: 2px 0 1px;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.metric-card small {
    color: var(--muted);
    font-size: 11px;
}

.metric-primary small {
    color: #bcd7d0;
}

.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(20, 38, 32, 0.025);
    margin-bottom: 20px;
}

.panel-header {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header-wrap {
    flex-wrap: wrap;
}

.panel-header h2 {
    margin-bottom: 2px;
    font-size: 16px;
    line-height: 1.35;
}

.panel-header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 11px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 20px;
}

.panel-span-2 {
    min-width: 0;
}

.action-panel {
    align-self: start;
}

.quick-actions {
    padding: 8px;
}

.quick-actions > a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px;
    border-radius: 7px;
}

.quick-actions > a:hover {
    background: var(--surface-soft);
}

.quick-actions > a > svg {
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: #a1aaa6;
}

.quick-icon {
    width: 39px;
    height: 39px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: var(--green-soft);
    color: var(--green);
}

.quick-icon svg {
    width: 18px;
    height: 18px;
}

.quick-actions strong,
.quick-actions small {
    display: block;
}

.quick-actions strong {
    font-size: 13px;
}

.quick-actions small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}

.text-link svg {
    width: 15px;
    height: 15px;
}

.notice-band {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 15px 18px;
    border: 1px solid #e7c891;
    border-radius: var(--radius);
    background: var(--amber-soft);
}

.flow-ready-band {
    border-color: #b8dbc8;
    background: var(--green-soft);
}

.flow-ready-band > svg {
    color: var(--green);
}

.inline-notice {
    margin: 14px;
}

.notice-band > svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    color: var(--amber);
}

.notice-band div {
    flex: 1;
}

.notice-band strong {
    display: block;
    font-size: 13px;
}

.notice-band p {
    margin-bottom: 0;
    color: #765a2b;
    font-size: 11px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: #f8f9f6;
    color: #64706d;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf0ec;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #fafbf9;
}

.data-table .numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .nowrap {
    white-space: nowrap;
}

.compact-table td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.record-link {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.record-link:hover {
    text-decoration: underline;
}

.cell-sub {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
}

.contract-cell {
    display: block;
    max-width: 245px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-action {
    width: 42px;
    padding-left: 4px !important;
    padding-right: 8px !important;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pending {
    color: #8a5b10;
    background: var(--amber-soft);
}

.status-approved {
    color: #216146;
    background: var(--green-soft);
}

.status-rejected {
    color: #93372f;
    background: var(--red-soft);
}

.status-cancelled {
    color: #66706d;
    background: #ecefec;
}

.text-danger {
    color: var(--red) !important;
}

.mono {
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
}

.button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    transition: background-color 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.button:active {
    transform: translateY(1px);
}

.button svg {
    width: 16px;
    height: 16px;
}

.button:disabled,
.button.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.button-primary {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

.button-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.button-secondary {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--border-strong);
}

.button-secondary:hover {
    border-color: #aeb9b1;
    background: var(--surface-soft);
}

.button-ghost {
    color: var(--muted);
    background: transparent;
    border-color: transparent;
}

.button-ghost:hover {
    color: var(--ink);
    background: var(--surface-soft);
}

.button-danger {
    color: #ffffff;
    background: var(--red);
    border-color: var(--red);
}

.button-danger:hover {
    background: #92362f;
}

.button-small {
    min-height: 31px;
    padding: 6px 10px;
    font-size: 11px;
}

.button-wide {
    width: 100%;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--muted);
    background: var(--surface);
    cursor: pointer;
}

.icon-button:hover {
    color: var(--ink);
    border-color: var(--border-strong);
    background: var(--surface-soft);
}

.icon-button svg {
    width: 17px;
    height: 17px;
}

.icon-button.small {
    width: 30px;
    height: 30px;
    border-color: transparent;
    background: transparent;
}

.icon-button.small:hover {
    background: #edf1ed;
}

.icon-button.danger:hover {
    color: var(--red);
    background: var(--red-soft);
}

.icon-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.empty-state {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 36px 20px;
    text-align: center;
}

.empty-state > svg {
    width: 34px;
    height: 34px;
    margin-bottom: 13px;
    color: #93a19b;
    stroke-width: 1.4;
}

.empty-state h3 {
    margin-bottom: 4px;
    font-size: 15px;
}

.empty-state p {
    max-width: 390px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 12px;
}

.empty-state.compact {
    min-height: 170px;
    padding: 24px 10px;
}

.empty-state.spacious {
    min-height: 420px;
}

.muted-empty {
    padding: 22px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}

.filter-bar select,
.filter-bar input,
.field input,
.field select,
.field textarea,
.password-reset-form input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    outline: none;
    color: var(--ink);
    background: var(--surface);
    font-size: 12px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.filter-bar select {
    width: auto;
    min-width: 120px;
}

.filter-bar input:focus,
.filter-bar select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.password-reset-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20, 92, 82, 0.09);
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 210px;
}

.search-field svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #87928e;
    transform: translateY(-50%);
}

.search-field input {
    padding-left: 36px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.field > span:first-child {
    color: #34413e;
    font-size: 11px;
    font-weight: 700;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field-hint {
    color: var(--muted);
    font-size: 10px;
}

.required {
    color: var(--red);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 15px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

.entry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 20px;
}

.form-panel {
    min-width: 0;
}

.form-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 99px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 700;
}

.form-step svg {
    width: 14px;
    height: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 19px 18px;
    padding: 22px;
}

.field-span-2 {
    grid-column: span 2;
}

.entry-summary {
    position: sticky;
    top: 104px;
}

.summary-list {
    margin: 0;
    padding: 9px 18px;
}

.summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 0;
    border-bottom: 1px solid #edf0ec;
}

.summary-list div:last-child {
    border-bottom: 0;
}

.summary-list dt {
    color: var(--muted);
    font-size: 11px;
}

.summary-list dd {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.summary-note,
.form-tip,
.process-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 8px 18px 16px;
    padding: 11px;
    border-radius: 7px;
    color: #42534e;
    background: #eef3ef;
    font-size: 10px;
}

.summary-note svg,
.form-tip svg,
.process-note > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--primary);
}

.summary-note p,
.form-tip p,
.process-note p {
    margin-bottom: 0;
}

.entry-summary > .button {
    width: calc(100% - 36px);
    margin: 0 18px 9px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    align-items: start;
    gap: 20px;
}

.title-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 4px 22px 22px;
}

.detail-grid > div {
    min-width: 0;
    padding: 17px 0;
    border-bottom: 1px solid #edf0ec;
}

.detail-grid > div:nth-child(3n + 2),
.detail-grid > div:nth-child(3n + 3) {
    padding-left: 18px;
}

.detail-grid dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
}

.detail-grid dd {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.detail-wide {
    grid-column: span 2;
}

.remark-text {
    white-space: pre-wrap;
}

.approval-timeline {
    margin: 0;
    padding: 20px;
    list-style: none;
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 12px;
    min-height: 70px;
}

.timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 28px;
    bottom: 0;
    left: 13px;
    width: 1px;
    background: var(--border);
}

.timeline-dot {
    z-index: 1;
    width: 27px;
    height: 27px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #6e7b76;
    background: #edf0ec;
}

.timeline-dot svg {
    width: 14px;
    height: 14px;
}

.timeline-approved .timeline-dot {
    color: var(--green);
    background: var(--green-soft);
}

.timeline-rejected .timeline-dot {
    color: var(--red);
    background: var(--red-soft);
}

.timeline-pending .timeline-dot {
    color: var(--amber);
    background: var(--amber-soft);
}

.timeline-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.timeline-title strong {
    font-size: 12px;
}

.timeline-title span {
    color: var(--muted);
    font-size: 9px;
}

.timeline-item p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.timeline-item blockquote {
    margin: 7px 0 0;
    padding: 7px 9px;
    border-left: 2px solid var(--border-strong);
    color: #52605c;
    background: var(--surface-soft);
    font-size: 10px;
}

.inline-action {
    margin: 0 18px 18px;
    padding: 13px;
    border: 1px solid #e7c891;
    border-radius: 7px;
    background: var(--amber-soft);
}

.inline-action p {
    margin-bottom: 10px;
    color: #765a2b;
    font-size: 11px;
}

.inline-actions {
    display: flex;
    gap: 8px;
}

.approval-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.approval-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-top: 3px solid #d39b39;
    border-radius: var(--radius);
    background: var(--surface);
}

.approval-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.approval-card-head a {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

.approval-card-head div span {
    margin-left: 7px;
    color: var(--muted);
    font-size: 10px;
}

.approval-card h2 {
    margin-bottom: 3px;
    font-size: 19px;
}

.approval-project {
    margin-bottom: 15px;
    color: var(--muted);
    font-size: 11px;
}

.approval-facts {
    display: grid;
    grid-template-columns: 1.6fr 0.7fr 0.7fr 1fr;
    gap: 1px;
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--border);
}

.approval-facts > span {
    padding: 9px 10px;
    background: var(--surface-soft);
}

.approval-facts small,
.approval-facts strong {
    display: block;
}

.approval-facts small {
    color: var(--muted);
    font-size: 9px;
}

.approval-facts strong {
    margin-top: 2px;
    font-size: 11px;
}

.approval-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.approval-form .field {
    flex: 1;
}

.approval-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
}

.stats-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.segmented-control {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.segmented-control button {
    min-height: 34px;
    padding: 7px 14px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 650;
}

.segmented-control button.active {
    color: #ffffff;
    background: var(--primary);
}

.stats-metrics {
    margin-bottom: 20px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 0;
}

.chart-panel {
    min-width: 0;
    margin-bottom: 20px;
}

.chart-span-2 {
    grid-column: span 2;
}

.chart-span-3 {
    grid-column: span 3;
}

.chart-unit {
    color: var(--muted);
    font-size: 10px;
}

.chart-canvas {
    min-height: 300px;
    padding: 8px;
    overflow-x: auto;
}

.chart-canvas-wide {
    min-height: 330px;
}

.chart-canvas svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-loading {
    min-height: 280px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
}

.chart-empty {
    min-height: 280px;
    display: grid;
    place-items: center;
    color: #8a9691;
    font-size: 12px;
}

.chart-text {
    fill: #697572;
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 11px;
}

.pie-layout {
    min-height: 282px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
}

.pie-layout > svg {
    width: 53%;
    max-width: 235px;
    flex: 0 0 auto;
}

.pie-legend {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.pie-legend-item {
    display: grid;
    grid-template-columns: 9px minmax(52px, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 10px;
}

.pie-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.pie-legend-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pie-legend-item strong {
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pie-legend-item small {
    min-width: 35px;
    color: var(--muted);
    text-align: right;
    font-size: 9px;
    white-space: nowrap;
}

.chart-value {
    fill: #26332f;
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 11px;
    font-weight: 700;
}

.chart-gridline {
    stroke: #e7ebe7;
    stroke-width: 1;
}

.chart-axis {
    stroke: #ccd4ce;
    stroke-width: 1;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    align-items: start;
    gap: 20px;
}

.admin-two-column {
    display: grid;
    grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
    align-items: start;
    gap: 20px;
}

.side-form {
    position: sticky;
    top: 104px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.narrow-panel {
    max-width: 560px;
}

.management-list {
    padding: 7px 14px;
}

.management-row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 54px;
    border-bottom: 1px solid #edf0ec;
}

.management-row:last-child {
    border-bottom: 0;
}

.order-index {
    width: 25px;
    color: #95a09c;
    font-family: Consolas, monospace;
    font-size: 10px;
}

.management-main {
    flex: 1;
    min-width: 0;
}

.management-main strong,
.management-main small {
    display: block;
}

.management-main strong {
    font-size: 12px;
}

.management-main small {
    color: var(--muted);
    font-size: 9px;
}

.inline-create-form {
    display: flex;
    align-items: end;
    gap: 9px;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-soft);
}

.inline-create-form .field {
    flex: 1;
}

.inline-create-form .field-order {
    flex: 0 0 72px;
}

.person-create-form {
    flex-wrap: wrap;
}

.people-groups {
    padding: 7px 14px 14px;
}

.people-group {
    border-bottom: 1px solid #edf0ec;
}

.people-group summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 3px;
    cursor: pointer;
    list-style: none;
}

.people-group summary::-webkit-details-marker {
    display: none;
}

.people-group summary span {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
}

.people-group summary b {
    color: var(--muted);
    font-size: 9px;
}

.people-group summary svg {
    width: 14px;
    height: 14px;
    color: var(--muted);
    transition: transform 150ms ease;
}

.people-group[open] summary svg {
    transform: rotate(180deg);
}

.people-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 0 14px 3px;
}

.person-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 3px 6px 3px 9px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--surface-soft);
    font-size: 10px;
}

.person-chip.inactive {
    opacity: 0.48;
}

.person-chip form {
    margin: 0;
}

.person-chip button {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #86918d;
    background: transparent;
    cursor: pointer;
}

.person-chip button:hover {
    color: var(--red);
    background: var(--red-soft);
}

.person-chip button svg {
    width: 11px;
    height: 11px;
}

.role-tag {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
}

.role-admin {
    color: var(--primary);
    background: var(--primary-soft);
}

.role-user {
    color: #59645f;
    background: #edf0ec;
}

.password-reset-form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.password-reset-form input {
    min-width: 86px;
    min-height: 30px;
    padding: 5px 7px;
    font-size: 10px;
}

.current-user-tag {
    color: var(--muted);
    font-size: 9px;
    white-space: nowrap;
}

.workflow-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
}

.flow-stage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.flow-stage-card {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 92px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.flow-stage-card > div {
    flex: 1;
    min-width: 0;
}

.flow-stage-card small,
.flow-stage-card strong,
.flow-stage-card p {
    display: block;
}

.flow-stage-card small {
    color: var(--muted);
    font-size: 9px;
}

.flow-stage-card strong {
    margin: 1px 0;
    font-size: 13px;
}

.flow-stage-card p {
    margin-bottom: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.process-management-row {
    flex-wrap: wrap;
}

.responsible-form {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 210px;
}

.responsible-form select {
    flex: 1;
    min-width: 0;
    min-height: 31px;
    padding: 5px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--ink);
    background: var(--surface);
    font-size: 10px;
}

.user-admin-table {
    min-width: 960px;
}

.user-admin-table .duty-tag,
.user-admin-table .role-tag,
.user-admin-table .current-user-tag,
.user-admin-table .password-reset-form button,
.user-admin-table td:nth-child(3),
.user-admin-table td:nth-child(5),
.user-admin-table .cell-sub {
    white-space: nowrap;
}

.identity-form {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 390px;
}

.identity-form select,
.identity-form input {
    min-height: 31px;
    padding: 5px 7px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 10px;
}

.identity-form select {
    width: 116px;
}

.identity-form input {
    width: 120px;
}

.duty-tag,
.stage-tag {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 2px 7px;
    border-radius: 5px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 9px;
    font-weight: 700;
}

.duty-tag.muted {
    color: var(--muted);
    background: #edf0ec;
}

.stage-tag {
    margin-right: 4px;
    color: var(--blue);
    background: var(--blue-soft);
}

.warning-tip {
    color: #765a2b;
    background: var(--amber-soft);
}

.workflow-list {
    margin: 0;
    padding: 22px;
    list-style: none;
}

.workflow-list > li:not(.workflow-connector) {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-soft);
}

.workflow-order {
    width: 27px;
    height: 27px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 800;
}

.workflow-person {
    flex: 1;
    min-width: 0;
}

.workflow-person strong,
.workflow-person small {
    display: block;
}

.workflow-person strong {
    font-size: 12px;
}

.workflow-person small {
    color: var(--muted);
    font-size: 9px;
}

.workflow-actions {
    display: flex;
    gap: 2px;
}

.workflow-connector {
    height: 24px;
    margin-left: 26px;
    border-left: 1px dashed #bcc7bf;
}

.process-note {
    margin-top: 16px;
}

.process-note strong {
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
}

.process-note p {
    color: var(--muted);
}

.flash-stack {
    position: relative;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.flash {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: #34413e;
    font-size: 11px;
}

.flash > svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.flash-success {
    border-color: #b8dbc8;
    background: var(--green-soft);
}

.flash-success > svg {
    color: var(--green);
}

.flash-error {
    border-color: #e8b9b4;
    background: var(--red-soft);
}

.flash-error > svg {
    color: var(--red);
}

.flash-warning {
    border-color: #e7c891;
    background: var(--amber-soft);
}

.flash-warning > svg {
    color: var(--amber);
}

.flash-close {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 5px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.flash-close svg {
    width: 14px;
    height: 14px;
}

.error-code {
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
}

.guest-error {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    padding: 30px;
    text-align: center;
}

.guest-error h1 {
    font-size: 22px;
}

/* Login */
.login-body {
    background: #edf0eb;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(480px, 1.15fr) minmax(420px, 0.85fr);
}

.login-visual {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 42px 48px;
    color: #ffffff;
    background-color: #183d36;
    background-image: linear-gradient(100deg, rgba(11, 38, 33, 0.96) 5%, rgba(13, 43, 37, 0.74) 50%, rgba(13, 43, 37, 0.35) 100%), url("../images/login-workshop.jpg");
    background-position: center;
    background-size: cover;
}

.visual-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 56px 56px;
    pointer-events: none;
}

.login-brand,
.visual-copy,
.visual-status {
    position: relative;
    z-index: 1;
}

.visual-copy {
    max-width: 600px;
    margin: auto 0;
    padding: 70px 0;
}

.eyebrow {
    margin-bottom: 12px;
    color: #d7a84d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.visual-copy h1 {
    margin-bottom: 18px;
    font-size: clamp(34px, 4.1vw, 58px);
    line-height: 1.16;
    letter-spacing: -0.03em;
}

.visual-description {
    max-width: 440px;
    margin-bottom: 0;
    color: #c5d7d1;
    font-size: 13px;
    line-height: 1.8;
}

.visual-status {
    display: flex;
    gap: 24px;
    color: #b8cdc6;
    font-size: 11px;
}

.visual-status span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.visual-status svg {
    width: 16px;
    height: 16px;
    color: #d9ac58;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 42px;
    background: #f8f9f6;
}

.login-form-wrap {
    width: min(100%, 390px);
}

.mobile-brand {
    display: none;
    margin-bottom: 32px;
}

.login-form-wrap h2 {
    margin-bottom: 8px;
    font-size: 26px;
    letter-spacing: -0.02em;
}

.login-help {
    margin-bottom: 27px;
    color: var(--muted);
    font-size: 12px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon > svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #7b8883;
    transform: translateY(-50%);
}

.input-with-icon input {
    min-height: 46px;
    padding-left: 38px;
}

.input-with-icon input[type="password"] {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle svg {
    width: 16px;
    height: 16px;
}

.login-form .button-primary {
    min-height: 46px;
    margin-top: 3px;
}

.login-footnote {
    margin: 20px 0 0;
    color: #8a9591;
    font-size: 10px;
    text-align: center;
}

.standalone-content {
    min-height: 100vh;
    padding: 24px;
}

@media (max-width: 1180px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .approval-cards {
        grid-template-columns: 1fr;
    }

    .chart-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-span-2,
    .chart-span-3 {
        grid-column: span 2;
    }

    .admin-layout,
    .entry-layout,
    .detail-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
    }

    .admin-two-column {
        grid-template-columns: 1fr;
    }

    .login-layout {
        grid-template-columns: minmax(420px, 1fr) minmax(390px, 0.8fr);
    }

    .login-visual {
        padding: 36px;
    }

    .flow-stage-grid {
        grid-template-columns: 1fr;
    }

    .identity-form {
        min-width: 330px;
    }
}

@media (max-width: 940px) {
    :root {
        --sidebar-width: 232px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-scrim {
        position: fixed;
        z-index: 35;
        inset: 0;
        display: none;
        background: rgba(13, 29, 25, 0.42);
    }

    .sidebar-scrim.open {
        display: block;
    }

    .main-shell {
        margin-left: 0;
    }

    .mobile-menu {
        display: inline-grid !important;
    }

    .topbar {
        padding: 12px 20px;
    }

    .page-content {
        padding: 20px;
    }

    .dashboard-grid,
    .admin-layout,
    .workflow-layout,
    .entry-layout,
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .entry-summary,
    .side-form {
        position: static;
    }

    .approval-form {
        align-items: stretch;
        flex-direction: column;
    }

    .approval-actions {
        justify-content: flex-end;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }

    .login-panel {
        min-height: 100vh;
        padding: 30px 22px;
    }

    .mobile-brand {
        display: flex;
    }
}

@media (max-width: 700px) {
    .topbar {
        min-height: 70px;
    }

    .page-heading h1 {
        font-size: 18px;
    }

    .page-heading p,
    .today-label {
        display: none;
    }

    .topbar-meta {
        gap: 0;
    }

    .user-chip > span:last-child {
        display: none;
    }

    .user-chip {
        padding: 2px;
        border: 0;
    }

    .page-content {
        padding: 16px 14px 30px;
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .metric-card {
        min-height: 105px;
        padding: 14px;
        gap: 10px;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
    }

    .metric-card strong {
        font-size: 23px;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .chart-span-2,
    .chart-span-3 {
        grid-column: span 1;
    }

    .stats-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .segmented-control {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .segmented-control button {
        padding-left: 5px;
        padding-right: 5px;
    }

    .filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-bar select {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
        padding: 17px;
    }

    .field-span-2 {
        grid-column: span 1;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
        padding: 0 17px 17px;
    }

    .detail-grid > div:nth-child(3n + 2),
    .detail-grid > div:nth-child(3n + 3) {
        padding-left: 0;
    }

    .detail-grid > div:nth-child(even) {
        padding-left: 14px;
    }

    .detail-wide {
        grid-column: span 2;
    }

    .title-line {
        align-items: flex-start;
        flex-direction: column;
    }

    .approval-facts {
        grid-template-columns: 1fr 1fr;
    }

    .notice-band {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .notice-band .button {
        margin-left: 36px;
    }

    .panel-header {
        padding: 14px 16px;
    }

    .quick-actions > a {
        min-height: 58px;
    }

    .inline-create-form {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-create-form .field-order {
        flex-basis: auto;
    }

    .responsible-form {
        width: 100%;
        order: 5;
    }

    .identity-form {
        min-width: 260px;
        flex-wrap: wrap;
    }

    .table-wrap {
        overflow-x: auto;
    }

    .data-table {
        min-width: 720px;
    }

    .compact-table {
        min-width: 560px;
    }

    .chart-canvas {
        min-height: 240px;
        padding: 0;
    }

    .chart-canvas-wide {
        min-height: 270px;
    }

    #daily-bar svg,
    #defect-line svg {
        min-width: 700px;
    }

    .pie-layout {
        min-height: 260px;
        padding: 8px 4px;
    }

    .pie-layout > svg {
        width: 47%;
    }
}

@media (max-width: 420px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 90px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid > div:nth-child(even) {
        padding-left: 0;
    }

    .detail-wide {
        grid-column: span 1;
    }

    .approval-facts {
        grid-template-columns: 1fr;
    }
}
