:root {
    --ink: #17211d;
    --muted: #64746d;
    --line: #d9e2dd;
    --paper: #f7faf8;
    --surface: #ffffff;
    --accent: #0f766e;
    --accent-dark: #0b4f49;
    --accent-soft: #e3f5ef;
    --gold: #b7791f;
    --gold-soft: #fff4d8;
    --sky-soft: #e9f5ff;
    --warn: #b91c1c;
    --shadow: 0 16px 40px rgba(23, 33, 29, 0.09);
    --shadow-soft: 0 8px 24px rgba(23, 33, 29, 0.07);
}

html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
    min-width: 0;
}

body {
    margin: 0;
    overflow-x: hidden;
    width: 100%;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(183, 121, 31, 0.08) 48%, rgba(233, 245, 255, 0.9)),
        var(--paper);
    color: var(--ink);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.7;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: clamp(12px, 2.6vw, 18px) clamp(14px, 4vw, 44px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(227, 245, 239, 0.88)),
        #fff;
    border-bottom: 1px solid rgba(15, 118, 110, 0.14);
    box-shadow: 0 10px 28px rgba(23, 33, 29, 0.08);
    backdrop-filter: blur(14px);
}

.topbar::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
}

.topbar::after {
    content: "";
    position: absolute;
    inset-inline-end: clamp(18px, 5vw, 62px);
    bottom: -46px;
    width: min(210px, 30vw);
    aspect-ratio: 1;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 8px;
    background: rgba(15, 118, 110, 0.05);
    transform: rotate(-6deg);
    pointer-events: none;
}

.brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(520px, 100%);
    min-height: 52px;
    padding: 8px 16px 10px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-soft);
    font-weight: 700;
    text-align: center;
    font-size: clamp(1rem, 2vw, 1.34rem);
    line-height: 1.35;
    overflow-wrap: anywhere;
    background-image: linear-gradient(120deg, var(--accent-dark) 0%, var(--accent) 55%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-color: rgba(255, 255, 255, 0.78);
    letter-spacing: 0;
}

.quick-nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.quick-nav .button {
    min-width: 118px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--accent-dark);
    border: 1px solid #b7d9d1;
    box-shadow: none;
}

.logout-form {
    margin: 0;
}

.page {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 24px clamp(14px, 4vw, 32px) 80px;
}

.hero,
.result-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding: clamp(20px, 5vw, 34px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(227, 245, 239, 0.92)),
        var(--accent-soft);
    border: 1px solid #c6ded6;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.hero::before,
.result-hero::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 7px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--gold));
}

.hero h1,
.result-hero h1 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2.2rem);
    background: linear-gradient(120deg, var(--accent-dark) 0%, var(--accent) 55%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0;
    line-height: 1.25;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    padding: 4px 12px 4px 10px;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--accent-soft), var(--gold-soft));
    border: 1px solid rgba(15, 118, 110, 0.18);
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.1);
}

.eyebrow::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    flex-shrink: 0;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.reference-number {
    margin: 8px 0 0;
    color: var(--accent-dark);
    font-weight: 700;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover,
button:hover {
    background: var(--accent-dark);
    box-shadow: 0 12px 26px rgba(15, 118, 110, 0.22);
    transform: translateY(-1px);
}

.button.secondary {
    background: #fff;
    color: var(--accent-dark);
    border: 1px solid #b7d9d1;
    box-shadow: none;
}

.button.secondary:hover {
    background: var(--accent-soft);
    box-shadow: 0 8px 18px rgba(23, 33, 29, 0.08);
}

.button:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(183, 121, 31, 0.32);
    outline-offset: 2px;
}

.button.small {
    min-height: 34px;
    padding: 6px 12px;
}

.panel,
.filters {
    margin-bottom: 20px;
    padding: clamp(16px, 4vw, 24px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.panel,
.section-box {
    content-visibility: auto;
    contain-intrinsic-size: auto 420px;
}

.panel h2,
.panel > h2 {
    margin-top: 0;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--accent), var(--gold), transparent) 1;
    letter-spacing: 0;
}

.dashboard-filters {
    align-items: end;
}

.management-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 16px;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input,
select,
textarea,
.button,
button {
    max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.11);
    outline: 0;
}

.compact-field {
    max-width: 360px;
    min-height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
}

textarea {
    resize: vertical;
}

.location-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.location-link {
    display: none;
    width: max-content;
    font-weight: 700;
}

.location-link.visible {
    display: inline-flex;
}

.field-help {
    color: var(--muted);
    font-weight: 400;
}

.team-builder {
    display: grid;
    gap: 10px;
}

.team-builder-label {
    font-weight: 700;
}

.team-members {
    display: grid;
    gap: 8px;
}

.team-member-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.add-team-member {
    justify-self: start;
}

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

.stats article,
.score-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.stats article:nth-child(2n),
.score-card {
    background: linear-gradient(135deg, #fff, var(--sky-soft));
}

.stats article:nth-child(3n) {
    background: linear-gradient(135deg, #fff, var(--gold-soft));
}

.stats span,
.score-card span,
.details-grid dt {
    color: var(--muted);
}

.stats strong,
.score-card strong {
    display: block;
    margin-top: 4px;
    font-size: 1.8rem;
}

.rating-card {
    border-color: currentColor;
}

.rating-stat {
    border-color: currentColor;
}

.rating-card span,
.rating-card strong,
.rating-stat span,
.rating-stat strong {
    color: inherit;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--accent), var(--gold), transparent) 1;
    letter-spacing: 0;
}

.section-box {
    margin: 12px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(23, 33, 29, 0.05);
}

.section-box summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(227, 245, 239, 0.8), rgba(255, 255, 255, 0.85));
}

.section-box small {
    color: var(--muted);
}

.items {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.item-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 12px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(23, 33, 29, 0.05);
}

.item-text {
    display: grid;
    gap: 6px;
}

.critical {
    display: inline-flex;
    width: max-content;
    padding: 2px 8px;
    border-radius: 8px;
    background: #fee2e2;
    color: var(--warn);
    font-size: 0.82rem;
    font-weight: 700;
}

.status-options ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.status-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.status-options input {
    width: 18px;
    min-height: 18px;
}

.notes-field {
    display: none;
    grid-column: 1 / -1;
}

.notes-field.visible {
    display: grid;
}

.section-notes-field,
.section-note-display {
    display: grid;
    gap: 6px;
    margin: 0 14px 14px;
    padding: 14px;
    border: 1px dashed #b7d9d1;
    border-radius: 8px;
    background: #fff;
}

.section-note-display {
    color: var(--ink);
}

.section-note-display p {
    margin: 0;
    color: var(--ink);
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
    background: linear-gradient(180deg, rgba(247, 250, 248, 0), var(--paper) 35%);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 11px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
    background: #f1f7f4;
}

tbody tr:nth-child(even) {
    background: rgba(233, 245, 255, 0.45);
}

tbody tr:hover {
    background: rgba(227, 245, 239, 0.72);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:focus-visible {
    outline: 3px solid rgba(183, 121, 31, 0.32);
    outline-offset: -3px;
}

.table-cell-link {
    display: block;
    min-height: 100%;
    color: inherit;
}

.badge {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 8px;
    background: #dff3ed;
    color: var(--accent-dark);
    font-weight: 700;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.pagination span {
    color: var(--muted);
    font-weight: 700;
}

.rating-excellent {
    background: #dcfce7;
    color: #166534;
}

.rating-very_good {
    background: #dbeafe;
    color: #1d4ed8;
}

.rating-good {
    background: #fef3c7;
    color: #92400e;
}

.rating-acceptable {
    background: #ffedd5;
    color: #c2410c;
}

.rating-pending {
    background: #ede9fe;
    color: #6d28d9;
}

.rating-out_of_service {
    background: #fee2e2;
    color: #b91c1c;
}

.workflow-draft {
    background: #fef3c7;
    color: #92400e;
}

.workflow-approved {
    background: #dcfce7;
    color: #166534;
}

.score-card.rating-excellent {
    background: linear-gradient(135deg, #fff, #dcfce7);
}

.rating-stat.rating-excellent {
    background: linear-gradient(135deg, #fff, #dcfce7);
}

.score-card.rating-very_good {
    background: linear-gradient(135deg, #fff, #dbeafe);
}

.rating-stat.rating-very_good {
    background: linear-gradient(135deg, #fff, #dbeafe);
}

.score-card.rating-good {
    background: linear-gradient(135deg, #fff, #fef3c7);
}

.rating-stat.rating-good {
    background: linear-gradient(135deg, #fff, #fef3c7);
}

.score-card.rating-acceptable {
    background: linear-gradient(135deg, #fff, #ffedd5);
}

.rating-stat.rating-acceptable {
    background: linear-gradient(135deg, #fff, #ffedd5);
}

.score-card.rating-pending {
    background: linear-gradient(135deg, #fff, #ede9fe);
}

.rating-stat.rating-pending {
    background: linear-gradient(135deg, #fff, #ede9fe);
}

.score-card.rating-out_of_service {
    background: linear-gradient(135deg, #fff, #fee2e2);
}

.rating-stat.rating-out_of_service {
    background: linear-gradient(135deg, #fff, #fee2e2);
}

.details-grid {
    margin: 0;
}

.details-grid div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #fff, #fbfdfc);
}

.details-grid dd {
    margin: 4px 0 0;
    font-weight: 700;
}

.empty-state {
    text-align: center;
}

code {
    display: inline-block;
    direction: ltr;
    padding: 8px 10px;
    background: #edf3f0;
    border-radius: 8px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    align-items: center;
    justify-items: center;
    padding-block: clamp(12px, 5vh, 42px);
    padding-inline: clamp(12px, 4vw, 42px);
    background:
        linear-gradient(120deg, rgba(15, 118, 110, 0.08) 0 18%, transparent 18% 100%),
        linear-gradient(300deg, rgba(184, 134, 11, 0.1) 0 14%, transparent 14% 100%),
        linear-gradient(180deg, #f7faf8, #eef7f3);
}

.login-page {
    width: min(100%, clamp(20rem, 42vw, 34rem));
    display: grid;
    gap: clamp(12px, 3vw, 16px);
}

.login-title {
    position: relative;
    overflow: hidden;
    min-height: clamp(82px, 14vh, 112px);
    display: grid;
    align-items: center;
    padding: clamp(14px, 3.4vw, 26px);
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(227, 245, 239, 0.82)),
        #fff;
    box-shadow: var(--shadow);
}

.login-title::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
}

.login-title::after {
    content: "";
    position: absolute;
    inset-inline-end: clamp(16px, 4vw, 36px);
    bottom: -36px;
    width: min(150px, 36%);
    aspect-ratio: 1;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: 8px;
    background: rgba(15, 118, 110, 0.06);
    transform: rotate(-6deg);
}

.login-title h1 {
    position: relative;
    z-index: 1;
    max-width: 420px;
    margin: 0;
    font-size: clamp(1.15rem, 2.4vw, 1.55rem);
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
    background: linear-gradient(120deg, var(--accent-dark) 0%, var(--accent) 60%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0;
}

.login-panel {
    width: 100%;
    justify-self: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.login-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(18px, 4.4vw, 36px);
}

.login-panel::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
}

.login-panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    text-align: center;
}

.login-mark {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.login-panel h2 {
    margin: 0;
    font-size: 1.7rem;
    background: linear-gradient(120deg, var(--accent-dark), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0;
}

.login-panel p {
    margin: 4px 0 0;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form input {
    min-height: 48px;
}

.login-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 4px;
}

.form-alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: var(--warn);
    font-weight: 700;
}

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

.message {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-soft);
    font-weight: 700;
}

.message.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--warn);
}

.message.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.errorlist {
    margin: 8px 0 0;
    padding: 8px 10px;
    list-style: none;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: var(--warn);
    font-size: 0.9rem;
    font-weight: 700;
}

@media (max-width: 760px) {
    body {
        background: var(--paper);
    }

    .topbar {
        position: static;
    }

    .topbar::after {
        display: none;
    }

    .page {
        padding-top: 16px;
        padding-inline: 10px;
    }

    .hero,
    .result-hero,
    .section-title {
        align-items: stretch;
        flex-direction: column;
    }

    .grid,
    .filters,
    .details-grid,
    .stats {
        grid-template-columns: 1fr;
    }

    .filter-actions .button {
        flex: 1 1 150px;
    }

    .item-card {
        grid-template-columns: 1fr;
    }

    .location-row {
        grid-template-columns: 1fr;
    }

    .team-member-row {
        grid-template-columns: 1fr;
    }

    .quick-nav {
        width: 100%;
        gap: 8px;
    }

    .quick-nav .button {
        min-width: 0;
        flex: 1 1 calc(50% - 8px);
    }

    .logout-form {
        flex: 1 1 calc(50% - 8px);
    }

    .logout-form .button {
        width: 100%;
    }

    .action-row .button {
        flex: 1 1 150px;
    }

    .sticky-actions .button {
        width: 100%;
        max-width: 100%;
        white-space: normal;
    }

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

    table.responsive-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    .responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .responsive-table tr {
        display: grid;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 6px 16px rgba(23, 33, 29, 0.05);
    }

    .responsive-table tbody tr:nth-child(even),
    .responsive-table tbody tr:hover {
        background: #fff;
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 8px 4px;
        border-bottom: 1px solid rgba(217, 226, 221, 0.7);
        text-align: right;
    }

    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 700;
    }

    .responsive-table td[colspan] {
        display: block;
    }

    .responsive-table td[colspan]::before {
        content: "";
    }

    .login-page {
        width: 100%;
    }

    .login-title {
        min-height: 96px;
    }

    .login-title h1 {
        font-size: clamp(1.55rem, 7vw, 1.9rem);
    }
}
