:root {
  color-scheme: light;
  --ink: #102342;
  --muted: #62728c;
  --line: #d9e3ef;
  --surface: #ffffff;
  --wash: #f4f7fb;
  --teal: #087f9b;
  --mint: #68a995;
  --gold: #c9a052;
  --red: #b8625b;
  --orange: #9c712e;
  --green: #4c8668;
  --info: #e8f2fa;
  --sage: #e7f3ec;
  --coral: #f8e8e5;
  --amber: #fbf1dc;
  --sidebar: #071b46;
  --navy: #071b46;
  --blue: #1769aa;
  --shadow: 0 8px 24px rgba(19, 46, 82, 0.06);
  font-family: Inter, "SF Pro Text", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  overflow-x: clip;
}

.multipage-shell .app-frame {
  align-items: stretch;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid #234e47;
  min-height: 100vh;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  color: #ffffff;
  padding: 4px 8px 14px;
}

.sidebar-brand img {
  background: #ffffff;
  border-radius: 8px;
  height: 44px;
  object-fit: contain;
  padding: 3px;
  width: 44px;
}

.side-menu {
  display: grid;
  gap: 8px;
}

.side-link,
.side-group summary,
.side-group a {
  border-radius: 8px;
  color: #dcebe8;
  display: block;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
}

.side-group summary {
  cursor: pointer;
}

.side-group a {
  color: #a9c3bd;
  font-size: 13px;
  margin-left: 10px;
  padding: 8px 12px;
}

.side-link.active,
.side-group summary.active,
.side-link:hover,
.side-group summary:hover,
.side-group a:hover {
  background: #236158;
  color: #ffffff;
}

.side-group[open] {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding-bottom: 5px;
}

.menu-toggle {
  display: none;
}

.page-panel {
  display: block;
}

body:not(.is-authenticated) .app-frame,
body:not(.is-authenticated) .app-header,
body:not(.is-authenticated) .shell {
  display: none;
}

body.is-authenticated .login-screen {
  display: none;
}

body:not(.is-admin) .admin-only,
body:not(.is-admin) #resetButton {
  display: none;
}

body:not(.is-admin):not(.is-bodega) .warehouse-only {
  display: none;
}

body:not(.can-create-items) .can-create-items,
body:not(.can-move-stock) .can-move-stock,
body:not(.can-request-stock) .can-request-stock,
body:not(.can-edit-items) .can-edit-items,
body:not(.can-edit-items) .inventory-card .admin-only,
body:not(.can-answer-bodega) .can-answer-bodega {
  display: none;
}

body.is-authenticated.can-create-items .can-create-items {
  display: inline-flex;
}

.status.critical,
.status.critico,
.inventory-card.critical,
.stock-row.critical {
  background: var(--coral);
  border-color: #d89a96;
  color: #87423f;
}

.status.low,
.status.reponer,
.inventory-card.low,
.stock-row.low {
  background: var(--amber);
  border-color: #e2c481;
  color: #7c5a24;
}

.status.ok,
.status.normal,
.inventory-card.ok,
.stock-row.ok {
  background: var(--sage);
  border-color: #acd0b9;
  color: #456e55;
}

.app-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.nav-button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #cfe4e2;
  font-weight: 800;
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: #1b4f59;
  color: #fff;
}

.main-area {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 34px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  flex: 1 1 300px;
  min-width: 300px;
}

.topbar-brand > div,
.section-heading > div,
.record-card-head > div,
.header-actions > * {
  min-width: 0;
}

.topbar-brand img {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 46px;
  object-fit: contain;
  padding: 3px;
  width: 46px;
}

.module-nav {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px clamp(16px, 3vw, 34px);
  position: sticky;
  top: 78px;
  z-index: 4;
}

.module-nav .nav-button {
  background: #edf5f4;
  border: 1px solid transparent;
  color: var(--teal);
  flex: 0 0 auto;
  min-height: 38px;
  text-align: center;
}

.module-nav .nav-button.active,
.module-nav .nav-button:hover {
  background: #0f2f38;
  border-color: #0f2f38;
  color: #fff;
}

.area-switcher {
  align-items: center;
  display: flex;
  gap: 8px;
}

.area-switcher span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.alerts-button {
  align-items: center;
  background: var(--amber);
  border: 1px solid #ead487;
  border-radius: 8px;
  color: #765a05;
  display: inline-flex;
  font-weight: 900;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
}

.alerts-button strong {
  align-items: center;
  background: var(--red);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  height: 22px;
  justify-content: center;
  min-width: 22px;
  padding: 0 6px;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.08;
}

.topbar .header-actions {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.app-header,
.tabs,
.area-focus,
.site-footer {
  display: none;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr 1fr 1fr;
}

.chart-bars {
  display: grid;
  gap: 10px;
}

.chart-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 80px minmax(0, 1fr) 42px;
  font-size: 13px;
}

.chart-row div {
  background: #e3ecef;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.chart-row i {
  background: var(--teal);
  display: block;
  height: 100%;
}

.area-modules {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.area-modules article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  padding: 18px;
}

textarea {
  border: 1px solid #c8d8dc;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  padding: 9px 11px;
  resize: vertical;
  width: 100%;
}

.danger {
  color: var(--red);
}

.secondary-button.danger {
  border-color: #ddb2ae;
  color: #87423f;
}

.expiry-high {
  background: #ffe9e9;
  border-color: #f1bbbb;
}

.expiry-mid {
  background: #fff4df;
  border-color: #efca8d;
}

.expiry-low {
  background: #eef8f3;
  border-color: #b8dccb;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

body.dialog-open {
  overflow: hidden;
}

body.dialog-open::before {
  background: rgba(26, 43, 48, 0.42);
  content: "";
  inset: 0;
  position: fixed;
  z-index: 49;
}

dialog.dialog-fallback-open {
  display: block;
  inset: 50% auto auto 50%;
  margin: 0;
  max-height: calc(100vh - 32px);
  max-width: min(620px, calc(100vw - 32px));
  overflow-y: auto;
  position: fixed;
  transform: translate(-50%, -50%);
  width: 100%;
  z-index: 50;
}

dialog.wide-dialog.dialog-fallback-open {
  max-width: min(980px, calc(100vw - 32px));
}

.app-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.login-screen {
  align-items: center;
  background: #edf4f2;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(25, 53, 50, 0.12);
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 30px;
  width: 100%;
}

.login-card img {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 72px;
  object-fit: contain;
  padding: 4px;
  width: 72px;
}

.login-card p,
.login-card h1 {
  margin: 0;
}

.login-card p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.login-error {
  color: var(--red);
  font-size: 14px;
  font-weight: 800;
  min-height: 20px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand img {
  height: 52px;
  width: 52px;
}

.brand p,
.brand h1,
.panel-title p,
.section-heading p {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand h1 {
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.1;
}

.header-actions,
.section-heading,
.form-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.section-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.area-focus {
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #e9f5f3 100%);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.2fr);
  margin-bottom: 18px;
  padding: 18px;
}

.area-focus span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.area-focus strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
}

.area-focus p {
  color: var(--muted);
  margin: 8px 0 0;
}

.area-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  list-style: none;
  margin: 0;
  padding: 0;
}

.area-list li {
  background: #fff;
  border: 1px solid #bdd1d6;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 11px;
}

.area-list li.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

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

.summary-grid article,
.panel,
.history-section,
.inventory-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-grid article {
  border-top: 3px solid #c9ddd7;
  padding: 18px;
}

.summary-grid article:nth-child(2) { border-top-color: #ddbd78; }
.summary-grid article:nth-child(3) { border-top-color: #d49590; }
.summary-grid article:nth-child(4) { border-top-color: #83b7aa; }

.summary-grid span,
label span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-grid strong {
  display: block;
  font-size: 30px;
}

.tabs {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 18px;
  padding: 8px;
}

.tab-button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  min-height: 42px;
  padding: 9px 12px;
}

.tab-button.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 92, 102, 0.18);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.controls {
  align-items: end;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 220px 190px;
  margin-bottom: 18px;
  padding: 14px;
}

input,
select {
  background: #fff;
  border: 1px solid #c8d8dc;
  border-radius: 6px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

.layout,
.two-column {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.two-column {
  grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
}

.panel {
  padding: 18px;
  position: sticky;
  top: 102px;
}

.panel-title h2,
.section-heading h2 {
  font-size: 20px;
  margin: 0 0 4px;
}

.panel-title p,
.section-heading p {
  color: var(--muted);
  font-size: 14px;
}

.compact {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}

.stock-form,
.dialog-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.icon-button,
.icon-only {
  border-radius: 6px;
  font-weight: 800;
  min-height: 42px;
  padding: 9px 14px;
}

.heading-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button {
  background: var(--teal);
  border: 1px solid var(--teal);
  color: white;
}

.primary-button:hover:not(:disabled) {
  background: #0e6f64;
  border-color: #0e6f64;
}

.secondary-button,
.icon-button,
.icon-only {
  background: white;
  border: 1px solid #bdd1d6;
  color: var(--ink);
}

.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.icon-only:hover:not(:disabled) {
  background: #f3f8f6;
  border-color: #8eb8ad;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.logout-link {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.sync-status {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  min-height: 30px;
  padding: 4px;
}

.sync-status::before {
  background: var(--gold);
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.user-badge {
  align-items: center;
  background: #edf7f7;
  border: 1px solid #bdd1d6;
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  min-height: 36px;
  padding: 7px 11px;
  white-space: nowrap;
}

.sync-status.online {
  background: transparent;
  color: var(--green);
}

.sync-status.online::before { background: #51a37c; }

.full {
  width: 100%;
}

.inventory-section {
  min-width: 0;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.inventory-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.inventory-card {
  display: grid;
  gap: 14px;
  min-height: 198px;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.inventory-card:hover {
  box-shadow: 0 18px 38px rgba(24, 50, 58, 0.13);
  transform: translateY(-2px);
}

.card-top {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.inventory-card h3 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.tag,
.state {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.tag {
  background: #edf7f7;
  color: #0f6670;
}

.state.ok {
  background: #e8f6ef;
  color: var(--green);
}

.state.low {
  background: #fff4df;
  color: var(--orange);
}

.state.critical {
  background: #ffe9e9;
  color: var(--red);
}

.stock-number {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.stock-number strong {
  font-size: 34px;
}

.stock-number span {
  color: var(--muted);
  font-size: 13px;
}

.meter {
  background: #e3ecef;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.meter span {
  background: var(--mint);
  display: block;
  height: 100%;
  width: 0;
}

.card-meta {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.mini-button {
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 800;
  min-height: 36px;
}

.reorder-list,
.history-list,
.bar-list {
  display: grid;
  gap: 10px;
}

.reorder-item,
.history-item,
.bar-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.reorder-item strong,
.history-item strong,
.bar-row strong {
  font-size: 14px;
}

.reorder-item span,
.history-item span,
.bar-row span {
  color: var(--muted);
  font-size: 13px;
}

.history-section {
  margin-top: 20px;
  padding: 18px;
}

.alert-section {
  border-left: 5px solid var(--orange);
}

.warehouse-alert {
  background: #fff8eb;
  border-color: #f0c37d;
}

.warehouse-alert.alert-critical {
  background: #fff1f1;
  border-color: #ef9a9a;
  border-left: 5px solid var(--red);
}

.warehouse-alert.alert-low,
.warehouse-alert.alert-pending {
  background: #fff8e6;
  border-color: #efd28c;
  border-left: 5px solid #d89a18;
}

.warehouse-alert.alert-restored,
.history-item.alert-restored {
  background: #edf8f1;
  border-color: #9fd3b2;
  border-left: 5px solid var(--green);
}

.warehouse-alert strong {
  color: #8a4d0f;
}

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

.stats-grid .panel {
  position: static;
}

.bar-track {
  background: #e3ecef;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.bar-track span {
  background: var(--teal);
  display: block;
  height: 100%;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.site-footer {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 28px 0 0;
  text-align: center;
}

h1,
h2,
h3,
p,
strong,
small,
.reorder-item span,
.history-item span {
  overflow-wrap: anywhere;
}

.scanner-box {
  background: #f6fbfb;
  border: 1px dashed #9fc8c7;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.scanner-box strong,
.scanner-box p {
  margin: 0;
}

.scanner-box p {
  color: var(--muted);
  font-size: 13px;
}

#scannerVideo {
  background: #102a30;
  border-radius: 8px;
  display: none;
  max-height: 260px;
  object-fit: cover;
  width: 100%;
}

#scannerVideo.active {
  display: block;
}

dialog {
  border: 0;
  border-radius: 8px;
  max-width: 560px;
  padding: 0;
  width: calc(100% - 28px);
}

dialog.wide-dialog {
  max-width: 980px;
}

.supply-order-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: min(52vh, 520px);
  overflow: auto;
}

.supply-order-table {
  min-width: 760px;
}

.supply-order-table thead {
  background: #f4f8f8;
  position: sticky;
  top: 0;
  z-index: 1;
}

.supply-order-table td:first-child strong,
.supply-order-table td:first-child small,
.request-detail-table td:first-child strong,
.request-detail-table td:first-child small {
  display: block;
}

.supply-order-table td small,
.request-detail-table td small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.quantity-cell {
  align-items: center;
  display: flex;
  gap: 8px;
}

.quantity-cell input {
  max-width: 120px;
  min-width: 90px;
}

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

dialog::backdrop {
  background: rgba(23, 49, 58, 0.38);
}

.dialog-form {
  margin: 0;
  padding: 20px;
}

menu {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

.empty {
  color: var(--muted);
  padding: 12px 0;
}

.module-shortcuts {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.module-shortcuts a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 4px;
  padding: 14px;
  text-decoration: none;
}

.module-shortcuts a:nth-child(2) { border-left-color: var(--mint); }
.module-shortcuts a:nth-child(3) { border-left-color: #7796ad; }
.module-shortcuts a:nth-child(4) { border-left-color: var(--gold); }
.module-shortcuts span { color: var(--muted); font-size: 13px; }

.module-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
}

.procedure-layout { grid-template-columns: minmax(0, 1fr); }
.module-layout:has(#procedureEditor[hidden]) { grid-template-columns: 1fr; }
.module-content { min-width: 0; }
.compact-panel { margin-bottom: 18px; position: static; }
.compact-heading { margin-top: 8px; }
.compact-heading h3 { font-size: 16px; margin: 0; }

.record-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.record-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
}

.record-card.is-inactive { opacity: 0.68; }
.record-card h3, .record-card p { margin: 0; }
.record-card p { color: var(--muted); font-size: 14px; }
.record-card-head { align-items: start; display: flex; gap: 10px; justify-content: space-between; }
.module-kicker { color: var(--teal); display: block; font-size: 11px; font-weight: 900; margin-bottom: 3px; text-transform: uppercase; }
.parameter-list { border-top: 1px solid var(--line); display: grid; gap: 7px; padding-top: 10px; }
.parameter-list span { color: var(--muted); font-size: 13px; }

.soft-status {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.soft-status.success { background: var(--sage); border-color: #bdd6c6; color: #456e55; }
.soft-status.warning { background: var(--amber); border-color: #e4ca91; color: #7b5b25; }
.soft-status.danger { background: var(--coral); border-color: #dfaaa6; color: #87423f; }
.soft-status.info { background: var(--info); border-color: #b8d2dc; color: #476d7c; }
.soft-status.neutral { background: #edf1f2; border-color: #d6dfe2; color: var(--muted); }

.form-stack, .consumption-list, .record-list { display: grid; gap: 10px; }
.procedure-item-row {
  align-items: end;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1.7fr) minmax(110px, 0.6fr) minmax(150px, 0.8fr) minmax(170px, 0.9fr) 42px;
  padding: 10px;
}

.check-line { align-items: center; display: flex; gap: 8px; min-height: 42px; }
.check-line input { min-height: 18px; width: 18px; }
.check-line span { margin: 0; }

.workflow-grid { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.45fr); }
.workflow-grid .panel { position: static; }
.workflow-grid .panel,
.workflow-grid form { min-width: 0; }
.step-title { align-items: center; display: flex; gap: 12px; }
.step-title > span { align-items: center; background: var(--teal); border-radius: 50%; color: #fff; display: inline-flex; font-weight: 900; height: 34px; justify-content: center; width: 34px; }
.step-title h2, .step-title p { margin: 0; }
.step-title p { color: var(--muted); font-size: 13px; }

.consumption-row {
  align-items: end;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-left: 4px solid #9fb4bb;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(210px, 1.7fr) minmax(90px, 0.55fr) minmax(110px, 0.65fr) 42px;
  padding: 10px;
}

.consumption-row > label:first-child { grid-column: 1; grid-row: 1; min-width: 0; }
.consumption-row > label:nth-of-type(2) { grid-column: 2; grid-row: 1; }
.consumption-row > label:nth-of-type(3) { grid-column: 3; grid-row: 1; }
.consumption-row .remove-consumption { grid-column: 4; grid-row: 1; }
.consumption-row .consumption-justification { grid-column: 1 / 4; grid-row: 2; }
.consumption-row .consumption-charge { grid-column: 4; grid-row: 2; }

.consumption-row.has-difference { background: var(--amber); border-left-color: var(--gold); }
.scanner-inline { background: #f8fafb; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 8px; margin: 14px 0; padding: 10px; }
#careScannerVideo { background: #26383d; border-radius: 8px; display: none; max-height: 260px; object-fit: cover; width: 100%; }
#careScannerVideo.active { display: block; }

.filter-row, .inline-form {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
}

.filter-row label, .inline-form label { flex: 1 1 160px; }
.filter-row button, .inline-form button { flex: 0 0 auto; }
.panel-table { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.panel-table table { min-width: 760px; }
.panel-table.is-disclosure-view,
.panel-table.disclosure-panel { overflow: visible; padding: 0; }
.metric-pair { align-items: baseline; display: flex; gap: 8px; }
.metric-pair strong { font-size: 28px; }
.metric-pair span { color: var(--muted); font-size: 13px; }

.record-line {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.record-line > div { display: grid; gap: 4px; }
.record-line > div:last-child { color: var(--muted); font-size: 13px; text-align: right; }
.form-message { color: var(--muted); font-size: 13px; font-weight: 700; margin: 0; min-height: 18px; }
.form-message.success { color: var(--green); }
.form-message.error, .global-error { color: var(--red); }
.global-error { background: var(--coral); border: 1px solid #dfaaa6; border-radius: 8px; margin-bottom: 14px; padding: 12px; }

.action-feedback {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  padding: 12px 14px;
}

.action-feedback.success {
  background: var(--sage);
  border-color: #b8d5c2;
  color: #3f7356;
}

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

.record-disclosure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.record-disclosure[open] {
  border-color: #adc9c1;
  box-shadow: var(--shadow);
}

.supply-order-disclosure {
  border-left: 5px solid #d9b76b;
}

.supply-order-disclosure.status-success {
  border-left-color: #79a98a;
}

.supply-order-disclosure.status-danger {
  border-left-color: #ce8782;
}

.order-note {
  background: #f6f9f9;
  border-radius: 6px;
  color: var(--muted);
  margin: 10px 0;
  padding: 10px 12px;
}

.request-detail-table {
  min-width: 780px;
}

.request-detail-table tr.has-shortage {
  background: var(--coral);
}

.shortage-text {
  color: #87423f !important;
  display: block;
  font-weight: 800;
}

.order-actions {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 12px;
}

.notification-item {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid #7ba9bb;
  border-radius: 8px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 14px 16px;
}

.notification-item > div { display: grid; gap: 5px; min-width: 0; }
.notification-item > div:last-child { justify-items: end; }
.notification-item span,
.notification-item time { color: var(--muted); font-size: 12px; }
.notification-item.warning { border-left-color: #d3a850; }
.notification-item.danger { border-left-color: #c96f69; }
.notification-item.success { border-left-color: #6d9d7e; }
.notification-item.is-resolved { opacity: 0.72; }
.primary-button.danger { background: #a95752; color: #fff; }

.record-disclosure > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  list-style: none;
  min-height: 76px;
  padding: 14px 16px;
}

.record-disclosure > summary::-webkit-details-marker { display: none; }
.record-disclosure > summary:hover { background: #f7faf9; }

.disclosure-identity,
.disclosure-meta {
  align-items: flex-start;
  display: flex;
  min-width: 0;
}

.disclosure-identity {
  flex-direction: column;
  gap: 5px;
}

.disclosure-identity strong { color: var(--ink); font-size: 15px; }
.disclosure-identity small { color: var(--muted); font-size: 12px; }

.disclosure-meta {
  align-items: center;
  color: var(--muted);
  flex: 0 1 auto;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 10px;
  justify-content: flex-end;
  text-align: right;
}

.disclosure-chevron {
  align-items: center;
  background: #e9f3f0;
  border-radius: 6px;
  color: var(--teal);
  display: inline-flex;
  font-size: 18px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  transition: transform 160ms ease;
  width: 30px;
}

.record-disclosure[open] .disclosure-chevron { transform: rotate(45deg); }

.disclosure-content {
  border-top: 1px solid var(--line);
  padding: 4px 10px 10px;
}

.disclosure-content table { min-width: 700px; }
.billing-detail-table { min-width: 1120px; }
.billing-detail-table td:first-child strong,
.billing-detail-table td:first-child small { display: block; }
.billing-detail-table td:first-child small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.billing-detail-table input { min-width: 160px; }
.billing-row.is-complete { background: #f2f8f4; }
.billing-row.is-saved { box-shadow: inset 4px 0 0 #5d9976; }
.success-button { background: var(--sage); border-color: #a9cdb6; color: #3f7356; }
.billing-disclosure.is-complete > summary { background: #f2f8f4; }

section[id] { scroll-margin-top: 96px; }

@media (max-width: 1180px) {
  .workflow-grid { grid-template-columns: 1fr; }

  .procedure-item-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(100px, 0.7fr) minmax(150px, 1fr);
  }

  .procedure-item-row label:nth-of-type(4) { grid-column: 1 / 3; }
}

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

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
  }

  .sidebar {
    box-shadow: var(--shadow);
    display: none;
    left: 0;
    max-width: 320px;
    position: fixed;
    top: 0;
    width: 86vw;
    z-index: 20;
  }

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

  .topbar {
    align-items: stretch;
    flex-direction: column;
    position: static;
  }

  .topbar-brand { min-width: 0; }

  .app-header,
  .header-actions,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .area-focus,
  .summary-grid,
  .controls,
  .layout,
  .two-column,
  .module-layout,
  .workflow-grid,
  .stats-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .area-list {
    justify-content: flex-start;
  }

  .panel {
    position: static;
  }

  .procedure-item-row,
  .consumption-row {
    grid-template-columns: 1fr 1fr;
  }

  .procedure-item-row label:first-child,
  .consumption-row label:first-child,
  .consumption-justification {
    grid-column: 1 / -1;
  }

  .procedure-item-row label:nth-of-type(4),
  .consumption-row > label:first-child,
  .consumption-row .consumption-justification,
  .consumption-row .consumption-charge {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .consumption-row > label:nth-of-type(2),
  .consumption-row > label:nth-of-type(3),
  .consumption-row .remove-consumption {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 12px;
    padding: 14px 16px;
  }

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

  .header-actions > * {
    justify-content: center;
    min-width: 0;
    width: 100%;
  }

  .header-actions .area-switcher,
  .header-actions .alerts-button,
  .header-actions #logoutButton {
    grid-column: 1 / -1;
  }

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

  .summary-grid article { padding: 14px; }
  .summary-grid strong { font-size: 25px; }

  .brand {
    align-items: start;
  }

  .brand img {
    height: 44px;
    width: 44px;
  }

  .form-row,
  .card-actions {
    grid-template-columns: 1fr;
  }

  .form-row {
    align-items: stretch;
    display: grid;
  }

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

  .procedure-item-row,
  .consumption-row {
    grid-template-columns: 1fr;
  }

  .procedure-item-row label:first-child,
  .consumption-row label:first-child,
  .consumption-justification {
    grid-column: auto;
  }

  .notification-item {
    align-items: stretch;
    flex-direction: column;
  }

  .notification-item > div:last-child { justify-items: start; }

  .filter-row,
  .inline-form,
  .record-line {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row label,
  .inline-form label {
    flex-basis: auto;
  }

  .record-disclosure > summary {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .disclosure-meta {
    justify-content: space-between;
    text-align: left;
    width: 100%;
  }

  .disclosure-content { padding: 0 6px 8px; }
}

/* Professional clinical interface */

body {
  background: var(--wash);
  color: var(--ink);
}

button,
a,
input,
select,
textarea,
summary {
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(8, 127, 155, 0.2);
  outline-offset: 2px;
}

.multipage-shell .app-frame {
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  border-right: 0;
  box-shadow: 8px 0 28px rgba(7, 27, 70, 0.08);
  padding: 18px 14px 28px;
}

.sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: 11px;
  margin-bottom: 16px;
  padding: 2px 8px 17px;
}

.sidebar-brand img {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  height: 42px;
  padding: 2px;
  width: 42px;
}

.sidebar-brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.side-menu {
  gap: 5px;
}

.side-link,
.side-group summary {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #c7d4e9;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
}

.side-link > svg,
.side-summary-label > svg {
  color: #84a4ca;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.side-summary-label {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.side-group summary {
  justify-content: space-between;
}

.side-chevron {
  height: 15px;
  transition: transform 160ms ease;
  width: 15px;
}

.side-group[open] .side-chevron {
  transform: rotate(180deg);
}

.side-link.active,
.side-group summary.active,
.side-link:hover,
.side-group summary:hover {
  background: #0d7895;
  border-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.side-link.active > svg,
.side-group summary.active .side-summary-label > svg,
.side-link:hover > svg,
.side-group summary:hover .side-summary-label > svg {
  color: #ffffff;
}

.side-group[open] {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
  padding-bottom: 7px;
}

.side-group a {
  border-left: 1px solid rgba(151, 180, 214, 0.28);
  border-radius: 0 6px 6px 0;
  color: #9fb2cf;
  font-size: 12px;
  font-weight: 600;
  margin-left: 20px;
  padding: 7px 12px 7px 16px;
}

.side-group a:hover {
  background: rgba(31, 146, 169, 0.14);
  color: #ffffff;
}

.topbar {
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(19, 46, 82, 0.035);
  min-height: 78px;
  padding: 12px clamp(20px, 3vw, 40px);
  z-index: 10;
}

.topbar-brand {
  flex-basis: 240px;
  min-width: 220px;
}

.topbar-brand img {
  display: none;
}

.topbar h1 {
  font-size: 23px;
  font-weight: 750;
}

.topbar .eyebrow {
  color: #8794a8;
  font-size: 10px;
  letter-spacing: 0;
  margin-bottom: 3px;
}

.header-actions {
  gap: 9px;
}

.area-switcher {
  background: #ffffff;
  border: 1px solid #ccd9e8;
  border-radius: 7px;
  gap: 7px;
  min-height: 42px;
  padding-left: 11px;
}

.area-switcher > svg {
  color: var(--teal);
  height: 16px;
  width: 16px;
}

.area-switcher span {
  font-size: 10px;
  letter-spacing: 0;
}

.area-switcher select {
  border: 0;
  min-height: 40px;
  min-width: 150px;
  padding-left: 2px;
}

.alerts-button {
  background: #ffffff;
  border-color: #d7e1ed;
  color: var(--ink);
  min-height: 42px;
  padding: 8px 10px;
  text-decoration: none;
}

.alerts-button:hover {
  background: #f7fafc;
  border-color: #aac2d8;
}

.alerts-button > svg {
  color: #b57b22;
  height: 17px;
  width: 17px;
}

.alerts-button strong {
  background: #c96b61;
  font-size: 11px;
  height: 20px;
  min-width: 20px;
}

.user-avatar {
  align-items: center;
  background: #e1f0ed;
  border: 1px solid #c7dfda;
  border-radius: 50%;
  color: #315f58;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.user-badge {
  background: transparent;
  border: 0;
  color: #43536d;
  max-width: 150px;
  overflow: hidden;
  padding: 6px 2px;
  text-overflow: ellipsis;
}

.sync-status {
  background: #f7f9fc;
  border: 1px solid #e0e7f0;
  border-radius: 999px;
  color: #7a8799;
  min-height: 30px;
  padding: 4px 8px;
}

.sync-status.online {
  background: #f1f7f4;
  color: #4c7c62;
}

.logout-link,
.primary-button,
.secondary-button,
.mini-button {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  text-decoration: none;
}

.logout-link > svg,
.primary-button > svg,
.secondary-button > svg,
.mini-button > svg {
  height: 16px;
  pointer-events: none;
  width: 16px;
}

.shell {
  max-width: 1520px;
  padding: 28px clamp(18px, 3vw, 42px) 54px;
}

.summary-grid {
  gap: 14px;
  margin-bottom: 24px;
}

.summary-grid article {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(19, 46, 82, 0.045);
  display: flex;
  justify-content: space-between;
  min-height: 116px;
  padding: 19px 20px;
}

.summary-grid article > svg {
  border-radius: 7px;
  height: 36px;
  padding: 9px;
  width: 36px;
}

.summary-grid .summary-total > svg { background: #e7f3f7; color: #087f9b; }
.summary-grid .summary-low > svg { background: var(--amber); color: #a1742d; }
.summary-grid .summary-critical > svg { background: var(--coral); color: #b45f56; }
.summary-grid .summary-lots > svg { background: var(--sage); color: #4c8668; }

.summary-grid span {
  color: #6e7d93;
  font-size: 12px;
  font-weight: 650;
}

.summary-grid strong {
  color: #101f39;
  font-size: 34px;
  font-weight: 780;
  line-height: 1;
  margin-top: 12px;
}

.summary-grid .summary-critical strong {
  color: #bd6258;
}

.dashboard-welcome {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 4px 0 22px;
}

.dashboard-welcome h2 {
  font-size: 30px;
  margin: 5px 0 5px;
}

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

.module-kicker {
  color: var(--teal);
  font-size: 10px;
  letter-spacing: 0;
}

.module-shortcuts {
  gap: 10px;
  margin-bottom: 20px;
}

.module-shortcuts a {
  border-left-width: 3px;
  box-shadow: none;
  min-height: 72px;
  padding: 14px 16px;
}

.module-shortcuts a:hover {
  border-color: #9dbbd1;
  box-shadow: 0 8px 20px rgba(19, 46, 82, 0.06);
  transform: translateY(-1px);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
}

.dashboard-grid .panel {
  position: static;
}

.dashboard-grid > .panel:last-child {
  grid-column: 1 / -1;
}

.panel-heading-line {
  align-items: flex-start;
  border-bottom: 1px solid #e8eef5;
  display: flex;
  justify-content: space-between;
  margin: -2px 0 14px;
  padding-bottom: 13px;
}

.panel-heading-line h2 {
  font-size: 17px;
  margin: 3px 0 0;
}

.panel-heading-line > svg {
  background: #edf4f9;
  border-radius: 7px;
  color: #38779e;
  height: 34px;
  padding: 8px;
  width: 34px;
}

.panel,
.history-section,
.record-card,
.record-line,
.record-disclosure,
.filter-row,
.inline-form,
.controls,
.panel-table {
  border-color: var(--line);
  box-shadow: 0 5px 18px rgba(19, 46, 82, 0.04);
}

.panel,
.history-section {
  padding: 20px;
}

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

.section-heading h2,
.panel-title h2 {
  color: #132543;
  font-size: 19px;
}

.section-heading p,
.panel-title p {
  color: #6c7b91;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.icon-button,
.icon-only {
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
  min-height: 42px;
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 5px 12px rgba(8, 127, 155, 0.14);
}

.primary-button:hover:not(:disabled) {
  background: #096d87;
  border-color: #096d87;
  box-shadow: 0 7px 16px rgba(8, 127, 155, 0.18);
  transform: translateY(-1px);
}

.secondary-button,
.icon-button,
.icon-only,
.mini-button {
  background: #ffffff;
  border-color: #cad7e5;
}

.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.icon-only:hover:not(:disabled),
.mini-button:hover:not(:disabled) {
  background: #f5f8fb;
  border-color: #9db7cc;
}

.icon-only {
  padding: 9px;
}

.icon-only > svg {
  height: 18px;
  pointer-events: none;
  width: 18px;
}

input,
select,
textarea {
  border-color: #cbd8e6;
  border-radius: 7px;
  min-height: 44px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aabfd2;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 155, 0.11);
  outline: 0;
}

.controls {
  background: #ffffff;
  padding: 15px;
}

.inventory-list-head {
  align-items: center;
  background: #eef3f8;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: #53637b;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 18px;
  grid-template-columns: minmax(240px, 1.45fr) minmax(150px, 0.72fr) 120px minmax(145px, 0.72fr) minmax(230px, 1fr);
  padding: 13px 18px;
  text-transform: uppercase;
}

.inventory-list {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 22px rgba(19, 46, 82, 0.045);
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.inventory-list .inventory-card {
  align-items: center;
  background: #ffffff !important;
  border: 0;
  border-bottom: 1px solid #e4eaf1;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink) !important;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(240px, 1.45fr) minmax(150px, 0.72fr) 120px minmax(145px, 0.72fr) minmax(230px, 1fr);
  min-height: 112px;
  padding: 16px 18px;
}

.inventory-list .inventory-card:last-child {
  border-bottom: 0;
}

.inventory-list .inventory-card.critical {
  box-shadow: inset 3px 0 0 #cf746b;
}

.inventory-list .inventory-card.low {
  box-shadow: inset 3px 0 0 #d5aa57;
}

.inventory-list .inventory-card:hover {
  background: #f9fbfd !important;
  transform: none;
}

.inventory-identity {
  min-width: 0;
}

.inventory-identity h3 {
  color: #14233d;
  font-size: 15px;
  margin: 0 0 6px;
}

.inventory-identity .tag {
  background: transparent;
  color: #5d6f88;
  font-size: 11px;
  padding: 0;
}

.inventory-identity .card-meta {
  font-size: 11px;
  gap: 2px;
  margin-top: 7px;
}

.inventory-stock-cell {
  display: grid;
  gap: 7px;
}

.inventory-stock-cell .stock-number strong {
  color: #13223a;
  font-size: 24px;
}

.inventory-stock-cell .stock-number span,
.inventory-stock-cell small,
.inventory-expiry-cell span {
  color: var(--muted);
  font-size: 11px;
}

.inventory-stock-cell .meter {
  height: 6px;
  max-width: 130px;
}

.inventory-card.critical .meter span { background: #c96b61; }
.inventory-card.low .meter span { background: #d1a34d; }
.inventory-card.ok .meter span { background: #5b9b7a; }

.inventory-state-cell {
  align-items: flex-start;
  display: flex;
}

.inventory-expiry-cell {
  display: grid;
  gap: 7px;
  justify-items: start;
}

.inventory-expiry-cell strong {
  font-size: 12px;
}

.inventory-expiry-cell .soft-status {
  font-size: 10px;
  padding: 4px 7px;
}

.inventory-list .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.mini-button {
  border: 1px solid #ced9e5;
  border-radius: 6px;
  color: #263a58;
  font-size: 11px;
  font-weight: 750;
  min-height: 34px;
  padding: 6px 9px;
}

.mini-button.icon-step {
  gap: 2px;
  min-width: 48px;
}

.mini-button.icon-step > svg {
  height: 14px;
  width: 14px;
}

.mini-button.danger {
  border-color: #e0b7b2;
  color: #9d514c;
}

.state,
.soft-status,
.tag {
  font-weight: 750;
}

.state.ok,
.soft-status.success {
  background: #e6f3ec;
  border-color: #c5dfd0;
  color: #447a5d;
}

.state.low,
.soft-status.warning {
  background: #fbf0d8;
  border-color: #ead29e;
  color: #8b6427;
}

.state.critical,
.soft-status.danger {
  background: #f8e6e3;
  border-color: #e3bab5;
  color: #9b4f49;
}

.soft-status.info {
  background: #e7f1f8;
  border-color: #c4d9e7;
  color: #3e6e8c;
}

.reorder-item,
.history-item,
.bar-row {
  background: #ffffff;
  border-color: #e0e7ef;
  padding: 12px 13px;
}

.reorder-item.alert-critical,
.warehouse-alert.alert-critical,
.notification-item.danger {
  background: #fdf3f1;
  border-color: #e6b8b3;
  border-left: 4px solid #c96b61;
}

.reorder-item.alert-low,
.warehouse-alert.alert-low,
.warehouse-alert.alert-pending,
.notification-item.warning {
  background: #fdf8ed;
  border-color: #ead3a3;
  border-left: 4px solid #d0a04d;
}

.warehouse-alert.alert-restored,
.history-item.alert-restored,
.notification-item.success {
  background: #f0f8f3;
  border-color: #bdd8c7;
  border-left: 4px solid #5e9876;
}

.table-wrap,
.panel-table {
  scrollbar-color: #b8c7d6 transparent;
}

table {
  background: #ffffff;
}

th {
  background: #eef3f8;
  color: #53637b;
  font-size: 11px;
  letter-spacing: 0;
  padding: 13px 12px;
}

td {
  color: #223653;
  padding: 13px 12px;
}

tbody tr:hover {
  background: #f8fafc;
}

.record-disclosure > summary:hover {
  background: #f7fafc;
}

.record-disclosure[open] {
  border-color: #adc5d8;
}

.disclosure-chevron {
  background: #e7f1f6;
  color: #397b9a;
}

dialog,
dialog.dialog-fallback-open {
  border: 1px solid #d3deea;
  box-shadow: 0 28px 70px rgba(10, 30, 63, 0.22);
}

.dialog-form {
  padding: 22px;
}

.scanner-box,
.scanner-inline,
.procedure-item-row,
.consumption-row {
  background: #f7fafc;
  border-color: #d7e2ed;
}

@media (max-width: 1280px) {
  .user-badge { display: none; }
  .area-switcher select { min-width: 125px; }
  .inventory-list-head { display: none; }
  .inventory-list { border-radius: 8px; gap: 10px; background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .inventory-list .inventory-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    grid-template-columns: minmax(220px, 1.35fr) minmax(140px, 0.72fr) 120px minmax(140px, 0.72fr);
  }
  .inventory-list .card-actions {
    border-top: 1px solid #e6ecf2;
    grid-column: 1 / -1;
    padding-top: 12px;
  }
}

@media (max-width: 940px) {
  .multipage-shell .app-frame { grid-template-columns: 1fr; }
  .sidebar {
    display: block;
    max-width: 300px;
    transform: translateX(-102%);
    transition: transform 200ms ease, visibility 200ms ease;
    visibility: hidden;
    z-index: 30;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }
  body.sidebar-open::after {
    background: rgba(7, 27, 70, 0.36);
    content: "";
    inset: 0;
    position: fixed;
    z-index: 20;
  }
  .topbar {
    align-items: center;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    position: sticky;
  }
  .topbar-brand img { display: block; height: 42px; width: 42px; }
  .topbar .header-actions { grid-column: 1 / -1; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .panel:last-child { grid-column: auto; }
  .inventory-list .inventory-card {
    grid-template-columns: minmax(0, 1.35fr) minmax(130px, 0.65fr);
  }
  .inventory-state-cell,
  .inventory-expiry-cell { justify-self: start; }
  .inventory-list .card-actions { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .shell { padding: 18px 14px 42px; }
  .topbar { padding: 12px 14px; }
  .topbar-brand { min-width: 0; }
  .topbar h1 { font-size: 19px; }
  .topbar .header-actions { display: grid; grid-template-columns: 1fr auto auto; }
  .header-actions .area-switcher { grid-column: 1 / -1; }
  .header-actions .alerts-button { grid-column: 1; }
  .header-actions .user-avatar { grid-column: 2; width: 38px; }
  .header-actions .sync-status { grid-column: 3; }
  .header-actions #logoutButton { grid-column: 1 / -1; }
  .area-switcher select { min-width: 0; }
  .summary-grid { gap: 10px; }
  .summary-grid article { min-height: 104px; padding: 15px; }
  .summary-grid article > svg { height: 32px; padding: 8px; width: 32px; }
  .summary-grid strong { font-size: 28px; }
  .dashboard-welcome { align-items: stretch; flex-direction: column; }
  .dashboard-welcome h2 { font-size: 25px; }
  .inventory-list .inventory-card {
    gap: 14px;
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .inventory-list .card-actions { grid-column: auto; }
  .inventory-stock-cell .meter { max-width: 100%; }
  .inventory-list .card-actions { justify-content: stretch; }
  .inventory-list .card-actions .mini-button { flex: 1 1 calc(50% - 6px); }
  .section-heading { gap: 12px; }
  .heading-actions { display: grid; grid-template-columns: 1fr; }
  .heading-actions > * { width: 100%; }
  menu { align-items: stretch; flex-direction: column-reverse; }
  menu > button { width: 100%; }
}

/* Login: acceso clinico limpio y separado del sitio publico. */
.login-screen {
  background:
    linear-gradient(90deg, #071b46 0, #071b46 min(34vw, 460px), transparent min(34vw, 460px)),
    #f4f7fb;
  min-height: 100svh;
  padding: clamp(20px, 5vw, 64px);
}

.login-card {
  border-color: #d7e2ed;
  box-shadow: 0 24px 64px rgba(10, 35, 72, 0.14);
  gap: 18px;
  margin-left: clamp(0px, 18vw, 250px);
  max-width: 430px;
  padding: clamp(26px, 4vw, 38px);
}

.login-card img {
  background: #ffffff;
  border-color: #d8e4ee;
  height: 84px;
  object-fit: contain;
  width: 84px;
}

.login-card p {
  color: #087f9b;
  letter-spacing: 0;
}

.login-card h1 {
  color: #102342;
  font-size: 29px;
  letter-spacing: 0;
}

.login-card label span {
  color: #43536d;
  font-weight: 750;
}

.login-card .primary-button {
  margin-top: 2px;
}

@media (max-width: 720px) {
  .login-screen {
    align-items: end;
    background: linear-gradient(180deg, #071b46 0, #071b46 32%, #f4f7fb 32%);
    padding: 18px;
  }

  .login-card {
    margin: 0;
    max-width: none;
  }
}

/* IziVentario 4.0: sucursales, valorizacion y lectura ejecutiva. */
.branch-switcher > svg {
  color: #4f806f;
}

.orders-button > svg {
  color: #8f681f;
}

.notices-button > svg {
  color: #a45450;
}

.notices-button strong {
  background: #b9635c;
}

.module-shortcuts a {
  align-content: center;
  display: grid;
  gap: 3px 10px;
  grid-template-columns: 34px minmax(0, 1fr);
}

.module-shortcuts a > svg {
  align-self: center;
  grid-row: 1 / 3;
  height: 22px;
  width: 22px;
}

.module-shortcuts .shortcut-inventory {
  background: rgba(218, 237, 245, 0.72);
  border-color: #b8d5e1;
  color: #2d6277;
}

.module-shortcuts .shortcut-attentions {
  background: rgba(225, 240, 234, 0.78);
  border-color: #bad6c9;
  color: #3d705d;
}

.module-shortcuts .shortcut-procedures {
  background: rgba(231, 235, 244, 0.82);
  border-color: #c5cede;
  color: #53677f;
}

.module-shortcuts .shortcut-warehouses {
  background: rgba(249, 240, 219, 0.78);
  border-color: #e4cf9e;
  color: #785f2d;
}

.module-shortcuts .shortcut-reports {
  background: rgba(240, 232, 240, 0.72);
  border-color: #d7c6d7;
  color: #6c5870;
}

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

.analytics-kpi,
.finance-kpi {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 5px 18px rgba(19, 46, 82, 0.045);
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 18px;
}

.analytics-kpi span,
.finance-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.analytics-kpi strong,
.finance-kpi strong {
  color: var(--ink);
  font-size: 27px;
  font-weight: 780;
  overflow-wrap: anywhere;
}

.analytics-kpi small,
.finance-kpi small {
  color: var(--muted);
  font-size: 12px;
}

.analytics-kpi.kpi-value {
  background: #eef6f8;
  border-color: #c9dde5;
}

.analytics-kpi.kpi-critical {
  background: #faeeec;
  border-color: #e6c1bd;
}

.analytics-kpi.kpi-warning {
  background: #fbf4e6;
  border-color: #ead5a9;
}

.analytics-kpi.kpi-expiry {
  background: #edf5f0;
  border-color: #c8ddd0;
}

.stats-grid .stats-wide {
  grid-column: span 2;
}

.backup-status {
  background: #f5f8fb;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 14px;
}

.backup-status .soft-status {
  justify-self: start;
}

.backup-status small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.backup-destination {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.backup-destination + .backup-destination {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 12px;
}

.catalog-search {
  display: grid;
  gap: 6px;
  margin: 16px 0 10px;
}

.catalog-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.inline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.table-input input {
  min-width: 120px;
  width: 140px;
}

.compact-check {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 5px;
  margin-top: 5px;
}

.compact-check input {
  min-height: 16px;
  width: 16px;
}

.stock-value {
  color: #315f58;
  display: block;
  font-size: 18px;
  margin-top: 8px;
}

.consumption-row .consumption-justification {
  grid-column: 1 / 3;
}

.consumption-row .consumption-charge {
  align-self: center;
  grid-column: 3 / 5;
  justify-self: end;
  min-width: 190px;
}

.consumption-row .consumption-charge span {
  line-height: 1.25;
  white-space: normal;
}

.procedure-item-row .check-line {
  align-self: end;
}

.compact-filters {
  padding: 10px 12px;
}

@media (max-width: 1180px) {
  .analytics-kpi-grid,
  .finance-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid .stats-wide {
    grid-column: auto;
  }
}

@media (max-width: 940px) {
  .procedure-item-row,
  .consumption-row {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.45fr);
  }

  .procedure-item-row > label,
  .procedure-item-row label:nth-of-type(4),
  .consumption-row > label:first-child,
  .consumption-row > label:nth-of-type(2),
  .consumption-row > label:nth-of-type(3),
  .consumption-row .consumption-justification,
  .consumption-row .consumption-charge,
  .consumption-row .remove-consumption {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    min-width: 0;
  }

  .procedure-item-row > label:first-child,
  .consumption-row > label:first-child,
  .consumption-row .consumption-justification {
    grid-column: 1 / -1;
  }

  .consumption-row .consumption-charge {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .topbar .header-actions {
    grid-template-columns: 1fr 1fr auto;
  }

  .header-actions .branch-switcher,
  .header-actions .area-switcher {
    grid-column: 1 / -1;
  }

  .header-actions .orders-button,
  .header-actions .notices-button {
    grid-column: auto;
  }

  .header-actions .user-avatar {
    grid-column: 3;
  }

  .header-actions .sync-status {
    grid-column: 1;
  }

  .header-actions #logoutButton {
    grid-column: 2 / -1;
  }

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

  .procedure-item-row,
  .consumption-row {
    grid-template-columns: 1fr;
  }

  .procedure-item-row > *,
  .procedure-item-row > label:first-child,
  .consumption-row > *,
  .consumption-row > label:first-child,
  .consumption-row .consumption-justification {
    grid-column: 1;
  }

  .module-shortcuts {
    grid-template-columns: 1fr;
  }
}
