:root {
  color-scheme: light;
  --navy: #12213d;
  --teal: #006b5f;
  --teal-hover: #00574e;
  --surface: #fff;
  --page: #f6f8fb;
  --text: #152238;
  --muted: #5f6d80;
  --border: #dce3eb;
  --focus: #a7d6ce;
  --success: #146c43;
  --warning: #805c00;
  --danger: #a32626;
  --radius: 14px;
  --shadow: 0 8px 24px rgb(18 33 61 / 6%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--text); line-height: 1.6; }
a { color: var(--teal); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--teal-hover); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 5; padding: .7rem 1rem; background: var(--navy); color: white; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.topbar { min-height: 76px; display: flex; align-items: center; gap: 2rem; padding: .85rem clamp(1rem, 4vw, 3.5rem); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--navy); text-decoration: none; font-size: 1.2rem; font-weight: 750; letter-spacing: -.025em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: #fff; border-radius: 11px; background: var(--navy); font-size: 1rem; }
.main-nav { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.7rem); flex: 1; }
.main-nav a { color: #394960; text-decoration: none; font-size: .93rem; font-weight: 580; }
.main-nav a:hover { color: var(--teal); }
.user-menu { display: flex; align-items: center; gap: .7rem; margin-inline-start: auto; }
.user-menu form { margin: 0; }
.user-label { color: var(--muted); font-size: .8rem; }
.language-button { border: 0; background: transparent; color: var(--teal); cursor: pointer; padding: .4rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid transparent; border-radius: 9px; padding: .65rem 1rem; min-height: 42px; color: var(--text); cursor: pointer; font-weight: 650; text-decoration: none; transition: background-color .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--teal); box-shadow: 0 3px 8px rgb(0 107 95 / 15%); }
.button-primary:hover { color: #fff; background: var(--teal-hover); }
.button-secondary { background: white; border-color: var(--border); }
.button-secondary:hover, .button-quiet:hover { background: #eef2f6; }
.button-quiet { background: transparent; border-color: var(--border); min-height: 36px; padding: .35rem .65rem; font-size: .85rem; }
.button-wide { width: 100%; }

.page-shell { width: min(1180px, calc(100% - 2rem)); min-height: calc(100vh - 138px); margin-inline: auto; padding-block: clamp(2rem, 5vw, 3.8rem); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 2rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--navy); font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.04em; line-height: 1.15; margin-bottom: .6rem; }
h2 { color: var(--navy); font-size: 1.32rem; line-height: 1.3; margin-bottom: .4rem; }
h3 { color: var(--navy); font-size: 1rem; margin: 1.35rem 0 .4rem; }
.eyebrow { color: var(--teal); text-transform: uppercase; letter-spacing: .09em; font-size: .76rem; font-weight: 750; margin-bottom: .55rem; }
.lede { max-width: 700px; margin: 0; color: var(--muted); font-size: 1.04rem; }
.content-section { margin-top: 2rem; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.section-heading h2 { margin: 0; }
.text-link { font-weight: 650; text-decoration: none; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-block: 2rem; }
.metric-card, .surface-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card { display: flex; flex-direction: column; gap: .35rem; min-height: 145px; padding: 1.2rem 1.3rem; color: inherit; text-decoration: none; }
.metric-card:hover { border-color: #a9cfc8; color: inherit; }
.metric-label { color: var(--muted); font-size: .88rem; }
.metric-value { color: var(--navy); font-size: 2rem; line-height: 1.1; }
.metric-link { margin-top: auto; color: var(--teal); font-size: .87rem; font-weight: 650; }
.surface-card { padding: clamp(1.1rem, 3vw, 1.7rem); }
.contribution-unavailable { border-inline-start: 4px solid var(--warning); }
.contribution-unavailable p { margin-bottom: 0; color: var(--muted); }
.inventory-create { margin-bottom: 1.25rem; }
.inventory-create > summary { color: var(--teal); cursor: pointer; font-weight: 700; }
.inventory-create > .field-help { margin-top: .7rem; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.stack-form { display: grid; gap: 1rem; }
.stack-form > label { display: grid; gap: .35rem; color: var(--navy); font-size: .9rem; font-weight: 650; }
.stack-form .button { justify-self: start; }
.action-card + .action-card { margin-top: 1rem; }
.action-card h3 { margin-top: .15rem; }
.action-card > label { display: grid; gap: .35rem; margin-block: .7rem; color: var(--navy); font-size: .88rem; font-weight: 650; }
.custody-record { margin-bottom: 1rem; }
.asset-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1rem; }
.asset-actions .action-card { min-width: 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.asset-actions .action-card > label { margin-block: .6rem; }
.employee-search-results { display: grid; gap: .3rem; max-height: 16rem; overflow-y: auto; }
.employee-search-option { width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); text-align: start; cursor: pointer; }
.employee-search-option:hover, .employee-search-option[aria-selected="true"] { border-color: var(--teal); background: #f5fbf9; }
.action-details { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.action-details summary { color: var(--teal); cursor: pointer; font-weight: 700; }
.action-details .form-grid { margin-top: 1rem; }
.equipment-fields { min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 10px; }
.equipment-fields legend { padding-inline: .4rem; color: var(--navy); font-weight: 700; }
.equipment-choice-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem 1rem; }
.equipment-choice { min-width: 0; }
.equipment-quantity { display: grid; gap: .35rem; color: var(--navy); font-size: .85rem; font-weight: 650; }
.stack-list { display: grid; gap: .8rem; margin-bottom: 1rem; }
.note-card h3 { margin-top: 0; }
.note-card p:last-child { margin-bottom: 0; }
button:disabled { cursor: wait; opacity: .65; }
.form-section { display: grid; gap: .8rem; min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 10px; }
.form-section legend { padding-inline: .35rem; color: var(--navy); font-weight: 700; overflow-wrap: anywhere; }
.field-help { color: var(--muted); font-size: .8rem; font-weight: 400; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; text-align: start; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { color: #526176; background: #f9fafc; font-size: .78rem; font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
.row-link { font-weight: 700; text-decoration: none; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: .22rem .6rem; background: #edf1f5; color: #49586c; font-size: .77rem; font-weight: 700; white-space: nowrap; }
.status-active, .status-available, .status-completed { background: #e8f5ee; color: var(--success); }
.status-in-progress, .status-submitted, .status-assigned { background: #eaf1fb; color: #24518b; }
.status-pending, .status-under_repair { background: #fff4d9; color: var(--warning); }
.status-rejected, .status-cancelled, .status-inactive, .status-retired { background: #fbeaea; color: var(--danger); }
.count-pill { display: inline-grid; place-items: center; min-width: 2rem; padding: .2rem .55rem; border-radius: 999px; background: #eef2f6; color: #46556a; font-size: .8rem; font-weight: 700; }
.empty-state { display: grid; justify-items: center; text-align: center; padding: 3.5rem 1rem; border: 1px dashed #cbd5df; border-radius: var(--radius); background: #fbfcfe; }
.empty-state h2, .empty-state h3 { margin-bottom: .3rem; }
.empty-state p, .empty-inline { color: var(--muted); margin-bottom: 0; }
.empty-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: .9rem; border-radius: 50%; color: var(--teal); background: #e6f3f0; font-size: 1.2rem; }
.empty-inline { padding: 1rem; text-align: center; }
.equipment-list, .item-list { display: grid; gap: .1rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.equipment-list li, .item-list li { display: flex; align-items: center; gap: .85rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.equipment-list li:last-child, .item-list li:last-child { border: 0; }
.equipment-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 11px; color: var(--teal); background: #eaf5f3; font-size: 1.1rem; }
.equipment-main, .equipment-meta { display: grid; gap: .12rem; }
.equipment-main { flex: 1; }
.equipment-main strong, .equipment-meta strong { color: var(--navy); font-size: .9rem; }
.equipment-main small, .equipment-meta small { color: var(--muted); font-size: .8rem; }
.detail-list { display: grid; gap: .8rem; margin: 1rem 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(130px, .8fr) 1.2fr; gap: 1rem; }
.detail-list dt { color: var(--muted); font-size: .88rem; }
.detail-list dd { margin: 0; color: var(--navy); font-weight: 600; overflow-wrap: anywhere; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.breadcrumbs { display: flex; align-items: center; gap: .65rem; color: var(--muted); margin-bottom: 1.2rem; font-size: .9rem; }
.breadcrumbs a { text-decoration: none; }
.search-form { max-width: 540px; margin-bottom: 1.1rem; }
.search-form label, .form-field label { display: block; color: var(--navy); margin-bottom: .35rem; font-size: .88rem; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid label { display: grid; align-content: start; gap: .35rem; color: var(--navy); font-size: .88rem; font-weight: 650; }
.form-grid .form-wide { grid-column: 1 / -1; }
.form-grid [hidden] { display: none !important; }
.form-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: flex-start; }
.checkbox-row { display: flex !important; align-items: center; gap: .65rem !important; }
.checkbox-row input { width: 1.1rem; height: 1.1rem; }
#request-form-message:empty { display: none; }
#request-form-message.error { margin: 0; padding: .8rem 1rem; border: 1px solid #ead6a2; border-radius: 9px; background: #fff9e8; color: var(--warning); }
.search-row { display: flex; gap: .5rem; }
input, select, textarea { width: 100%; border: 1px solid #bdc8d5; border-radius: 8px; background: white; color: var(--text); padding: .65rem .75rem; }
textarea { resize: vertical; min-height: 100px; }
.messages { margin-bottom: 1.25rem; }
.message, .notice { padding: .8rem 1rem; border-radius: 9px; border: 1px solid var(--border); background: white; }
.message.success { border-color: #b8dfc7; background: #eff9f2; color: var(--success); }
.message.error, .notice-warning { border-color: #ead6a2; background: #fff9e8; color: var(--warning); }
.auth-card { width: min(430px, 100%); margin: clamp(2rem, 8vh, 6rem) auto; padding: clamp(1.5rem, 6vw, 2.4rem); border: 1px solid var(--border); border-radius: 18px; background: white; box-shadow: 0 18px 55px rgb(18 33 61 / 9%); }
.auth-card h1 { font-size: 2rem; }
.auth-card .button { margin-block: 1.4rem .8rem; }
.small-copy { color: var(--muted); font-size: .82rem; margin: .8rem 0 0; }
.footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem clamp(1rem, 4vw, 3.5rem); border-top: 1px solid var(--border); color: var(--muted); font-size: .78rem; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: .8rem 1.2rem; }
  .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; padding-block: .35rem; }
  .user-menu { margin-inline-start: auto; }
}
@media (max-width: 650px) {
  .page-shell { width: min(100% - 1.25rem, 1180px); padding-block: 1.4rem 2.5rem; }
  .topbar { padding-inline: .8rem; }
  .user-label { display: none; }
  .user-menu { gap: .3rem; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .page-heading > .button, .page-heading > a.button { align-self: stretch; }
  .profile-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .form-wide { grid-column: auto; }
  th, td { padding: .7rem .75rem; }
  .footer { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
