:root {
    --bg: #f3f6f8;
    --panel: #ffffff;
    --line: #dce4ea;
    --text: #1f2a33;
    --muted: #64717b;
    --primary: #176b87;
    --primary-dark: #10566e;
    --success: #1f8a5b;
    --warning: #b7791f;
    --danger: #c2413a;
    --radius: 8px;
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
textarea,
button {
    font: inherit;
}

textarea {
    resize: vertical;
}

.topbar {
    min-height: 64px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-main {
    display: contents;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.login-head h1,
.page-head h1,
.panel-head h2 {
    margin: 0;
}

.brand strong {
    font-size: 17px;
    white-space: nowrap;
}

.brand small {
    display: none;
}

.brand small,
.muted,
.eyebrow,
.stat-card span,
.stat-card p,
.user-chip em,
.login-note,
.page-head p,
.panel-head p {
    color: var(--muted);
}

nav {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    overflow: hidden;
    min-width: 0;
}

nav a,
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

nav a {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 15px;
    flex: 0 1 auto;
    font-weight: 400;
    line-height: 1.15;
    color: #263843;
    letter-spacing: 0;
}

nav a:hover,
nav a.active {
    background: #e8f2f5;
    color: #0f5d75;
    border-color: #cfe0e6;
}

.nav-toggle {
    display: none;
}

.button.primary,
button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover,
button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary,
button.secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.button.danger,
button.danger {
    background: var(--danger);
    color: #fff;
}

.button.mini {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 13px;
}

.full {
    width: 100%;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    flex: 0 0 auto;
}

.user-chip span {
    font-weight: 700;
}

.user-basic-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(110px, .8fr) minmax(120px, .8fr) minmax(120px, .8fr) minmax(130px, .9fr) minmax(160px, 1fr) minmax(100px, .65fr);
    gap: 10px;
    align-items: end;
}

.layout {
    width: min(1500px, calc(100% - 32px));
    margin: 24px auto 48px;
    font-size: 18px;
}

.site-footer {
    padding: 0 16px 24px;
    color: #68737d;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    color: #176b87;
    text-decoration: underline;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(23, 107, 135, .10), transparent 34%),
        linear-gradient(315deg, rgba(31, 138, 91, .10), transparent 32%),
        var(--bg);
}

.login-card {
    width: min(460px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 48px rgba(30, 42, 50, .10);
}

.login-head {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin-bottom: 22px;
    text-align: center;
}

.login-head h1 {
    font-size: 24px;
}

.login-head p {
    margin: 4px 0 0;
    line-height: 1.6;
}

.login-shell .site-footer {
    padding-bottom: 0;
}

.login-card form {
    display: grid;
    gap: 14px;
}

.login-card form label {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
}

.login-card form label span {
    text-align: right;
    white-space: nowrap;
}

.login-card form input,
.login-card form select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.register-card {
    width: min(560px, 100%);
}

.register-card form label {
    grid-template-columns: 88px minmax(0, 1fr);
}

.login-card button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

@media (max-width: 520px) {
    .login-shell {
        justify-content: flex-start;
        padding: 18px 12px;
    }

    .register-card form label {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .register-card form label span {
        text-align: left;
    }
}

.login-links {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.login-links span {
    color: var(--muted);
    font-size: 13px;
}

.flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 6px;
    background: #eaf7f0;
    color: #17613e;
    border: 1px solid #c9ead9;
}

.flash.error {
    background: #fff0ef;
    color: #a3302a;
    border-color: #f2ccc9;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    margin-bottom: 18px;
}

.page-head h1 {
    font-size: 30px;
    margin-bottom: 8px;
}

.page-head h1.progress-page-title {
    font-size: 24px;
}

.page-head h1.report-page-title {
    font-size: 24px;
}

.page-head h1.contract-page-title {
    font-size: 24px;
}

.page-head p {
    margin: 0;
    line-height: 1.7;
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--primary);
}

.page-actions,
.form-actions,
.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.project-filter-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 260px;
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.project-filter-select span {
    white-space: nowrap;
}

.project-filter-select select {
    min-width: 190px;
    height: 36px;
}

.material-management-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.material-category-card {
    min-height: 220px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.material-category-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.material-category-head h2 {
    margin: 0;
    font-size: 21px;
}

.material-category-head p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.material-category-kicker {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 6px;
    background: #e7f2f5;
    color: var(--primary-dark);
    font-weight: 800;
}

.material-category-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.material-category-card small {
    color: var(--muted);
    line-height: 1.5;
}

.panel,
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.panel {
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 12px 32px rgba(30, 42, 50, .05);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.panel-head h2 {
    font-size: 18px;
}

.progress-plan-section > .panel-head {
    position: sticky;
    top: 64px;
    z-index: 8;
    margin: -20px -20px 16px;
    padding: 12px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.small-panel-title {
    font-size: 15px !important;
}

.title-date {
    margin-left: 8px;
    color: var(--muted);
    font-size: .74em;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.material-request-status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 16px;
}

.material-request-status-tabs .button {
    min-width: 96px;
    justify-content: center;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.system-entry {
    display: grid;
    align-content: space-between;
    gap: 16px;
    min-height: 230px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.system-entry-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.system-entry h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.system-entry p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.embedded-module {
    height: calc(100vh - 156px);
    min-height: 680px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.embedded-module-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.embedded-module-note {
    color: var(--muted);
    font-size: 13px;
}

.embedded-module iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.system-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    font-weight: 800;
}

.system-mark.engineering {
    background: var(--primary);
}

.system-mark.dorm {
    background: var(--success);
}

.system-mark.material {
    background: #5b5f97;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: #f7fafb;
    font-size: 13px;
}

.stat-card {
    padding: 18px;
}

.stat-card strong {
    display: block;
    margin: 8px 0 4px;
    font-size: 28px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.project-table {
    min-width: 1180px;
}

.project-name-cell {
    min-width: 360px;
    max-width: 680px;
    white-space: nowrap;
}

.contract-list-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 13px;
}

.contract-table-wrap {
    overflow-x: visible;
}

.project-intro-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.project-intro-toolbar h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.25;
}

.project-intro-project-select {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-width: min(460px, 100%);
}

.project-intro-project-select label {
    display: grid;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
}

.project-intro-project-select select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.project-intro-project-select .button {
    flex: 0 0 auto;
}

.project-intro-empty {
    min-height: 220px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 8px;
    text-align: center;
}

.project-intro-empty h2,
.project-intro-empty p {
    margin: 0;
}

.project-intro-empty p {
    color: var(--muted);
}

.project-intro-hero {
    position: relative;
    height: 390px;
    min-height: 390px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    border-radius: var(--radius);
    background-color: #2f5967;
    box-shadow: 0 12px 30px rgba(31, 42, 51, .12);
}

.project-intro-hero-backdrop {
    position: absolute;
    inset: -28px;
    z-index: 0;
    display: block;
    width: calc(100% + 56px);
    height: calc(100% + 56px);
    object-fit: cover;
    object-position: center;
    filter: blur(22px);
    opacity: 1;
    transform: scale(1.04);
}

.project-intro-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(21, 62, 72, .46) 0%, rgba(21, 62, 72, .22) 32%, rgba(12, 38, 48, .08) 68%, rgba(12, 38, 48, .25) 100%);
}

.project-intro-hero-image {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 60%;
    z-index: 1;
    display: block;
    width: 40%;
    height: 100%;
    object-fit: contain;
    object-position: right center;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .72) 7%, #000 16%, #000 100%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .72) 7%, #000 16%, #000 100%);
}

.project-intro-hero-content {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: min(46%, 700px);
    max-width: 700px;
    padding: 42px 48px;
    color: #fff;
}

.project-intro-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 4px;
    background: rgba(255, 255, 255, .12);
    font-size: 13px;
}

.project-intro-hero-content h2 {
    margin: 16px 0 10px;
    font-size: 36px;
    line-height: 1.25;
}

.project-intro-hero-content p {
    max-width: 720px;
    margin: 0;
    font-size: 17px;
    line-height: 1.7;
    color: rgba(255, 255, 255, .88);
}

.project-intro-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 16px 0 24px;
    border: 1px solid var(--line);
    background: var(--line);
}

.project-intro-facts article {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 18px 20px;
    background: #fff;
}

.project-intro-facts span {
    color: var(--muted);
    font-size: 13px;
}

.project-intro-facts strong {
    overflow-wrap: anywhere;
    font-size: 18px;
    line-height: 1.35;
}

.project-intro-content {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
    gap: 34px;
    padding: 8px 0 24px;
}

.project-intro-copy h2 {
    margin: 0 0 14px;
    font-size: 25px;
}

.project-intro-copy > p:last-child,
.project-intro-detail p:last-child {
    margin: 0;
    color: #43515a;
    font-size: var(--intro-font-size, 16px);
    line-height: 1.9;
    white-space: normal;
}

.project-intro-meta {
    padding-left: 26px;
    border-left: 1px solid var(--line);
}

.project-intro-meta h3 {
    margin: 0 0 14px;
    font-size: 18px;
}

.project-intro-meta dl {
    display: grid;
    gap: 12px;
    margin: 0;
}

.project-intro-meta dl div {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
}

.project-intro-meta dt {
    color: var(--muted);
    font-size: 13px;
}

.project-intro-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.5;
}

.project-intro-detail {
    padding: 22px 24px;
}

.project-intro-detail h2 {
    margin: 0 0 12px;
    font-size: 21px;
}

.project-intro-edit-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.project-intro-edit-form > label {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
}

.project-intro-edit-form input,
.project-intro-edit-form textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
}

.project-intro-edit-form textarea {
    line-height: 1.65;
}

.project-intro-edit-form small {
    overflow-wrap: anywhere;
}

.project-intro-edit-form .upload-progress {
    grid-column: 1 / -1;
}

.participant-units-field {
    display: grid;
    gap: 10px;
}

.participant-units-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.participant-units-head > div {
    display: grid;
    gap: 3px;
}

.participant-units-head strong {
    color: var(--text);
    font-size: 14px;
}

.participant-units-head small {
    font-size: 12px;
}

.participant-unit-list {
    display: grid;
    gap: 8px;
}

.participant-unit-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 2fr) auto;
    gap: 8px;
    align-items: center;
}

.participant-unit-row input[type="text"] {
    min-width: 0;
}


.participant-unit-row {
    white-space: nowrap;
}

.participant-unit-row input {
    white-space: nowrap;
}
.project-intro-richtext {
    font-size: 16px;
    line-height: 1.9;
    color: #43515a;
    font-weight: 400;
}

.project-intro-richtext p,
.project-intro-richtext-body {
    font-size: 16px;
    line-height: 1.9;
    color: #43515a;
    font-weight: 400;
}

.project-intro-detail .project-intro-richtext,
.project-intro-detail .project-intro-richtext p,
.project-intro-detail .project-intro-richtext-body,
.project-intro-detail .project-intro-richtext-body p {
    font-size: 16px !important;
    line-height: 1.9;
    color: #43515a;
    font-weight: 400;
}

.project-intro-richtext-body p {
    margin: 0 0 10px;
}

.project-intro-richtext-body ul,
.project-intro-richtext-body ol {
    margin: 0 0 12px 22px;
    padding: 0;
}

.project-intro-richtext-body h1,
.project-intro-richtext-body h2,
.project-intro-richtext-body h3,
.project-intro-richtext-body h4 {
    margin: 0 0 10px;
}

.project-intro-notes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 18px;
}

.project-intro-notes article {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(31, 42, 51, .04);
}

.project-intro-notes strong {
    display: block;
    margin-bottom: 12px;
    font-size: 21px;
}

.project-intro-notes p {
    margin: 0;
    font-size: var(--intro-font-size, 16px);
    line-height: 1.75;
    white-space: pre-wrap;
}

.construction-block-editor {
    display: grid;
    gap: 10px;
}

.construction-block-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfe;
}

.construction-block-row input,
.construction-block-row textarea {
    grid-column: 1 / -1;
}

.construction-block-row textarea {
    min-height: 130px;
}

.contract-security-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.security-gate-form {
    padding: 14px 15px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.security-gate-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.security-gate-message {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.security-gate-row {
    display: flex;
    gap: 8px;
}

.security-gate-row input {
    min-width: 0;
    flex: 1 1 auto;
}

.security-gate-row .button {
    flex: 0 0 auto;
}

.participant-unit-row .button {
    min-width: 52px;
}

.subtle-danger {
    background: #fff7f6;
    border-color: #e7c7c4;
    color: #a54a43;
}

.subtle-danger:hover {
    background: #ffefed;
}

.subtle-danger:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.project-intro-current-image {
    display: block;
    width: min(100%, 460px);
    max-height: 180px;
    margin-top: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #eef3f5;
}

.upload-progress-track i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #1f8a5b;
    transition: width .16s linear;
}

@media (max-width: 900px) {
    .project-intro-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .project-intro-project-select {
        width: 100%;
        min-width: 0;
    }

    .project-intro-hero {
        height: 330px;
        min-height: 330px;
    }

    .project-intro-hero-content {
        padding: 30px 26px;
    }

    .project-intro-hero-content h2 {
        font-size: 29px;
    }

    .project-intro-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-intro-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .project-intro-meta {
        padding: 20px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .project-intro-edit-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .participant-unit-row {
        grid-template-columns: minmax(130px, .8fr) minmax(0, 1.6fr) auto;
    }
}

@media (max-width: 520px) {
    .project-intro-toolbar h1 {
        font-size: 24px;
    }

    .project-intro-project-select {
        align-items: stretch;
        flex-direction: column;
    }

    .project-intro-project-select .button {
        width: 100%;
    }

    .project-intro-hero {
        height: 290px;
        min-height: 290px;
        border-radius: 6px;
    }

    .project-intro-hero-image {
        right: 0;
        left: 0;
        width: 100%;
        object-position: center;
    }

    .project-intro-hero-content {
        width: 100%;
        max-width: none;
        padding: 24px 20px;
    }

    .project-intro-hero-content h2 {
        margin-top: 12px;
        font-size: 25px;
    }

    .project-intro-hero-content p {
        font-size: 15px;
    }

    .project-intro-facts,
    .project-intro-edit-form {
        grid-template-columns: 1fr;
    }

    .participant-units-head {
        align-items: stretch;
        flex-direction: column;
    }

    .participant-units-head .button {
        width: fit-content;
    }

    .participant-unit-row {
        grid-template-columns: 1fr;
    }

    .project-intro-facts article {
        padding: 14px 16px;
    }

    .project-intro-detail {
        padding: 18px;
    }
}
/* Admin center and visual balancing */
.layout {
    font-size: 16px;
}

.page-head h1 {
    font-size: 26px;
}

.page-head p,
.panel-head p {
    font-size: 14px;
}

.panel-head h2 {
    font-size: 17px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
    min-height: 128px;
    padding: 16px;
}

.stat-card span {
    font-size: 13px;
    font-weight: 700;
}

.stat-card strong {
    font-size: 25px;
    line-height: 1.15;
}

.stat-card p {
    min-height: 34px;
    font-size: 13px;
    line-height: 1.45;
}

.form-grid label,
.weekly-top-query label {
    font-size: 14px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.weekly-top-query input,
.weekly-top-query select {
    font-size: 14px;
}

.admin-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-entry-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.admin-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 132px;
    padding: 18px;
    color: var(--text);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.admin-entry:hover {
    transform: translateY(-2px);
    border-color: #b9d5df;
    box-shadow: 0 16px 36px rgba(30, 42, 50, .09);
}

.admin-entry-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 8px;
    background: #e7f2f5;
    color: var(--primary-dark);
    font-weight: 800;
}

.admin-entry strong,
.admin-entry small {
    display: block;
}

.admin-entry strong {
    margin: 2px 0 8px;
    font-size: 17px;
}

.admin-entry small {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.admin-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-color: #cfe0e6;
    background: #f4fafb;
}

.admin-notice strong {
    flex: 0 0 auto;
    color: var(--primary-dark);
}

.admin-notice span {
    line-height: 1.65;
}

.dashboard-notice {
    margin-top: -4px;
}

.admin-settings-panel {
    max-width: 980px;
}

.admin-settings-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-settings-form .full-row {
    grid-column: 1 / -1;
}

.admin-content-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.admin-content-list div {
    display: grid;
    gap: 6px;
    min-height: 86px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfc;
}

.admin-content-list strong {
    font-size: 15px;
}

.admin-content-list span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.admin-log-filter {
    display: grid;
    grid-template-columns: minmax(140px, .8fr) minmax(140px, .8fr) minmax(220px, 1.3fr) auto;
    gap: 12px;
    align-items: end;
}

.admin-log-filter label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
}

.admin-log-filter input,
.admin-log-filter select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
}

.admin-log-table {
    min-width: 960px;
}

.admin-log-table th,
.admin-log-table td {
    font-size: 13px;
    line-height: 1.45;
}

.admin-log-table td:nth-child(5),
.admin-log-table td:nth-child(6) {
    max-width: 360px;
}

@media (max-width: 1180px) {
    .stats-grid,
    .admin-stats-grid,
    .admin-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-content-list {
        grid-template-columns: 1fr;
    }

    .admin-log-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .page-head h1 {
        font-size: 23px;
    }

    .stats-grid,
    .admin-stats-grid,
    .admin-entry-grid,
    .admin-settings-form,
    .admin-log-filter {
        grid-template-columns: 1fr;
    }

    .admin-entry,
    .admin-notice {
        align-items: flex-start;
    }
}

@media print {
    .topbar,
    .flash,
    .page-head,
    .stats-grid,
    .panel:not(.printable-section),
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .layout {
        width: 100%;
        margin: 0;
        font-size: 12px;
    }

    .printable-section {
        display: block !important;
        border: 0;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .panel-head {
        margin-bottom: 10px;
    }

    .table-wrap {
        overflow: visible;
    }

    table {
        min-width: 0;
        width: 100%;
        font-size: 12px;
    }

    th,
    td {
        padding: 6px;
        border: 1px solid #999;
    }
}

.contract-list-table th,
.contract-list-table td {
    padding: 6px 5px;
    line-height: 1.25;
    vertical-align: middle;
}

.contract-list-table th,
.contract-list-table td:not(.row-actions) {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.contract-list-table th {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    font-size: 12px;
}

.contract-list-table .contract-no-cell {
    width: 6.5%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-all;
    line-height: 1.25;
}

.contract-list-table .contract-sign-date-cell {
    width: 7%;
    white-space: nowrap;
}

.contract-list-table td:nth-child(3) {
    width: 13%;
}

.contract-list-table th:nth-child(1),
.contract-list-table td:nth-child(1) {
    width: 3.5%;
}

.contract-list-table th:nth-child(4),
.contract-list-table td:nth-child(4),
.contract-list-table th:nth-child(8),
.contract-list-table td:nth-child(8),
.contract-list-table th:nth-child(14),
.contract-list-table td:nth-child(14) {
    width: 6%;
}

.contract-list-table th:nth-child(5),
.contract-list-table td:nth-child(5),
.contract-list-table th:nth-child(13),
.contract-list-table td:nth-child(13) {
    width: 9%;
}

.contract-list-table th:nth-child(6),
.contract-list-table td:nth-child(6),
.contract-list-table th:nth-child(7),
.contract-list-table td:nth-child(7),
.contract-list-table th:nth-child(9),
.contract-list-table td:nth-child(9),
.contract-list-table th:nth-child(10),
.contract-list-table td:nth-child(10) {
    width: 6.5%;
}

.contract-list-table th:nth-child(12),
.contract-list-table td:nth-child(12) {
    width: 6%;
}

.contract-list-table th:last-child,
.contract-list-table td:last-child {
    width: 7%;
}

.contract-list-table .tag {
    min-height: 22px;
    padding: 0 5px;
    font-size: 12px;
}

.contract-list-table .button.mini {
    min-height: 26px;
    padding: 3px 6px;
    font-size: 12px;
}

.contract-list-table .row-actions {
    gap: 4px;
}

.progress-form {
    display: grid;
    gap: 12px;
}

.progress-project-row {
    display: grid;
    grid-template-columns: minmax(320px, 520px) minmax(140px, 200px) auto;
    gap: 10px;
    align-items: end;
}

.progress-entry-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.progress-entry-row label:nth-child(1) {
    flex: 1 1 220px;
}

.progress-entry-row label:nth-child(2),
.progress-entry-row label:nth-child(4),
.progress-entry-row label:nth-child(10) {
    flex: 0 0 88px;
}

.progress-entry-row label:nth-child(3),
.progress-entry-row label:nth-child(5),
.progress-entry-row label:nth-child(6),
.progress-entry-row label:nth-child(7),
.progress-entry-row label:nth-child(8) {
    flex: 0 0 122px;
}

.progress-entry-row label:nth-child(9) {
    flex: 1 1 180px;
}

.progress-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.progress-form input,
.progress-form select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.input-with-action {
    display: flex;
    gap: 6px;
}

.input-with-action input {
    min-width: 0;
}

.input-with-action .button {
    flex: 0 0 auto;
}

.inline-query-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.inline-query-form input[type="date"] {
    width: 148px;
    min-height: 30px;
    padding: 4px 8px;
}

.progress-table {
    min-width: 1440px;
    table-layout: fixed;
    font-size: 14px;
    border-collapse: separate;
    border-spacing: 0;
}

.progress-plan-section,
.progress-plan-section .progress-table {
    position: static;
    max-height: none;
}

.progress-plan-table-wrap {
    overflow: visible;
}

.progress-table th,
.progress-table td {
    padding: 8px 6px;
    white-space: normal;
    word-break: break-word;
}

.progress-table thead {
    position: sticky;
    top: 128px;
    z-index: 5;
}

.progress-table th {
    white-space: nowrap;
    word-break: keep-all;
    font-size: 14px;
    background: #f5f8fa;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background-clip: padding-box;
}

.progress-toolbar-button {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1.2;
}

.progress-form .form-actions .button,
.progress-form .form-actions button {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.2;
}

.progress-table th:nth-child(1),
.progress-table td:nth-child(1) {
    width: 44px;
}

.progress-table th:nth-child(2),
.progress-table td:nth-child(2) {
    width: 180px;
}

.progress-table th:nth-child(3),
.progress-table td:nth-child(3) {
    width: 70px;
}

.progress-table th:nth-child(4),
.progress-table td:nth-child(4) {
    width: 150px;
}

.progress-table th:nth-child(5),
.progress-table td:nth-child(5),
.progress-table th:nth-child(6),
.progress-table td:nth-child(6),
.progress-table th:nth-child(8),
.progress-table td:nth-child(8),
.progress-table th:nth-child(9),
.progress-table td:nth-child(9) {
    width: 96px;
    white-space: nowrap;
}

.progress-table th:nth-child(7),
.progress-table td:nth-child(7) {
    width: 106px;
    white-space: nowrap;
}

.progress-table th:nth-child(10),
.progress-table td:nth-child(10),
.progress-table th:nth-child(11),
.progress-table td:nth-child(11) {
    width: 80px;
}

.progress-table th:nth-child(12),
.progress-table td:nth-child(12) {
    width: 64px;
}

.progress-table th:nth-child(13),
.progress-table td:nth-child(13) {
    width: 232px;
}

.progress-milestone {
    align-self: end;
    min-height: 38px;
    white-space: nowrap;
}

.progress-table .row-actions {
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.progress-table td.progress-row-actions {
    display: table-cell;
    width: 210px;
    text-align: center;
    vertical-align: middle;
}

.progress-table th:nth-child(11),
.progress-table td:nth-child(11) {
    width: 140px;
}

.progress-table th:nth-child(12),
.progress-table td:nth-child(12) {
    width: 74px;
    text-align: center;
}

.progress-save-top {
    align-self: end;
    flex-wrap: nowrap;
}

.progress-row-actions,
.progress-sort-actions,
.progress-edit-actions {
    justify-content: center;
}

.progress-row-actions .inline,
.progress-sort-actions .inline,
.progress-edit-actions .inline {
    display: inline-flex;
    flex: 0 0 auto;
}

.progress-row-actions .button {
    flex: 0 0 auto;
    width: auto;
}

.progress-table .button.mini {
    min-height: 26px;
    padding: 3px 6px;
    font-size: 12px;
}

.progress-table .progress-icon-button {
    width: 28px;
    min-width: 28px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

.progress-editable {
    cursor: text;
}

.progress-editable:hover {
    background: #fffdf2;
}

.progress-inline-editor {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 4px 6px;
    border: 1px solid var(--primary);
    border-radius: 5px;
    background: #fff;
    font: inherit;
}

.progress-edit-modal .modal-panel {
    width: min(1240px, 100%);
}

.progress-table .button.danger,
.progress-table button.danger {
    background: #e8aaa6;
    border-color: #dc938e;
    color: #6f2d2a;
}

.progress-table .button.danger:hover,
.progress-table button.danger:hover {
    background: #dc938e;
    border-color: #ce817b;
    color: #5f2522;
}

@media (max-width: 900px) {
    .progress-plan-section > .panel-head {
        position: static;
        margin: 0 0 16px;
        padding: 0;
        border-bottom: 0;
    }

    .progress-plan-table-wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .progress-table thead {
        position: static;
    }
}

.progress-percent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.progress-percent-green {
    color: #17613e;
    background: #e7f6ed;
    border: 1px solid #c6e8d4;
}

.progress-percent-yellow {
    color: #8a5b12;
    background: #fff6d8;
    border: 1px solid #edd789;
}

.progress-percent-red {
    color: #9f2f2a;
    background: #fde8e5;
    border: 1px solid #efb6af;
}

.progress-percent-neutral {
    color: var(--muted);
    background: #f4f7f9;
    border: 1px solid var(--line);
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 6px 8px;
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
    line-height: 1.35;
}

th {
    color: var(--muted);
    font-weight: 600;
    background: #f8fafb;
    white-space: nowrap;
}

tbody tr:nth-child(odd):not(.summary-row) {
    background: #fff;
}

tbody tr:nth-child(even):not(.summary-row) {
    background: #f8fbfc;
}

tbody tr:hover:not(.summary-row) {
    background: #eef6f8;
}

.dashboard-table td.good,
.good {
    color: var(--success);
}

.warn {
    color: var(--warning);
}

.bad {
    color: var(--danger);
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7fafb;
    font-size: 13px;
}

.tag-neutral {
    border-color: #d4dce3;
    background: #f4f7f9;
    color: var(--muted);
}

.tag-warn {
    border-color: #f0d6a7;
    background: #fff7ea;
    color: var(--warning);
}

.material-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 16px;
}

.compact-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.material-request-meta {
    grid-auto-columns: minmax(170px, 240px);
    overflow-x: visible;
}

.material-request-meta .project-context {
    display: none;
}

.weekly-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr);
    gap: 12px;
    align-items: end;
}

.weekly-top-query {
    grid-template-columns: minmax(230px, 1fr) minmax(150px, .65fr) minmax(260px, 1fr) auto;
}

.weekly-top-query label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.weekly-top-query input,
.weekly-top-query select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.weekly-top-query .form-actions {
    flex-wrap: nowrap;
    align-self: end;
}

.weekly-entry-form {
    display: grid;
    gap: 12px;
}

.weekly-entry-table {
    min-width: 1080px;
}

.weekly-entry-table th,
.weekly-entry-table td {
    vertical-align: top;
}

.weekly-entry-table td:nth-child(6),
.weekly-entry-table td:nth-child(7) {
    min-width: 220px;
    max-width: 360px;
    line-height: 1.55;
}

.weekly-period-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(125px, 1fr));
    gap: 12px;
    align-items: end;
}

.weekly-period-form .weekly-period-title,
.weekly-period-form .weekly-period-wide {
    grid-column: span 2;
}

.weekly-period-form .form-actions {
    grid-column: 1 / -1;
}

.weekly-period-form label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.weekly-period-form input,
.weekly-period-form select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.weekly-period-list {
    margin-top: 14px;
}

.weekly-period-window-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.weekly-period-window-note span {
    color: var(--muted);
}

.weekly-period-window-note .button {
    margin-left: auto;
}

.weekly-summary-head {
    align-items: flex-start;
    gap: 16px;
}

.weekly-summary-head .form-actions {
    flex-wrap: nowrap;
}

.weekly-summary-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.weekly-summary-counts span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 7px 10px;
    border: 1px solid #cfdadd;
    border-radius: 5px;
    background: #f4f8f8;
    color: var(--muted);
    font-size: 13px;
}

.weekly-summary-counts strong {
    color: var(--text);
    font-size: 17px;
}

.weekly-summary-paper {
    overflow-x: auto;
    padding: 22px;
    border: 1px solid #cfdadd;
    background: #eef2f3;
}

.weekly-summary-paper .weekly-summary-document {
    width: min(760px, 100%);
    min-height: 720px;
    margin: 0 auto;
    padding: 42px 54px;
    background: #fff;
    color: #000;
    box-shadow: 0 5px 18px rgba(31, 54, 61, .1);
    font-family: "仿宋_GB2312", "FangSong", "仿宋", serif;
    font-size: 17px;
    line-height: 1.55;
}

.weekly-summary-document h1 {
    margin: 0 0 20px;
    text-align: center;
    font-size: 24px;
    letter-spacing: 0;
}

.weekly-summary-document p {
    margin: 0 0 4px;
}

.weekly-summary-meta p {
    text-indent: 0;
}

.weekly-meta-gap {
    display: inline-block;
    margin-left: 4em;
}

.weekly-summary-section {
    margin-top: 12px !important;
    font-weight: 700;
}

.weekly-summary-project,
.weekly-summary-person {
    margin-top: 8px !important;
    font-weight: 700;
}

.weekly-summary-line,
.weekly-summary-empty {
    padding-left: 2em;
}

.weekly-summary-empty {
    color: #5f6668;
}

.weekly-decisions-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 16px;
}

.weekly-decisions-form label {
    display: grid;
    gap: 6px;
}

.weekly-decisions-form textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
}

.weekly-detail-modal {
    width: min(820px, 100%);
}

.weekly-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 13px;
}

.weekly-detail-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.weekly-detail-content article {
    min-height: 180px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fbfc;
}

.weekly-detail-content h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.weekly-detail-content article > div {
    min-height: 120px;
    white-space: pre-wrap;
    color: var(--text);
    line-height: 1.7;
}

.weekly-scope-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    align-items: center;
}

.weekly-text-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.weekly-text-grid label {
    display: grid;
    gap: 6px;
}

.weekly-text-stack {
    grid-template-columns: 1fr;
}

.weekly-query-form {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(180px, .6fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.weekly-query-form label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.weekly-query-form input,
.weekly-query-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.material-request-form {
    display: grid;
    gap: 14px;
}

.material-request-form .request-remarks {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.material-request-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.material-request-table table,
.material-entry-table {
    font-size: 15px;
}

.material-request-table th,
.material-request-table td,
.material-entry-table th,
.material-entry-table td {
    white-space: nowrap;
}

.nowrap-actions {
    flex-wrap: nowrap;
}

.approval-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.approval-steps li {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafb;
}

.approval-steps li.done {
    border-color: #c8e7d6;
    background: #eef8f2;
}

.approval-steps strong,
.approval-steps span {
    display: block;
}

.approval-steps span,
.approval-steps p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.tag-contract-signed {
    border-color: #bbdce8;
    background: #eaf6fb;
    color: #176b87;
}

.tag-contract-unsigned {
    border-color: #efd2d0;
    background: #fff0ef;
    color: var(--danger);
}

.tag-contract-active {
    border-color: #c8e7d6;
    background: #eef8f2;
    color: var(--success);
}

.tag-contract-done {
    border-color: #d4dce3;
    background: #f4f7f9;
    color: var(--muted);
}

.tag-contract-other {
    border-color: #f0d6a7;
    background: #fff7ea;
    color: var(--warning);
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 24px 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid.narrow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 760px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.form-grid textarea {
    min-height: 92px;
}

.daily-log-query-form {
    display: grid;
    grid-template-columns: minmax(240px, 1.1fr) minmax(150px, 220px) auto;
    gap: 10px 12px;
    align-items: end;
}

.daily-log-query-form label {
    display: grid;
    gap: 5px;
    color: #4b5563;
    font-size: 13px;
}

.daily-log-query-form select,
.daily-log-query-form input {
    width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
}

/* Unified type scale and control rhythm */
body {
    font-size: 14px;
    line-height: 1.5;
}

.layout {
    font-size: 15px;
}

.topbar {
    min-height: 62px;
    padding-inline: 16px;
}

.brand strong {
    font-size: 16px;
}

nav a {
    font-size: 14px;
    padding-inline: 9px;
}

nav a,
.button,
button {
    min-height: 36px;
}

.button,
button {
    padding: 7px 12px;
    font-size: 14px;
}

.page-head h1 {
    font-size: 28px;
    line-height: 1.25;
}

.panel-head h2,
.material-category-head h2 {
    line-height: 1.35;
}

.panel-head h2 {
    font-size: 18px;
}

.system-entry h3 {
    font-size: 17px;
    line-height: 1.4;
}

.panel,
.material-category-card {
    padding: 18px;
}

th,
td {
    font-size: 13px;
    line-height: 1.45;
}

.form-grid label,
.report-entry-form label,
.report-top-row label,
.report-detail-row label {
    font-size: 14px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.report-entry-form input,
.report-entry-form select {
    min-height: 38px;
    padding: 8px 11px;
}

.login-head {
    gap: 8px;
}

.login-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    max-width: 100%;
    white-space: nowrap;
}

.login-card .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 8px;
    font-size: 20px;
}

.login-brand h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
    white-space: nowrap;
}

.login-head > p {
    margin: 0;
    font-size: 14px;
}

@media (max-width: 720px) {
    .layout {
        width: min(100% - 20px, 1500px);
        margin-top: 16px;
    }

    .topbar {
        padding-inline: 10px;
    }

    .brand strong {
        font-size: 15px;
    }

    .page-head h1 {
        font-size: 24px;
    }

    .panel,
    .material-category-card {
        padding: 14px;
    }

    .login-card {
        padding: 22px 18px;
    }

    .login-brand h1 {
        font-size: 21px;
    }

    .login-brand {
        gap: 8px;
    }
}

.daily-log-query-form .form-actions {
    flex-wrap: nowrap;
}

.daily-log-query-form button {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: none;
}

.compact-form {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(128px, 160px);
    align-items: end;
    overflow-x: auto;
    padding-bottom: 4px;
}

.compact-form label {
    min-width: 128px;
}

.compact-form .wide-col {
    min-width: 220px;
}

.compact-form .form-actions {
    min-width: 220px;
    flex-wrap: nowrap;
}

.masonry-entry-form.form-grid.compact-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.1fr) minmax(130px, .7fr) minmax(130px, .7fr) minmax(220px, 1.2fr) minmax(220px, 1.2fr) 76px minmax(130px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(190px, 1fr);
    grid-auto-flow: row;
    grid-auto-columns: initial;
    gap: 10px;
    overflow-x: visible;
    padding-bottom: 0;
}

.masonry-entry-form label {
    min-width: 0;
}

.masonry-entry-form .masonry-project-field {
    grid-column: 1 / -1;
    max-width: 520px;
}

.masonry-entry-form .masonry-unit-field {
    max-width: 76px;
}

.masonry-entry-form .wide-col {
    grid-column: span 3;
    min-width: 0;
}

.masonry-entry-form .form-actions {
    min-width: 0;
}

.masonry-table-wrap {
    overflow-x: visible;
}

.masonry-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
}

.masonry-table th,
.masonry-table td {
    padding: 8px 6px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.masonry-table th:first-child,
.masonry-table td:first-child {
    width: 42px;
}

.masonry-summary-table th:nth-child(5),
.masonry-summary-table td:nth-child(5),
.masonry-detail-table th:nth-child(7),
.masonry-detail-table td:nth-child(7) {
    width: 58px;
}

.masonry-summary-table th:nth-child(6),
.masonry-summary-table td:nth-child(6),
.masonry-detail-table th:nth-child(8),
.masonry-detail-table td:nth-child(8),
.masonry-detail-table th:nth-child(9),
.masonry-detail-table td:nth-child(9) {
    width: 84px;
}

.personnel-form {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: end;
    font-size: 13px;
}

.personnel-form label {
    min-width: 0;
    gap: 5px;
    color: #4b5563;
}

.personnel-form input,
.personnel-form select,
.personnel-form textarea {
    min-width: 0;
    max-width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 13px;
    border-radius: 6px;
}

.personnel-form > label {
    grid-column: span 1;
}

.personnel-form .personnel-project-field {
    grid-column: span 2;
}

.personnel-form .personnel-name-field {
    grid-column: span 1;
}

.personnel-form .personnel-id-field {
    grid-column: span 3;
}

.personnel-form .personnel-phone-field {
    grid-column: span 2;
}

.personnel-form .personnel-team-field {
    grid-column: span 1;
}

.personnel-form .personnel-date-field {
    grid-column: span 1;
    max-width: none;
}

.personnel-form .personnel-date-field input {
    width: 100%;
}

.personnel-form .personnel-dorm-field {
    grid-column: span 2;
}

.personnel-form .personnel-dorm-compact-field {
    grid-column: span 1;
}

.personnel-form .personnel-row-start-field {
    grid-column-start: 1;
}

.personnel-form .personnel-small-field {
    grid-column: span 1;
}

.personnel-form .personnel-address-field {
    grid-column: span 3;
}

.personnel-form textarea {
    min-height: 42px;
    resize: vertical;
}

.personnel-form .form-actions {
    grid-column: span 2;
    align-self: end;
    flex-wrap: nowrap;
}

.personnel-form .personnel-save-actions {
    grid-column: span 1;
}

.personnel-form .personnel-form-query {
    grid-column: 3 / span 5;
    align-self: end;
    margin: 0;
}

.personnel-query-head h2 {
    margin: 0;
    font-size: 15px;
}

.personnel-query-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin: 0;
    white-space: nowrap;
}

.personnel-query-title {
    display: none;
    color: #4b5563;
    font-size: 13px;
    white-space: nowrap;
}

.personnel-query-inline label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.personnel-query-inline input,
.personnel-query-inline select {
    width: 260px;
    min-height: 32px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
}

.personnel-query-inline .form-actions {
    flex-wrap: nowrap;
    gap: 6px;
}

.personnel-form .button,
.personnel-form button,
.personnel-query-inline .button,
.personnel-query-inline button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: none;
}

.hidden-query-form {
    display: none;
}

.personnel-table {
    font-size: 13px;
}

.personnel-table th,
.personnel-table td {
    padding: 5px 7px;
    line-height: 1.35;
}

.personnel-table th {
    white-space: nowrap;
}

.user-edit-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-edit-form .full-row,
.user-edit-form .permission-box {
    grid-column: 1 / -1;
}

.report-entry-form {
    display: grid;
    gap: 12px;
}

.report-entry-form label,
.report-top-row label,
.report-detail-row label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    min-width: 0;
}

.report-entry-form input,
.report-entry-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.report-status-field {
    display: grid;
    gap: 6px;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
}

.report-status-field legend {
    margin-bottom: 6px;
    color: var(--text);
    font-size: 14px;
}

.radio-inline {
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 5px !important;
    margin-right: 0;
    white-space: nowrap;
}

.radio-inline input {
    width: auto;
}

.report-status-field small {
    display: inline;
    margin-top: 0;
    color: var(--muted);
    line-height: 1.4;
    white-space: nowrap;
}

.report-status-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    white-space: nowrap;
}

.report-top-row,
.report-detail-row {
    display: grid;
    gap: 10px;
    align-items: end;
}

.report-top-row {
    grid-template-columns: minmax(180px, .75fr) minmax(150px, .55fr) minmax(260px, .9fr) minmax(150px, .55fr);
}

.report-detail-row {
    grid-template-columns: repeat(7, minmax(116px, 1fr)) minmax(180px, 1.35fr) auto;
}

.report-entry-form .form-actions {
    min-width: 0;
    flex-wrap: wrap;
}

.report-entry-form .earthwork-save-actions {
    min-width: 112px;
    width: auto;
    align-self: end;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.report-entry-form .earthwork-save-actions .primary {
    min-width: 96px;
    white-space: nowrap;
}

.earthwork-entry-form .earthwork-save-actions {
    grid-column: 5;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
    margin-top: 2px;
}

.earthwork-entry-form {
    grid-template-columns: minmax(260px, 2.2fr) minmax(150px, 1.1fr) minmax(150px, 1.1fr) minmax(150px, 1.1fr) minmax(220px, 1.6fr);
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 12px 14px;
    overflow: visible;
    padding-bottom: 0;
}

.earthwork-entry-form > label {
    min-width: 0;
}

.earthwork-entry-form > label:first-of-type {
    grid-column: 1;
    grid-row: 1;
}

.earthwork-entry-form > label:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
}

.earthwork-entry-form > label:nth-of-type(3) {
    grid-column: 3;
    grid-row: 1;
}

.earthwork-entry-form > label:nth-of-type(4) {
    grid-column: 4;
    grid-row: 1;
}

.earthwork-entry-form .earthwork-remarks-field {
    grid-column: 1 / 3;
    grid-row: 2;
    min-width: 0;
}

.earthwork-entry-form .earthwork-file-field {
    grid-column: 3 / -1;
    grid-row: 2;
    min-width: 0;
}

.earthwork-entry-form .upload-progress {
    grid-column: 1 / 5;
    grid-row: 3;
    width: 100%;
}

.earthwork-entry-form .earthwork-file-field input[type="file"] {
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
}

.earthwork-entry-form .earthwork-save-actions .primary {
    min-width: 92px;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: none;
}

.earthwork-record-table {
    min-width: 980px;
    font-size: 13px;
}

.earthwork-record-table th,
.earthwork-record-table td {
    padding: 6px 8px;
    line-height: 1.35;
    white-space: nowrap;
}

.earthwork-record-table th:nth-child(3),
.earthwork-record-table td:nth-child(3) {
    min-width: 220px;
}

.earthwork-record-table th:nth-child(6),
.earthwork-record-table td:nth-child(6) {
    min-width: 120px;
}

.earthwork-record-table th:nth-child(7),
.earthwork-record-table td:nth-child(7) {
    min-width: 180px;
    white-space: normal;
}

.month-summary-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.month-summary-link:hover,
.month-summary-link.active {
    color: var(--primary-dark);
}

.ledger-form .wide-col,
.ledger-form .full-row {
    grid-column: 1 / -1;
}

.contract-entry-form {
    display: grid;
    gap: 12px;
    overflow-x: visible;
}

.contract-entry-form label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    min-width: 0;
}

.contract-entry-form input,
.contract-entry-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.contract-filter-form {
    display: grid;
    grid-template-columns: minmax(320px, 560px);
}

.receipt-filter-form {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.receipt-filter-form label {
    flex: 1 1 320px;
    min-width: 280px;
}

.contract-payment-filter-form {
    grid-template-columns: minmax(220px, 320px) minmax(360px, 1fr);
    gap: 12px;
    align-items: end;
}

.contract-filter-form label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.contract-filter-form select {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
}

.contract-top-row,
.contract-detail-row {
    display: grid;
    gap: 10px;
    align-items: end;
}

.contract-top-row {
    grid-template-columns: minmax(240px, 1.2fr) minmax(130px, .55fr) minmax(220px, 1fr) minmax(110px, auto);
}

.contract-detail-row {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.contract-detail-row .contract-remark-field {
    grid-column: auto;
}

.contract-entry-form .form-actions {
    min-width: 0;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.contract-entry-form .contract-submit-actions {
    grid-column: auto;
    align-self: end;
    flex-wrap: nowrap;
}

.file-actions-cell {
    min-width: 88px;
    white-space: nowrap;
}

.contract-list-table .file-actions-cell {
    min-width: 0;
    white-space: normal;
}

.file-actions-cell .detail-link + .detail-link {
    margin-left: 8px;
}

.contract-payment-form {
    display: grid;
    gap: 12px;
}

.contract-payment-form label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    min-width: 0;
}

.contract-payment-form input,
.contract-payment-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.contract-payment-top-row,
.contract-payment-detail-row {
    display: grid;
    gap: 10px;
    align-items: end;
}

.contract-payment-top-row {
    grid-template-columns: minmax(320px, 1.5fr) minmax(130px, .7fr) minmax(136px, .7fr) minmax(140px, .7fr);
}

.contract-payment-detail-row {
    grid-template-columns: minmax(120px, .65fr) minmax(130px, .7fr) minmax(180px, 1fr) minmax(130px, .7fr) minmax(200px, 1.2fr) auto;
}

.contract-payment-form .form-actions {
    min-width: 0;
    flex-wrap: wrap;
}

.summary-row {
    font-weight: 700;
    background: #f7fafc;
}

.material-batch-form {
    display: grid;
    gap: 14px;
}

.material-project-row {
    max-width: none;
}

.material-entry-wrap {
    border: 1px solid var(--line);
    border-radius: 6px;
}

.material-entry-table {
    min-width: 1060px;
    table-layout: fixed;
    font-size: 13px;
}

.material-entry-table th,
.material-entry-table td {
    padding: 6px;
}

.material-entry-table th:nth-child(1),
.material-entry-table td:nth-child(1) {
    width: 46px;
}

.material-entry-table th:nth-child(2),
.material-entry-table td:nth-child(2) {
    width: 116px;
}

.material-entry-table th:nth-child(3),
.material-entry-table td:nth-child(3) {
    width: 104px;
}

.material-entry-table th:nth-child(4),
.material-entry-table td:nth-child(4),
.material-entry-table th:nth-child(8),
.material-entry-table td:nth-child(8) {
    width: 120px;
}

.material-entry-table th:nth-child(5),
.material-entry-table td:nth-child(5) {
    width: 92px;
}

.material-entry-table th:nth-child(6),
.material-entry-table td:nth-child(6) {
    width: 92px;
}

.material-entry-table th:nth-child(10),
.material-entry-table td:nth-child(10) {
    width: 88px;
}

.material-entry-table th:nth-child(9),
.material-entry-table td:nth-child(9) {
    width: 92px;
}

.material-entry-table th:nth-child(7),
.material-entry-table td:nth-child(7) {
    width: 230px;
}

.material-entry-table th:nth-child(8),
.material-entry-table td:nth-child(8) {
    width: 120px;
}

.material-entry-table input,
.material-entry-table select {
    width: 100%;
    min-width: 0;
    padding: 7px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.concrete-receipt-table th:nth-child(2),
.concrete-receipt-table td:nth-child(2) {
    width: 132px;
}

.concrete-receipt-table th:nth-child(3),
.concrete-receipt-table td:nth-child(3) {
    width: 540px;
}

.concrete-receipt-table th:nth-child(4),
.concrete-receipt-table td:nth-child(4) {
    width: 112px;
}

.concrete-receipt-table th:nth-child(5),
.concrete-receipt-table td:nth-child(5) {
    width: 60px;
}

.concrete-receipt-table th:nth-child(6),
.concrete-receipt-table td:nth-child(6) {
    width: 148px;
}

.concrete-receipt-table th:nth-child(7),
.concrete-receipt-table td:nth-child(7) {
    width: 160px;
}

.concrete-receipt-table th:nth-child(8),
.concrete-receipt-table td:nth-child(8) {
    width: 180px;
}

.concrete-receipt-table input,
.concrete-receipt-table select {
    width: auto;
    min-width: 0;
}

.concrete-spec-stack {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    column-gap: 18px;
    align-items: center;
    white-space: nowrap;
    line-height: 1.2;
    width: max-content;
    max-width: 100%;
}

.concrete-spec-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    width: max-content;
    min-width: 0;
}

.concrete-spec-item select {
    width: auto;
    min-width: 0;
}

.concrete-spec-cell {
    width: 540px;
}

.concrete-receipt-table {
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
}

.concrete-material-name {
    width: 8ch;
}

.concrete-detail-table th:nth-child(2),
.concrete-detail-table td:nth-child(2) {
    width: 164px;
}

.concrete-detail-table th:nth-child(3),
.concrete-detail-table td:nth-child(3) {
    width: 78px;
}

.concrete-detail-table th:nth-child(4),
.concrete-detail-table td:nth-child(4) {
    width: 72px;
}

.concrete-detail-table th:nth-child(5),
.concrete-detail-table td:nth-child(5) {
    width: 78px;
}

.concrete-detail-table th:nth-child(6),
.concrete-detail-table td:nth-child(6) {
    width: 96px;
}

.concrete-detail-table th:nth-child(7),
.concrete-detail-table td:nth-child(7) {
    width: 64px;
}

.concrete-detail-table th:nth-child(8),
.concrete-detail-table td:nth-child(8),
.concrete-detail-table th:nth-child(9),
.concrete-detail-table td:nth-child(9),
.concrete-detail-table th:nth-child(10),
.concrete-detail-table td:nth-child(10) {
    width: 92px;
}

.concrete-detail-table th:nth-child(11),
.concrete-detail-table td:nth-child(11) {
    width: 164px;
}

.concrete-detail-table th:nth-child(12),
.concrete-detail-table td:nth-child(12) {
    width: 164px;
}

.concrete-detail-table input,
.concrete-detail-table select {
    width: auto;
    min-width: 0;
}

.concrete-stats-grid .stat-card strong {
    font-size: 24px;
}

.concrete-form-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.concrete-form-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.concrete-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: end;
}

.concrete-form-grid label {
    min-width: 0;
    display: grid;
    gap: 6px;
    flex: 0 0 auto;
}

.concrete-form-grid input,
.concrete-form-grid select {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
}

.concrete-form-grid .concrete-project-field select {
    width: 13.8em;
    min-width: 13.8em;
}

.concrete-form-grid .concrete-date-field input {
    width: 11.8em;
    min-width: 11.8em;
}

.concrete-form-grid .concrete-work-part-field input {
    width: 12.2em;
    min-width: 12.2em;
}

.concrete-form-grid .concrete-supplier-field input {
    width: 11.8em;
    min-width: 11.8em;
}

.concrete-form-grid .concrete-plate-field input,
.concrete-form-grid .concrete-vehicle-field input {
    width: 7.8em;
    min-width: 7.8em;
}

.concrete-form-grid .concrete-ticket-field input {
    width: 8.8em;
    min-width: 8.8em;
}

.concrete-form-grid .concrete-arrival-field input {
    width: 12.2em;
    min-width: 12.2em;
}

.concrete-form-grid .concrete-time-field input {
    width: 6.5em;
    min-width: 6.5em;
}

.concrete-form-grid .concrete-strength-field select,
.concrete-form-grid .concrete-waterproof-field select {
    width: 5.8em;
    min-width: 5.8em;
    padding-left: 7px;
    padding-right: 7px;
}

.concrete-form-grid .concrete-method-field select {
    width: 5.8em;
    min-width: 5.8em;
    padding-left: 7px;
    padding-right: 7px;
}

.concrete-form-grid .concrete-specimen-field input {
    width: 4.5em;
    min-width: 4.5em;
}

.concrete-form-grid .concrete-remarks-field input {
    width: 11em;
    min-width: 11em;
}

.concrete-form-grid .concrete-volume-field input {
    width: 5.8em;
    min-width: 5.8em;
}

.concrete-form-grid .concrete-project-field,
.concrete-form-grid .concrete-date-field,
.concrete-form-grid .concrete-work-part-field,
.concrete-form-grid .concrete-strength-field,
.concrete-form-grid .concrete-waterproof-field,
.concrete-form-grid .concrete-method-field,
.concrete-form-grid .concrete-specimen-field,
.concrete-form-grid .concrete-remarks-field,
.concrete-form-grid .concrete-supplier-field,
.concrete-form-grid .concrete-plate-field,
.concrete-form-grid .concrete-vehicle-field,
.concrete-form-grid .concrete-ticket-field,
.concrete-form-grid .concrete-arrival-field,
.concrete-form-grid .concrete-time-field,
.concrete-form-grid .concrete-volume-field {
    flex: 0 0 auto;
}

.concrete-form-grid .concrete-form-row-top,
.concrete-form-grid .concrete-form-row-bottom {
    overflow: visible;
    padding-bottom: 2px;
}

.concrete-form-grid .concrete-form-row-top label,
.concrete-form-grid .concrete-form-row-bottom label {
    white-space: nowrap;
}

.concrete-form-grid .full-row {
    width: 100%;
    flex: 0 0 100%;
    align-self: stretch;
}

.concrete-table {
    min-width: 1120px;
    font-size: 13px;
}

.concrete-table th,
.concrete-table td {
    padding: 7px 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.concrete-table td:nth-child(3),
.concrete-truck-table td:nth-child(4),
.concrete-truck-table td:nth-child(5),
.concrete-batch-table td:nth-child(4) {
    white-space: normal;
    min-width: 140px;
}

.concrete-detail-lines {
    margin-top: 8px;
    min-width: 260px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    white-space: normal;
}

.concrete-batch-form .form-actions {
    justify-content: flex-start;
    gap: 10px;
}

.inline-remark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.inline-remark input {
    min-width: 260px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

@media (max-width: 900px) {
    .concrete-form-grid {
        gap: 12px;
    }

    .concrete-form-row {
        flex-wrap: wrap;
    }

    .concrete-form-grid .concrete-project-field,
    .concrete-form-grid .concrete-date-field,
    .concrete-form-grid .concrete-work-part-field,
    .concrete-form-grid .concrete-strength-field,
    .concrete-form-grid .concrete-waterproof-field,
    .concrete-form-grid .concrete-method-field,
    .concrete-form-grid .concrete-specimen-field,
    .concrete-form-grid .concrete-remarks-field,
    .concrete-form-grid .concrete-supplier-field,
    .concrete-form-grid .concrete-plate-field,
    .concrete-form-grid .concrete-vehicle-field,
    .concrete-form-grid .concrete-ticket-field,
    .concrete-form-grid .concrete-arrival-field,
    .concrete-form-grid .concrete-time-field,
    .concrete-form-grid .concrete-volume-field {
        width: auto;
        flex: 1 1 140px;
    }

    .concrete-form-grid .concrete-project-field select,
    .concrete-form-grid .concrete-date-field input,
    .concrete-form-grid .concrete-work-part-field input,
    .concrete-form-grid .concrete-strength-field select,
    .concrete-form-grid .concrete-waterproof-field select,
    .concrete-form-grid .concrete-method-field select,
    .concrete-form-grid .concrete-specimen-field input,
    .concrete-form-grid .concrete-remarks-field input,
    .concrete-form-grid .concrete-supplier-field input,
    .concrete-form-grid .concrete-plate-field input,
    .concrete-form-grid .concrete-vehicle-field input,
    .concrete-form-grid .concrete-ticket-field input,
    .concrete-form-grid .concrete-arrival-field input,
    .concrete-form-grid .concrete-time-field input,
    .concrete-form-grid .concrete-volume-field input {
        width: 100%;
    }

    .concrete-table {
        min-width: 980px;
    }

    .inline-remark {
        width: 100%;
    }

    .inline-remark input {
        min-width: 0;
        width: 100%;
    }
}

.receipt-qty-builder {
    display: flex;
    align-items: center;
    gap: 8px;
}

.receipt-qty-builder input {
    flex: 1 1 auto;
    min-width: 0;
}

.receipt-qty-total,
.receipt-qty-breakdown {
    font-size: 12px;
    line-height: 1.3;
}

.receipt-qty-total {
    flex: 0 0 auto;
    white-space: nowrap;
}

.receipt-qty-breakdown {
    color: var(--muted);
    word-break: break-all;
}

.material-summary-table {
    min-width: 960px;
}

.batch-actions {
    justify-content: flex-end;
}

.project-context {
    align-self: stretch;
    min-width: 280px;
    padding: 10px 12px;
    border: 1px solid #cfe0e6;
    border-radius: 6px;
    background: #f3fafc;
    color: var(--primary-dark);
    font-size: 13px;
    line-height: 1.5;
}

.detail-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.detail-link:hover,
.link-button:hover {
    color: var(--primary-dark);
}

.link-button {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(31, 42, 51, .42);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(960px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: auto;
    padding: 20px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 24px 70px rgba(30, 42, 50, .22);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.modal-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.modal-head p {
    margin: 0;
    color: var(--muted);
}

.permission-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfdfe;
}

.permission-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
}

.check-inline,
.check-card {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-inline input,
.check-card input {
    width: 14px;
    height: 14px;
    min-height: 14px;
    flex: 0 0 14px;
    margin: 0;
}

.check-card {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
}

.permission-grid label.check-card,
.permission-head label.check-inline,
.permission-table label.permission-check {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    flex-direction: row;
}

.permission-grid label.check-card {
    justify-content: flex-start;
    text-align: left;
}

.check-card span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.check-card em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.permission-table-wrap {
    max-height: none;
}

.permission-table {
    min-width: 860px;
}

.user-list-table {
    font-size: 13px;
    min-width: 980px;
}

.user-list-table th,
.user-list-table td {
    padding: 8px 8px;
    line-height: 1.45;
    vertical-align: middle;
}

.user-list-table th {
    color: #52616c;
    font-size: 13px;
}

.user-list-table td:nth-child(5),
.user-list-table td:nth-child(6),
.user-list-table td:nth-child(7) {
    color: #52616c;
    font-size: 12px;
    line-height: 1.5;
}

.user-list-table .button.mini {
    min-height: 26px;
    padding: 4px 7px;
    font-size: 12px;
}

.permission-table th,
.permission-table td {
    white-space: nowrap;
    text-align: center;
}

.permission-table th:first-child,
.permission-table td:first-child {
    text-align: left;
}

.permission-check {
    justify-content: center;
    gap: 5px;
    font-size: 13px;
}

.full-row {
    grid-column: 1 / -1;
}

.upload-progress {
    display: grid;
    gap: 7px;
    padding: 10px 12px;
    border: 1px solid #b8d7e2;
    border-radius: 6px;
    background: #f3fafc;
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #225568;
    font-size: 13px;
}

.upload-progress-head strong {
    color: var(--primary-dark);
    white-space: nowrap;
}

.upload-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: #dcebf0;
}

.upload-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #1f8a5b;
    transition: width .16s linear;
}

.change-management-form .compact-form,
.change-management-top-row {
    display: grid;
    grid-auto-flow: initial;
    grid-auto-columns: initial;
    grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(130px, .8fr));
    gap: 12px 14px;
    align-items: end;
    overflow-x: visible;
    padding-bottom: 0;
}

.change-management-top-row label {
    min-width: 0;
    font-size: 13px;
    color: #4b5563;
}

.change-management-top-row input,
.change-management-top-row select,
.change-management-top-row textarea {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 13px;
}

.change-management-top-row .wide-col {
    grid-column: span 2;
    min-width: 0;
}

.change-targets-block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfdfe;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.change-targets-head {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    font-size: 11px;
    white-space: nowrap;
}

.change-targets-head span,
.change-target-empty {
    color: var(--muted);
    font-size: 11px;
}

.change-target-select {
    width: 100%;
    min-width: 0;
    background: #fff;
    font-size: 13px;
}

.change-target-picker {
    flex: 0 1 780px;
    width: min(780px, 100%);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.change-target-select-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.change-target-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
    margin-top: 6px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.change-target-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: #26364a;
    font-size: 13px;
    line-height: 1.35;
    min-width: 0;
}

.change-target-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.change-target-chip button {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #eef2f6;
    color: #667085;
    cursor: pointer;
    line-height: 18px;
    font-size: 13px;
    flex: 0 0 auto;
}

.change-target-grid {
    display: flex;
    flex: 1 1 auto;
    gap: 5px;
    overflow-x: auto;
    min-width: 0;
    padding-bottom: 2px;
}

.change-target-item {
    flex: 0 0 auto;
    min-height: 24px;
    padding: 3px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.change-target-item input {
    width: 12px;
    height: 12px;
    margin: 0;
}

.change-submit-actions {
    justify-content: flex-end;
}

.change-submit-button {
    min-height: 30px;
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.change-pending-table,
.change-confirm-table {
    font-size: 14px;
}

.change-confirm-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.change-confirm-form input {
    width: 100%;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
}

.change-confirm-form button {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 12px;
}

.change-file-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfdfe;
    font-size: 14px;
}

.change-file-box span {
    color: var(--muted);
}

.inline {
    display: inline;
}

.import-result {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.import-result.good {
    background: #eef8f2;
    border-color: #c8e7d6;
}

.import-result.warn {
    background: #fff7ea;
    border-color: #f0d6a7;
}

.error-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--danger);
}

@media (max-width: 900px) {
    .material-management-grid {
        grid-template-columns: 1fr;
    }

    .change-management-form .compact-form,
    .change-management-top-row {
        grid-template-columns: 1fr;
    }

    .change-management-top-row .wide-col {
        grid-column: 1 / -1;
    }

    .change-targets-block {
        align-items: stretch;
        flex-direction: column;
    }

    .change-target-grid {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .change-confirm-form {
        grid-template-columns: 1fr;
    }

    .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        min-height: 0;
        padding: 10px 12px;
        gap: 8px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .brand {
        justify-content: flex-start;
        flex: 1 1 auto;
    }

    .brand strong {
        font-size: 18px;
        white-space: normal;
        text-align: left;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 34px;
        padding: 8px 14px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
        color: var(--primary);
        font-size: 15px;
        font-weight: 700;
    }

    nav {
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
    }

    .topbar.nav-open nav {
        display: grid;
    }

    nav a {
        min-height: 42px;
        padding: 9px 8px;
        font-size: 15px;
        background: #f7fafb;
        border: 1px solid var(--line);
        border-radius: 8px;
    }

    .user-chip {
        justify-content: center;
        font-size: 12px;
    }

    .stats-grid,
    .system-grid,
    .form-grid,
    .form-grid.narrow {
        grid-template-columns: 1fr;
    }

    .panel,
    .stat-card,
    .material-category-card {
        border-radius: 10px;
    }

    .panel {
        padding: 16px;
    }

    input,
    select,
    textarea,
    .button,
    button {
        min-height: 44px;
    }

    .user-basic-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid.compact-form {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(128px, 160px);
    }

    .personnel-form > label,
    .personnel-form .personnel-project-field,
    .personnel-form .personnel-name-field,
    .personnel-form .personnel-id-field,
    .personnel-form .personnel-phone-field,
    .personnel-form .personnel-team-field,
    .personnel-form .personnel-date-field,
    .personnel-form .personnel-dorm-field,
    .personnel-form .personnel-small-field,
    .personnel-form .personnel-address-field,
    .personnel-form .personnel-save-actions,
    .personnel-form .personnel-form-query,
    .personnel-form .form-actions {
        grid-column: 1 / -1;
    }

    .progress-project-row {
        grid-template-columns: 1fr;
    }

    .report-top-row,
    .report-detail-row,
    .contract-top-row,
    .contract-detail-row,
    .contract-payment-top-row,
    .contract-payment-detail-row,
    .weekly-filter-form,
    .weekly-top-query,
    .weekly-text-grid,
    .weekly-period-form,
    .weekly-detail-content,
    .weekly-query-form,
    .weekly-decisions-form,
    .daily-log-query-form,
    .contract-payment-filter-form,
    .personnel-query-inline {
        grid-template-columns: 1fr;
    }

    .weekly-period-form .weekly-period-title,
    .weekly-period-form .weekly-period-wide,
    .weekly-period-form .form-actions {
        grid-column: 1;
    }

    .weekly-summary-head {
        align-items: stretch;
    }

    .weekly-summary-head .form-actions {
        flex-wrap: wrap;
    }

    .weekly-summary-paper {
        margin-right: -14px;
        margin-left: -14px;
        padding: 0;
        border-right: 0;
        border-left: 0;
    }

    .weekly-summary-paper .weekly-summary-document {
        min-height: 0;
        padding: 22px 16px;
        box-shadow: none;
        font-size: 15px;
    }

    .weekly-meta-gap {
        display: block;
        margin-left: 0;
    }

    .earthwork-entry-form {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
        overflow: visible;
    }

    .earthwork-entry-form > label,
    .earthwork-entry-form .earthwork-remarks-field,
    .earthwork-entry-form .earthwork-file-field,
    .earthwork-entry-form .upload-progress,
    .earthwork-entry-form .earthwork-save-actions {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .earthwork-entry-form .earthwork-save-actions .primary {
        width: auto;
    }

    .contract-detail-row .contract-remark-field {
        grid-column: auto;
    }

    .user-edit-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .permission-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .button {
        width: 100%;
    }

    .compact-form .button,
    .compact-form button {
        width: auto;
    }
}

@media (max-width: 520px) {
    .layout {
        width: min(100% - 16px, 1500px);
        margin-top: 12px;
    }

    nav,
    .user-edit-form,
    .user-basic-row,
    .permission-grid,
    .stats-grid,
    .system-grid {
        grid-template-columns: 1fr;
    }

    .page-actions,
    .form-actions {
        width: 100%;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.contract-table-wrap {
    overflow-x: visible;
}

.construction-block-editor { display: grid; gap: 10px; }
.construction-block-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.construction-block-editor-head > div { display: grid; gap: 3px; }
.construction-block-editor-head strong { color: var(--text); font-size: 14px; }
.construction-block-editor-head small { font-size: 12px; }
.construction-block-list { display: grid; gap: 10px; }
@media (max-width: 700px) { .construction-block-editor-head { align-items: stretch; flex-direction: column; } .construction-block-row { grid-template-columns: 1fr; } }

.report-list-head { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.report-view-password-form { display:inline-flex; align-items:center; gap:7px; margin:0; }
.report-view-password-form input[type="password"] { width:140px; min-height:32px; padding:6px 9px; border:1px solid var(--line); border-radius:6px; background:#fff; }
@media (max-width:700px) { .report-list-head { align-items:stretch; flex-direction:column; } .report-view-password-form { width:100%; } .report-view-password-form input[type="password"] { width:100%; } }

.daily-log-summary-panel { margin-top: 18px; }
.daily-log-summary-filter { display:flex; align-items:end; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.daily-log-summary-filter label { min-width:180px; }
.daily-log-summary-stats { margin-top:8px; }
@media (max-width:700px) { .daily-log-summary-filter { align-items:stretch; flex-direction:column; } .daily-log-summary-filter label { min-width:0; } }

.daily-log-summary-filter select,
.daily-log-summary-filter input { min-width: 150px; }
.daily-log-summary-panel table { min-width: 980px; }
@media (max-width: 700px) { .daily-log-summary-filter select, .daily-log-summary-filter input { min-width: 0; width: 100%; } }

.notification-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.notification-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .48); }
.notification-modal-card { position: relative; width: min(620px, 100%); max-height: min(720px, 90vh); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, #fff); box-shadow: 0 20px 60px rgba(15, 23, 42, .24); }
.notification-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notification-modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.notification-modal-close { border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.notification-modal-list { display: grid; gap: 12px; margin-top: 16px; }
.notification-modal-list article { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel, #f8fafc); }
.notification-modal-list article p { margin: 7px 0; white-space: pre-wrap; }
.notification-modal-list article small { color: var(--muted); }
.notification-modal-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.notification-modal-actions form { margin: 0; }
@media (max-width: 700px) { .notification-modal { padding: 12px; align-items: flex-end; } .notification-modal-card { max-height: 85vh; padding: 16px; border-radius: 8px 8px 0 0; } .notification-modal-list article { align-items: stretch; flex-direction: column; } .notification-modal-actions { justify-content: flex-end; } }

.event-entry-list { display:grid; gap:10px; }
.event-entry-row { display:grid; grid-template-columns:150px minmax(180px,1fr) minmax(220px,1.4fr) 110px 60px; gap:10px; align-items:end; padding:12px; border:1px solid var(--line); border-radius:10px; background:#f8fafc; }
.event-entry-row label { min-width:0; }
.event-entry-row textarea { min-height:42px; resize:vertical; }
.event-important-check { display:flex; align-items:center; gap:6px; min-height:42px; white-space:nowrap; }
.event-important-check input { width:auto; }
.metro-board { position:relative; display:flex; align-items:flex-start; gap:0; min-height:190px; padding:52px 18px 30px; overflow-x:auto; }
.metro-line { position:absolute; left:28px; right:28px; top:91px; height:8px; border-radius:8px; background:linear-gradient(90deg,#176b87,#36a3b8); }
.metro-stop { position:relative; z-index:1; flex:1 0 190px; min-width:190px; text-align:center; }
.metro-dot { display:block; width:24px; height:24px; margin:27px auto 0; border:6px solid #fff; border-radius:50%; background:#176b87; box-shadow:0 0 0 3px #176b87; }
.metro-card { position:absolute; left:50%; bottom:58px; width:170px; transform:translateX(-50%); padding:10px; border:1px solid var(--line); border-radius:9px; background:#fff; box-shadow:0 5px 15px rgba(15,70,90,.1); text-align:left; }
.metro-card strong,.metro-card time,.metro-card small { display:block; }
.metro-card time { margin-top:4px; color:var(--primary); font-size:12px; }
.metro-card small { margin-top:4px; color:var(--muted); }
.metro-stop-down .metro-card { top:58px; bottom:auto; }
@media (max-width:800px) { .event-entry-row { grid-template-columns:1fr; } .event-important-check { min-height:36px; } .metro-board { min-width:700px; } }.event-actions { white-space: nowrap; }

.tower-form.form-grid.compact-form {
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px 14px;
    overflow-x: visible;
    padding-bottom: 0;
}

.user-registration-meta {
    min-width: 142px;
}

.user-registration-meta strong,
.user-registration-meta span {
    display: block;
    white-space: nowrap;
}

.user-registration-meta span {
    color: #687985;
    font-size: 12px;
}

.password-visible {
    display: inline-block;
    max-width: 150px;
    padding: 3px 6px;
    border-radius: 5px;
    background: #f4f7f8;
    color: #263843;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.tower-form.form-grid.compact-form label,
.tower-form.form-grid.compact-form .form-actions {
    min-width: 0;
}

.tower-form.form-grid.compact-form .wide-col {
    grid-column: span 2;
    min-width: 0;
}

.tower-form.form-grid.compact-form .full-row {
    grid-column: 1 / -1;
}

@media (max-width: 1180px) {
    .tower-form.form-grid.compact-form {
        grid-template-columns: repeat(3, minmax(145px, 1fr));
    }
}

@media (max-width: 820px) {
    .tower-form.form-grid.compact-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .tower-form.form-grid.compact-form {
        grid-template-columns: 1fr;
    }

    .tower-form.form-grid.compact-form .wide-col {
        grid-column: 1;
    }
}
.event-action-row { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.event-action-row form { display: inline-flex; margin: 0; }
.event-action-row .button { white-space: nowrap; }
.event-entry-row { grid-template-columns: 130px minmax(160px,1.2fr) minmax(130px,1fr) minmax(160px,1.4fr) 76px 56px; }
.event-actions { white-space: nowrap; min-width: 210px; }
.event-insert-row input { min-width: 110px; }
.event-edit-modal { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:20px; background:rgba(15,23,42,.45); }
.event-edit-modal[hidden] { display:none; }
.event-edit-dialog { width:min(520px,100%); max-height:90vh; overflow:auto; padding:20px; border-radius:12px; background:#fff; box-shadow:0 20px 60px rgba(15,23,42,.25); }
.event-edit-dialog form { display:grid; gap:12px; }
@media (max-width:900px) { .event-entry-row { grid-template-columns:1fr 1fr; } .event-entry-row .event-details-field { grid-column:1 / -1; } .event-actions { min-width:210px; } }

/* Event records layout overrides */
.event-board { overflow: hidden; }
.metro-board { overflow-x: auto; overflow-y: hidden; min-height: 230px; max-height: 300px; scrollbar-width: thin; }
.metro-card { z-index: 2; }
.metro-edit-button { margin-top: 8px; }
.event-important-form { margin: 0; }
.event-create-panel .event-entry-row { grid-template-columns: 130px minmax(180px, 1.2fr) minmax(140px, 1fr) minmax(180px, 1.4fr) 58px; }
.event-create-panel .event-entry-row label { white-space: nowrap; }
@media (max-width: 900px) {
    .event-create-panel .event-entry-list { overflow-x: auto; }
    .event-create-panel .event-entry-row { min-width: 760px; grid-template-columns: 130px 190px 150px 190px 58px; }
}

.event-board .metro-board {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 18px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.event-board .metro-board::-webkit-scrollbar {
    width: 0;
    height: 0;
}
.event-board .metro-board::-webkit-scrollbar-thumb {
    background: transparent;
}
.metro-card .metro-edit-button {
    display: inline-flex;
    margin-top: 8px;
}
.event-board .metro-board {
    overflow: hidden !important;
    max-width: 100%;
    max-height: 300px;
}
.event-board .metro-board::-webkit-scrollbar,
.event-board .metro-board::-webkit-scrollbar-track,
.event-board .metro-board::-webkit-scrollbar-thumb {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.event-board .metro-board {
    display: flex;
    align-items: flex-start;
    min-height: 360px;
    height: auto;
    max-height: none !important;
    overflow: visible !important;
    padding: 150px 18px 150px;
}
.event-board .metro-stop {
    min-height: 80px;
}
.event-board .metro-board::-webkit-scrollbar { display: none !important; }
.event-board .metro-board { scrollbar-width: none !important; -ms-overflow-style: none !important; }
.event-board .metro-board {
    min-height: 230px;
    height: 230px;
    max-height: 230px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 52px 18px 30px;
    scrollbar-width: auto !important;
    -ms-overflow-style: auto !important;
}
.event-board .metro-board::-webkit-scrollbar {
    display: initial !important;
    width: auto !important;
    height: auto !important;
}
.metro-edit-form { display: grid; gap: 4px; }
.metro-title-input { width: 100%; font-weight: 700; font-size: 17px; border: 1px solid #d7e2ea; border-radius: 6px; padding: 4px 6px; box-sizing: border-box; }
.metro-date-input { width: 100%; color: var(--primary); border: 1px solid #d7e2ea; border-radius: 6px; padding: 3px 5px; box-sizing: border-box; }
.metro-details-input { width: 100%; min-height: 38px; resize: none; border: 1px solid #d7e2ea; border-radius: 6px; padding: 4px 6px; box-sizing: border-box; }
.metro-edit-form .button { justify-self: start; margin-top: 2px; }
/* Rebuilt metro fishbone board */
.event-board .metro-board {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    height: 230px;
    min-height: 230px;
    max-height: 230px !important;
    margin: 0;
    padding: 0 34px;
    overflow: visible !important;
}
.event-board .metro-line {
    top: 111px;
    left: 34px;
    right: 34px;
    height: 7px;
    border-radius: 0;
    background: #2185a0;
}
.event-board .metro-stop {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
}
.event-board .metro-dot {
    position: absolute;
    top: 99px;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: 0;
    transform: translateX(-50%);
    border: 5px solid #fff;
    background: #2185a0;
    box-shadow: 0 0 0 3px #2185a0;
}
.event-board .metro-card,
.event-board .metro-stop-down .metro-card {
    position: absolute;
    left: calc(50% - 14px);
    top: 24px;
    bottom: auto;
    width: min(170px, calc(100% - 20px));
    transform: translateX(-100%);
    padding: 9px;
    border: 1px solid #d7e2ea;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(15,70,90,.10);
}
.event-board .metro-stop-down .metro-card {
    top: 136px;
}
.event-board .metro-card .metro-branch {
    position: absolute;
    right: -14px;
    width: 30px;
    height: 2px;
    background: #2185a0;
    transform-origin: right center;
}
.event-board .metro-stop:not(.metro-stop-down) .metro-branch {
    bottom: -1px;
    transform: rotate(28deg);
}
.event-board .metro-stop-down .metro-branch {
    top: -1px;
    transform: rotate(-28deg);
}
.event-board .metro-edit-form { display: grid; gap: 4px; }
.event-board .metro-title-input,
.event-board .metro-date-input { width: 100%; box-sizing: border-box; }
.event-board .metro-title-input { font-size: 15px; font-weight: 700; }
.event-board .metro-date-input { color: var(--primary); font-size: 12px; }
.event-board .metro-edit-form .button { justify-self: start; padding: 3px 8px; }
@media (max-width: 900px) {
    .event-board .metro-board { min-width: 760px; overflow-x: auto !important; }
}
/* Important event metro fishbone board */
.event-board .metro-fishbone-board {
    position: relative;
    display: flex;
    align-items: flex-start;
    height: 230px;
    min-height: 230px;
    max-height: 230px;
    padding: 0 28px;
    overflow: visible;
}
.event-board .metro-fishbone-board .metro-line {
    position: absolute;
    top: 111px;
    left: 28px;
    right: 28px;
    height: 7px;
    border-radius: 4px;
    background: #2185a0;
}
.event-board .metro-fishbone-board .metro-stop {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 230px;
}
.event-board .metro-fishbone-board .metro-dot {
    position: absolute;
    z-index: 2;
    top: 99px;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: 0;
    transform: translateX(-50%);
    border: 5px solid #fff;
    border-radius: 50%;
    background: #2185a0;
    box-shadow: 0 0 0 3px #2185a0;
}
.event-board .metro-fishbone-board .metro-fish-card {
    position: absolute;
    z-index: 3;
    top: 22px;
    left: calc(50% - 14px);
    width: min(168px, calc(100% - 16px));
    min-height: 58px;
    transform: translateX(-100%);
    padding: 10px;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(15,70,90,.1);
}
.event-board .metro-fishbone-board .metro-fish-card strong,
.event-board .metro-fishbone-board .metro-fish-card time {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.event-board .metro-fishbone-board .metro-fish-card strong { font-size: 15px; }
.event-board .metro-fishbone-board .metro-fish-card time { margin-top: 7px; color: var(--primary); font-size: 12px; }
.event-board .metro-fishbone-board .metro-branch {
    position: absolute;
    right: -15px;
    bottom: -1px;
    width: 34px;
    height: 2px;
    background: #2185a0;
    transform: rotate(28deg);
    transform-origin: right center;
}
@media (max-width: 900px) {
    .event-board .metro-fishbone-board { min-width: 760px; overflow-x: auto; }
}
/* Final metro alignment */
.event-board .metro-fishbone-board .metro-dot {
    top: 94px;
}
.event-board .metro-fishbone-board .metro-fish-card {
    top: 18px;
    left: calc(50% - 14px);
}
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card {
    top: 138px;
}
.event-board .metro-fishbone-board .metro-stop:not(.metro-stop-down) .metro-branch {
    bottom: -1px;
    transform: rotate(28deg);
}
.event-board .metro-fishbone-board .metro-stop-down .metro-branch {
    top: -1px;
    bottom: auto;
    transform: rotate(-28deg);
}

.event-board .metro-fishbone-board .metro-dot { top: 97px; }
.event-board .metro-fishbone-board .metro-line {
    top: 115px !important;
}
.event-board .metro-fishbone-board .metro-dot {
    top: 101px !important;
}
.event-board .metro-fishbone-board .metro-stop {
    height: 230px;
}
.event-board .metro-fishbone-board .metro-fish-card {
    top: 18px;
}
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card {
    top: 140px;
}
/* Align the metro rail with station centers */
.event-board .metro-fishbone-board {
    height: 350px !important;
    min-height: 350px !important;
    max-height: 350px !important;
}
.event-board .metro-fishbone-board .metro-line {
    top: 231px !important;
}
.event-board .metro-fishbone-board .metro-dot {
    top: 214px !important;
}
.event-board .metro-fishbone-board .metro-stop {
    height: 350px !important;
}
.event-board .metro-fishbone-board .metro-fish-card {
    top: 18px !important;
}
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card {
    top: 248px !important;
}
.event-board .metro-fishbone-board .metro-stop:not(.metro-stop-down) .metro-branch {
    bottom: auto !important;
    top: 196px !important;
    transform: rotate(28deg) !important;
}
.event-board .metro-fishbone-board .metro-stop-down .metro-branch {
    top: 248px !important;
    transform: rotate(-28deg) !important;
}
/* Unified metro board positioning */
.event-board .metro-fishbone-board {
    position: relative;
    display: flex;
    align-items: stretch;
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    padding: 0 36px !important;
    overflow: visible !important;
}
.event-board .metro-fishbone-board .metro-line {
    position: absolute;
    z-index: 1;
    top: 150px !important;
    left: 36px !important;
    right: 36px !important;
    height: 7px !important;
    margin: 0;
    border-radius: 4px;
    background: #2185a0;
}
.event-board .metro-fishbone-board .metro-stop {
    position: relative;
    z-index: 2;
    flex: 1 1 0;
    min-width: 0;
    height: 300px !important;
}
.event-board .metro-fishbone-board .metro-dot {
    position: absolute;
    z-index: 4;
    top: 133px !important;
    left: 50%;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    transform: translateX(-50%);
    border: 5px solid #fff;
    border-radius: 50%;
    background: #2185a0;
    box-shadow: 0 0 0 3px #2185a0;
}
.event-board .metro-fishbone-board .metro-fish-card,
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card {
    position: absolute;
    z-index: 3;
    left: 50% !important;
    width: min(170px, calc(100% - 10px));
    min-height: 64px;
    margin: 0;
    transform: translateX(-50%);
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(15,70,90,.1);
}
.event-board .metro-fishbone-board .metro-fish-card { top: 24px !important; }
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card { top: 190px !important; }
.event-board .metro-fishbone-board .metro-branch,
.event-board .metro-fishbone-board .metro-stop-down .metro-branch {
    position: absolute;
    left: 50%;
    right: auto;
    width: 2px;
    height: 32px;
    background: #2185a0;
    transform: translateX(-50%) !important;
}
.event-board .metro-fishbone-board .metro-branch { top: 100%; bottom: auto; }
.event-board .metro-fishbone-board .metro-stop-down .metro-branch { top: auto; bottom: 100%; }
/* Final station alignment: cards close to the line, no diagonal branches */
.event-board .metro-fishbone-board {
    position: relative !important;
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
    padding: 0 36px !important;
    overflow: visible !important;
}
.event-board .metro-fishbone-board .metro-line {
    position: absolute !important;
    top: 150px !important;
    left: 36px !important;
    right: 36px !important;
    height: 7px !important;
    margin: 0 !important;
    transform: none !important;
}
.event-board .metro-fishbone-board .metro-stop {
    position: relative !important;
    height: 300px !important;
}
.event-board .metro-fishbone-board .metro-dot {
    position: absolute !important;
    top: 133px !important;
    left: 50% !important;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    box-sizing: content-box !important;
}
.event-board .metro-fishbone-board .metro-fish-card,
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card {
    position: absolute !important;
    left: 50% !important;
    width: min(170px, calc(100% - 10px)) !important;
    min-height: 64px !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    box-sizing: border-box !important;
}
.event-board .metro-fishbone-board .metro-fish-card {
    top: 54px !important;
    bottom: auto !important;
}
.event-board .metro-fishbone-board .metro-stop-down .metro-fish-card {
    top: 166px !important;
    bottom: auto !important;
}
.event-board .metro-fishbone-board .metro-branch,
.event-board .metro-fishbone-board .metro-stop-down .metro-branch {
    display: none !important;
}

.event-actions .event-delete-button { background: #f3d9d6; border-color: #e8c1bd; color: #8f3b35; }
.event-actions .event-delete-button:hover { background: #edc8c4; border-color: #dca9a4; }

/* Event board: expand by node count and scroll horizontally only. */
.event-board .metro-scroll {
    display: block;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
    scrollbar-gutter: stable;
    overscroll-behavior-x: contain;
}
.event-board .metro-scroll .metro-fishbone-board {
    display: flex !important;
    width: max(100%, var(--board-width, 760px)) !important;
    min-width: var(--board-width, 760px) !important;
    max-width: none !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box;
}
.event-board .metro-scroll .metro-stop {
    flex: 0 0 190px !important;
    min-width: 190px !important;
}

/* Responsive application shell and touch-friendly forms */
body {
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 1181px) {
    .topbar.nav-compact {
        min-height: 0;
        padding: 10px 12px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px 12px;
    }

    .topbar.nav-compact .topbar-main {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    .topbar.nav-compact .brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar.nav-compact .brand > span:last-child {
        min-width: 0;
    }

    .topbar.nav-compact .brand strong {
        display: block;
        overflow: hidden;
        font-size: 16px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar.nav-compact .nav-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding: 7px 14px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
        color: var(--primary);
        font-size: 15px;
        font-weight: 700;
    }

    .topbar.nav-compact nav {
        grid-column: 1 / -1;
        grid-row: 2;
        display: none;
        width: 100%;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
    }

    .topbar.nav-compact.nav-open nav {
        display: grid;
    }

    .topbar.nav-compact nav a {
        width: 100%;
        min-height: 42px;
        padding: 9px 8px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #f7fafb;
        font-size: 15px;
    }

    .topbar.nav-compact .user-chip {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
    }
}

@media (max-width: 1180px) {
    .topbar {
        min-height: 0;
        padding: 10px 12px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px 12px;
    }

    .topbar-main {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .brand > span:last-child {
        min-width: 0;
    }

    .brand strong {
        display: block;
        overflow: hidden;
        font-size: 16px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding: 7px 14px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
        color: var(--primary);
        font-size: 15px;
        font-weight: 700;
    }

    nav {
        grid-column: 1 / -1;
        grid-row: 2;
        display: none;
        width: 100%;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
    }

    .topbar.nav-open nav {
        display: grid;
    }

    nav a {
        width: 100%;
        min-height: 42px;
        padding: 9px 8px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #f7fafb;
        font-size: 15px;
    }

    .user-chip {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
    }

    .login-card input,
    .login-card select,
    .login-card textarea {
        font-size: 16px;
    }
}

@media (max-width: 900px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

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

    .layout,
    .layout > *,
    .panel,
    .panel-head,
    .page-head {
        min-width: 0;
        max-width: 100%;
    }

    .panel-head,
    .page-head {
        align-items: stretch;
    }

    .layout form:not(.inline) {
        min-width: 0;
        max-width: 100%;
    }

    .layout form:not(.inline) label {
        min-width: 0;
        max-width: 100%;
    }

    .layout input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
    .layout select,
    .layout textarea {
        min-width: 0 !important;
        max-width: 100%;
        font-size: 16px;
    }

    .layout input[type="file"] {
        width: 100%;
        font-size: 14px;
    }

    .layout input[type="checkbox"],
    .layout input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        flex: 0 0 20px;
    }

    .form-grid.compact-form:not(.tower-form) {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-auto-flow: row !important;
        grid-auto-columns: minmax(0, 1fr) !important;
        overflow-x: visible !important;
        padding-bottom: 0;
    }

    .form-grid.compact-form:not(.tower-form) > label,
    .form-grid.compact-form:not(.tower-form) > .form-actions,
    .form-grid.compact-form:not(.tower-form) > .full-row,
    .earthwork-entry-form > label,
    .earthwork-entry-form .earthwork-remarks-field,
    .earthwork-entry-form .earthwork-file-field,
    .earthwork-entry-form .upload-progress,
    .earthwork-entry-form .earthwork-save-actions {
        grid-column: 1 !important;
        grid-row: auto !important;
        width: 100%;
        min-width: 0 !important;
    }

    .compact-form .wide-col,
    .compact-form .form-actions,
    .receipt-filter-form label,
    .project-filter-select,
    .inline-remark {
        width: 100%;
        min-width: 0;
    }

    .project-filter-select {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .project-filter-select select,
    .inline-remark input {
        width: 100%;
        min-width: 0;
    }

    .concrete-form-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        align-items: end;
    }

    .concrete-form-grid .concrete-project-field,
    .concrete-form-grid .concrete-date-field,
    .concrete-form-grid .concrete-work-part-field,
    .concrete-form-grid .concrete-strength-field,
    .concrete-form-grid .concrete-waterproof-field,
    .concrete-form-grid .concrete-method-field,
    .concrete-form-grid .concrete-specimen-field,
    .concrete-form-grid .concrete-remarks-field,
    .concrete-form-grid .concrete-supplier-field,
    .concrete-form-grid .concrete-plate-field,
    .concrete-form-grid .concrete-vehicle-field,
    .concrete-form-grid .concrete-ticket-field,
    .concrete-form-grid .concrete-arrival-field,
    .concrete-form-grid .concrete-time-field,
    .concrete-form-grid .concrete-volume-field,
    .concrete-form-grid .full-row {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100%;
        flex: none;
    }

    .concrete-form-grid input,
    .concrete-form-grid select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100%;
    }

    .receipt-qty-builder,
    .concrete-form-actions,
    .weekly-scope-row {
        flex-wrap: wrap;
    }

    .table-wrap,
    .contract-table-wrap,
    .material-entry-wrap,
    .permission-table-wrap,
    .progress-plan-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .row-actions .button,
    .row-actions button,
    .event-action-row .button,
    .event-action-row button {
        width: auto;
    }

    .modal-backdrop {
        padding: 12px;
    }

    .modal-panel,
    .event-edit-dialog {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }

    .progress-plan-section > .panel-head {
        top: 0;
    }
}

@media (max-width: 640px) {
    .topbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .topbar-main {
        grid-column: 1;
    }

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

    .user-chip {
        grid-column: 1;
        grid-row: 3;
        justify-content: center;
        padding-top: 8px;
        border-top: 1px solid var(--line);
    }

    .layout {
        width: calc(100% - 16px);
        margin-top: 12px;
    }

    .panel {
        padding: 14px 12px;
    }

    .concrete-form-row,
    .tower-form.form-grid.compact-form {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .tower-form.form-grid.compact-form .wide-col {
        grid-column: 1;
    }

    .form-actions:not(.row-actions),
    .page-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }

    .form-actions:not(.row-actions) > .button,
    .form-actions:not(.row-actions) > button,
    .page-actions > .button,
    .page-actions > button {
        width: 100%;
    }
}

@media (max-width: 420px) {
    nav {
        grid-template-columns: minmax(0, 1fr);
    }

    .brand strong {
        font-size: 15px;
    }

    .nav-toggle {
        padding-inline: 12px;
    }
}

.masonry-entry-form.form-grid.compact-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.1fr) minmax(130px, .7fr) minmax(130px, .7fr) minmax(220px, 1.2fr) minmax(220px, 1.2fr) 76px minmax(130px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(190px, 1fr);
    grid-auto-flow: row;
    grid-auto-columns: initial;
    gap: 10px;
    overflow-x: visible;
    padding-bottom: 0;
}

.masonry-entry-form .masonry-project-field {
    grid-column: 1 / -1;
    max-width: 520px;
}

.masonry-entry-form .masonry-unit-field {
    max-width: 76px;
}

.masonry-entry-form label,
.masonry-entry-form .wide-col,
.masonry-entry-form .form-actions {
    min-width: 0;
}

.masonry-entry-form .wide-col {
    grid-column: span 3;
}

.masonry-table-wrap {
    overflow-x: visible;
}

.masonry-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
}

.masonry-table th,
.masonry-table td {
    padding: 8px 6px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.masonry-table th:first-child,
.masonry-table td:first-child {
    width: 42px;
}

.masonry-summary-table th:nth-child(5),
.masonry-summary-table td:nth-child(5),
.masonry-detail-table th:nth-child(7),
.masonry-detail-table td:nth-child(7) {
    width: 58px;
}

.masonry-summary-table th:nth-child(6),
.masonry-summary-table td:nth-child(6),
.masonry-detail-table th:nth-child(8),
.masonry-detail-table td:nth-child(8),
.masonry-detail-table th:nth-child(9),
.masonry-detail-table td:nth-child(9) {
    width: 84px;
}

@media (max-width: 900px) {
    .masonry-entry-form.form-grid.compact-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .masonry-entry-form .masonry-project-field,
    .masonry-entry-form .wide-col,
    .masonry-entry-form .form-actions {
        grid-column: 1 / -1;
        max-width: none;
    }

    .masonry-entry-form .masonry-unit-field {
        max-width: none;
    }
}
