.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.app-sidebar {
  display: none;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--shell-header-height);
  padding: 0.5rem clamp(1rem, 3vw, 1.5rem);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.app-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  font-weight: 700;
  min-height: 2.75rem;
}

.app-topbar__brand .logo-svg {
  width: 2rem;
  height: 2rem;
}

.app-topbar__brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.app-tabbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  min-height: calc(var(--shell-tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.app-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.4rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.app-tab:hover {
  color: var(--text-main);
  text-decoration: none;
}

.app-tab[aria-current="page"] {
  color: var(--accent);
}

.app-tab svg {
  width: 1.375rem;
  height: 1.375rem;
}

.app-tab--menu {
  position: relative;
  flex: 1;
  display: block;
}

.app-tab__summary {
  height: 100%;
  list-style: none;
}

.app-tab__summary::-webkit-details-marker {
  display: none;
}

.app-tab__panel {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  right: 0.5rem;
  z-index: 60;
  display: none;
  width: min(17rem, calc(100vw - 2rem));
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.app-tab--menu[open] .app-tab__panel {
  display: grid;
  gap: var(--space-3);
}

.app-tab__username {
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

@media (min-width: 64rem) {
  .app-shell {
    grid-template-columns: var(--shell-sidebar-width) minmax(0, 1fr);
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
  }

  .app-topbar,
  .app-tabbar {
    display: none;
  }
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: var(--space-4) var(--space-5);
  color: var(--text-main);
  font-weight: 700;
  white-space: nowrap;
}

.app-sidebar__brand .logo-svg {
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
}

.app-sidebar__brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.app-sidebar__nav {
  display: grid;
  gap: 0.2rem;
  padding: var(--space-2) var(--space-3);
}

.app-navlink {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-navlink svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.app-navlink:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
  text-decoration: none;
}

.app-navlink[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.app-sidebar__footer {
  margin-top: auto;
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

.app-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.app-user__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9375rem;
}

.app-user__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.app-main {
  min-width: 0;
  padding: clamp(1rem, 2.5vw, 2rem) clamp(1rem, 3vw, 2rem) var(--space-8);
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}

.container--wide {
  max-width: var(--content-max-wide);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: clamp(1.375rem, 1rem + 1.5vw, 1.75rem);
}

.page-subtitle {
  margin-top: 0.25rem;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.card-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  }
}

@media (min-width: 120rem) {
  .card-grid {
    gap: var(--space-5);
  }
}

.split {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 64rem) {
  .split--fleet,
  .split--aside {
    grid-template-columns: minmax(0, 1fr) 19rem;
    align-items: start;
  }
}

.form-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  align-items: start;
  grid-auto-rows: minmax(min-content, auto);
}

.form-grid .field {
  margin: 0;
}

.field--full {
  grid-column: 1 / -1;
}

@media (min-width: 48rem) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-3);
}

.section-head:first-child {
  margin-top: 0;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

@media (max-width: 47.99rem) {
  .page-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }

  .page-actions .button {
    width: 100%;
  }
}

.table-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody tr:last-child td,
.table tbody tr:last-child th {
  border-bottom: 0;
}

.table.is-striped tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

.table.is-hoverable tbody tr {
  transition: background-color var(--transition-fast);
}

.table.is-hoverable tbody tr:hover {
  background: var(--accent-soft);
}

.table.is-fullwidth {
  width: 100%;
}

.table.is-bordered th,
.table.is-bordered td {
  border: 1px solid var(--border);
}

.table a {
  color: var(--accent);
  font-weight: 600;
}

.table ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

@media (max-width: 47.99rem) {
  .table--responsive,
  .table--responsive tbody,
  .table--responsive tr,
  .table--responsive td,
  .table--responsive tbody th {
    display: block;
  }

  .table--responsive thead {
    display: none;
  }

  .table--responsive tbody tr {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
  }

  .table--responsive tbody tr:last-child {
    border-bottom: 0;
  }

  .table--responsive tbody tr:nth-child(even) {
    background: transparent;
  }

  .table--responsive tbody tr:hover {
    background: transparent;
  }

  .table--responsive td,
  .table--responsive tbody th {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding: 0.3rem 0;
    border: 0;
  }

  .table--responsive td::before,
  .table--responsive tbody th::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
  }

  .table--responsive td:not([data-label])::before,
  .table--responsive td[data-label=""]::before {
    content: none;
  }

  .table--responsive td[data-label=""] {
    justify-content: flex-end;
  }

  .table--responsive td:first-child {
    padding-top: 0;
    font-weight: 600;
  }
}

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.ml-2 { margin-left: var(--space-2); }
.is-size-7 { font-size: 0.8125rem; }
.mono { font-family: var(--font-mono); }
.has-text-grey { color: var(--text-muted); }
.has-text-weight-semibold { font-weight: 600; }
.has-text-weight-bold { font-weight: 700; }
.has-text-centered { text-align: center; }
.has-background-light { background: var(--bg-elevated); }
.is-inline-block { display: inline-block; }
.is-flex { display: flex; }
.is-justify-content-space-between { justify-content: space-between; }
.is-align-items-center { align-items: center; }
