:root {
  color-scheme: light;
  --bg: #eef3f1;
  --ink: #16202a;
  --muted: #60717b;
  --line: #d5e1dc;
  --panel: #ffffff;
  --brand: #20843f;
  --brand-dark: #12612b;
  --accent: #f2c230;
  --steel: #22313d;
  --danger: #c2410c;
  --danger-bg: #fff1e8;
  --warning: #9a6a00;
  --warning-bg: #fff6d4;
  --calm: #23627a;
  --calm-bg: #e5f3f5;
  --shadow: 0 24px 70px rgba(22, 32, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(242, 194, 48, 0.16), transparent 28rem),
    radial-gradient(circle at top left, rgba(32, 132, 63, 0.16), transparent 34rem),
    linear-gradient(135deg, #fbfcfb 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-checking .login-screen,
.auth-checking .app-shell {
  visibility: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(17, 27, 35, 0.88), rgba(17, 27, 35, 0.54) 38%, rgba(17, 27, 35, 0.14) 70%),
    linear-gradient(0deg, rgba(17, 27, 35, 0.62), rgba(17, 27, 35, 0.08) 55%),
    url("/login-photo.jpg") center center / cover no-repeat;
  isolation: isolate;
}

.login-layout {
  width: min(1120px, 100%);
  min-height: min(720px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.login-forms {
  display: grid;
  align-content: center;
}

.login-card {
  width: 100%;
  display: grid;
  gap: 12px;
  align-self: center;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 2px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  color: var(--ink);
}

.login-card .eyebrow {
  color: var(--brand-dark);
  opacity: 1;
}

.company-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: #ffffff;
}

.company-logo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.login-logo {
  min-height: 92px;
  padding: 12px 16px;
  border: 1px solid rgba(213, 225, 220, 0.96);
  box-shadow: 0 12px 34px rgba(22, 32, 42, 0.08);
}

.login-logo img {
  max-width: 285px;
}

.login-showcase {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}

.login-showcase img {
  display: none;
}

.login-showcase::before {
  content: none;
}

.login-showcase::after {
  content: none;
}

.login-showcase-content {
  min-height: 100%;
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 10px;
  padding: 30px 0 0;
  color: #ffffff;
  text-align: right;
}

.login-showcase-content h2 {
  max-width: 620px;
  margin: 0;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  font-size: clamp(2.3rem, 3.8vw, 3.7rem);
  line-height: 1.02;
  text-shadow: 0 18px 42px rgba(0, 0, 0, 0.52);
  white-space: normal;
}

.login-showcase-content p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.02rem;
  line-height: 1.55;
  font-weight: 700;
  text-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.showcase-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.showcase-stats span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  color: #ffffff;
  font-weight: 900;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.logo-chip {
  width: min(260px, 46vw);
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.logo-chip img {
  display: block;
  width: 100%;
  max-height: 70px;
  object-fit: contain;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark strong {
  font-size: 1.05rem;
  text-transform: uppercase;
}

.brand-mark small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 800;
}

.login-copy,
.login-hint {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-hint {
  font-size: 0.86rem;
}

.form-error {
  margin: 0;
  border: 1px solid rgba(194, 65, 12, 0.28);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9rem;
  line-height: 1.35;
  font-weight: 800;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.12);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
  overflow-x: clip;
}

.hero {
  position: relative;
  min-height: 250px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 24px;
  padding: 34px;
  border-radius: 28px;
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(46, 128, 74, 0.92), rgba(92, 170, 82, 0.78)),
    url("data:image/svg+xml,%3Csvg width='980' height='520' viewBox='0 0 980 520' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,.26)' stroke-width='2.5'%3E%3Cpath d='M76 374h210l52-96h245l58 96h260'/%3E%3Cpath d='M154 374v-74h92v74M694 374v-82h106v82'/%3E%3Cpath d='M442 266V112M442 112l-82 36M442 112l74 46M442 112l8-86'/%3E%3Cpath d='M80 146h190M80 188h142M80 230h212'/%3E%3Cpath d='M628 120h190M628 160h150M628 200h116'/%3E%3Cpath d='M318 405h336M360 438h252' stroke='rgba(242,194,48,.72)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 6px;
  background: linear-gradient(90deg, var(--brand), var(--accent), #ffffff);
}

.eyebrow {
  margin: 0 0 7px;
  color: inherit;
  opacity: 0.72;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.76rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.35rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-side {
  width: min(460px, 42vw);
  display: grid;
  gap: 14px;
  justify-items: end;
  align-self: stretch;
  align-content: start;
  text-align: right;
}

.hero-logo {
  width: min(330px, 100%);
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.32));
}

.hero-side p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 800;
}

.hero-actions,
.record-actions,
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.hero-actions button {
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), #58a83c);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.ghost-button {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.32);
}

.secondary-button {
  background: #edf5f4;
  color: var(--brand-dark);
}

.danger-button {
  color: var(--danger);
  background: var(--danger-bg);
}

.icon-button {
  width: 44px;
  padding: 0;
  color: var(--ink);
  background: #eef3f5;
}

.full {
  width: 100%;
}

.small-button {
  min-height: 38px;
  padding: 0 14px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.status-strip article,
.panel,
.record-card {
  border: 1px solid rgba(213, 225, 220, 0.96);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 36px rgba(16, 24, 32, 0.06);
}

.status-strip article {
  border-radius: 14px;
  padding: 18px;
  border-top: 4px solid var(--brand);
}

.status-strip span {
  display: block;
  margin-bottom: 4px;
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
}

.status-strip p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.status-strip .danger {
  background: var(--danger-bg);
  border-top-color: var(--danger);
}

.status-strip .warning {
  background: var(--warning-bg);
  border-top-color: var(--accent);
}

.status-strip .calm {
  background: var(--calm-bg);
  border-top-color: var(--calm);
}

.app-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  border-radius: 20px;
  padding: 22px;
}

.sidebar {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.side-nav,
.entity-list {
  display: grid;
  gap: 8px;
}

.side-nav {
  margin-bottom: 16px;
}

.side-nav-item,
.entity-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.side-nav-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-weight: 900;
}

.side-nav-item strong {
  display: none;
}

.side-nav-item strong.alert-count {
  min-width: 30px;
  min-height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fee2e2;
  color: #b42318;
  font-weight: 900;
}

.side-nav-item.active {
  border-color: rgba(32, 132, 63, 0.45);
  background: linear-gradient(135deg, #edf6ed, #ffffff);
  box-shadow: inset 4px 0 0 var(--brand);
}

.entity-button.active {
  border-color: rgba(32, 132, 63, 0.45);
  background: linear-gradient(135deg, #edf6ed, #ffffff);
  box-shadow: inset 4px 0 0 var(--brand);
}

.entity-button {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.entity-button span {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.entity-button small,
.empty-mini {
  color: var(--muted);
  font-weight: 700;
}

.empty-mini {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.main-panel {
  min-height: 420px;
}

.panel-heading,
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.entity-profile {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f8fbf8, #edf6ed);
  border: 1px solid var(--line);
}

.entity-profile h2 {
  margin-bottom: 6px;
  font-size: 1.55rem;
}

.entity-profile p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.group-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbf8;
}

.group-tabs.single {
  display: block;
  padding: 12px 14px;
  color: var(--brand-dark);
  font-weight: 900;
}

.group-tab {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.group-tab.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 8px 22px rgba(22, 32, 42, 0.08), inset 0 -3px 0 var(--accent);
}

.audit-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbf8;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
}

.audit-row strong {
  color: var(--steel);
}

.audit-row span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.audit-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.audit-row .danger-button {
  min-height: 34px;
  padding: 8px 10px;
  white-space: nowrap;
}

.account-details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.account-details summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.account-details .audit-list {
  margin-top: 10px;
}

.profile-form {
  width: min(560px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 32, 42, 0.58);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: grid;
  gap: 13px;
  padding: 22px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #31404a;
  font-size: 0.92rem;
  font-weight: 800;
}

.recipient-picker {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #f8fbf8;
}

.recipient-picker legend {
  padding: 0 6px;
  color: var(--steel);
  font-size: 0.9rem;
  font-weight: 900;
}

.recipient-list {
  display: grid;
  gap: 8px;
}

.recipient-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.recipient-option input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.recipient-option span {
  display: grid;
  gap: 2px;
}

.recipient-option small,
.field-hint {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.field-hint {
  margin: 0;
  line-height: 1.4;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfdfd;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #71827c;
  opacity: 1;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.search {
  width: min(260px, 100%);
}

.sms-banner {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border-left: 4px solid var(--brand);
  background: #edf6ed;
  color: #24482e;
  font-size: 0.92rem;
  line-height: 1.45;
}

.sms-banner.visible {
  display: block;
}

.records-list {
  display: grid;
  gap: 12px;
}

.record-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  border-radius: 14px;
  padding: 16px;
  min-width: 0;
}

.record-main {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.record-main > div:last-child {
  min-width: 0;
}

.badge {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #edf6ed;
  color: var(--brand-dark);
  font-weight: 900;
}

.record-card h3 {
  margin-bottom: 5px;
  font-size: 1.04rem;
  overflow-wrap: anywhere;
}

.meta,
.notes,
.record-date span {
  color: var(--muted);
}

.meta,
.notes {
  margin-bottom: 0;
  line-height: 1.45;
}

.record-date {
  text-align: right;
}

.record-date strong {
  display: block;
  font-size: 1.2rem;
}

.record-card.overdue {
  border-color: rgba(194, 65, 12, 0.32);
}

.record-card.urgent {
  border-color: rgba(161, 98, 7, 0.36);
}

.notes,
.record-actions {
  grid-column: 1 / -1;
}

.empty-state {
  display: none;
  padding: 36px 20px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state.visible {
  display: block;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  transform: translateY(120px);
  transition: transform 0.2s ease;
  border-radius: 12px;
  padding: 13px 16px;
  background: var(--steel);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast.visible {
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 36%);
    gap: 18px;
    padding: 28px;
  }

  .hero-logo {
    width: min(280px, 100%);
  }

  .app-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .panel {
    padding: 18px;
  }
}

@media (max-width: 900px) {
  .login-screen {
    padding: 18px;
    align-items: start;
  }

  .login-layout {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .login-forms {
    order: 2;
  }

  .login-showcase {
    order: 1;
    min-height: auto;
    border-radius: 20px;
  }

  .login-showcase-content {
    min-height: auto;
    justify-items: start;
    padding: 0;
    text-align: left;
  }

  .login-showcase-content h2 {
    font-size: clamp(1.8rem, 7vw, 3.1rem);
    white-space: normal;
  }

  .hero,
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .sidebar.panel {
    padding-bottom: 16px;
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(136px, 1fr));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .side-nav-item {
    min-width: 136px;
  }

  .entity-list {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .hero-side {
    width: 100%;
    justify-items: start;
    align-content: start;
    text-align: left;
  }

  .hero-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    align-self: start;
  }

  .status-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar,
  .entity-profile,
  .audit-row {
    align-items: stretch;
  }
}

@media (max-width: 620px) {
  body {
    background:
      linear-gradient(135deg, rgba(242, 194, 48, 0.12), transparent 18rem),
      linear-gradient(135deg, #fbfcfb 0%, var(--bg) 100%);
  }

  .login-screen {
    padding: 12px;
    align-items: start;
  }

  .login-layout {
    gap: 10px;
  }

  .login-card {
    margin-top: 10px;
    padding: 18px;
    border-radius: 16px;
    gap: 12px;
  }

  .login-card h1 {
    font-size: 2.25rem;
  }

  .login-logo {
    min-height: 88px;
    padding: 12px;
  }

  .login-showcase {
    min-height: auto;
    border-radius: 16px;
  }

  .login-showcase-content {
    padding: 4px 2px 0;
    gap: 9px;
  }

  .login-showcase-content h2 {
    font-size: 1.72rem;
    line-height: 1.04;
  }

  .login-showcase-content p:not(.eyebrow) {
    font-size: 0.9rem;
    line-height: 1.42;
  }

  .showcase-stats {
    gap: 6px;
  }

  .showcase-stats span {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .shell {
    width: 100%;
    padding: 0 0 18px;
  }

  .hero,
  .panel {
    border-radius: 0;
    padding: 16px;
  }

  .hero {
    min-height: auto;
    gap: 14px;
    align-items: start;
  }

  .hero h1 {
    margin-bottom: 8px;
    font-size: 2.35rem;
    line-height: 1;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .hero-side {
    gap: 10px;
  }

  .hero-side p {
    font-size: 0.88rem;
  }

  .hero-actions,
  .controls {
    width: 100%;
  }

  .hero-actions button,
  .controls input,
  .controls select {
    flex: 1 1 100%;
  }

  .hero-logo {
    width: min(230px, 74vw);
  }

  .status-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 8px;
  }

  .status-strip article {
    padding: 12px;
    border-radius: 12px;
  }

  .status-strip span {
    font-size: 1.55rem;
  }

  .status-strip p {
    font-size: 0.86rem;
  }

  .app-layout {
    gap: 10px;
  }

  .sidebar.panel,
  .main-panel {
    margin: 0 8px;
    border-radius: 16px;
  }

  .sidebar-head {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: -16px -16px 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 -2px 12px;
    overflow-x: visible;
  }

  .side-nav-item {
    min-width: 0;
    min-height: 46px;
    padding: 9px 10px;
  }

  .side-nav-item span {
    font-size: 0.92rem;
  }

  .entity-list {
    grid-template-columns: 1fr;
    max-height: 260px;
    overflow: auto;
    padding-right: 2px;
  }

  .toolbar,
  .panel-heading,
  .entity-profile,
  .audit-row {
    display: grid;
    gap: 12px;
  }

  .toolbar {
    margin-bottom: 12px;
  }

  .search {
    width: 100%;
  }

  .entity-profile {
    padding: 14px;
    border-radius: 14px;
  }

  .record-card {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .record-main {
    gap: 10px;
  }

  .badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .record-date {
    text-align: left;
  }

  .record-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .record-actions button,
  .record-actions select {
    width: 100%;
  }

  .group-tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .group-tab {
    width: 100%;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: min(92vh, 760px);
    border-radius: 18px 18px 0 0;
    padding: 18px;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }
}

@media (max-width: 380px) {
  .hero h1 {
    font-size: 2rem;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-nav-item {
    min-width: 0;
  }
}
