:root {
  --navy: #102a43;
  --navy-2: #183b56;
  --blue: #1565c0;
  --blue-dark: #0d47a1;
  --gold: #f2b705;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #172b4d;
  --muted: #66788a;
  --border: #d9e2ec;
  --danger: #b42318;
  --success: #137333;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(16, 42, 67, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
.public-body { min-height: 100vh; background: #eef2f6; }
.public-institutional-header { background: #fff; border-top: 7px solid var(--navy); border-bottom: 3px solid var(--gold); }
.public-header-inner { width: min(820px, calc(100% - 28px)); min-height: 98px; margin: 0 auto; display: flex; align-items: center; }
.institutional-logo { display: block; width: 176px; max-width: 100%; height: auto; max-height: 70px; object-fit: contain; object-position: left center; }
.public-page { width: min(820px, calc(100% - 28px)); margin: 0 auto; padding: 34px 0 24px; }
.public-footer { padding: 18px; color: var(--muted); text-align: center; font-size: .86rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: var(--navy); color: #fff; border-bottom: 4px solid var(--gold); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 750; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand .institutional-logo { width: 118px; max-height: 48px; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav a, .nav .link-button { color: #fff; font-weight: 600; }
.main-content { min-height: calc(100vh - 150px); padding: 44px 0 70px; }
.site-footer { background: #e9eff5; color: var(--muted); padding: 24px 0; font-size: .9rem; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; color: var(--blue); }
.link-button:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 12px; }
h2 { font-size: 1.25rem; }
p { margin-top: 0; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; font-weight: 800; margin-bottom: 8px; }
.lead { color: var(--muted); font-size: 1.08rem; }
.hero, .page-heading.with-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 32px; }
.page-heading { margin-bottom: 30px; }
.page-heading p, .hero p { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid transparent; padding: 10px 16px; font-weight: 700; cursor: pointer; font-size: .95rem; text-decoration: none; }
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { background: #edf4ff; border-color: #b8d4f5; color: var(--blue-dark); }
.button.ghost { background: #fff; border-color: var(--border); color: var(--navy); }
.button.danger { background: var(--danger); color: #fff; }
.button.large { padding: 13px 22px; }
.button.small { padding: 8px 12px; font-size: .86rem; }
.button.full { width: 100%; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card, .panel, .table-card, .narrow-card, .narrow-panel, .form-shell, .success-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { display: flex; flex-direction: column; min-height: 250px; }
.card-body { padding: 24px; flex: 1; }
.card-body h2 { margin: 18px 0 10px; }
.card-body p { color: var(--muted); }
.card-footer { padding: 18px 24px; border-top: 1px solid var(--border); }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 10px; font-size: .76rem; font-weight: 800; }
.badge.success { background: #e6f4ea; color: var(--success); }
.badge.muted { background: #edf0f3; color: #59636e; }
.form-shell { max-width: 820px; margin: 0 auto; overflow: hidden; }
.form-visual { display: grid; place-items: center; margin: 0; overflow: hidden; background: #edf1f5; border-bottom: 1px solid var(--border); }
.form-visual img { display: block; max-width: 100%; height: auto; object-fit: contain; }
.form-visual.landscape img { width: 100%; max-height: 460px; }
.form-visual.portrait { padding: 24px; }
.form-visual.portrait img { width: auto; max-height: 580px; }
.form-header { padding: 34px 38px 28px; border-top: 7px solid var(--blue); border-bottom: 1px solid var(--border); }
.form-header h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.form-cover { display: block; width: 100%; max-height: 360px; margin: -34px -38px 28px; object-fit: cover; width: calc(100% + 76px); }
.form-intro { margin-top: 20px; }
.honeypot, .honeypot[hidden] { display: none !important; }
.document-control { display: grid; grid-template-columns: minmax(180px, .7fr) 1fr; gap: 10px; }
.grid-field { min-width: 0; padding: 0; border: 0; }
.grid-field > legend { margin-bottom: 12px; color: var(--navy); font-weight: 750; }
.grid-row { margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; }
.grid-row > strong { display: block; margin-bottom: 8px; }
.schedule { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; margin-top: 18px; }
.public-form { padding: 34px 38px; }
.info-block { background: #eef5ff; border-left: 4px solid var(--blue); padding: 20px; border-radius: 10px; margin: 6px 0 26px; }
.info-block h2 { margin-bottom: 6px; }
.info-block p { margin-bottom: 0; color: var(--muted); }
.field-block { margin-bottom: 24px; }
.field-block > label:not(.checkbox-label) { display: block; font-weight: 750; margin-bottom: 8px; color: var(--navy); }
.input { width: 100%; border: 1px solid #bcccdc; border-radius: 9px; background: #fff; padding: 11px 12px; color: var(--text); font: inherit; }
.input:focus { outline: 3px solid rgba(21, 101, 192, .14); border-color: var(--blue); }
textarea.input { resize: vertical; }
.choice-input { accent-color: var(--blue); }
ul[id$="_0"], ul[id*="id_"] { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 9px; }
ul[id*="id_"] label { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; font-weight: 700; color: var(--navy); }
.checkbox-label input { margin-top: 5px; }
.required { color: var(--danger); }
.help-text { color: var(--muted); font-size: .86rem; margin: 7px 0 0; }
.field-errors ul, .form-errors ul { list-style: none; margin: 0; padding: 0; }
.field-errors, .form-errors { color: var(--danger); font-size: .88rem; margin-top: 7px; }
.has-error .input { border-color: var(--danger); }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); padding-top: 24px; margin-top: 30px; }
.submit-row p { color: var(--muted); font-size: .86rem; margin: 0; }
.closed-state { padding: 40px; text-align: center; }
.preview-notice { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; padding: 12px 14px; background: #fff7e6; border: 1px solid #e6c46a; border-radius: 6px; color: var(--navy); }
.preview-notice span { color: var(--muted); font-size: .9rem; }
.public-form button:disabled { cursor: not-allowed; opacity: .62; transform: none; }
.unavailable-state { max-width: 680px; margin: 40px auto; padding: 46px; background: #fff; border-top: 7px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow); }
.unavailable-state p:last-child { color: var(--muted); margin-bottom: 0; }
.success-card { max-width: 700px; margin: 0 auto; padding: 48px; text-align: center; }
.success-icon { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 50%; background: #e6f4ea; color: var(--success); font-size: 2rem; font-weight: 900; }
.reference-box { background: #f7f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin: 26px 0; display: grid; gap: 5px; }
.reference-box span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.reference-box strong { overflow-wrap: anywhere; }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { padding: 26px; }
.access-panel { margin-top: 22px; }
.share-panel { margin: 22px 0; }
.share-panel p { color: var(--muted); margin-bottom: 12px; }
.share-link { display: block; padding: 12px; background: #f5f8fb; border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
.access-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, .5fr) auto; gap: 10px; align-items: end; }
.access-list { display: grid; gap: 8px; margin-top: 18px; }
.access-list > div { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--border); }
.access-list span { display: grid; gap: 2px; }
.access-list small { color: var(--muted); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading p { color: var(--muted); font-size: .9rem; }
.panel-footer-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 20px; }
.stack-form { display: grid; gap: 4px; }
.stack-form .field-block { margin-bottom: 17px; }
.field-list { display: grid; gap: 10px; }
.field-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 13px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; }
.position { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #e5effa; color: var(--navy); font-weight: 800; }
.field-row-main { display: grid; gap: 2px; }
.field-row-main span { color: var(--muted); font-size: .82rem; }
.field-row-actions { display: flex; gap: 10px; font-size: .88rem; }
.danger-link { color: var(--danger); }
.narrow-card, .narrow-panel { max-width: 700px; margin: 0 auto; padding: 32px; }
.notice { background: #eef5ff; color: var(--navy); padding: 16px; border-radius: 10px; margin-bottom: 20px; }
.notice p { margin: 5px 0 0; color: var(--muted); }
.notice.warning { background: #fff7e6; border: 1px solid #f2d49b; }
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f5f8fb; color: var(--navy); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: 0; }
.subtle { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.actions-cell { display: flex; gap: 12px; flex-wrap: wrap; font-size: .88rem; }
.empty-state { background: #fff; border: 1px dashed #b9c7d5; border-radius: var(--radius); padding: 42px; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.empty-state.compact { padding: 22px; box-shadow: none; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.detail-item { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.detail-item span { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.detail-item strong { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-item small { color: var(--muted); }
.revision-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 22px; }
.revision-summary div { display: grid; gap: 4px; }
.revision-summary span { color: var(--muted); font-size: .82rem; }
.revision-fields { display: grid; gap: 10px; margin-bottom: 22px; }
.revision-fields h2 { margin-bottom: 8px; }
.restore-panel { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.restore-panel p { color: var(--muted); margin-bottom: 0; }
.operation-strip { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; gap: 16px; align-items: center; margin-bottom: 22px; padding: 18px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.operation-strip > div:not(.button-row) { display: grid; gap: 3px; }
.operation-strip span, .operation-strip small { color: var(--muted); font-size: .82rem; }
.filter-bar { display: grid; grid-template-columns: auto minmax(220px, 420px) auto; gap: 10px; align-items: center; margin-bottom: 18px; }
.messages { display: grid; gap: 10px; margin-bottom: 22px; }
.message { padding: 13px 16px; background: #eef5ff; border: 1px solid #c8ddf4; border-radius: 9px; }
.message.success { background: #e6f4ea; border-color: #b7dfc3; color: var(--success); }
code { background: #eef2f6; border-radius: 5px; padding: 2px 5px; font-size: .86em; }

@media (max-width: 800px) {
  .header-inner, .hero, .page-heading.with-actions { align-items: flex-start; flex-direction: column; }
  .header-inner { padding: 16px 0; }
  .nav { flex-wrap: wrap; gap: 14px; }
  .two-column { grid-template-columns: 1fr; }
  .form-header, .public-form { padding-left: 22px; padding-right: 22px; }
  .form-cover { margin-left: -22px; margin-right: -22px; width: calc(100% + 44px); }
  .document-control { grid-template-columns: 1fr; }
  .operation-strip, .filter-bar { grid-template-columns: 1fr; }
  .restore-panel { align-items: stretch; flex-direction: column; }
  .access-form { grid-template-columns: 1fr; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .field-row { grid-template-columns: 34px 1fr; }
  .field-row-actions { grid-column: 2; }
}
