:root {
  --navy-950: #092642;
  --navy-900: #0d3152;
  --navy-800: #173f60;
  --teal-800: #0b6661;
  --teal-700: #0f766e;
  --teal-600: #0d8880;
  --teal-100: #d9f1ee;
  --teal-50: #edf9f7;
  --ink: #243746;
  --muted: #657786;
  --canvas: #f4f8f8;
  --surface: #ffffff;
  --line: #d9e3e6;
  --line-strong: #bdcdd2;
  --blue: #2167ae;
  --blue-soft: #eaf3fb;
  --green: #16835a;
  --green-soft: #e6f5ee;
  --amber: #d97706;
  --amber-soft: #fff5df;
  --red: #c2413b;
  --red-soft: #fff0ef;
  --shadow: 0 6px 24px rgb(23 50 77 / 8%);
  --shadow-strong: 0 16px 48px rgb(9 38 66 / 18%);
  --radius: 14px;
  --radius-small: 10px;
  --sidebar: 248px;
  --focus: 0 0 0 3px rgb(13 136 128 / 28%);
  font-family:
    "Noto Sans JP",
    "Yu Gothic UI",
    "Hiragino Kaku Gothic ProN",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  font-size: 16px;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.55;
}

body.modal-open {
  overflow: hidden;
}

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

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

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
  box-shadow: var(--focus);
}

a {
  color: var(--teal-800);
}

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

.noscript-message {
  margin: 24px;
  padding: 18px 20px;
  border: 1px solid #f2c37d;
  border-radius: var(--radius-small);
  background: var(--amber-soft);
  color: #7a4500;
  font-weight: 700;
}

.app-loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.startup-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--teal-100);
  border-top-color: var(--teal-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(460px, 1.12fr);
  background:
    radial-gradient(circle at 16% 12%, rgb(18 180 166 / 26%), transparent 30%),
    linear-gradient(145deg, var(--navy-950), var(--navy-800) 54%, var(--teal-800));
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  overflow: hidden;
  color: white;
}

.login-brand::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: 80px;
  width: 360px;
  height: 360px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 50%;
  box-shadow:
    0 0 0 52px rgb(255 255 255 / 4%),
    0 0 0 104px rgb(255 255 255 / 3%);
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #18b9ad, #0d8880);
  color: white;
  box-shadow: 0 10px 26px rgb(0 0 0 / 18%);
  font-size: 30px;
}

.brand-name {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: rgb(255 255 255 / 76%);
  font-weight: 600;
}

.login-message {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: auto 0;
}

.login-message h2 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.login-message p {
  max-width: 540px;
  margin: 24px 0 0;
  color: rgb(255 255 255 / 78%);
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.85;
}

.login-points {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.login-points li {
  padding: 8px 12px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: rgb(255 255 255 / 88%);
  font-size: 14px;
  font-weight: 700;
}

.login-panel-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(24px, 5vw, 80px);
  background: rgb(244 248 248 / 96%);
}

.login-panel {
  width: min(100%, 560px);
}

.login-panel > .eyebrow {
  margin-bottom: 8px;
}

.login-panel h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(29px, 3vw, 40px);
  line-height: 1.35;
}

.login-lead {
  margin: 12px 0 26px;
  color: var(--muted);
  font-size: 17px;
}

.login-card {
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 24px;
  padding: 5px;
  border-radius: 12px;
  background: #edf3f4;
}

.auth-tab {
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.is-active {
  background: white;
  color: var(--teal-800);
  box-shadow: 0 2px 9px rgb(23 50 77 / 10%);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.field > label,
.field-label {
  color: var(--navy-900);
  font-size: 15px;
  font-weight: 800;
}

.required-mark {
  margin-left: 5px;
  color: var(--red);
  font-size: 12px;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.control,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #91a9b1;
}

.input-with-clear {
  position: relative;
}

.input-with-clear input {
  padding-right: 50px !important;
}

.clear-input {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  transform: translateY(-50%);
}

.clear-input:hover {
  background: #edf3f4;
  color: var(--navy-950);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
}

.check-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--teal-700);
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--teal-700);
  color: white;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.button:hover:not(:disabled) {
  background: var(--teal-800);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button-secondary {
  border-color: var(--line-strong);
  background: white;
  color: var(--navy-900);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--teal-700);
  background: var(--teal-50);
  color: var(--teal-800);
}

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--teal-800);
}

.button-ghost:hover:not(:disabled) {
  background: var(--teal-50);
}

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

.button-danger:hover:not(:disabled) {
  background: #a83430;
}

.button-warning {
  background: var(--amber);
}

.button-warning:hover:not(:disabled) {
  background: #b96205;
}

.button-wide {
  width: 100%;
  min-height: 52px;
}

.login-error {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #efb5b2;
  border-radius: 9px;
  background: var(--red-soft);
  color: #8c2b27;
  font-weight: 700;
}

.demo-note {
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid #a9dcd6;
  border-radius: 10px;
  background: var(--teal-50);
  color: #175650;
  font-size: 14px;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  background:
    linear-gradient(180deg, var(--navy-950), var(--navy-900) 55%, #0c3f58);
  color: white;
  box-shadow: 8px 0 28px rgb(9 38 66 / 10%);
}

.sidebar-brand {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
}

.sidebar-brand .brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 24px;
}

.sidebar-brand-name {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.sidebar-brand-sub {
  display: block;
  margin-top: 2px;
  color: rgb(255 255 255 / 68%);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  padding: 16px 12px;
}

.nav-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: rgb(255 255 255 / 78%);
  text-align: left;
  font-weight: 800;
  transition: background 140ms ease, color 140ms ease;
}

.nav-button:hover {
  background: rgb(255 255 255 / 8%);
  color: white;
}

.nav-button.is-active {
  background: linear-gradient(135deg, #0c8e86, #087b74);
  color: white;
  box-shadow: 0 6px 18px rgb(0 0 0 / 15%);
}

.nav-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  font-size: 21px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 18px;
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.account-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: rgb(255 255 255 / 7%);
  color: white;
  text-align: left;
}

.account-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: var(--teal-700);
  font-size: 21px;
}

.account-name {
  display: block;
  font-size: 14px;
  font-weight: 900;
}

.account-role {
  display: block;
  color: rgb(255 255 255 / 63%);
  font-size: 12px;
}

.main-area {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(18px, 2.5vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgb(244 248 248 / 94%);
  backdrop-filter: blur(12px);
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--navy-900);
  font-size: 24px;
}

.page-heading {
  min-width: 220px;
}

.page-heading h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(24px, 2.1vw, 32px);
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.page-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.facility-pill,
.date-control {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  color: var(--navy-900);
  font-weight: 800;
}

.date-control input {
  width: 140px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
}

.content {
  width: min(100%, 1560px);
  margin: 0 auto;
  padding: clamp(18px, 2.5vw, 34px);
}

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

.content-title {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.35;
}

.content-description {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.kpi-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 116px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 26px;
}

.kpi-card.is-warning .kpi-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.kpi-card.is-danger .kpi-icon {
  background: var(--red-soft);
  color: var(--red);
}

.kpi-label {
  margin: 0;
  color: var(--navy-900);
  font-size: 15px;
  font-weight: 800;
}

.kpi-value {
  margin: 2px 0 0;
  color: var(--teal-800);
  font-size: clamp(31px, 3vw, 44px);
  font-weight: 900;
  line-height: 1.05;
}

.kpi-card.is-warning .kpi-value {
  color: var(--amber);
}

.kpi-card.is-danger .kpi-value {
  color: var(--red);
}

.kpi-unit {
  margin-left: 4px;
  font-size: 17px;
}

.notice-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 14px 17px;
  border: 1px solid #efc47d;
  border-radius: var(--radius-small);
  background: var(--amber-soft);
  color: #6f4100;
}

.notice-strip strong {
  color: #4d3107;
}

.notice-strip .button {
  margin-left: auto;
  flex: 0 0 auto;
}

.info-strip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #a8d9d3;
  border-radius: 10px;
  background: var(--teal-50);
  color: #175650;
}

.info-strip.is-warning {
  border-color: #efc47d;
  background: var(--amber-soft);
  color: #6f4100;
}

.panel {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  color: var(--navy-950);
  font-size: 21px;
  line-height: 1.35;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 18px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.filters .field {
  min-width: 180px;
  margin: 0;
}

.search-group {
  display: flex;
  width: min(100%, 580px);
  gap: 8px;
}

.search-group input {
  flex: 1;
  min-width: 0;
}

.data-table-wrap {
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e6edef;
  vertical-align: middle;
  text-align: left;
}

.data-table th {
  background: #f6f9fa;
  color: #405663;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.data-table td {
  color: var(--ink);
  font-size: 15px;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

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

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

.primary-cell {
  color: var(--navy-950);
  font-size: 17px;
  font-weight: 900;
}

.secondary-cell {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-ready,
.status-approved,
.status-active {
  background: var(--green-soft);
  color: var(--green);
}

.status-running,
.status-pending {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-warning,
.status-maintenance {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-danger,
.status-rejected,
.status-cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.status-muted,
.status-completed,
.status-inactive {
  background: #f0f3f4;
  color: #5d6d76;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.row-button {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--teal-700);
  border-radius: 8px;
  background: white;
  color: var(--teal-800);
  font-size: 13px;
  font-weight: 900;
}

.row-button:hover {
  background: var(--teal-50);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.record-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: white;
}

.record-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.record-card h3 {
  margin: 0;
  color: var(--navy-950);
  font-size: 18px;
}

.record-code {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.record-details {
  display: grid;
  gap: 7px;
  margin: 15px 0 0;
}

.record-line {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  font-size: 14px;
}

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

.record-value {
  color: var(--ink);
  font-weight: 700;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 18px;
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  padding: 36px 20px;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 31px;
}

.empty-state h3 {
  margin: 0;
  color: var(--navy-950);
  font-size: 20px;
}

.empty-state p {
  max-width: 540px;
  margin: 8px auto 17px;
  color: var(--muted);
}

.loading-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.skeleton {
  display: block;
  height: 18px;
  border-radius: 7px;
  background: linear-gradient(90deg, #edf2f3 25%, #f8fafb 40%, #edf2f3 60%);
  background-size: 300% 100%;
  animation: shimmer 1.25s infinite;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(9 38 66 / 58%);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  width: min(100%, 760px);
  max-height: min(90vh, 920px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: 0 28px 80px rgb(0 0 0 / 28%);
}

.modal-dialog.is-wide {
  width: min(100%, 980px);
}

.modal-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 23px;
}

.modal-close {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #eef3f4;
  color: var(--navy-900);
  font-size: 26px;
}

.modal-content {
  max-height: calc(min(90vh, 920px) - 144px);
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

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

.form-grid .field.is-full {
  grid-column: 1 / -1;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  font-weight: 700;
}

.segmented input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal-700);
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: grid;
  width: min(420px, calc(100vw - 40px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 14px 15px;
  border: 1px solid #a8d9d3;
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-strong);
  color: var(--ink);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  border-color: #efb5b2;
}

.toast.is-warning {
  border-color: #efc47d;
}

.toast-title {
  display: block;
  color: var(--navy-950);
  font-weight: 900;
}

.toast-message {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.toast-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
}

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

.drawer-overlay {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

.version-line {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.test-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  background: #fff1c9;
  color: #714400;
  font-size: 13px;
  font-weight: 900;
}

@media (max-width: 1180px) {
  :root {
    --sidebar: 222px;
  }

  .facility-pill span:last-child {
    display: none;
  }

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

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

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

  .data-table th,
  .data-table td {
    padding-inline: 10px;
  }
}

body[data-layout="ipad"] {
  --sidebar: 214px;
}

body[data-layout="ipad"] .content {
  padding: 20px;
}

body[data-layout="ipad"] .topbar {
  padding-inline: 20px;
}

body[data-layout="ipad"] .button,
body[data-layout="ipad"] .nav-button,
body[data-layout="ipad"] .row-button {
  min-height: 50px;
}

body[data-layout="ipad"] .data-table th,
body[data-layout="ipad"] .data-table td {
  padding-block: 15px;
  font-size: 15px;
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-panel-wrap {
    min-height: 100vh;
    padding: 24px;
  }

  .sidebar {
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

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

  .drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    border: 0;
    background: rgb(9 38 66 / 52%);
  }

  body.sidebar-open .drawer-overlay {
    display: block;
  }

  .main-area {
    margin-left: 0;
    padding-bottom: 76px;
  }

  .menu-toggle {
    display: grid;
  }

  .topbar {
    min-height: 70px;
    padding: 10px 14px;
  }

  .page-heading {
    min-width: 0;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .page-heading p,
  .facility-pill {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .date-control {
    min-height: 44px;
    padding: 7px 9px;
  }

  .date-control span {
    display: none;
  }

  .date-control input {
    width: 128px;
    font-size: 14px;
  }

  .topbar-actions .button {
    min-width: 44px;
    padding-inline: 11px;
  }

  .topbar-actions .button-label {
    display: none;
  }

  .content {
    padding: 16px 14px 22px;
  }

  .content-header {
    display: grid;
  }

  .content-header .action-row {
    width: 100%;
  }

  .content-header .action-row .button {
    flex: 1;
  }

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

  .kpi-card {
    min-height: 104px;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    padding: 14px;
  }

  .kpi-icon {
    width: 42px;
    height: 42px;
    font-size: 21px;
  }

  .kpi-value {
    font-size: 31px;
  }

  .notice-strip {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .notice-strip .button {
    width: 100%;
    margin-left: 0;
  }

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

  .panel-header .action-row {
    width: 100%;
  }

  .panel-header .action-row .button {
    flex: 1;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
    background: #f5f8f9;
  }

  .data-table tbody tr {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: white;
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(100px, 36%) 1fr;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed #e1e9eb;
    overflow-wrap: anywhere;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

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

  .data-table td.cell-primary {
    display: block;
    padding-top: 0;
  }

  .data-table td.cell-primary::before {
    display: none;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-button {
    width: 100%;
    min-height: 46px;
  }

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

  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: 68px;
    padding: 5px max(5px, env(safe-area-inset-right))
      max(5px, env(safe-area-inset-bottom))
      max(5px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 -6px 22px rgb(9 38 66 / 10%);
    backdrop-filter: blur(12px);
  }

  .bottom-nav-button {
    display: grid;
    min-width: 0;
    min-height: 56px;
    place-items: center;
    align-content: center;
    gap: 1px;
    padding: 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
  }

  .bottom-nav-button .nav-icon {
    width: 26px;
    height: 26px;
    font-size: 20px;
  }

  .bottom-nav-button.is-active {
    background: var(--teal-50);
    color: var(--teal-800);
  }
}

@media (max-width: 620px) {
  .login-panel-wrap {
    align-items: start;
    padding: 24px 16px;
  }

  .login-panel {
    margin-top: 4vh;
  }

  .login-card {
    padding: 20px 16px;
  }

  .login-panel h1 {
    font-size: 28px;
  }

  .auth-tab {
    padding-inline: 8px;
    font-size: 14px;
  }

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

  .kpi-card {
    display: block;
    min-height: 112px;
  }

  .kpi-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .kpi-label {
    padding-right: 38px;
  }

  .kpi-value {
    margin-top: 14px;
  }

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

  .form-grid .field.is-full {
    grid-column: auto;
  }

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

  .modal-dialog,
  .modal-dialog.is-wide {
    width: 100%;
    max-height: 94vh;
    border-radius: 18px 18px 0 0;
  }

  .modal-content {
    max-height: calc(94vh - 144px);
    padding: 17px 15px;
  }

  .modal-footer {
    padding-inline: 15px;
  }

  .modal-footer .button {
    flex: 1;
  }

  .filters,
  .search-group {
    display: grid;
    width: 100%;
  }

  .filters .field {
    width: 100%;
  }

  .record-line {
    grid-template-columns: 92px 1fr;
  }

  .toast-region {
    right: 12px;
    bottom: 82px;
    width: calc(100vw - 24px);
  }
}

@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 print {
  .sidebar,
  .topbar,
  .mobile-bottom-nav,
  .action-row,
  .row-actions {
    display: none !important;
  }

  .main-area {
    margin: 0;
  }

  .content {
    width: 100%;
    padding: 0;
  }

  .panel,
  .kpi-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
