/*
 * KARI 재물조사 운영관리 UI
 * Mobile-first, dependency-free design system.
 */

:root {
  color-scheme: light;
  --navy-950: #071a2c;
  --navy-900: #0b243d;
  --navy-800: #123655;
  --navy-700: #194a70;
  --teal-700: #087b78;
  --teal-600: #079795;
  --teal-500: #10aaa7;
  --teal-100: #d9f5f2;
  --teal-50: #effbfa;
  --blue-700: #175cd3;
  --blue-100: #dbeafe;
  --green-700: #087443;
  --green-100: #d9f5e7;
  --amber-800: #92400e;
  --amber-600: #d97706;
  --amber-100: #fef0c7;
  --red-800: #991b1b;
  --red-700: #b42318;
  --red-100: #fee4e2;
  --gray-950: #101828;
  --gray-800: #1d2939;
  --gray-700: #344054;
  --gray-600: #475467;
  --gray-500: #667085;
  --gray-400: #98a2b3;
  --gray-300: #d0d5dd;
  --gray-200: #e4e7ec;
  --gray-100: #f2f4f7;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --surface: #ffffff;
  --page: #f3f7fa;
  --border: #d9e2ea;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.08);
  --shadow-md: 0 8px 24px rgb(7 26 44 / 0.12);
  --shadow-lg: 0 20px 48px rgb(7 26 44 / 0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --topbar-height: 60px;
  --bottom-nav-height: 68px;
  --content-max: 1180px;
  --focus: 0 0 0 3px rgb(16 170 167 / 0.3);
  --font-sans: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html {
  min-width: 320px;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--gray-950);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.has-open-modal {
  overflow: hidden;
}

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

button,
[role="button"],
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

a {
  color: var(--blue-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

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

h1,
h2,
h3 {
  color: var(--navy-950);
  line-height: 1.3;
}

:focus-visible {
  border-radius: 4px;
  outline: 3px solid rgb(16 170 167 / 0.42);
  outline-offset: 2px;
}

::selection {
  background: var(--teal-100);
  color: var(--navy-950);
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--navy-950);
  color: var(--white);
  font-weight: 800;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.is-hidden,
[hidden] {
  display: none !important;
}

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

.app-main {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 18px 16px calc(var(--bottom-nav-height) + 30px + env(safe-area-inset-bottom));
}

/* Current PHP view compatibility: .main-content is the server-rendered shell. */
.main-content {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 18px 16px calc(var(--bottom-nav-height) + 30px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  z-index: 500;
  top: 0;
  min-height: var(--topbar-height);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgb(255 255 255 / 0.12);
  background: rgb(7 26 44 / 0.97);
  color: var(--white);
  box-shadow: 0 2px 12px rgb(7 26 44 / 0.18);
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 14px;
  padding-left: 14px;
}

.topbar > div:first-child:not(.topbar__inner) {
  min-width: 0;
}

.topbar-subtitle {
  overflow: hidden;
  max-width: 58vw;
  margin: 1px 0 0;
  color: #acd0e3;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__inner {
  display: flex;
  width: min(100%, var(--content-max));
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 8px 14px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 11px;
  background: var(--teal-500);
  color: var(--navy-950);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.brand__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__eyebrow {
  display: block;
  color: #acdeda;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.identity-chip {
  display: inline-flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.08);
  color: var(--white);
}

.identity-chip > span:last-child {
  display: grid;
  min-width: 0;
}

.identity-chip strong,
.identity-chip small {
  overflow: hidden;
  max-width: 94px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-chip strong {
  font-size: 12px;
}

.identity-chip small {
  color: #acd0e3;
  font-size: 10px;
}

.identity-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #43d17e;
  box-shadow: 0 0 0 3px rgb(67 209 126 / 0.15);
}

.topbar__button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.09);
  color: var(--white);
}

.topbar__button:hover {
  background: rgb(255 255 255 / 0.16);
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 20px;
}

.desktop-nav a {
  min-height: 44px;
  padding: 11px 13px;
  border-radius: 10px;
  color: #d7e4ed;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.desktop-nav a:hover,
.desktop-nav a[aria-current="page"],
.desktop-nav a.is-active {
  background: rgb(16 170 167 / 0.2);
  color: var(--white);
}

.connection-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.08);
  color: #d9f5e7;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.connection-pill::before,
.status-dot::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #43d17e;
  box-shadow: 0 0 0 3px rgb(67 209 126 / 0.15);
  content: "";
}

.connection-pill.is-offline {
  border-color: rgb(254 228 226 / 0.28);
  background: rgb(180 35 24 / 0.24);
  color: #fee4e2;
}

.connection-pill.is-offline::before,
.status-dot.is-offline::before {
  background: #ff746b;
  box-shadow: 0 0 0 3px rgb(255 116 107 / 0.15);
}

.bottom-nav {
  position: fixed;
  z-index: 600;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(var(--nav-items, 5), minmax(0, 1fr));
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding: 6px max(6px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right));
  border-top: 1px solid var(--border);
  background: rgb(255 255 255 / 0.97);
  box-shadow: 0 -8px 28px rgb(7 26 44 / 0.08);
  backdrop-filter: blur(16px);
}

.bottom-nav__item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 4px 2px;
  border-radius: 12px;
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 760;
  text-decoration: none;
}

.bottom-nav__item:hover,
.bottom-nav__item.is-active,
.bottom-nav__item[aria-current="page"] {
  background: var(--teal-50);
  color: var(--teal-700);
}

.bottom-nav__item.is-active::after,
.bottom-nav__item[aria-current="page"]::after {
  position: absolute;
  bottom: 1px;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--teal-600);
  content: "";
}

.bottom-nav__icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.mobile-menu {
  position: fixed;
  z-index: 750;
  top: calc(var(--topbar-height) + env(safe-area-inset-top) + 8px);
  right: 12px;
  width: min(292px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-lg);
}

.mobile-menu a,
.mobile-menu button {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--gray-800);
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

.mobile-menu a:hover,
.mobile-menu button:hover {
  background: var(--gray-100);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.page-header__title {
  margin-bottom: 4px;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.page-header__subtitle {
  margin: 0;
  color: var(--gray-600);
  font-size: 14px;
}

.page-header__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--teal-700);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section {
  margin-top: 22px;
}

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

.section__title {
  margin: 0;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.section__meta {
  color: var(--gray-500);
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack--sm {
  gap: 8px;
}

.stack--lg {
  gap: 18px;
}

.cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card__header,
.card__body,
.card__footer {
  padding: 15px;
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
}

.card__description {
  margin: 3px 0 0;
  color: var(--gray-600);
  font-size: 13px;
}

.card__footer {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.hero-status {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid #174a70;
  border-radius: var(--radius-lg);
  background: var(--navy-900);
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.hero-status::after {
  position: absolute;
  top: -72px;
  right: -56px;
  width: 180px;
  height: 180px;
  border: 32px solid rgb(16 170 167 / 0.13);
  border-radius: 50%;
  content: "";
}

.hero-status h1,
.hero-status h2,
.hero-status h3 {
  position: relative;
  z-index: 1;
  color: var(--white);
}

.hero-status__label {
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
  color: #9ed9d5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.hero-status__value {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(25px, 7vw, 38px);
  font-weight: 950;
  letter-spacing: -0.05em;
}

.hero-status__meta {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: #d7e4ed;
  font-size: 13px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-card__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 750;
}

.kpi-card__value {
  display: block;
  overflow: hidden;
  color: var(--navy-950);
  font-size: clamp(23px, 7vw, 34px);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.kpi-card__unit {
  margin-left: 2px;
  color: var(--gray-500);
  font-size: 12px;
  font-weight: 700;
}

.kpi-card__delta {
  display: block;
  margin-top: 5px;
  color: var(--gray-500);
  font-size: 11px;
}

.kpi-card--primary {
  border-color: #9ed9d5;
  background: var(--teal-50);
}

.kpi-card--success .kpi-card__value {
  color: var(--green-700);
}

.kpi-card--warning .kpi-card__value {
  color: var(--amber-800);
}

.kpi-card--danger .kpi-card__value {
  color: var(--red-700);
}

.device-grid {
  display: grid;
  gap: 12px;
}

.device-card {
  --device-accent: var(--navy-900);
  --device-tint: var(--gray-50);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--device-tint) 0, var(--white) 108px);
  box-shadow: inset 0 3px 0 var(--device-accent), var(--shadow-sm);
}

.device-card--pc-02 {
  --device-accent: #175cd3;
  --device-tint: #eff4ff;
}

.device-card--pc-03 {
  --device-accent: #087443;
  --device-tint: #ecfdf3;
}

.device-card--pc-05 {
  --device-accent: #b54708;
  --device-tint: #fff7ed;
}

.device-card--pc-08 {
  --device-accent: #6941c6;
  --device-tint: #f4f3ff;
}

.device-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--gray-400);
  content: "";
}

.device-card.is-safe::before,
.device-card.is-complete::before {
  background: var(--green-700);
}

.device-card.is-warning::before,
.device-card.is-pending::before {
  background: var(--amber-600);
}

.device-card.is-danger::before,
.device-card.is-blocked::before {
  background: var(--red-700);
}

.device-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px 18px;
}

.device-card__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.device-card__number {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--device-accent);
  color: var(--white);
  font-size: 14px;
  font-weight: 900;
}

.device-card__title {
  margin: 0;
  color: var(--device-accent);
  font-size: 16px;
  font-weight: 850;
}

.device-card__owner {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--gray-500);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 14px 12px 18px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
}

.device-stat {
  min-width: 0;
  padding: 10px 12px;
}

.device-stat + .device-stat {
  border-left: 1px solid var(--gray-200);
}

.device-stat__label {
  display: block;
  margin-bottom: 2px;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 700;
}

.device-stat__value {
  display: block;
  color: var(--navy-950);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.25;
}

.device-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px 13px 18px;
  color: var(--gray-500);
  font-size: 12px;
}

.device-card__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px 14px 18px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.device-card__actions .btn--secondary {
  border-color: var(--device-accent);
  color: var(--device-accent);
}

.status-badge,
.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.badge--success,
.status-badge.is-success,
.status-badge.is-safe {
  border-color: #a9dfc1;
  background: var(--green-100);
  color: var(--green-700);
}

.badge--warning,
.status-badge.is-warning,
.status-badge.is-pending {
  border-color: #f4cf76;
  background: var(--amber-100);
  color: var(--amber-800);
}

.badge--danger,
.status-badge.is-danger,
.status-badge.is-blocked {
  border-color: #f3b7b2;
  background: var(--red-100);
  color: var(--red-800);
}

.badge--info,
.status-badge.is-info {
  border-color: #b6cffb;
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge--teal {
  border-color: #9ed9d5;
  background: var(--teal-100);
  color: var(--teal-700);
}

.alert {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid #b6cffb;
  border-radius: var(--radius-md);
  background: #eff6ff;
  color: #153e75;
}

.alert__icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: currentColor;
  color: var(--white);
  font-size: 12px;
  font-weight: 900;
}

.alert__title {
  margin: 0 30px 2px 0;
  color: inherit;
  font-size: 14px;
  font-weight: 850;
}

.alert__message {
  margin: 0;
  font-size: 13px;
}

.alert__close {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: currentColor;
  font-size: 20px;
}

.alert--success {
  border-color: #a9dfc1;
  background: #ecfdf3;
  color: #075b35;
}

.alert--warning {
  border-color: #f4cf76;
  background: #fffaeb;
  color: #7a2e0e;
}

.alert--danger {
  border-color: #f3b7b2;
  background: #fff1f0;
  color: #8f1711;
}

.offline-banner {
  position: sticky;
  z-index: 490;
  top: calc(var(--topbar-height) + env(safe-area-inset-top));
  display: none;
  padding: 8px 14px;
  background: var(--amber-100);
  color: #6e2b0b;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.offline-banner.is-visible {
  display: block;
}

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--navy-900);
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: var(--navy-800);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  box-shadow: var(--focus);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn--primary {
  background: var(--teal-700);
}

.btn--primary:hover {
  background: #066663;
}

.btn--secondary {
  border-color: var(--gray-300);
  background: var(--white);
  color: var(--gray-800);
}

.btn--secondary:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.btn--danger {
  background: var(--red-700);
}

.btn--danger:hover {
  background: #941d14;
}

.btn--warning {
  background: var(--amber-600);
  color: #211006;
}

.btn--ghost {
  background: transparent;
  color: var(--navy-800);
}

.btn--ghost:hover {
  background: var(--gray-100);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 38px;
  padding: 7px 11px;
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  background: var(--white);
  color: var(--gray-700);
}

.form-grid {
  display: grid;
  gap: 15px;
}

.form-group {
  min-width: 0;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 800;
}

.form-label__optional {
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 600;
}

.form-control,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  background: var(--white);
  color: var(--gray-950);
  font-size: 16px;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgb(16 24 40 / 0.03);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.form-control:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--gray-400);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--teal-600);
  outline: 0;
  box-shadow: var(--focus);
}

.form-control[aria-invalid="true"],
.form-select[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
  border-color: var(--red-700);
}

.form-control:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

.form-textarea {
  min-height: 112px;
  resize: vertical;
}

.form-help,
.form-error {
  margin: 5px 0 0;
  color: var(--gray-500);
  font-size: 12px;
}

.form-error {
  color: var(--red-700);
  font-weight: 700;
}

.context-help-toggle {
  display: inline-grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  margin-left: 7px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--gray-300);
  border-radius: 50%;
  background: var(--white);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  vertical-align: 0.16em;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.context-help-toggle:hover,
.context-help-toggle[aria-expanded="true"] {
  border-color: var(--teal-600);
  background: var(--teal-50);
  color: var(--teal-700);
}

.context-help-toggle:focus-visible {
  border-color: var(--teal-600);
  outline: 0;
  box-shadow: var(--focus);
}

.form-label.has-context-help {
  justify-content: flex-start;
}

.form-label.has-context-help .form-label__optional {
  margin-left: auto;
}

.login-card__title .context-help-toggle {
  border-color: rgb(255 255 255 / 0.38);
  background: rgb(255 255 255 / 0.12);
  color: var(--white);
  box-shadow: none;
}

.login-card__title .context-help-toggle:hover,
.login-card__title .context-help-toggle[aria-expanded="true"] {
  border-color: var(--white);
  background: rgb(255 255 255 / 0.22);
  color: var(--white);
}

.context-help-popover {
  position: fixed;
  z-index: 1200;
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  padding: 11px 13px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  background: var(--white);
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
  box-shadow: var(--shadow-lg);
}

.context-help-popover[hidden] {
  display: none;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  min-width: 0;
  border-radius: 10px 0 0 10px;
}

.input-group .btn,
.input-group .input-addon {
  flex: 0 0 auto;
  border-radius: 0 10px 10px 0;
}

.input-addon {
  display: inline-flex;
  min-width: 48px;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid var(--gray-300);
  border-left: 0;
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 750;
}

.check-row {
  display: flex;
  min-height: 44px;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  color: var(--gray-800);
  font-size: 14px;
  font-weight: 650;
}

.check-row input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--teal-700);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(var(--segments, 2), minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--gray-100);
}

.segmented-control a,
.segmented-control button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.segmented-control .is-active,
.segmented-control [aria-selected="true"] {
  background: var(--white);
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
}

.search-bar {
  position: relative;
}

.search-bar .form-control {
  padding-right: 48px;
}

.search-bar__button {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--teal-700);
  font-weight: 900;
}

.count-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #9ed9d5;
  border-radius: 11px;
  background: var(--teal-50);
}

.count-summary__label {
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 800;
}

.count-summary__value {
  color: var(--navy-950);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.data-table td {
  color: var(--gray-800);
}

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

.data-table tbody tr:hover {
  background: #fbfefe;
}

.data-table .number {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.data-table .primary-cell {
  color: var(--navy-950);
  font-weight: 800;
}

.list-card {
  display: block;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  color: inherit;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.list-card:hover {
  border-color: #9ed9d5;
  box-shadow: 0 4px 16px rgb(7 123 120 / 0.1);
}

.list-card__title {
  margin: 0;
  color: var(--navy-950);
  font-size: 15px;
  font-weight: 850;
}

.list-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 5px;
  color: var(--gray-500);
  font-size: 12px;
}

.schedule-date-nav,
.schedule-date-form {
  display: flex;
  align-items: center;
  gap: 7px;
}

.schedule-date-nav {
  flex-wrap: wrap;
}

.schedule-date-form .form-control {
  width: auto;
  min-width: 148px;
}

.preferred-schedule {
  border-color: #9ed9d5;
  box-shadow: 0 6px 22px rgb(7 123 120 / 0.08);
}

.preferred-visit-list {
  display: grid;
  gap: 10px;
}

.preferred-visit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--teal-50), var(--white) 58%);
}

.preferred-visit-card__main {
  min-width: 0;
}

.preferred-visit-card__main .eyebrow {
  margin-bottom: 2px;
}

.preferred-visit-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.preferred-visit-card__title a {
  color: var(--navy-950);
  text-decoration: none;
}

.preferred-visit-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin-top: 5px;
  color: var(--gray-600);
  font-size: 12px;
}

.preferred-visit-card__count {
  display: grid;
  min-width: 62px;
  justify-items: end;
}

.preferred-visit-card__count small {
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 750;
}

.preferred-visit-card__count strong {
  color: var(--amber-800);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.15;
}

.preferred-visit-card__actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: flex-end;
}

.schedule-create {
  overflow: hidden;
}

.schedule-create__summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  color: var(--navy-950);
  list-style: none;
  cursor: pointer;
}

.schedule-create__summary::-webkit-details-marker {
  display: none;
}

.schedule-create__summary::after {
  color: var(--teal-700);
  content: "+";
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.schedule-create[open] .schedule-create__summary {
  border-bottom: 1px solid var(--gray-200);
}

.schedule-create[open] .schedule-create__summary::after {
  content: "−";
}

.schedule-create__summary span {
  margin-left: auto;
  color: var(--gray-500);
  font-size: 12px;
}

@media (min-width: 760px) {
  .preferred-visit-card {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .preferred-visit-card__actions {
    grid-column: auto;
  }
}

.progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
}

.progress__bar {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--teal-600);
  transition: width 240ms ease;
}

.progress--warning .progress__bar {
  background: var(--amber-600);
}

.progress--danger .progress__bar {
  background: var(--red-700);
}

.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 18px;
}

.timeline__item::before {
  position: absolute;
  top: 18px;
  bottom: 0;
  left: 10px;
  width: 2px;
  background: var(--gray-200);
  content: "";
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item:last-child::before {
  display: none;
}

.timeline__dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin: 4px 0 0 5px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--teal-600);
  box-shadow: 0 0 0 2px var(--teal-600);
}

.timeline__title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.timeline__meta {
  margin: 2px 0 0;
  color: var(--gray-500);
  font-size: 12px;
}

.empty-state {
  padding: 36px 18px;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-600);
  text-align: center;
}

.empty-state__mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 16px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 21px;
  font-weight: 900;
}

.empty-state__title {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 850;
}

.empty-state__text {
  max-width: 420px;
  margin: 0 auto;
  font-size: 13px;
}

.sync-gate {
  overflow: hidden;
  border: 2px solid var(--red-700);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: 0 10px 32px rgb(180 35 24 / 0.12);
}

.sync-gate.is-safe {
  border-color: var(--green-700);
  box-shadow: 0 10px 32px rgb(8 116 67 / 0.1);
}

.sync-gate__header {
  padding: 15px;
  background: var(--red-700);
  color: var(--white);
}

.sync-gate.is-safe .sync-gate__header {
  background: var(--green-700);
}

.sync-gate__title {
  margin: 0;
  color: inherit;
  font-size: 17px;
  font-weight: 900;
}

.sync-gate__body {
  padding: 15px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.comparison-cell {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
}

.comparison-cell__label {
  display: block;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 750;
}

.comparison-cell__value {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--navy-950);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-overflow: ellipsis;
}

.comparison-cell.is-match {
  border-color: #a9dfc1;
  background: #ecfdf3;
}

.comparison-cell.is-mismatch {
  border-color: #f3b7b2;
  background: #fff1f0;
}

.login-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 24px 16px;
  background: var(--navy-950);
}

.login-card {
  width: min(100%, 420px);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.13);
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.28);
}

.login-card__brand {
  position: relative;
  overflow: hidden;
  padding: 28px 24px;
  background: var(--navy-900);
  color: var(--white);
}

.login-card__brand::after {
  position: absolute;
  right: -60px;
  bottom: -75px;
  width: 180px;
  height: 180px;
  border: 30px solid rgb(16 170 167 / 0.18);
  border-radius: 50%;
  content: "";
}

.login-card__title {
  position: relative;
  z-index: 1;
  margin: 14px 0 6px;
  color: var(--white);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.login-card__subtitle {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #c8d8e4;
  font-size: 13px;
}

.login-card__body {
  padding: 24px;
}

.google-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  background: var(--white);
  color: var(--gray-800);
  font-size: 15px;
  font-weight: 750;
  box-shadow: var(--shadow-sm);
}

.google-button:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.avatar {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 900;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal,
dialog.modal {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--gray-950);
  box-shadow: var(--shadow-lg);
}

dialog.modal::backdrop {
  background: rgb(7 26 44 / 0.68);
  backdrop-filter: blur(3px);
}

.modal:not(dialog) {
  position: fixed;
  z-index: 1000;
  top: 50%;
  left: 50%;
  display: none;
  transform: translate(-50%, -50%);
}

.modal:not(dialog).is-open {
  display: block;
}

.modal-backdrop {
  position: fixed;
  z-index: 990;
  inset: 0;
  background: rgb(7 26 44 / 0.68);
  backdrop-filter: blur(3px);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
}

.modal__title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.modal__close {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  margin: -8px -8px 0 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gray-600);
  font-size: 24px;
}

.modal__close:hover {
  background: var(--gray-100);
}

.modal__body {
  padding: 0 18px 18px;
  color: var(--gray-700);
}

.modal__footer {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.danger-summary {
  padding: 12px 13px;
  border-left: 4px solid var(--red-700);
  border-radius: 8px;
  background: var(--red-100);
  color: var(--red-800);
  font-size: 13px;
  font-weight: 700;
}

.toast-region {
  position: fixed;
  z-index: 1500;
  right: 12px;
  bottom: calc(var(--bottom-nav-height) + 14px + env(safe-area-inset-bottom));
  left: 12px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: min(100%, 440px);
  margin-left: auto;
  padding: 11px 12px;
  border: 1px solid #264866;
  border-radius: 11px;
  background: var(--navy-900);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 700;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal-500);
  content: "";
}

.toast.is-success::before {
  background: #43d17e;
}

.toast.is-warning::before {
  background: #fdb022;
}

.toast.is-danger::before,
.toast.is-error::before {
  background: #ff746b;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.toast__close {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d7e4ed;
  font-size: 19px;
}

.toast__close:hover {
  background: rgb(255 255 255 / 0.1);
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 7px;
  border: 1px solid var(--gray-300);
  border-radius: 9px;
  background: var(--white);
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.pagination .is-current,
.pagination [aria-current="page"] {
  border-color: var(--teal-700);
  background: var(--teal-700);
  color: var(--white);
}

.muted {
  color: var(--gray-500) !important;
}

.text-success {
  color: var(--green-700) !important;
}

.text-warning {
  color: var(--amber-800) !important;
}

.text-danger {
  color: var(--red-700) !important;
}

.text-right {
  text-align: right !important;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.nowrap {
  white-space: nowrap;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Server status names map to the same visual severity. */
.status-badge.status-ready,
.status-badge.status-sync-allowed,
.status-badge.status-available,
.status-badge.status-completed,
.status-badge.status-verified,
.status-badge.status-sent,
.status-badge.status-success,
.status-badge.status-closed {
  border-color: #a9dfc1;
  background: var(--green-100);
  color: var(--green-700);
}

.status-badge.status-needs-baseline,
.status-badge.status-in-field,
.status-badge.status-upload-pending,
.status-badge.status-scheduled,
.status-badge.status-in-progress,
.status-badge.status-partial,
.status-badge.status-draft,
.status-badge.status-claimed,
.status-badge.status-in-use {
  border-color: #f4cf76;
  background: var(--amber-100);
  color: var(--amber-800);
}

.status-badge.status-sync-blocked,
.status-badge.status-upload-failed,
.status-badge.status-revisit-required,
.status-badge.status-failed,
.status-badge.status-disabled {
  border-color: #f3b7b2;
  background: var(--red-100);
  color: var(--red-800);
}

.alert-success {
  border-color: #a9dfc1;
  background: #ecfdf3;
  color: #075b35;
}

.alert-warning {
  border-color: #f4cf76;
  background: #fffaeb;
  color: #7a2e0e;
}

.alert-danger,
.alert-error {
  border-color: #f3b7b2;
  background: #fff1f0;
  color: #8f1711;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal-600);
  transition: width 240ms ease;
}

.progress-label {
  display: block;
  margin-top: 4px;
  color: var(--gray-500);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 16px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 21px;
  font-weight: 900;
}

/* Direct-link navigation compatibility used by the PHP shell. */
.desktop-nav a.active {
  background: rgb(16 170 167 / 0.2);
  color: var(--white);
}

.bottom-nav > a {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 4px 2px;
  border-radius: 12px;
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 760;
  text-decoration: none;
}

.bottom-nav > a > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.bottom-nav > a > small {
  font-size: 11px;
  font-weight: inherit;
}

.bottom-nav > a:hover,
.bottom-nav > a.active {
  background: var(--teal-50);
  color: var(--teal-700);
}

.bottom-nav > a.active::after {
  position: absolute;
  bottom: 1px;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--teal-600);
  content: "";
}

@media (max-width: 699px) {
  .page-header {
    flex-direction: column;
  }

  .page-header__actions {
    width: 100%;
  }

  .page-header__actions .btn {
    flex: 1 1 0;
  }

  .data-table[data-responsive="cards"],
  .data-table[data-responsive="cards"] tbody,
  .data-table[data-responsive="cards"] tr,
  .data-table[data-responsive="cards"] td {
    display: block;
    width: 100%;
  }

  .data-table[data-responsive="cards"] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table[data-responsive="cards"] {
    padding: 8px;
  }

  .data-table[data-responsive="cards"] tbody tr {
    margin-bottom: 9px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--white);
  }

  .data-table[data-responsive="cards"] tbody tr:last-child {
    margin-bottom: 0;
  }

  .data-table[data-responsive="cards"] td {
    display: grid;
    grid-template-columns: minmax(88px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    text-align: right;
  }

  .data-table[data-responsive="cards"] td::before {
    color: var(--gray-500);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 800;
    text-align: left;
  }

  .data-table[data-responsive="cards"] td.primary-cell {
    padding-top: 12px;
    background: var(--gray-50);
    font-size: 15px;
  }

  .data-table[data-responsive="cards"] td[data-label=""],
  .data-table[data-responsive="cards"] td.actions {
    display: block;
    text-align: left;
  }

  .data-table[data-responsive="cards"] td[data-label=""]::before,
  .data-table[data-responsive="cards"] td.actions::before {
    display: none;
  }
}

@media (min-width: 560px) {
  .app-main {
    padding-right: 22px;
    padding-left: 22px;
  }

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

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

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

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

  .modal__footer {
    flex-direction: row;
    justify-content: flex-end;
  }

  .modal__footer .btn {
    min-width: 112px;
  }

  .toast-region {
    right: 18px;
    left: auto;
    width: 440px;
  }
}

@media (min-width: 880px) {
  :root {
    --topbar-height: 68px;
  }

  .app-main {
    padding-top: 26px;
    padding-bottom: 42px;
  }

  .desktop-nav {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .topbar__button[data-mobile-nav-toggle] {
    display: none;
  }

  .mobile-menu {
    display: none !important;
  }

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

  .card__header,
  .card__body,
  .card__footer {
    padding-right: 20px;
    padding-left: 20px;
  }

  .toast-region {
    bottom: 22px;
  }
}

@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;
  }
}

@media (forced-colors: active) {
  .device-card::before,
  .status-badge::before,
  .connection-pill::before,
  .progress__bar {
    background: CanvasText;
  }

  .btn,
  .bottom-nav__item,
  .status-badge,
  .connection-pill {
    forced-color-adjust: auto;
  }
}

@media print {
  .topbar,
  .bottom-nav,
  .mobile-menu,
  .page-header__actions,
  .btn,
  .toast-region,
  .offline-banner {
    display: none !important;
  }

  body,
  html {
    background: var(--white);
  }

  .app-main {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .card,
  .device-card,
  .table-wrap {
    break-inside: avoid;
    box-shadow: none;
  }
}

@media (min-width: 560px) {
  .main-content {
    padding-right: 22px;
    padding-left: 22px;
  }
}

@media (min-width: 880px) {
  .main-content {
    padding-top: 26px;
    padding-bottom: 42px;
  }
}

@media print {
  .main-content {
    width: 100%;
    max-width: none;
    padding: 0;
  }
}
