:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --border: #e4e7ec;
    --primary: #176b5b;
    --primary-dark: #0f5145;
    --primary-soft: #e8f5f1;
    --warning: #b54708;
    --warning-soft: #fff4e5;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --shadow: 0 10px 30px rgba(23, 32, 51, 0.07);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    line-height: 1.55;
}

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

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

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    display: flex;
    height: 72px;
    justify-content: space-between;
    padding: 0 max(24px, calc((100vw - 1180px) / 2));
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    display: flex;
    gap: 12px;
}

.brand-mark {
    align-items: center;
    background: var(--primary);
    border-radius: 12px;
    color: #fff;
    display: flex;
    font-size: 18px;
    font-weight: 700;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
}

.topnav {
    align-items: center;
    display: flex;
    gap: 18px;
}

.topnav form {
    margin: 0;
}

.page {
    margin: 0 auto;
    max-width: 1180px;
    padding: 34px 24px 80px;
}

.page-heading,
.task-hero {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-heading h1,
.task-hero h1,
.form-heading h1 {
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -0.03em;
    line-height: 1.16;
    margin: 6px 0 10px;
}

.page-heading p,
.task-hero p,
.form-heading p {
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 650;
    justify-content: center;
    min-height: 42px;
    padding: 9px 16px;
}

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

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

.button-secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.button-wide {
    width: 100%;
}

.text-button {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 8px;
}

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

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}

.summary-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    margin-bottom: 8px;
}

.summary-card span {
    color: var(--muted);
}

.summary-warning {
    background: var(--warning-soft);
    border-color: #fedf89;
}

.section-block {
    margin: 32px 0;
}

.section-title,
.section-title > div {
    align-items: center;
    display: flex;
}

.section-title {
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title > div {
    gap: 12px;
}

.section-title h2,
.section-title p {
    margin: 0;
}

.section-title h2 {
    font-size: 20px;
}

.section-title p {
    color: var(--muted);
    font-size: 13px;
}

.section-icon {
    align-items: center;
    background: var(--primary-soft);
    border-radius: 10px;
    color: var(--primary);
    display: flex;
    font-weight: 800;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.section-icon-review {
    background: var(--warning-soft);
    color: var(--warning);
}

.section-icon-dispatched {
    background: #eef4ff;
    color: #3538cd;
}

.section-icon-content {
    background: #f4ebff;
    color: #7f56d9;
}

.count-chip,
.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 650;
    padding: 4px 9px;
}

.count-chip,
.badge-neutral {
    background: #f2f4f7;
    color: #475467;
}

.badge-status {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.task-list {
    display: grid;
    gap: 10px;
}

.task-row {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 17px 18px;
}

.task-row-overdue {
    border-left: 4px solid var(--danger);
}

.task-main {
    min-width: 0;
}

.task-main h3 {
    font-size: 17px;
    margin: 7px 0 3px;
}

.task-main h3 a:hover {
    color: var(--primary);
}

.task-main p,
.task-deadline small {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.task-deadline {
    flex: 0 0 150px;
    text-align: right;
}

.task-deadline small,
.task-deadline strong,
.task-deadline a {
    display: block;
}

.task-deadline a {
    color: var(--primary);
    font-size: 13px;
    font-weight: 650;
    margin-top: 6px;
}

.content-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
}

.content-card:hover {
    border-color: #9ccbbf;
    box-shadow: var(--shadow);
}

.content-card h3 {
    margin: 12px 0 6px;
}

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

.content-card footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.panel h2 {
    font-size: 20px;
    margin: 0 0 14px;
}

.panel h3 {
    font-size: 15px;
}

.narrow-page {
    margin: 0 auto;
    max-width: 720px;
}

.back-link {
    color: var(--muted);
    display: inline-block;
    margin-bottom: 18px;
}

.form-panel {
    padding: clamp(24px, 5vw, 46px);
}

.form-heading {
    margin-bottom: 28px;
}

.stack-form {
    display: grid;
    gap: 15px;
}

.stack-form p,
.field {
    display: grid;
    gap: 7px;
    margin: 0;
}

.stack-form label,
.field label {
    font-size: 14px;
    font-weight: 650;
}

.flow-settings {
    border: 0;
    display: grid;
    gap: 10px;
    margin: 4px 0 0;
    padding: 0;
}

.flow-settings legend {
    font-size: 14px;
    font-weight: 650;
    padding: 0;
}

.flow-help,
.review-settings-heading p {
    color: var(--muted);
    font-size: 12px;
    margin: 0;
}

.choice-cards {
    display: grid;
    gap: 10px;
}

.choice-card {
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    padding: 13px 14px;
}

.choice-card:has(input:checked) {
    background: var(--primary-soft);
    border-color: #75b6a7;
}

.choice-card input {
    margin-top: 4px;
    width: auto;
}

.choice-card strong,
.choice-card small {
    display: block;
}

.choice-card small {
    color: var(--muted);
    font-weight: 400;
    margin-top: 2px;
}

.review-settings {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.review-settings-heading {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.review-settings-heading h2 {
    font-size: 16px;
    margin: 0 0 2px;
}

.review-step-editor {
    display: grid;
    gap: 10px;
}

.review-step-row {
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: grid;
    gap: 10px;
    grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) auto;
    padding: 12px;
}

.review-step-number {
    align-items: center;
    align-self: center;
    background: var(--primary-soft);
    border-radius: 50%;
    color: var(--primary-dark);
    display: flex;
    font-size: 13px;
    font-weight: 700;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.review-step-delete > input {
    display: none;
}

.review-step-delete .text-button {
    color: var(--danger);
    white-space: nowrap;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    color: var(--text);
    outline: none;
    padding: 11px 12px;
    width: 100%;
}

.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.field small,
.helptext {
    color: var(--muted);
    font-size: 12px;
}

.field-error,
.errorlist {
    color: var(--danger);
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.message {
    border-radius: 10px;
    padding: 11px 14px;
}

.message-success {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.message-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.task-hero {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
}

.task-hero-overdue {
    border-top: 4px solid var(--danger);
}

.deadline-box {
    background: var(--surface-soft);
    border-radius: 12px;
    flex: 0 0 auto;
    padding: 14px 18px;
}

.deadline-box small,
.deadline-box strong {
    display: block;
}

.deadline-box small {
    color: var(--muted);
    font-size: 12px;
}

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

.detail-main {
    display: grid;
    gap: 18px;
}

.sticky-panel {
    position: sticky;
    top: 94px;
}

.prose {
    color: #344054;
}

.linked-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: grid;
    gap: 3px;
    margin-top: 20px;
    padding: 14px;
}

.linked-item span,
.linked-item small {
    color: var(--muted);
    font-size: 12px;
}

.action-panel {
    border-left: 4px solid var(--primary);
}

.review-panel {
    border-left-color: var(--warning);
}

.submission-summary {
    background: var(--surface-soft);
    border-radius: 12px;
    margin: 16px 0;
    padding: 15px;
}

.submission-summary a {
    color: var(--primary);
    font-weight: 650;
}

.timeline {
    display: grid;
    gap: 20px;
}

.timeline-item {
    display: grid;
    gap: 12px;
    grid-template-columns: 12px 1fr;
}

.timeline-dot {
    background: var(--primary);
    border: 3px solid var(--primary-soft);
    border-radius: 50%;
    height: 12px;
    margin-top: 6px;
    width: 12px;
}

.timeline-item header {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.timeline-item time,
.timeline-item p {
    color: var(--muted);
    font-size: 13px;
    margin: 4px 0;
}

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

.review-steps,
.version-list {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.review-step {
    align-items: center;
    display: flex;
    gap: 10px;
}

.review-step > span {
    align-items: center;
    background: #f2f4f7;
    border-radius: 50%;
    display: flex;
    font-size: 12px;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.review-step strong,
.review-step small {
    display: block;
}

.review-step small,
.muted {
    color: var(--muted);
    font-size: 12px;
}

.review-step-approved > span {
    background: var(--primary-soft);
    color: var(--primary);
}

.review-step-pending > span {
    background: var(--warning-soft);
    color: var(--warning);
}

.success-copy {
    color: var(--primary);
    font-weight: 700;
}

.empty-state,
.empty-inline {
    color: var(--muted);
    text-align: center;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed #cfd4dc;
    border-radius: var(--radius);
    padding: 38px 20px;
}

.empty-state > span {
    color: var(--primary);
    font-size: 28px;
}

.empty-state h3 {
    color: var(--text);
    margin: 8px 0 4px;
}

.empty-state p {
    margin: 0;
}

.empty-inline {
    padding: 20px;
}

.version-list li {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.version-list li:last-child {
    border-bottom: 0;
}

.version-list p {
    color: var(--muted);
    font-size: 13px;
    margin: 4px 0;
}

.version-list small,
.version-list a {
    display: block;
    font-size: 12px;
}

.version-list a {
    color: var(--primary);
    margin-top: 5px;
}

.panel hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 22px 0;
}

.login-shell {
    align-items: center;
    display: grid;
    gap: 60px;
    grid-template-columns: 1fr 420px;
    min-height: calc(100vh - 170px);
}

.login-intro h1 {
    font-size: clamp(42px, 6vw, 68px);
    letter-spacing: -0.05em;
    line-height: 1.04;
    margin: 10px 0 18px;
    max-width: 650px;
}

.login-intro p {
    color: var(--muted);
    font-size: 18px;
    max-width: 560px;
}

.login-panel {
    padding: 32px;
}

.mobile-nav {
    display: none;
}

@media (max-width: 760px) {
    .topbar {
        height: 62px;
        padding: 0 16px;
    }

    .brand small,
    .topnav {
        display: none;
    }

    .page {
        padding: 24px 14px 94px;
    }

    .page-heading,
    .task-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading > .button {
        width: 100%;
    }

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

    .summary-card {
        padding: 14px 10px;
        text-align: center;
    }

    .summary-card strong {
        font-size: 26px;
    }

    .summary-card span {
        font-size: 12px;
    }

    .section-title p {
        display: none;
    }

    .task-row {
        align-items: stretch;
        flex-direction: column;
    }

    .task-deadline {
        align-items: center;
        border-top: 1px solid var(--border);
        display: flex;
        flex: auto;
        justify-content: space-between;
        padding-top: 10px;
        text-align: left;
    }

    .task-deadline small {
        display: none;
    }

    .task-deadline a {
        margin: 0;
    }

    .content-grid,
    .detail-layout,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .review-settings-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .review-step-row {
        align-items: stretch;
        grid-template-columns: 30px 1fr;
    }

    .review-step-row .field,
    .review-step-delete {
        grid-column: 2;
    }

    .content-grid {
        gap: 10px;
    }

    .sticky-panel {
        position: static;
    }

    .detail-side {
        order: -1;
    }

    .deadline-box {
        width: 100%;
    }

    .panel {
        padding: 18px;
    }

    .login-shell {
        gap: 24px;
        min-height: auto;
    }

    .login-intro h1 {
        font-size: 38px;
    }

    .login-intro p {
        font-size: 15px;
    }

    .mobile-nav {
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid var(--border);
        bottom: 0;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        left: 0;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        position: fixed;
        right: 0;
        z-index: 30;
    }

    .mobile-nav a {
        align-items: center;
        color: var(--muted);
        display: flex;
        flex-direction: column;
        font-size: 11px;
        gap: 2px;
    }

    .mobile-nav span {
        color: var(--primary);
        font-size: 21px;
        font-weight: 700;
    }
}
