
/* =========================================================
   HOSTILE GLOBAL STYLES
   Intentionally retained for Shadow DOM isolation testing.
   ========================================================= */

* {
  font-family: Georgia, serif !important;
  color: #333;
}

button {
  background: hotpink !important;
  padding: 20px !important;
}

li {
  font-size: 22px;
}

body {
  margin: 0;
  background: #eef1f4;
}

nav {
  background: #2c3e50;
  padding: 14px 24px;
}

nav,
nav * {
  color: #fff;
}

main {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.card {
  background: #fff;
  padding: 16px;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

td,
th {
  border-bottom: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

/* =========================================================
   DESIGN TOKENS
   ========================================================= */

:root {
  --page: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e6ebf1;

  --navy: #172b4d;
  --text: #26364b;
  --muted: #77859a;

  --teal: #0f9488;
  --teal-dark: #0b766e;
  --teal-soft: #e5f6f3;

  --blue: #4277d4;
  --blue-soft: #edf3ff;

  --green: #18845b;
  --green-soft: #e7f7ef;

  --amber: #b7791f;
  --amber-soft: #fff5df;

  --red: #c2414b;
  --red-soft: #fff0f0;

  --subtle: #94a0b0;
  --text-secondary: #536278;
  --divider: #edf0f4;
  --track: #edf1f5;
  --row-hover: #f8fbfd;
  --topbar-bg: rgb(255 255 255 / 94%);
  --avatar-bg: #dcece9;
  --avatar-text: #176b64;
  --chip-bg: #edf2f8;
  --chip-text: #405c80;
  --status-blue-text: #3768bd;
  --status-amber-text: #a46c14;

  /* The sidebar stays dark in both themes */
  --sidebar: #172b4d;
  --sidebar-width: 248px;
  --sidebar-collapsed-width: 76px;

  --radius: 14px;
  --shadow: 0 2px 8px rgb(23 43 77 / 4%);
  --shadow-hover: 0 12px 28px rgb(23 43 77 / 8%);

  color-scheme: light;
}

/* Set on <html> by the inline script in index.html (saved choice, else OS setting) */
:root[data-theme="dark"] {
  --page: #0e1520;
  --surface: #161f2d;
  --surface-soft: #1b2636;
  --border: #253246;

  --navy: #e9eef6;
  --text: #cfd8e5;
  --muted: #8b99ad;
  --subtle: #6d7c91;
  --text-secondary: #a9b5c6;

  --teal: #14a597;
  --teal-dark: #5fd3c6;
  --teal-soft: rgb(20 165 151 / 16%);

  --blue: #6d9cf0;
  --blue-soft: rgb(109 156 240 / 15%);

  --green: #3fbf8a;
  --green-soft: rgb(63 191 138 / 15%);

  --amber: #e0a84a;
  --amber-soft: rgb(224 168 74 / 15%);

  --red: #ef7a82;
  --red-soft: rgb(239 122 130 / 14%);

  --divider: #212d3e;
  --track: #243146;
  --row-hover: #1a2433;
  --topbar-bg: rgb(22 31 45 / 92%);
  --avatar-bg: rgb(20 165 151 / 18%);
  --avatar-text: #7de1d6;
  --chip-bg: #222f45;
  --chip-text: #a9c1e6;
  --status-blue-text: #8fb4f5;
  --status-amber-text: #e9b866;

  --sidebar: #0a111b;

  --shadow: 0 2px 8px rgb(0 0 0 / 25%);
  --shadow-hover: 0 12px 28px rgb(0 0 0 / 35%);

  color-scheme: dark;
}

/* =========================================================
   BASE & HOST APPLICATION OVERRIDES
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
}

body .app-shell,
body .app-shell *,
body .device-gate,
body .device-gate * {
  font-family: Inter, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif !important;
  color: var(--text);
}

body .app-shell button {
  padding: 0 !important;
  border: 0;
  font: inherit;
  cursor: pointer;
}

body .app-shell li {
  font-size: inherit;
}

body .app-shell nav {
  padding: 0;
  background: transparent;
}

body .app-shell nav,
body .app-shell nav * {
  color: inherit;
}

body .app-shell a {
  color: inherit;
  text-decoration: none;
}

body .app-shell button:focus-visible,
body .app-shell a:focus-visible,
body .app-shell input:focus-visible {
  outline: 3px solid #69c8bd;
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 200ms ease;
}

/* Set on <html> by app.js; remembered across visits */
:root[data-sidebar="collapsed"] .app-layout {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

:root[data-sidebar="collapsed"] .sidebar {
  padding-inline: 12px;
}

:root[data-sidebar="collapsed"] .brand {
  justify-content: center;
  padding-inline: 0;
}

:root[data-sidebar="collapsed"] .brand-text,
:root[data-sidebar="collapsed"] .nav-label,
:root[data-sidebar="collapsed"] .nav-text,
:root[data-sidebar="collapsed"] .nav-count,
:root[data-sidebar="collapsed"] .sidebar-bottom {
  display: none;
}

:root[data-sidebar="collapsed"] .nav-item {
  justify-content: center;
  width: 44px;
  margin-inline: auto;
  padding: 0;
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 16px 18px;
  overflow-y: auto;
  background: var(--sidebar);
  z-index: 5;
}

body .app-shell .sidebar,
body .app-shell .sidebar * {
  color: #d4deec;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--teal);
  color: #fff !important;
  font-size: 23px;
  font-weight: 800;
}

.brand-name {
  color: #fff !important;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.6px;
}

.brand-caption {
  display: block;
  margin-top: 3px;
  color: #91a4bf !important;
  font-size: 11px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.nav-label {
  padding: 0 12px;
  margin: 8px 0 10px;
  color: #8295b0 !important;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body .app-shell .nav-list li {
  font-size: inherit;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 9px;
  color: #b9c8da !important;
  font-size: 13px;
  font-weight: 550;
  transition: background 180ms ease, color 180ms ease;
}

.nav-item:hover {
  background: rgb(255 255 255 / 7%);
  color: #fff !important;
}

.nav-item.active {
  background: rgb(255 255 255 / 10%);
  color: #fff !important;
  font-weight: 650;
}

body .app-shell .nav-item.active .nav-icon {
  color: #fff;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 20px;
  font-size: 17px;
}

.nav-count {
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 22px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: 6px;
  background: rgb(255 255 255 / 9%);
  color: #e1eaf5 !important;
  font-size: 10px;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 26px;
}

.support-card {
  padding: 15px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 12px;
  background: rgb(255 255 255 / 4%);
}

.support-title {
  margin-bottom: 6px;
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
}

.support-copy {
  color: #a9b9ce !important;
  font-size: 11px;
  line-height: 1.6;
}

.sidebar-footer {
  padding: 22px 10px 0;
  color: #8195b1 !important;
  font-size: 10px;
}

/* Topbar */

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 0 34px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
}

.breadcrumb {
  color: var(--muted) !important;
  font-size: 12px;
}

.breadcrumb strong {
  color: var(--text) !important;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

/* Show the icon for the theme you would switch to */
.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: contents;
}

.theme-toggle .icon-moon {
  display: contents;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 238px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
}

.search-icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--muted) !important;
}

.search-box:focus-within {
  border-color: var(--teal);
}

body .app-shell .search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text) !important;
  font-size: 12px;
}

.search-box input::placeholder {
  color: var(--subtle) !important;
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border) !important;
  border-radius: 9px;
  background: var(--surface) !important;
  font-size: 17px !important;
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--red);
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 15px;
  border-left: 1px solid var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text) !important;
  font-size: 12px;
  font-weight: 800;
}

.profile-name {
  color: var(--text) !important;
  font-size: 12px;
  font-weight: 700;
}

.profile-role {
  margin-top: 3px;
  color: var(--muted) !important;
  font-size: 10px;
}

/* Main content */

.page-content {
  /* Overrides the hostile `main { display: grid }` rule above. */
  display: block;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 32px 34px 48px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  animation: enter-up 500ms both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--teal-dark) !important;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #20a779;
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: pulse 2s ease-in-out infinite;
}

.page-title {
  margin: 0;
  color: var(--navy) !important;
  font-size: clamp(25px, 3vw, 32px);
  font-weight: 750;
  letter-spacing: -1.2px;
  line-height: 1.2;
}

.page-description {
  margin: 9px 0 0;
  color: var(--muted) !important;
  font-size: 13px;
  line-height: 1.6;
}

.date-label {
  margin-bottom: 3px;
  color: var(--muted) !important;
  font-size: 11px;
  text-align: right;
}

.date-value {
  color: var(--text) !important;
  font-size: 13px;
  font-weight: 650;
  text-align: right;
}

/* Metrics */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 17px;
  margin-bottom: 24px;
}

.metric-card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: enter-up 550ms both;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.metric-card:nth-child(1) { animation-delay: 70ms; }
.metric-card:nth-child(2) { animation-delay: 130ms; }
.metric-card:nth-child(3) { animation-delay: 190ms; }
.metric-card:nth-child(4) { animation-delay: 250ms; }

.metric-top,
.metric-footer,
.ward-info,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  color: var(--muted) !important;
  font-size: 12px;
  font-weight: 600;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 18px;
}

.metric-icon.teal { background: var(--teal-soft); }
.metric-icon.blue { background: var(--blue-soft); }
.metric-icon.amber { background: var(--amber-soft); }
.metric-icon.green { background: var(--green-soft); }

.metric-value {
  margin: 15px 0 8px;
  color: var(--navy) !important;
  font-size: 32px;
  font-weight: 760;
  letter-spacing: -1.4px;
  line-height: 1;
}

.metric-footer {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted) !important;
  font-size: 11px;
}

.metric-change {
  color: var(--green) !important;
  font-weight: 750;
}

.metric-change.neutral {
  color: var(--blue) !important;
}

/* Panels and headings */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  margin-bottom: 25px;
}

.panel {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: enter-up 600ms 220ms both;
}

.section-heading {
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  color: var(--navy) !important;
  font-size: 15px;
  font-weight: 750;
}

.section-subtitle {
  margin-top: 5px;
  color: var(--muted) !important;
  font-size: 11px;
}

.text-link {
  color: var(--teal-dark) !important;
  font-size: 11px;
  font-weight: 750;
}

/* Ward occupancy */

.occupancy-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 23px 0 25px;
  padding: 15px;
  border-radius: 11px;
  background: var(--surface-soft);
}

.occupancy-number {
  color: var(--navy) !important;
  font-size: 25px;
  font-weight: 760;
}

.occupancy-caption,
.ward-detail {
  margin-top: 5px;
  color: var(--muted) !important;
  font-size: 10px;
}

.occupancy-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green) !important;
  font-size: 10px;
  font-weight: 700;
}

.occupancy-rows {
  display: grid;
  gap: 22px;
}

.ward-row {
  display: grid;
  gap: 10px;
}

.ward-name {
  color: var(--text) !important;
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 20px;
  background: var(--track);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  transform-origin: left;
  animation: progress-in 900ms 350ms both;
}

.progress-fill.teal { background: var(--teal); }
.progress-fill.blue { background: var(--blue); }
.progress-fill.amber { background: #e6a23c; }
.progress-fill.red { background: #db646b; }

/* Activity feed */

.activity-list {
  display: grid;
  margin-top: 17px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--divider);
}

.activity-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.activity-icon.admission { background: var(--blue-soft); }
.activity-icon.discharge { background: var(--green-soft); }
.activity-icon.order { background: var(--amber-soft); }
.activity-icon.alert { background: var(--red-soft); }

.activity-body {
  min-width: 0;
  flex: 1;
}

.activity-title {
  margin: 1px 0 5px;
  color: var(--text) !important;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.activity-description {
  color: var(--muted) !important;
  font-size: 10px;
  line-height: 1.6;
}

.activity-time {
  flex-shrink: 0;
  color: var(--subtle) !important;
  font-size: 10px;
}

/* Patient table */

.table-panel {
  padding: 0;
  overflow: hidden;
  animation: enter-up 650ms 300ms both;
}

.table-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 23px;
}

.table-header-actions,
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

body .app-shell .table-filter {
  min-height: 35px;
  padding: 8px 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

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

body .app-shell table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

body .app-shell thead {
  background: var(--surface-soft);
}

body .app-shell th {
  padding: 13px 23px;
  border-bottom: 1px solid var(--border);
  color: var(--subtle) !important;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

body .app-shell td {
  padding: 15px 23px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-secondary) !important;
  font-size: 11px;
  white-space: nowrap;
}

body .app-shell tbody tr:hover {
  background: var(--row-hover);
}

body .app-shell tbody tr:last-child td {
  border-bottom: 0;
}

body .app-shell tbody tr[hidden] {
  display: none;
}

.patient-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}

.patient-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--chip-text) !important;
  font-size: 10px;
  font-weight: 800;
}

.patient-name {
  color: var(--text) !important;
  font-size: 11px;
  font-weight: 750;
}

.patient-id {
  margin-top: 4px;
  color: var(--subtle) !important;
  font-size: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 750;
}

.status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status.admitted {
  background: var(--blue-soft);
  color: var(--status-blue-text) !important;
}

.status.review {
  background: var(--amber-soft);
  color: var(--status-amber-text) !important;
}

.status.critical {
  background: var(--red-soft);
  color: var(--red) !important;
}

.status.stable {
  background: var(--green-soft);
  color: var(--green) !important;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 23px;
  border-top: 1px solid var(--border);
}

.table-count {
  color: var(--muted) !important;
  font-size: 10px;
}

.pagination {
  gap: 6px;
}

.page-number {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--border) !important;
  border-radius: 7px;
  background: var(--surface) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}

.page-number.current {
  border-color: var(--teal) !important;
  background: var(--teal) !important;
  color: #fff !important;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding-top: 25px;
  color: var(--subtle) !important;
  font-size: 10px;
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Animations */

@keyframes enter-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progress-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Responsive layouts */

@media (max-width: 1200px) {
  :root {
    --sidebar-width: 215px;
  }

  .topbar {
    padding: 0 24px;
  }

  .page-content {
    padding: 28px 24px 40px;
  }

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

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 13px 16px;
  }

  .brand {
    padding: 0;
  }

  .nav-label,
  .sidebar-bottom,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 5px;
    margin-top: 14px;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    min-height: 38px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .nav-icon,
  .nav-count {
    display: none;
  }

  .topbar {
    position: static;
    min-height: 65px;
    padding: 12px 18px;
  }

  .search-box {
    width: min(42vw, 220px);
  }

  .profile-details {
    display: none;
  }

  .profile {
    padding-left: 10px;
  }

  .page-content {
    padding: 24px 18px 32px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .date-block {
    display: none;
  }

  .metrics-grid {
    gap: 12px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 28px;
  }

  .panel {
    padding: 18px;
  }

  .table-panel {
    padding: 0;
  }

  .table-panel-header {
    padding: 18px;
  }

  body .app-shell th,
  body .app-shell td {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 9px;
  }

  .breadcrumb {
    font-size: 10px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .search-box {
    width: 125px;
    padding: 0 8px;
  }

  .search-box input {
    font-size: 10px !important;
  }

  .icon-button {
    width: 33px;
    height: 33px;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card {
    padding: 13px;
  }

  .metric-label {
    font-size: 10px;
  }

  .metric-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .metric-value {
    font-size: 25px;
  }

  .metric-footer {
    font-size: 9px;
  }

  .page-title {
    font-size: 25px;
  }

  .section-title {
    font-size: 14px;
  }

  .table-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-footer {
    flex-direction: column;
  }
}


/* Record observation */

.feed-panel {
  margin: 25px 0;
}

.feed-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

body .app-shell .feed-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

body .app-shell .feed-row[hidden] {
  display: none;
}

.feed-field {
  display: grid;
  gap: 6px;
}

.feed-label {
  color: var(--muted) !important;
  font-size: 11px;
  font-weight: 700;
}

body .app-shell .feed-field select,
body .app-shell .feed-field input {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text) !important;
  font-size: 12px;
  outline: none;
}

body .app-shell .feed-field select:focus,
body .app-shell .feed-field input:focus {
  border-color: var(--teal);
}

body .app-shell .feed-submit {
  justify-self: start;
  height: 38px;
  padding: 0 18px !important;
  border-radius: 9px;
  background: var(--teal) !important;
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
}

body .app-shell .feed-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.feed-status {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 12px;
}

.feed-status.ok {
  color: var(--green) !important;
}

.feed-status.error {
  color: var(--red) !important;
}

/* Small-screen gate: the dashboard needs at least a tablet-width screen */

.device-gate {
  display: none;
}

@media (max-width: 767px) {
  .app-shell {
    display: none;
  }

  .device-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    background: var(--sidebar);
  }

  .device-gate-card {
    max-width: 360px;
    padding: 32px 24px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-hover);
    text-align: center;
  }

  .device-gate-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    border-radius: 12px;
    background: var(--teal);
    color: #fff !important;
    font-size: 24px;
  }

  .device-gate-title {
    margin: 0 0 10px;
    color: var(--navy) !important;
    font-size: 20px;
    font-weight: 800;
  }

  .device-gate-copy {
    margin: 0;
    color: var(--muted) !important;
    font-size: 14px;
    line-height: 1.6;
  }
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
