:root {
  --bg: #eef4ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-soft: #f8fbff;
  --surface-tint: #eef6ff;
  --text: #172033;
  --text-soft: #31415f;
  --muted: #64748b;
  --line: rgba(37, 99, 235, 0.14);
  --line-strong: rgba(37, 99, 235, 0.24);
  --primary: #e53935;
  --primary-dark: #b42318;
  --primary-soft: #fff0ef;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eaf1ff;
  --violet: #7c3aed;
  --pink: #ff4d8d;
  --amber: #f97316;
  --saffron: #ff9800;
  --success: #16a34a;
  --danger: #e53935;
  --sidebar: #101827;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #e8eef2;
  --sidebar-muted: #91a1ab;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active: rgba(255, 255, 255, 0.11);
  --shadow-sm: 0 10px 28px rgba(23, 32, 51, 0.08);
  --shadow-md: 0 18px 44px rgba(37, 99, 235, 0.13);
  --shadow-lg: 0 28px 76px rgba(23, 32, 51, 0.2);
  --focus: 0 0 0 4px rgba(37, 99, 235, 0.14);
  --brand-gradient: linear-gradient(135deg, #e53935 0%, #f97316 46%, #2563eb 100%);
  --cool-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --warm-gradient: linear-gradient(135deg, #e53935 0%, #ff9800 100%);
  --radius: 8px;
  --sidebar-w: 270px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(37, 99, 235, 0.12) 0%, rgba(255, 255, 255, 0) 36%),
    linear-gradient(245deg, rgba(255, 77, 141, 0.1) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(180deg, #ffffff 0, var(--bg) 360px, #f7f9ff 100%);
  color: var(--text);
  font-family: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.68rem 0.78rem;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: var(--focus);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  accent-color: var(--accent);
}

label {
  display: grid;
  gap: 0.38rem;
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 0.82rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f2f6ff;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  color: var(--text-soft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

code,
.code-block {
  font-family: Consolas, Monaco, monospace;
}

.app-shell {
  min-height: 100vh;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0) 36%),
    linear-gradient(180deg, #101827 0%, #0b1323 100%);
  color: var(--sidebar-text);
}

.sidebar-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 54px;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.45rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--radius);
  background: var(--brand-gradient);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 14px 30px rgba(229, 57, 53, 0.28);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.25;
}

.brand strong {
  color: #f8fafc;
  font-size: 0.98rem;
}

.brand small {
  margin-top: 0.1rem;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

.brand-auth strong {
  color: var(--text);
}

.brand-auth small {
  color: var(--muted);
}

.sidebar-caption {
  margin: 0.35rem 0.5rem 0.65rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--sidebar-line);
  color: var(--sidebar-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 0.18rem;
}

.nav-list a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0.62rem 0.75rem;
  border-radius: var(--radius);
  color: #b7c4cc;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 650;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-list a.active {
  background: linear-gradient(135deg, rgba(229, 57, 53, 0.96), rgba(249, 115, 22, 0.92));
  color: #fff;
  box-shadow: 0 12px 28px rgba(229, 57, 53, 0.22);
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 0.75rem;
  border-top: 1px solid var(--sidebar-line);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.sidebar-avatar,
.user-pill > span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eaf1ff, #fff0ef);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-info strong,
.sidebar-user-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-info strong {
  color: #fff;
  font-size: 0.86rem;
}

.sidebar-user-info small {
  color: var(--sidebar-muted);
  font-size: 0.75rem;
}

.sidebar-logout {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5db;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.sidebar-logout:hover {
  background: rgba(201, 37, 29, 0.18);
  color: #fff;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(15, 24, 32, 0.45);
}

.main-panel {
  width: 100%;
  min-width: 0;
  max-width: 1580px;
  margin: 0 auto;
  padding: 1.1rem 1.2rem 2.5rem;
}

.topbar {
  position: sticky;
  top: 1rem;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  margin-bottom: 1rem;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.page-title {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.page-kicker {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 40px;
  padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
}

.user-pill strong,
.user-pill small {
  display: block;
  line-height: 1.2;
}

.user-pill strong {
  color: var(--text);
  font-size: 0.86rem;
}

.user-pill small {
  color: var(--muted);
  font-size: 0.74rem;
}

.icon-button {
  display: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  padding: 9px;
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2.5px 0;
  border-radius: 2px;
  background: var(--text);
}

.panel,
.stat-card,
.auth-panel,
.install-panel {
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.panel {
  margin-bottom: 1rem;
  padding: 1.1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h2,
.panel h3,
.panel h4,
.panel-header h2,
.panel-header p {
  margin-top: 0;
}

.panel h2,
.panel-header h2 {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.25;
}

.panel > h2 {
  margin-bottom: 1rem;
}

.page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(23, 32, 51, 0.96), rgba(37, 99, 235, 0.88)),
    linear-gradient(135deg, rgba(229, 57, 53, 0.22), rgba(249, 115, 22, 0.18));
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.dashboard-hero-copy {
  display: grid;
  align-content: center;
  gap: 0.8rem;
  min-width: 0;
  padding: 1.3rem;
}

.dashboard-hero-copy .page-kicker {
  color: #ffb86b;
}

.dashboard-hero-copy h2,
.dashboard-hero-copy p {
  margin: 0;
}

.dashboard-hero-copy h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.7rem);
  line-height: 1.05;
}

.dashboard-hero-copy p {
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.dashboard-hero-panel {
  display: grid;
  align-content: stretch;
  gap: 0.75rem;
  min-width: 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(14px);
}

.hero-meter,
.hero-stat-strip {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
}

.hero-meter {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
}

.hero-meter span,
.hero-stat-strip dt {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-meter strong {
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 0.95;
}

.hero-meter div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.hero-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb86b, #ff4d8d, #7c3aed);
}

.hero-stat-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem 1rem;
  margin: 0;
  padding: 1rem;
}

.hero-stat-strip dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 950;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dashboard-metric-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.stat-card {
  position: relative;
  min-height: 122px;
  overflow: hidden;
  padding: 1rem;
  border-top: 4px solid var(--card-accent, var(--accent));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.78)),
    linear-gradient(135deg, var(--card-accent, var(--accent)), rgba(255, 255, 255, 0) 58%);
}

.card-grid .stat-card:nth-child(4n + 1) {
  --card-accent: var(--accent);
}

.card-grid .stat-card:nth-child(4n + 2) {
  --card-accent: var(--violet);
}

.card-grid .stat-card:nth-child(4n + 3) {
  --card-accent: var(--primary);
}

.card-grid .stat-card:nth-child(4n + 4) {
  --card-accent: var(--amber);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 54px;
  height: 30px;
  border: 8px solid rgba(37, 99, 235, 0.1);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.stat-card span {
  display: block;
  color: var(--card-accent, var(--accent));
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin: 0.45rem 0 0.22rem;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  line-height: 1;
}

.stat-card small {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.58rem 1rem;
  cursor: pointer;
  color: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.button-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 14px 30px rgba(229, 57, 53, 0.2);
}

.button-primary:hover {
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.18);
}

.button-ghost {
  border-color: rgba(37, 99, 235, 0.14);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-soft);
}

.button-ghost:hover {
  background: var(--surface-soft);
}

.button-danger {
  border-color: #f2b7b1;
  background: var(--primary-soft);
  color: var(--danger);
}

.button-small {
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.alert {
  margin-bottom: 1rem;
  padding: 0.82rem 0.95rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-soft);
}

.alert-success {
  border-color: #b9e6cb;
  border-left-color: var(--success);
  background: #effaf3;
  color: #145a35;
}

.alert-danger {
  border-color: #f4bdb8;
  border-left-color: var(--danger);
  background: var(--primary-soft);
  color: #8d1c14;
}

.alert-warning {
  border-color: #f3d995;
  border-left-color: var(--amber);
  background: #fff9eb;
  color: #7a4d12;
}

.alert-info {
  border-color: #aee0dc;
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: #0b554f;
}

.status,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 24px;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  background: #edf2f4;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

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

.status-success {
  background: #eaf8ef;
  color: var(--success);
}

.status-warning {
  background: #fff6df;
  color: var(--amber);
}

.status-danger {
  background: var(--primary-soft);
  color: var(--danger);
}

.status-muted {
  background: #edf2f4;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 760px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.form-grid > *,
.form-stack > * {
  min-width: 0;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-grid h2.wide {
  margin: 1rem 0 -0.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 1.22rem;
}

.form-grid h2.wide:first-of-type {
  margin-top: 0.2rem;
  padding-top: 0;
  border-top: 0;
}

.wide {
  grid-column: 1 / -1;
}

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

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 40px;
  font-weight: 750;
}

.check-row input {
  width: auto;
}

.actions-cell,
.inline-actions,
.mini-form,
.inline-reset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.inline-reset input,
.mini-form input,
.mini-form select {
  width: min(180px, 100%);
  min-width: 140px;
}

.auth-page,
.install-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(229, 57, 53, 0.12), rgba(255, 255, 255, 0) 34%),
    linear-gradient(245deg, rgba(37, 99, 235, 0.14), rgba(255, 255, 255, 0) 36%),
    linear-gradient(180deg, #ffffff 0, var(--bg) 100%);
}

.auth-panel,
.install-panel {
  width: min(100%, 480px);
  padding: 1.4rem;
}

.install-panel {
  width: min(100%, 980px);
}

.auth-panel h1 {
  margin-bottom: 0.25rem;
}

.meta-list {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 0.62rem 1rem;
}

.meta-list dt {
  color: var(--muted);
  font-weight: 850;
}

.meta-list dd {
  margin: 0;
}

.code-block {
  overflow: auto;
  padding: 1rem;
  border-radius: var(--radius);
  background: #101c24;
  color: #e8eef2;
}

.empty-state,
.empty-inline {
  padding: 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  text-align: center;
}

.action-panel {
  border-color: rgba(229, 57, 53, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 240, 239, 0.98), rgba(255, 255, 255, 0.88)),
    linear-gradient(135deg, rgba(229, 57, 53, 0.1), rgba(249, 115, 22, 0.08));
}

.request-panel {
  border-color: rgba(37, 99, 235, 0.18);
  background:
    linear-gradient(135deg, rgba(234, 241, 255, 0.95), rgba(255, 255, 255, 0.86)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(255, 77, 141, 0.08));
}

.request-inspection-form {
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
}

.inspection-form {
  max-width: 100%;
  min-width: 0;
  padding-bottom: 6.9rem;
}

.inspection-form .panel {
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.inspection-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.35fr) auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.05rem;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 246, 255, 0.9)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(255, 77, 141, 0.12));
  box-shadow: var(--shadow-md);
}

.inspection-heading h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.24rem, 2vw, 1.72rem);
}

.inspection-heading .muted {
  margin: 0;
  color: var(--text-soft);
  font-weight: 720;
}

.inspection-status {
  display: grid;
  gap: 0.15rem;
  min-width: 190px;
  padding: 0.72rem 0.82rem;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
  text-align: left;
}

.inspection-status span:first-child {
  color: var(--accent);
  font-size: 1rem;
}

.check-category {
  display: grid;
  gap: 1rem;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 1.25rem;
}

.check-category h3 {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 34px;
  margin: 0;
  padding: 0.38rem 0.72rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.check-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 1.05rem;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 1.12rem;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.92)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(124, 58, 237, 0.04));
  box-shadow: var(--shadow-sm);
}

.check-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cool-gradient);
}

.check-item.is-failed {
  border-color: rgba(229, 57, 53, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 245, 0.96)),
    linear-gradient(135deg, rgba(229, 57, 53, 0.1), rgba(249, 115, 22, 0.06));
}

.check-item.is-failed::before {
  background: var(--warm-gradient);
}

.check-item.is-attention {
  border-color: rgba(249, 115, 22, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 237, 0.96)),
    linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(37, 99, 235, 0.04));
}

.check-item.is-attention::before {
  background: linear-gradient(135deg, var(--amber), var(--saffron));
}

.check-main {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
}

.check-main h4,
.check-main p {
  margin: 0;
  overflow-wrap: anywhere;
}

.check-main h4 {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.32;
}

.check-main p {
  color: var(--text-soft);
  font-weight: 680;
}

.check-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 0.85rem;
  min-width: 0;
}

.check-details textarea {
  min-height: 6.2rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  max-width: none;
  gap: 0.55rem;
}

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

.segmented label {
  display: block;
  min-width: 0;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 48px;
  padding: 0.62rem;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-soft);
  text-align: center;
  font-weight: 880;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: inset 0 -1px 0 rgba(37, 99, 235, 0.06);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.segmented span:hover {
  border-color: rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
}

.segmented input:checked + span {
  border-color: transparent;
  background: var(--cool-gradient);
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.check-item footer {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-top: 0.78rem;
  border-top: 1px dashed rgba(37, 99, 235, 0.18);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 760;
}

.check-item footer strong {
  color: var(--danger);
}

.camera-section {
  margin-top: 1.1rem;
  padding: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.camera-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: var(--shadow-sm);
}

.camera-preview {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #f3f7ff;
  color: var(--muted);
  font-weight: 850;
}

.camera-preview img,
.camera-modal video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-preview.has-image {
  border-style: solid;
  border-color: var(--accent);
  background: #101c24;
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 24, 32, 0.72);
}

.camera-modal[hidden] {
  display: none;
}

.camera-modal-panel {
  display: grid;
  gap: 0.85rem;
  width: min(100%, 720px);
  padding: 1rem;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.camera-modal video {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: #101c24;
}

.sticky-submit {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  padding: 0.82rem 1.2rem;
  border-top: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 -14px 34px rgba(37, 99, 235, 0.12);
  backdrop-filter: blur(14px);
}

.sticky-submit span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.checklist-panels,
.checklist-editor,
.checklist-edit-list {
  display: grid;
  gap: 1rem;
}

.checklist-add-form {
  padding: 1rem 0 0.25rem;
  border-top: 1px solid var(--line);
}

.checklist-list-item {
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

.checklist-item-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
}

.checklist-item-summary strong,
.checklist-item-summary small {
  display: block;
}

.checklist-item-summary strong {
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.checklist-item-summary small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.checklist-edit-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
  padding: 1rem;
  border-top: 1px solid rgba(37, 99, 235, 0.12);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.92), rgba(255, 255, 255, 0.86));
}

.checklist-edit-form[hidden] {
  display: none;
}

.checklist-edit-form textarea {
  min-height: 4rem;
}

.row-toggle {
  min-height: 40px;
}

.photo-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.photo-chip,
.thumb-link {
  color: var(--accent);
  font-weight: 850;
  text-decoration: none;
}

.photo-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.38rem 0.68rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: var(--accent-soft);
}

.thumb-link {
  display: inline-flex;
  margin-right: 0.35rem;
}

.toast-root {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  display: grid;
  gap: 0.6rem;
  width: min(340px, calc(100vw - 2rem));
}

.toast {
  display: grid;
  gap: 0.15rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #101827, #172033);
  color: #f8fafc;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.16s ease-out;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast span {
  color: #b7c4cc;
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 24, 32, 0.56);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 430px);
  padding: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
}

.modal-card h2 {
  margin-top: 0;
}

.updater-panel {
  max-width: 780px;
}

.updater-form {
  grid-template-columns: 1fr auto;
  margin-top: 1rem;
}

.compact-meta {
  grid-template-columns: 150px minmax(0, 1fr);
}

.muted {
  color: var(--muted);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(var(--sidebar-w), calc(100vw - 3rem));
    transform: translateX(-110%);
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.open ~ .sidebar-overlay {
    display: block;
  }

  .icon-button {
    display: grid;
  }

  .sticky-submit {
    left: 0;
  }

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

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

  .inspection-heading {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .inspection-heading > .button {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .check-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .auth-page,
  .install-page {
    align-items: flex-start;
    padding: 0.75rem;
  }

  .auth-panel,
  .install-panel {
    padding: 1.1rem;
  }

  .main-panel {
    padding: 0.75rem 0.75rem 1.75rem;
  }

  .topbar,
  .panel-header,
  .page-intro,
  .checklist-item-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-header > .status,
  .panel-header > .badge {
    align-self: flex-start;
  }

  .topbar {
    top: 0.75rem;
    padding: 0.65rem 0.8rem;
  }

  .topbar h1 {
    white-space: normal;
  }

  .topbar-left,
  .topbar-actions,
  .user-pill {
    width: 100%;
  }

  .card-grid,
  .dashboard-metric-grid,
  .form-grid,
  .form-grid.compact,
  .split-grid,
  .check-details,
  .camera-grid,
  .checklist-edit-form,
  .updater-form {
    grid-template-columns: 1fr;
  }

  .segmented,
  .segmented-four {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .dashboard-hero-copy,
  .dashboard-hero-panel {
    padding: 1rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .inspection-status {
    min-width: 0;
    text-align: left;
  }

  .inspection-heading {
    grid-template-columns: 1fr;
    padding: 0.95rem;
  }

  .inspection-heading > .button {
    display: none;
  }

  .inspection-form {
    padding-bottom: 9rem;
  }

  .check-category {
    gap: 0.85rem;
  }

  .check-item {
    gap: 0.9rem;
    padding: 1rem;
  }

  .checklist-actions,
  .actions-cell,
  .inline-actions,
  .mini-form,
  .inline-reset {
    align-items: stretch;
    flex-direction: column;
    justify-content: stretch;
  }

  .inline-reset input,
  .mini-form input,
  .mini-form select,
  .meta-list {
    width: 100%;
  }

  .meta-list,
  .compact-meta {
    grid-template-columns: 1fr;
  }

  .sticky-submit {
    align-items: stretch;
    flex-direction: column;
    padding: 0.75rem;
  }

  .toast-root {
    top: 0.75rem;
    right: 0.75rem;
    width: calc(100vw - 1.5rem);
  }
}

@media (max-width: 480px) {
  .panel,
  .auth-panel,
  .install-panel {
    padding: 1rem;
  }

  .card-grid,
  .segmented,
  .segmented-four {
    grid-template-columns: 1fr;
  }

  .check-item {
    padding: 0.85rem;
  }

  .inspection-heading {
    padding: 0.85rem;
  }
}
