@font-face {
    font-display: swap;
    font-family: "Montserrat";
    src: url("/fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
}

:root {
    color-scheme: light;
    --ink: #182231;
    --muted: #667085;
    --line: #dfe4ea;
    --surface: #ffffff;
    --canvas: #f4f6f8;
    --navy: #132359;
    --navy-hover: #1d347d;
    --gold: #ae7f0e;
    --brand-charcoal: #353638;
    --brand-yellow: #ffcc00;
    --danger: #b42318;
    --success: #157f4a;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--canvas);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.5;
}

a { color: inherit; }

.admin-header {
    min-height: 70px;
    padding: 7px clamp(20px, 4vw, 50px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--brand-charcoal);
    color: #fff;
    box-shadow: 0 1px 5px var(--brand-yellow);
}

.admin-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-brand-home {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-decoration: none;
}

.admin-brand-home:hover .admin-brand-name { color: var(--brand-yellow); }

.admin-brand-logo {
    width: 60px;
    height: 48px;
    object-fit: contain;
    padding: 4px;
    flex: 0 0 auto;
}

.admin-brand-name {
    font-size: 1.12rem;
    font-weight: 750;
    letter-spacing: .01em;
    white-space: nowrap;
}

.admin-brand-section {
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, .28);
    color: var(--brand-yellow);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.admin-brand-section:hover { color: #ffe16a; }

.admin-nav { display: flex; align-items: center; gap: 10px; }
.admin-nav > a:not(.button) { padding: 9px 10px; text-decoration: none; }
.admin-nav > a:not(.button):hover { color: var(--brand-yellow); }
.admin-nav form { margin: 0; }

.admin-main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 44px 0 72px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.8rem, 3vw, 2.45rem); line-height: 1.15; }
h2 { margin: 32px 0 16px; font-size: 1.25rem; }

.eyebrow {
    margin-bottom: 7px;
    color: var(--gold);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.page-summary { margin-bottom: 0; color: var(--muted); }

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

.page-head.compact { align-items: center; }

.button {
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.button-primary { background: var(--navy); color: #fff; }
.admin-header .button-primary { background: var(--brand-yellow); color: #202124; }
.button-primary:hover { background: var(--navy-hover); }
.admin-header .button-primary:hover { background: #ffe16a; }
.button-secondary { border-color: var(--line); background: #fff; }
.button-quiet { border-color: transparent; }
.admin-header .button-quiet { color: #fff; }
.admin-header .button-quiet:hover { color: var(--brand-yellow); }
.button-danger { background: var(--danger); color: #fff; }
.button-wide { width: 100%; }

.alert {
    margin: 0 0 22px;
    padding: 14px 16px;
    border: 1px solid;
    border-radius: 8px;
}

.alert ul { margin: 0; padding-left: 20px; }
.alert-error { border-color: #f4b8b2; background: #fff2f0; color: #8f1f16; }
.alert-success { border-color: #a9dfc3; background: #eefbf4; color: #11663d; }

.search-form { margin-bottom: 18px; }
.search-form > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.search-form > div { display: flex; gap: 8px; }

input, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd2da;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input { min-height: 44px; }
textarea { min-height: 112px; line-height: 1.5; resize: vertical; }
input:focus, textarea:focus { outline: 3px solid rgba(38, 92, 190, .16); border-color: #4776c6; }
.search-form input { max-width: 420px; }

.table-card {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 8px 30px rgba(24, 34, 49, .05);
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 15px; border-bottom: 1px solid #e9edf1; text-align: left; white-space: nowrap; }
th { background: #f8fafc; color: #536173; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }

.status {
    padding: 5px 9px;
    border-radius: 999px;
    display: inline-block;
    font-size: .8rem;
    font-weight: 800;
}

.status-active { background: #e9f8ef; color: var(--success); }
.status-expired { background: #f1f3f5; color: #667085; }
.actions { text-align: right; }
.actions a { margin-left: 12px; color: #284f94; font-weight: 700; text-decoration: none; }
.actions .danger-link { color: var(--danger); }
.empty-cell { padding: 40px; color: var(--muted); text-align: center; }
.comment-cell { min-width: 260px; max-width: 460px; white-space: normal; line-height: 1.4; }
.muted, .field-note { color: var(--muted); }
.field-note { margin: 12px 0 0; font-size: .88rem; }

.login-card, .editor-card, .confirm-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(24, 34, 49, .08);
}

.login-card { width: min(440px, 100%); margin: 6vh auto 0; padding: clamp(24px, 5vw, 40px); }
.editor-card { padding: clamp(22px, 4vw, 38px); }
.confirm-card { width: min(620px, 100%); margin: 5vh auto 0; padding: clamp(24px, 5vw, 40px); }

.admin-form label { display: block; }
.admin-form label > span { display: block; margin-bottom: 7px; color: #465365; font-size: .9rem; font-weight: 700; }
.admin-form > label + label { margin-top: 18px; }
.login-card .button-wide { margin-top: 24px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.equipment-grid { max-width: 820px; }
.form-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 10px; }
.object-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.subsection-head { margin: 34px 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.subsection-head h2 { margin: 0; }
.installation-comment { max-width: 820px; margin-top: 24px; }

.record-summary { margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.record-summary div { padding: 14px; border-radius: 8px; background: #f5f7fa; }
.record-summary dt { color: var(--muted); font-size: .8rem; font-weight: 700; }
.record-summary dd { margin: 4px 0 0; font-weight: 800; }

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

@media (max-width: 760px) {
    .admin-header { align-items: flex-start; gap: 8px; padding: 7px 12px 10px; flex-direction: column; }
    .admin-brand, .admin-brand-home { gap: 8px; }
    .admin-brand-logo { width: 50px; height: 44px; }
    .admin-brand-name { font-size: 1rem; }
    .admin-brand-section { padding-left: 8px; font-size: .82rem; }
    .admin-nav { width: 100%; flex-wrap: wrap; }
    .admin-main { width: min(100% - 24px, 1180px); padding-top: 28px; }
    .page-head { align-items: stretch; flex-direction: column; }
    .page-head .button { align-self: flex-start; }
    .form-grid { grid-template-columns: 1fr; }
    .object-form-grid { grid-template-columns: 1fr; }
    .search-form > div { flex-wrap: wrap; }
    .search-form input { max-width: none; flex-basis: 100%; }
    .record-summary { grid-template-columns: 1fr; }
}
