.nomad-admin {
  --nomad-ink: #20382e;
  --nomad-primary: #20382e;
  --nomad-secondary: #6b4823;
  --nomad-canvas: #f4f2e9;
  --nomad-surface: #fff;
  --nomad-sidebar: #20382e;
  --nomad-sidebar-hover: #304f40;
  --nomad-sidebar-active: #41634f;
  --nomad-success: #346249;
  --nomad-warning: #91400f;
  --nomad-danger: #992d26;
  --nomad-focus: #a44d14;
  --nomad-border: #b9c1b9;
  --nomad-type: system-ui, sans-serif;
  --nomad-gutter: clamp(.8rem, 3vw, 2rem);
  --nomad-radius: .55rem;
  --bs-body-font-family: var(--nomad-type);
  --bs-body-color: var(--nomad-ink);
  --bs-border-color: var(--nomad-border);
  --bs-card-bg: var(--nomad-surface);
  --lte-sidebar-width: 13.75rem;
  background: var(--nomad-canvas);
  color: var(--nomad-ink);
  font-family: var(--nomad-type);
  padding: 0;
}

body.nomad-admin:has(.operations-page) { padding: 0; }
.nomad-admin .app-wrapper { grid-template-columns: auto minmax(0, 1fr); }
.nomad-header {
  display: flex;
  justify-content: space-between;
  gap: .65rem;
  background: var(--nomad-surface);
  border-bottom: 1px solid var(--nomad-border);
  padding: .7rem var(--nomad-gutter);
}
.nomad-header-start { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.nomad-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 750; line-height: 1.2; }
.nomad-brand small { display: block; color: var(--nomad-secondary); font-size: .82rem; margin-top: .22rem; }
.nomad-header a.nomad-brand { padding: 0; color: inherit; background: transparent; text-decoration: none; }
.nomad-header svg, .nomad-sidebar svg { width: 1.25rem; height: 1.25rem; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nomad-header .nomad-sidebar-toggle, .nomad-account summary, #sidebar-close {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem;
  padding: .45rem .65rem; margin: 0; border: 1px solid var(--nomad-border);
  border-radius: var(--nomad-radius); color: var(--nomad-ink); background: var(--nomad-surface);
}
.nomad-account { position: relative; }
.nomad-account summary { cursor: pointer; list-style: none; }
.nomad-account summary::-webkit-details-marker { display: none; }
.nomad-account-panel {
  position: absolute; inset: calc(100% + .6rem) 0 auto auto; width: min(15rem, 84vw);
  z-index: 1035; padding: .9rem; gap: .4rem; overflow-wrap: anywhere;
  box-shadow: 0 .4rem 1rem #20382e24;
}
.nomad-account-panel span { font-size: .87rem; }

.nomad-sidebar {
  --lte-sidebar-color: #fff;
  --lte-sidebar-hover-bg: var(--nomad-sidebar-hover);
  --lte-sidebar-hover-color: #fff;
  --lte-sidebar-menu-active-bg: var(--nomad-sidebar-active);
  --lte-sidebar-menu-active-color: #fff;
  background: var(--nomad-sidebar);
  padding: .85rem .55rem;
  color: #fff;
}
.nomad-sidebar nav { display: block; margin: 0; }
.nomad-sidebar .nav-link {
  display: flex; gap: .6rem; align-items: center; width: auto;
  padding: .68rem .65rem; margin: .15rem 0; color: #fff; background: transparent;
}
.nomad-sidebar .nav-link[aria-current="page"] { background: var(--nomad-sidebar-active); font-weight: 700; }
.nomad-sidebar .nav-link:hover { background: var(--nomad-sidebar-hover); }
.nomad-sidebar .nav-link:focus-visible, #sidebar-close:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
#sidebar-close { align-self: flex-start; margin: 0 0 .7rem .35rem; }
.nomad-sidebar-overlay { position: fixed; inset: 0; background: #14271eaa; z-index: 1040; }
.nomad-menu-open { overflow: hidden; }

.nomad-admin .app-main {
  margin: 0; width: 100%; max-width: 95rem; justify-self: center;
  container-type: inline-size;
}
.nomad-admin .app-content-header, .nomad-admin .app-content { padding-inline: var(--nomad-gutter); }
.nomad-admin .app-content-header { padding-top: clamp(1rem, 3vw, 2rem); padding-bottom: .8rem; }
.nomad-admin h1 { font-size: clamp(1.65rem, 3.2vw, 2.45rem); font-weight: 750; margin: 0; }
.nomad-admin h2 { font-size: clamp(1.18rem, 2vw, 1.45rem); font-weight: 700; }
.nomad-admin h3 { font-size: 1.12rem; font-weight: 700; }
.nomad-admin .nomad-section-heading { margin-top: 1.4rem; }
.nomad-admin .app-content :is(#record-form, #assignment-form, #create-admin-form) {
  background: var(--nomad-surface); border: 1px solid var(--nomad-border);
  border-radius: var(--nomad-radius); padding: clamp(.8rem, 3vw, 1.35rem); margin-block: .8rem;
}
.nomad-admin .app-content form:not(.materials-filters) button { margin-top: .8rem; }
.nomad-admin :is(button, summary, a, input, select):focus-visible { outline: 3px solid var(--nomad-focus); outline-offset: 2px; }
.nomad-admin button { border-radius: var(--nomad-radius); }
.nomad-admin .danger { background: var(--nomad-danger); }
.nomad-admin .card { --bs-card-border-color: var(--nomad-border); --bs-card-border-radius: var(--nomad-radius); }
.nomad-admin .storage-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); }
.nomad-admin .storage-panel { margin-bottom: 1rem; }
.nomad-admin .storage-panel dt, .nomad-admin .storage-panel dd { margin: 0; }
.nomad-admin .app-content .administrator-card { margin: 0; }
.nomad-admin .table-scroll { margin-top: 1rem; }

body.nomad-admin.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 1rem; }
.nomad-admin .login-box { width: min(100%, 27rem); margin: 0; }
.nomad-admin .login-box .card-body { padding: clamp(1rem, 5vw, 2rem); }
.nomad-admin .login-box h1 { font-size: 1.7rem; overflow-wrap: anywhere; }
.nomad-admin .login-box input { max-width: none; }
.nomad-admin .nomad-home-link { padding: 0; color: var(--nomad-primary); background: transparent; }
.nomad-admin.login-page #message:empty { min-height: 0; margin: .65rem 0; }

@media (max-width: 61.999rem) {
  .nomad-admin .app-wrapper { grid-template-columns: 0 minmax(0, 1fr); }
  .nomad-sidebar { position: fixed; z-index: 1045; inset: 0 auto 0 0; }
  .nomad-admin:not(.nomad-menu-open) .nomad-sidebar { display: none; }
}
@container (max-width: 58rem) { .materials-table .received-col { display: none; } }
@container (max-width: 47rem) { .materials-table .leader-col { display: none; } }
@container (max-width: 40rem) { .materials-table .trip-col { display: none; } }

.assignment-link-panel {
  margin-top: .85rem; padding: .7rem .85rem;
  background: #f1f5ef; border: 1px solid var(--nomad-border);
  border-radius: var(--nomad-radius);
}
.assignment-link-panel label { margin: 0 0 .35rem; }
.assignment-link-panel input { max-width: 100%; }

.nomad-admin #confirmation { width: min(42rem, calc(100vw - 1.5rem)); }
.nomad-admin #confirmation-files {
  max-height: clamp(5.5rem, calc(100dvh - 25rem), 22rem);
  margin-bottom: 1rem; padding: 0; overflow: auto;
  border: 1px solid var(--nomad-border); border-radius: var(--nomad-radius);
}
#confirmation-files table { width: 100%; table-layout: fixed; font-size: .9rem; }
#confirmation-files th, #confirmation-files td {
  padding: .36rem .5rem; text-align: start; vertical-align: top;
  overflow-wrap: anywhere; border-bottom: 1px solid #dce0d9;
}
#confirmation-files thead { position: sticky; top: 0; background: #e7ece3; }
#confirmation-files th:first-child { width: 2.3rem; }
#confirmation-files th:last-child { width: 6.3rem; }
#confirmation-files tr:last-child td { border-bottom: 0; }
#confirmation-files tbody tr:nth-child(even) { background: #f7f8f4; }
.confirmation-actions button + button { margin-inline-start: 0; }

.nomad-admin .nomad-badge { color: var(--nomad-ink); background: #e7ece3; }
.nomad-admin .nomad-badge-active { color: #fff; background: var(--nomad-success); }
.nomad-admin .app-content form:not(.materials-filters) button + button { margin-inline-start: .5rem; }
@media (min-width: 62rem) {
  .nomad-sidebar .sidebar-wrapper {
    position: sticky;
    top: .85rem;
    flex: 0 0 auto;
    max-height: calc(100dvh - 1.7rem);
    overflow-y: auto;
  }
}
@media (max-width: 36rem) {
  .materials-table thead th:nth-child(7) { font-size: .75rem; white-space: nowrap; }
}

@media (min-width: 62rem) {
  .nomad-admin.nomad-sidebar-compact { --lte-sidebar-width: 4.25rem; }
  .nomad-sidebar-compact .nomad-sidebar .nav-link { justify-content: center; }
  .nomad-sidebar-compact .nomad-sidebar .nav-link span { display: none; }
}
#sidebar-tooltip {
  position: fixed; z-index: 1040; transform: translateY(-50%);
  padding: .35rem .55rem; border-radius: var(--nomad-radius);
  color: white; background: var(--nomad-primary); pointer-events: none;
}

.admin-table-filters, .admin-table-summary, .admin-table-pagination {
  display: flex; align-items: end; flex-wrap: wrap; gap: .65rem;
}
.admin-table-pagination { margin: 0; }
.admin-table-summary { justify-content: space-between; padding-bottom: 1rem; }
.admin-table-filters label { flex: 1 1 10rem; min-width: 0; margin-block: .65rem 0; }
.admin-table-filters :is(input, select) { max-width: 100%; }
.admin-table-message { margin-block: .75rem 0; }
.admin-table-message:empty, .admin-table-pagination[hidden] { display: none; }
.admin-table { width: 100%; table-layout: fixed; text-align: start; }
.admin-table :is(th, td) {
  padding: .4rem .55rem; vertical-align: middle; overflow-wrap: anywhere;
  border-bottom: 1px solid #dce0d9;
}
.admin-table thead { background: #e7ece3; }
.admin-table tbody tr:nth-child(even) { background: #f7f8f4; }
.admin-table tbody tr:last-child > * { border-bottom: 0; }
.admin-table th button {
  padding: .35rem .2rem; background: transparent; color: inherit; text-align: start; font-weight: 700;
}
.admin-table [aria-sort="ascending"] button::after { content: " ↑"; }
.admin-table [aria-sort="descending"] button::after { content: " ↓"; }
.admin-table .admin-table-actions { width: 5.25rem; text-align: center; }
.admin-table .icon-button[data-tooltip]::after { inset: auto 0 100% auto; }
@container (max-width: 42rem) {
  .admin-table .admin-table-secondary { display: none; }
}
@container (max-width: 26rem) {
  .admin-table { font-size: .87rem; }
  .admin-table :is(th, td) { padding-inline: .35rem; }
  .admin-table .admin-table-state { width: 5.1rem; }
  .admin-table .admin-table-date { width: 5.4rem; white-space: nowrap; }
}

.nomad-admin .nomad-dialog {
  padding: 0; max-height: calc(100dvh - 1.5rem);
}
.nomad-admin .nomad-dialog-wide { width: min(64rem, calc(100vw - 1.5rem)); }
.nomad-dialog-header, .nomad-dialog-footer {
  position: sticky; z-index: 3; padding: .8rem clamp(.8rem, 3vw, 1.3rem);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--nomad-surface);
}
.nomad-dialog-header { top: 0; border-bottom: 1px solid var(--nomad-border); }
.nomad-dialog-footer { bottom: 0; justify-content: end; border-top: 1px solid var(--nomad-border); flex-wrap: wrap; }
.nomad-dialog-header h2 { margin: 0; }
.nomad-dialog-body { padding: .65rem clamp(.8rem, 3vw, 1.3rem) 1rem; }
.nomad-dialog-body :is(#registry-message, #assignment-progress, #administrators-message):empty { display: none; }
.nomad-admin .nomad-dialog-close { width: 2.75rem; min-height: 2.75rem; padding: .3rem; font-size: 1.45rem; }
.nomad-admin .nomad-dialog :is(input, select) { max-width: 100%; }
@container (max-width: 42rem) {
  #administrators-list .admin-table-secondary + .admin-table-actions { width: 4.75rem; }
}
.nomad-dialog #record-form label:first-child, .nomad-dialog #assignment-form label:first-child { margin-top: 0; }
.nomad-dialog #associated { margin-top: 1.3rem; }
#leader-create-page { max-width: 39rem; }
#leader-create-page .nomad-dialog-header { display: none; }
#leader-create-page .nomad-dialog-body { padding: 0; }
#leader-create-page .nomad-dialog-footer { position: static; justify-content: start; padding: 0; background: transparent; border: 0; }
@media (max-height: 28rem) {
  .nomad-dialog-header, .nomad-dialog-footer { position: static; }
}

#editor-message:has(p:not(:empty)) { flex: 1 0 100%; }
#editor-message p { margin: 0; }
#editor-message:not(:has(p:not(:empty))) { display: none; }
.nomad-dialog :is(button, input, select, .assignment-link-panel) { scroll-margin-block: 4.5rem; }
