* {
  box-sizing: border-box;
}
.login {
  margin: 0;
  color: #173448;
  background: #eef4f5;
  font:
    16px/1.5 system-ui,
    sans-serif;
}
.login main {
  max-width: 450px;
  margin: clamp(32px, 12vh, 120px) auto;
  padding: 24px;
}
.login-brand {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -1.2px;
  color: #143a4b;
  margin-bottom: 28px;
}
.login-brand span {
  color: #16836d;
}
.login form {
  background: #fff;
  padding: clamp(20px, 5vw, 36px);
  border: 1px solid #d4e2e4;
  border-radius: 16px;
  box-shadow: 0 12px 36px #183d4c0d;
}
.login h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 24px;
}
.login label,
.login input,
.login button {
  display: block;
  width: 100%;
  font: inherit;
}
.login input {
  min-height: 48px;
  margin: 7px 0 18px;
  padding: 10px;
  border: 1px solid #a7bdc4;
  border-radius: 7px;
}
.login button {
  background: #116d60;
  color: white;
  border: 0;
  min-height: 48px;
  border-radius: 7px;
  font-weight: 650;
}
.login p:empty {
  display: none;
}
.menu-open,
.menu-close,
.scrim,
.mobile-expand {
  display: none;
}
.tablewrap td.row-actions {
  display: none;
}
.formgrid label span:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.formgrid input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex: none;
}
#sync-error {
  background: #fff2d5;
  color: #553a00;
  padding: 10px 18px;
}
#sync-error[hidden] {
  display: none;
}
.panel,
.grid > *,
.two > *,
.settings > *,
.toolbar > * {
  min-width: 0;
}
.app-sidebar .asidefoot button {
  display: block;
  margin-top: 10px;
  background: transparent;
  color: white;
  border: 1px solid #79939f;
  padding: 8px 16px;
  border-radius: 6px;
}
@media screen and (max-width: 800px) {
  .main {
    margin: 0;
    min-width: 0;
  }
  body.menu-visible {
    overflow: hidden;
  }
  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    height: 100dvh;
    z-index: 31;
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 3px;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }
  .menu-visible .app-sidebar {
    display: flex;
  }
  .app-sidebar .brand,
  .app-sidebar .navtitle,
  .app-sidebar .asidefoot {
    display: block;
  }
  .app-sidebar .nav {
    display: flex;
    min-height: 46px;
    font-size: 15px;
    width: 100%;
  }
  .app-sidebar .brand {
    padding: 10px 12px 15px;
  }
  .menu-open,
  .menu-close {
    display: inline-grid;
    place-items: center;
    border: 1px solid #adc4cb;
    background: #fff;
    color: #14364a;
    border-radius: 9px;
    min-width: 46px;
    min-height: 46px;
    font-size: 22px;
  }
  .menu-close {
    position: absolute;
    right: 12px;
    top: 16px;
  }
  .menu-visible .scrim {
    display: block;
    position: fixed;
    inset: 0;
    border: none;
    background: #0d253a77;
    z-index: 30;
  }
  .main .top {
    position: sticky;
    top: 0;
    min-height: 60px;
    height: auto;
    padding: 7px max(12px, env(safe-area-inset-right)) 7px
      max(12px, env(safe-area-inset-left));
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .top > div:first-of-type {
    flex: 1;
  }
  .top .actions {
    display: block;
  }
  .top .actions .btn {
    display: none;
  }
  .top #save-status {
    display: block;
    font-size: 11px;
    color: #176c5d;
    overflow-wrap: anywhere;
  }
  .main .content {
    padding: 18px max(12px, env(safe-area-inset-left))
      max(36px, env(safe-area-inset-bottom));
    width: 100%;
  }
  h1 {
    font-size: 26px;
  }
  .heading {
    display: block;
  }
  .heading .actions {
    margin-top: 12px;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .two,
  .settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .panel,
  .kpi {
    padding: 14px;
  }
  .btn,
  .link,
  .nav,
  select,
  input:not([type="checkbox"]):not([type="file"]),
  .mobile-expand {
    min-height: 44px;
  }
  .btn {
    white-space: normal;
    line-height: 1.25;
  }
  input:not([type="checkbox"]),
  textarea,
  select {
    font-size: 16px !important;
    max-width: 100%;
    min-width: 0;
  }
  .toolbar,
  .actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .toolbar input,
  .toolbar select {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
  .content .tablewrap,
  .dialog .tablewrap {
    max-height: none;
    overflow: visible;
    border: none;
    background: transparent;
  }
  .tablewrap table {
    width: 100%;
    min-width: 0;
    display: block;
  }
  .tablewrap thead {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .tablewrap tbody {
    display: grid;
    gap: 9px;
  }
  .tablewrap tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid #d6e2e6;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
  }
  .tablewrap tr td,
  .tablewrap tr td:first-child {
    position: static;
    min-width: 0;
    max-width: none !important;
    text-align: left;
    background: transparent;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    border: 0;
    padding: 5px 6px;
    display: block;
  }
  .tablewrap td:before {
    content: attr(data-label);
    display: block;
    color: #5e7380;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 600;
  }
  .tablewrap td.name,
  .tablewrap td.empty,
  .tablewrap td.wide-cell {
    grid-column: 1/-1;
  }
  .tablewrap td .link {
    min-height: 44px;
  }
  .tablewrap .compact-row:not(.expanded) .secondary-cell {
    display: none;
  }
  .mobile-expand {
    display: block;
    background: #eef5f4;
    color: #125f54;
    border: 0;
    border-radius: 6px;
    font-weight: 650;
    width: 100%;
    text-align: center;
  }
  .tablewrap td.row-actions {
    display: block;
    grid-column: 1/-1;
  }
  .tablewrap select {
    width: 100%;
  }
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .dialog {
    max-width: 100%;
    max-height: 96dvh;
    border-radius: 16px 16px 0 0;
    padding: 20px 14px max(30px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .dialog .settings {
    grid-template-columns: 1fr;
  }
  .toast {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: none;
  }
  .pager {
    flex-wrap: wrap;
  }
  #email-preview {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  #email-preview table {
    min-width: 0 !important;
    word-break: break-word;
  }
  .metric {
    gap: 10px;
  }
  .metric span {
    min-width: 0;
  }
}
@media print {
  .menu-open,
  .menu-close,
  .scrim,
  .mobile-expand,
  .row-actions,
  #sync-error {
    display: none !important;
  }
}
