:root {
    --ink: #17202a;
    --muted: #697586;
    --line: #dfe4ea;
    --soft: #f5f7fa;
    --panel: #ffffff;
    --navy: #13395b;
    --blue: #1769aa;
    --blue-soft: #eaf3fb;
    --green: #1f7a50;
    --amber: #946200;
    --radius: 14px;
    --shadow: 0 10px 35px rgba(20, 47, 74, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: #eef2f6; color: var(--ink); font: 15px/1.5 Inter, "Segoe UI", Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.topbar { min-height: 70px; padding: 0 5vw; background: var(--navy); color: white; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 4px 18px rgba(15, 39, 63, .2); }
.brand { display: flex; color: white; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #fff; color: var(--navy); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { opacity: .65; font-size: 11px; letter-spacing: .06em; }
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav a, .link-button { color: rgba(255,255,255,.82); font-weight: 600; }
.topbar nav a:hover, .link-button:hover { color: white; }
.inline-form { display: inline; }
.link-button { background: none; border: 0; cursor: pointer; padding: 0; }

.container { width: min(1180px, 92vw); margin: 38px auto 70px; }
.page-head { display: flex; gap: 24px; justify-content: space-between; align-items: flex-end; margin-bottom: 25px; }
.page-head.compact { align-items: center; }
.page-head h1 { font-size: clamp(28px, 4vw, 42px); margin: 3px 0 4px; letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; color: var(--blue); }

.btn { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 9px; padding: 10px 16px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--blue); color: white; box-shadow: 0 6px 15px rgba(23,105,170,.2); }
.btn-primary:hover { background: #115c98; }
.btn-secondary { background: white; color: var(--navy); border-color: var(--line); }
.btn-block { width: 100%; }
.button-row { display: flex; gap: 10px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 20px; display: flex; align-items: baseline; gap: 10px; }
.stat strong { font-size: 29px; color: var(--navy); }
.stat span { color: var(--muted); }
.filter-bar { display: grid; grid-template-columns: 1fr 220px auto; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.filter-bar input, .filter-bar select { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: white; }

.table-card, .form-section, .detail-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.registry { width: 100%; border-collapse: collapse; }
.registry th { background: #f0f4f8; color: #516173; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; text-align: left; padding: 12px 16px; }
.registry td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.registry td small { display: block; color: var(--muted); margin-top: 3px; }
.registry tr:hover td { background: #fbfcfd; }
.actions { text-align: right; white-space: nowrap; }
.actions a { margin-left: 13px; font-weight: 700; font-size: 13px; }
.empty { text-align: center; padding: 45px !important; color: var(--muted); }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-draft { background: #fff3d8; color: var(--amber); }
.badge-ready { background: #def3e8; color: var(--green); }
.badge-issued { background: var(--blue-soft); color: var(--blue); }

.notice { padding: 12px 16px; background: #def3e8; color: var(--green); border-radius: 9px; margin-bottom: 16px; font-weight: 650; }
.field-error { color: #9f2525; background: #fdeaea; padding: 10px 12px; border-radius: 8px; }

.editor-form { display: grid; gap: 18px; }
.form-section { padding: 23px; overflow: visible; }
.section-title { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 20px; }
.section-title > span { display: grid; place-items: center; min-width: 34px; height: 28px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: 12px; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; color: #344152; font-weight: 700; font-size: 13px; }
.field > span b { color: #b12424; }
.field small { color: var(--muted); font-weight: 400; }
.field em { color: #ad2727; font-style: normal; font-weight: 500; }
.form-control, .stack-form input { width: 100%; min-height: 42px; border: 1px solid #cfd7e1; border-radius: 8px; background: #fff; padding: 9px 11px; color: var(--ink); }
textarea.form-control { resize: vertical; }
.form-control:focus, .stack-form input:focus { outline: 3px solid rgba(23,105,170,.12); border-color: var(--blue); }
.check-row { display: flex; align-items: center; gap: 9px; margin: 2px 0 16px; font-weight: 700; }
.check-row input { width: 18px; height: 18px; }
.equipment-wrap { display: grid; gap: 12px; }
.equipment-editor { width: 100%; border-collapse: collapse; }
.equipment-editor th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.equipment-editor td { padding: 6px; }
.equipment-editor input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px; }
.equipment-editor th:nth-child(1) { width: 52%; }
.equipment-editor th:nth-child(2), .equipment-editor th:nth-child(3), .equipment-editor th:nth-child(4) { width: 14%; }
.remove-row { width: 32px; height: 32px; border: 0; border-radius: 7px; background: #fdeaea; color: #a42323; font-weight: 900; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 14px; z-index: 2; padding: 12px; border-radius: 12px; background: rgba(238,242,246,.92); backdrop-filter: blur(8px); }

.detail-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); gap: 18px; margin-bottom: 18px; }
.detail-card { padding: 23px; }
.detail-card h2 { margin: 0 0 18px; }
.detail-card h3 { margin-top: 26px; }
.detail-title { display: flex; justify-content: space-between; align-items: flex-start; }
.facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px 24px; margin: 0; }
.facts div, .people div { border-bottom: 1px solid var(--line); padding-bottom: 9px; }
dt { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
dd { margin: 0; font-weight: 650; }
.people { display: grid; gap: 14px; margin: 0 0 24px; }
.work-list { padding-left: 22px; }
.work-list li { padding-left: 4px; margin-bottom: 7px; }
.equipment-view { margin-top: 18px; }
.muted { color: var(--muted); }

.login-shell { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.login-card { width: min(460px, 100%); background: white; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.03em; margin: 7px 0 10px; }
.login-card > p { color: var(--muted); margin: 0 0 24px; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { font-weight: 700; font-size: 13px; }
.stack-form input { display: block; margin-top: 6px; }

@media (max-width: 900px) {
    .form-grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
    .topbar nav a:nth-child(1), .topbar nav a:nth-child(3) { display: none; }
}
@media (max-width: 650px) {
    .container { width: min(94vw, 1180px); margin-top: 24px; }
    .topbar { padding: 0 3vw; }
    .page-head { align-items: stretch; flex-direction: column; }
    .stats { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr; }
    .table-card { overflow-x: auto; }
    .registry { min-width: 720px; }
    .form-grid.two, .form-grid.four, .facts { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .equipment-wrap { overflow-x: auto; }
    .equipment-editor { min-width: 760px; }
    .button-row { flex-direction: column; }
}
