:root {
  --bg: #f4f6f9;
  --panel: #fff;
  --ink: #17212f;
  --muted: #667085;
  --line: #d8dee9;
  --nav: #253247;
  --nav2: #32445c;
  --blue: #2f5f91;
  --green: #287a3e;
  --red: #b42318;
  --amber: #b45309;
  --shadow: 0 12px 28px rgba(24, 39, 75, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", Arial, sans-serif;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button {
  min-height: 38px;
  border: 1px solid #b8c3d2;
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
button.primary { background: var(--nav); border-color: var(--nav); color: #fff; }
button.ghost { background: transparent; color: #dbe5f2; border-color: rgba(255,255,255,.25); width: 100%; margin-top: 12px; }
button.danger { border-color: #efb4ae; color: var(--red); }
input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 86px; resize: vertical; }
label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.hidden { display: none !important; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 4px 0 0; color: var(--muted); }
.login-card label { margin-top: 14px; }
.login-card button { width: 100%; margin-top: 16px; }
.hint { font-size: 13px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row.side { padding: 6px 6px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-row.side strong { color: #fff; display: block; }
.brand-row.side span { display: block; margin-top: 2px; color: #cbd5e1; font-size: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--nav);
  color: #fff;
  font-weight: 900;
}
.side .brand-mark { background: #fff; color: var(--nav); }
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}
aside {
  background: var(--nav);
  padding: 16px 12px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  overflow: auto;
}
nav {
  display: grid;
  gap: 5px;
  padding-top: 14px;
}
.nav-item {
  position: relative;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  color: #dbe5f2;
  background: transparent;
  margin: 0;
  padding: 9px 10px;
  font-size: 13px;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-item.active, .nav-item:hover { background: var(--nav2); color: #fff; transform: translateY(-1px); }
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 3px;
  border-radius: 999px;
  background: #8fd3ff;
  animation: navSlide .22s ease;
}
.guide-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  margin-top: 14px;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  color: #dbe5f2;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
}
.guide-link:hover { background: var(--nav2); color: #fff; }
button.ghost {
  width: 100%;
  margin-top: 8px;
  white-space: nowrap;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}
main { min-width: 0; }
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
header h2 { margin: 0; font-size: 21px; }
header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(520px, 48vw);
}
#globalSearch { max-width: 380px; }
.header-actions #globalSearch {
  flex: 1 1 280px;
}
button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}
.view { display: none; padding: 22px; }
.view.active { display: block; }
.view.view-enter { animation: viewEnter .22s ease; }
@keyframes navSlide {
  from { opacity: 0; transform: scaleX(.45); }
  to { opacity: 1; transform: scaleX(1); }
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.metrics article, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.metrics article { padding: 16px; min-height: 92px; }
.doa-stock-panel { margin-bottom: 16px; }
.stock-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.stock-strip.warehouse {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin-bottom: 0;
}
.stock-card {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.stock-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.stock-card strong {
  display: block;
  margin-top: 6px;
  font-size: 25px;
}
.warehouse-card { background: #f8fff9; }
.clickable-card {
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.clickable-card:hover {
  border-color: #8db7df;
  box-shadow: 0 8px 20px rgba(47, 95, 145, .14);
  transform: translateY(-1px);
}
.metrics span { color: var(--muted); font-size: 12px; font-weight: 800; }
.metrics strong { display: block; margin-top: 9px; font-size: 28px; }
.quick-panel { margin-bottom: 16px; }
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.quick-actions button {
  min-height: 52px;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .85fr);
  gap: 14px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar h2 { margin: 0; font-size: 20px; }
.toolbar p { margin: 4px 0 0; color: var(--muted); }
.import-panel { margin-bottom: 14px; }
.import-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #f2f7fc;
  color: #334155;
  font-size: 13px;
}
.message-schema-note {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-left: 4px solid #7c3aed;
  border-radius: 8px;
  background: #f8faff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.message-schema-note strong {
  color: var(--ink);
  font-size: 13px;
}
.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.readiness-card {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
}
.readiness-card.ready,
.readiness-card.configured {
  border-left-color: #16a34a;
  background: #f8fffb;
}
.readiness-card.waiting {
  border-left-color: #f59e0b;
  background: #fffaf0;
}
.readiness-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
}
.readiness-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.integration-subpanel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.integration-subpanel h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.admin-user-list .panel-body {
  overflow-x: auto;
}
.admin-user-list table {
  min-width: 760px;
}
.admin-user-editor .form {
  align-items: start;
}
.permission-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.permission-chip {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}
.permission-chip input {
  width: auto;
  min-height: auto;
  accent-color: var(--blue);
}
.permission-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 14px; overflow: auto; }
.filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, .45fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.form .wide, .checklist { grid-column: 1 / -1; }
.scan-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.scan-actions input {
  display: none;
}
.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 6px;
}
.check-item {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.check-item input { width: auto; min-height: auto; }
.preview-box {
  min-height: 190px;
  display: grid;
  place-items: center;
  border: 1px dashed #9aa9bd;
  border-radius: 8px;
  background: #fbfcfe;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.preview-box img {
  display: none;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}
.attachment-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.attachment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.attachment-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f1f4f8;
}
.attachment-card div {
  padding: 9px;
  font-size: 12px;
  color: var(--muted);
}
.attachment-card strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 2px;
}
.doa-photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px dashed rgba(15, 35, 55, .18);
  border-radius: 14px;
  background: rgba(248, 250, 252, .82);
}
.doa-photo-preview .import-note {
  grid-column: 1 / -1;
  margin: 0;
}
.doa-photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(15, 35, 55, .12);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 35, 55, .08);
}
.doa-photo-card.pending {
  border-color: rgba(20, 184, 166, .5);
  background: #f0fdfa;
}
.doa-photo-card img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.doa-photo-card div {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
  font-size: 12px;
  color: var(--muted);
}
.doa-photo-card strong {
  color: var(--ink);
  font-size: 13px;
}
.doa-photo-card button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  font-size: 12px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); background: #f7f9fc; font-size: 12px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }
tr.selected-row td { background: #eef6ff; border-bottom-color: #b9d7f4; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.badge.good { color: var(--green); border-color: #b7dfc2; background: #f3fbf5; }
.badge.warn { color: var(--amber); border-color: #f3ca9d; background: #fff7ed; }
.badge.bad { color: var(--red); border-color: #efb4ae; background: #fff5f5; }

/* User-adjustable work panels. Native browser resize keeps the feature simple and reliable. */
.view.active > .panel,
.view.active > .grid > .panel,
.view.active > .grid section.panel {
  resize: both;
  overflow: auto;
  min-width: 280px;
  min-height: 150px;
  max-width: 100%;
}

.view.active > .panel::after,
.view.active > .grid > .panel::after,
.view.active > .grid section.panel::after {
  content: "크기조절";
  display: block;
  width: fit-content;
  margin: 0 10px 8px auto;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.panel-body {
  min-height: 80px;
}

@media (max-width: 720px) {
  .view.active > .panel,
  .view.active > .grid > .panel,
  .view.active > .grid section.panel {
    resize: vertical;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .view.active > .panel::after,
  .view.active > .grid > .panel::after,
  .view.active > .grid section.panel::after {
    content: "세로 크기조절";
  }
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--nav);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(120%);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 940px) {
  .app {
    display: block;
    padding-bottom: 94px;
  }
  aside {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    display: block;
    height: auto;
    min-height: auto;
    padding: 6px 8px 8px;
    background: #fff;
    color: var(--ink);
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 28px rgba(15, 23, 42, .12);
    overflow: visible;
  }
  .brand-row.side {
    display: none;
  }
  nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding-top: 0;
  }
  .nav-item {
    width: 100%;
    min-height: 34px;
    padding: 5px 3px;
    justify-content: center;
    font-size: 10px;
    line-height: 1.15;
    white-space: normal;
    word-break: keep-all;
    color: var(--muted);
    background: #fff;
    border: 1px solid transparent;
  }
  .nav-item.active,
  .nav-item:hover {
    background: var(--nav);
    color: #fff;
    border-color: var(--nav);
    transform: none;
  }
  .nav-item.active::after {
    display: none;
  }
  .guide-link,
  button.ghost {
    width: auto;
    min-height: 22px;
    margin-top: 4px;
    padding: 2px 7px;
    font-size: 10px;
    line-height: 1.2;
    border-color: var(--line);
    color: var(--muted);
    background: #fff;
  }
  .guide-link { display: inline-flex; margin-right: 4px; }
  button.ghost { display: inline-flex; }
  header {
    position: static;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
  }
  #globalSearch { max-width: none; }
  .header-actions {
    min-width: 0;
    width: 100%;
  }
  .metrics {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
  }
  .metrics article {
    flex: 0 0 160px;
    min-height: 82px;
    scroll-snap-align: start;
  }
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .stock-card,
  .quick-actions button {
    flex: 0 0 145px;
  }
  .grid, .form, .checklist, .filter-row { grid-template-columns: 1fr; }
  .scan-actions { grid-template-columns: 1fr 1fr; }
  .attachment-list { grid-template-columns: 1fr; }
  .view { padding: 14px; }
  button, input, select {
    min-height: 46px;
  }
  .quick-actions button {
    min-height: 56px;
    font-size: 15px;
  }
  .metrics article {
    min-height: 76px;
  }
}

/* Absolute final responsive priority */
.app {
  width: 100%;
  max-width: 100%;
  grid-template-columns: clamp(212px, 17vw, 260px) minmax(0, 1fr);
}

main {
  width: 100%;
  max-width: 1680px;
  min-width: 0;
  margin-inline: auto;
}

.view {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: clamp(14px, 2vw, 28px);
}

#globalSearch {
  width: min(420px, 42vw);
  max-width: 100%;
}
.header-actions #globalSearch {
  width: auto;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.stock-strip,
.stock-strip.warehouse {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

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

.filter-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.panel,
.panel-body,
.panel-head,
header,
header > div {
  min-width: 0;
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

@media (max-width: 940px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app {
    display: block;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  main,
  .view {
    max-width: none;
  }

  .view {
    padding: clamp(10px, 3.4vw, 16px);
  }

  header {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: clamp(8px, 2.8vw, 12px) clamp(10px, 3.6vw, 14px);
  }

  header h2 {
    font-size: clamp(16px, 5vw, 19px);
    line-height: 1.25;
  }

  header p {
    font-size: clamp(10px, 3.2vw, 12px);
    line-height: 1.35;
  }

  #globalSearch {
    width: 100%;
    height: clamp(34px, 9.5vw, 40px);
    min-height: 0;
    font-size: clamp(12px, 3.5vw, 14px);
  }
  .header-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
  }
  button.compact {
    min-height: 34px;
    padding: 0 9px;
    font-size: 11px;
  }

  aside {
    position: fixed;
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    top: auto;
    z-index: 40;
    width: auto;
    max-height: 38vh;
    padding: clamp(6px, 2vw, 8px);
    overflow-y: auto;
  }

  .brand-row.side {
    display: none;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: clamp(5px, 1.8vw, 8px);
  }

  .nav-item {
    min-width: 0;
    min-height: clamp(38px, 11vw, 46px);
    padding: 6px 4px;
    font-size: clamp(10px, 3.1vw, 12px);
    line-height: 1.2;
    text-align: center;
    justify-content: center;
    word-break: keep-all;
  }

  .guide-link,
  button.ghost {
    width: auto;
    min-height: 28px;
    margin-top: 6px;
    padding: 5px 10px;
    font-size: clamp(10px, 3vw, 12px);
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: clamp(8px, 2.4vw, 12px);
    padding-bottom: 0;
  }

  .metrics article,
  .stock-card,
  .quick-actions button {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .grid,
  .form,
  .checklist,
  .filter-row {
    grid-template-columns: 1fr;
  }

  .scan-actions {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  button,
  input,
  select,
  textarea {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 340px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions,
  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Dashboard button auto-fit rows */
nav,
.quick-actions,
.panel-head > div,
.toolbar,
.scan-actions {
  min-width: 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  align-items: stretch;
}

.quick-actions button {
  width: 100%;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.panel-head {
  gap: 10px;
}

.panel-head button,
.toolbar button,
.scan-actions button {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
}

@media (min-width: 941px) {
  nav {
    display: grid;
    grid-template-columns: 1fr;
  }

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

@media (max-width: 940px) {
  nav {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: clamp(5px, 1.8vw, 8px);
  }

  .nav-item {
    flex: 1 1 clamp(78px, 24vw, 132px);
    width: auto;
  }

  .quick-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: clamp(8px, 2.4vw, 12px);
    scroll-snap-type: x proximity;
  }

  .quick-actions button {
    flex: 1 0 clamp(128px, 42vw, 180px);
    scroll-snap-align: start;
  }

  .panel-head button,
  .toolbar button,
  .scan-actions button {
    flex: 1 1 auto;
    min-width: min(100%, 112px);
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .nav-item {
    flex-basis: clamp(82px, 30vw, 124px);
  }

  .quick-actions button {
    flex-basis: clamp(132px, 48vw, 170px);
  }
}

/* Fold/tablet unfolded layout - final priority */
@media (min-width: 600px) and (max-width: 940px) {
  .app {
    display: block;
    padding-bottom: 0;
  }

  aside {
    position: static;
    width: 100%;
    max-height: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 10px 14px;
    overflow: visible;
  }

  .brand-row.side {
    display: flex;
    padding: 4px 0 10px;
    margin-bottom: 8px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
  }

  .nav-item {
    flex: none;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .guide-link,
  button.ghost {
    display: inline-flex;
    width: auto;
    min-height: 30px;
    margin-top: 8px;
  }

  header {
    padding: 12px 18px;
  }

  .view {
    padding: 16px 18px 24px;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .quick-actions button {
    flex: none;
    width: 100%;
    min-height: 58px;
  }
}

/* Wider fold/tablet safeguard */
@media (min-width: 600px) and (max-width: 1100px) {
  .app {
    display: block;
    padding-bottom: 0;
  }

  aside {
    position: static;
    width: 100%;
    max-height: none;
    border-radius: 0;
    padding: 10px 14px;
    overflow: visible;
  }

  .brand-row.side {
    display: flex;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
  }

  .nav-item {
    flex: none;
    width: 100%;
  }

  .view,
  main {
    width: 100%;
    max-width: none;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .quick-actions button {
    flex: none;
    width: 100%;
  }
}

/* Fold/tablet unfolded layout */
@media (min-width: 600px) and (max-width: 940px) {
  .app {
    display: block;
    padding-bottom: 0;
  }

  aside {
    position: static;
    width: 100%;
    max-height: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 10px 14px;
    overflow: visible;
  }

  .brand-row.side {
    display: flex;
    padding: 4px 0 10px;
    margin-bottom: 8px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
  }

  .nav-item {
    flex: none;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .guide-link,
  button.ghost {
    display: inline-flex;
    width: auto;
    min-height: 30px;
    margin-top: 8px;
  }

  header {
    padding: 12px 18px;
  }

  .view {
    padding: 16px 18px 24px;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .quick-actions button {
    flex: none;
    width: 100%;
    min-height: 58px;
  }
}

/* Final responsive fit system */
*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: clamp(212px, 17vw, 260px) minmax(0, 1fr);
}

main {
  width: 100%;
  max-width: 1680px;
  min-width: 0;
  margin-inline: auto;
}

.view {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: clamp(14px, 2vw, 28px);
}

header {
  width: 100%;
  min-width: 0;
  gap: clamp(10px, 2vw, 20px);
}

header > div {
  min-width: 0;
}

#globalSearch {
  width: min(420px, 42vw);
  max-width: 100%;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.stock-strip,
.stock-strip.warehouse {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

.grid {
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 340px), .85fr);
}

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

.filter-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  align-items: end;
}

.filter-row button,
.filter-row input,
.filter-row select {
  width: 100%;
}

.panel,
.panel-body,
.panel-head {
  min-width: 0;
}

.panel-body {
  max-width: 100%;
}

table {
  min-width: 720px;
}

.panel-body > table,
.panel-body .table-wrap {
  max-width: 100%;
}

@media (min-width: 1441px) {
  .view {
    max-width: 1540px;
  }

  .metrics article {
    min-height: 104px;
  }
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

  #globalSearch {
    width: min(360px, 36vw);
  }
}

@media (max-width: 940px) {
  body {
    min-width: 0;
  }

  .app {
    display: block;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  main {
    max-width: none;
  }

  .view {
    max-width: none;
    padding: clamp(10px, 3.4vw, 16px);
  }

  header {
    position: static;
    grid-template-columns: 1fr;
    padding: clamp(8px, 2.8vw, 12px) clamp(10px, 3.6vw, 14px);
  }

  header h2 {
    font-size: clamp(16px, 5vw, 19px);
  }

  header p {
    font-size: clamp(10px, 3.2vw, 12px);
  }

  #globalSearch {
    width: 100%;
    height: clamp(34px, 9.5vw, 40px);
    min-height: 0;
    font-size: clamp(12px, 3.5vw, 14px);
  }

  aside {
    position: fixed;
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    top: auto;
    z-index: 40;
    width: auto;
    max-height: 38vh;
    padding: clamp(6px, 2vw, 8px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .brand-row.side {
    display: none;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: clamp(5px, 1.8vw, 8px);
  }

  .nav-item {
    min-width: 0;
    min-height: clamp(38px, 11vw, 46px);
    padding: 6px 4px;
    font-size: clamp(10px, 3.1vw, 12px);
    line-height: 1.2;
    text-align: center;
    justify-content: center;
    word-break: keep-all;
  }

  .guide-link,
  button.ghost {
    width: auto;
    min-height: 28px;
    margin-top: 6px;
    padding: 5px 10px;
    font-size: clamp(10px, 3vw, 12px);
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: clamp(8px, 2.4vw, 12px);
    padding-bottom: 0;
  }

  .metrics article,
  .stock-card,
  .quick-actions button {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .metrics article {
    min-height: clamp(76px, 20vw, 92px);
    padding: clamp(12px, 3.4vw, 16px);
  }

  .metrics strong,
  .stock-card strong {
    font-size: clamp(24px, 7vw, 30px);
  }

  .panel-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-head h3 {
    font-size: clamp(15px, 4vw, 17px);
  }

  .panel-head button,
  .toolbar button {
    min-height: 36px;
    width: auto;
  }

  .grid,
  .form,
  .checklist,
  .filter-row {
    grid-template-columns: 1fr;
  }

  .scan-actions {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  button,
  input,
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    font-size: max(16px, 1rem);
  }

  table {
    min-width: 640px;
  }
}

@media (max-width: 420px) {
  .view {
    padding-inline: 10px;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .quick-actions button {
    min-height: 52px;
  }
}

@media (max-width: 340px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions,
  nav {
    grid-template-columns: 1fr 1fr;
  }

  table {
    min-width: 560px;
  }
}

/* Image-led premium theme */
:root {
  --ops-visual: url("./assets/operations-hero.png");
  --chrome: rgba(255, 255, 255, .84);
  --chrome-strong: rgba(255, 255, 255, .94);
  --ink-strong: #07111f;
  --accent-cyan: #51d4e8;
}

body {
  background:
    radial-gradient(circle at 80% 0%, rgba(81, 212, 232, .13), transparent 30%),
    linear-gradient(180deg, #f7f9fc 0, #eef2f6 360px, #edf1f5 100%);
}

.login {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(90deg, rgba(7, 17, 31, .96) 0%, rgba(7, 17, 31, .82) 42%, rgba(7, 17, 31, .44) 100%),
    var(--ops-visual) center right / cover no-repeat;
}

.login::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 22%, rgba(81, 212, 232, .22), transparent 26%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
}

.login-card {
  background: rgba(255,255,255,.91);
  border: 1px solid rgba(255,255,255,.58);
  backdrop-filter: blur(18px);
}

.app {
  background:
    linear-gradient(90deg, rgba(238, 242, 246, .98) 0, rgba(238, 242, 246, .94) 52%, rgba(238, 242, 246, .88) 100%),
    var(--ops-visual) top right / 980px auto no-repeat;
}

aside {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 17, 31, .96), rgba(20, 35, 56, .94)),
    var(--ops-visual) center left / auto 100% no-repeat;
}

aside::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 24% 8%, rgba(81, 212, 232, .18), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0) 28%);
}

aside > * {
  position: relative;
  z-index: 1;
}

.brand-row.side {
  border-bottom-color: rgba(255,255,255,.16);
}

.side .brand-mark {
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(230, 246, 249, .96));
}

.nav-item {
  border: 1px solid transparent;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.12);
}

.nav-item.active {
  box-shadow:
    inset 3px 0 0 var(--accent-cyan),
    0 10px 26px rgba(0,0,0,.13);
}

header {
  background:
    linear-gradient(90deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.91) 54%, rgba(255,255,255,.78) 100%),
    var(--ops-visual) top right / 520px auto no-repeat;
  border-bottom-color: rgba(203, 213, 225, .72);
}

header h2,
.toolbar h2,
.panel-head h3 {
  color: var(--ink-strong);
}

#dashboard {
  position: relative;
  isolation: isolate;
}

#dashboard::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 24px;
  right: 24px;
  top: 18px;
  height: 176px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(7,17,31,.92), rgba(7,17,31,.58) 48%, rgba(7,17,31,.16)),
    var(--ops-visual) center right / cover no-repeat;
  box-shadow: 0 26px 70px rgba(7, 17, 31, .16);
}

#dashboard .metrics {
  padding: 18px 18px 4px;
}

#dashboard .metrics article {
  background: rgba(255,255,255,.92);
  border-color: rgba(255,255,255,.7);
  backdrop-filter: blur(12px);
}

.panel {
  background: var(--chrome-strong);
  backdrop-filter: blur(10px);
}

.panel-head {
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.9));
}

.doa-stock-panel,
.quick-panel,
.import-panel {
  box-shadow: 0 18px 42px rgba(15, 23, 42, .09);
}

.stock-card {
  background:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(239,247,255,.94));
}

.warehouse-card {
  background:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(239,253,246,.95));
}

.quick-actions button.primary {
  background:
    linear-gradient(135deg, rgba(23, 32, 51, .98), rgba(26, 70, 88, .96)),
    var(--ops-visual) center / cover no-repeat;
}

@media (min-width: 941px) {
  main {
    background:
      linear-gradient(180deg, rgba(247,249,252,.9), rgba(238,242,246,.96));
  }
}

@media (max-width: 940px) {
  .login {
    background:
      linear-gradient(180deg, rgba(7,17,31,.78), rgba(7,17,31,.94)),
      var(--ops-visual) center top / auto 100% no-repeat;
  }
  .app {
    background:
      linear-gradient(180deg, rgba(246,248,251,.94), rgba(238,242,246,.98)),
      var(--ops-visual) top right / 680px auto no-repeat;
  }
  aside {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    top: auto;
    z-index: 40;
    background:
      linear-gradient(180deg, rgba(7,17,31,.94), rgba(18,31,49,.94)),
      var(--ops-visual) center / cover no-repeat;
  }
  aside::before {
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  }
  header {
    background:
      linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,.88)),
      var(--ops-visual) top right / 420px auto no-repeat;
  }
  #dashboard::before {
    left: 14px;
    right: 14px;
    top: 10px;
    height: 150px;
    border-radius: 14px;
  }
  #dashboard .metrics {
    padding: 14px 12px 2px;
  }
  .nav-item {
    background: rgba(255,255,255,.9);
    border-color: rgba(255,255,255,.45);
  }
  .nav-item.active,
  .nav-item:hover {
    background: rgba(7, 17, 31, .94);
    border-color: rgba(81, 212, 232, .24);
  }
}

/* Premium operations UI refresh */
:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #d7dee8;
  --nav: #172033;
  --nav2: #243149;
  --blue: #2563a6;
  --teal: #0f766e;
  --green: #287a3e;
  --red: #b42318;
  --amber: #b45309;
  --surface: #f8fafc;
  --soft-blue: #eef6ff;
  --soft-teal: #ecfdfa;
  --shadow: 0 14px 34px rgba(16, 24, 40, .08);
  --shadow-strong: 0 24px 60px rgba(15, 23, 42, .14);
}

body {
  background:
    linear-gradient(180deg, #f7f9fc 0, #eef2f6 280px, #eef2f6 100%);
}

button {
  min-height: 40px;
  border-color: #c7d0dd;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
button:hover {
  border-color: #94a3b8;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}
button:active { transform: translateY(0); box-shadow: none; }
button.primary {
  border-color: #172033;
  background: linear-gradient(180deg, #263854, #172033);
  color: #fff;
}
button.danger {
  background: #fff7f7;
  border-color: #f0b7b3;
}

input, select, textarea {
  min-height: 40px;
  border-color: #cfd8e3;
  border-radius: 7px;
  background: #fff;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2f78bd;
  box-shadow: 0 0 0 3px rgba(47, 120, 189, .14);
}
label {
  color: #475569;
  font-size: 12px;
  letter-spacing: 0;
}

.login {
  background:
    linear-gradient(135deg, rgba(23, 32, 51, .92), rgba(15, 118, 110, .72)),
    linear-gradient(180deg, #f8fafc, #eef2f6);
}
.login-card {
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
}
.brand-mark {
  border-radius: 9px;
  background: linear-gradient(180deg, #263854, #172033);
}

.app {
  grid-template-columns: 248px minmax(0, 1fr);
}
aside {
  background:
    linear-gradient(180deg, #172033 0, #1d2b43 52%, #162130 100%);
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: 12px 0 30px rgba(15, 23, 42, .12);
}
.brand-row.side {
  padding: 8px 8px 18px;
  margin-bottom: 8px;
}
.side .brand-mark {
  color: #172033;
  box-shadow: 0 8px 18px rgba(0,0,0,.16);
}
.nav-item {
  min-height: 38px;
  border-radius: 7px;
  padding: 10px 12px;
  color: #d8e2ef;
}
.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,.11);
  color: #fff;
  transform: none;
}
.nav-item.active {
  box-shadow: inset 3px 0 0 #5fd5c7;
}
.nav-item.active::after { display: none; }
.guide-link,
button.ghost {
  border-radius: 7px;
}

header {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(203, 213, 225, .78);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}
header h2 {
  font-size: 22px;
  font-weight: 900;
}
header p { color: #64748b; }
#globalSearch {
  min-height: 42px;
  border-radius: 999px;
  padding-left: 16px;
  background: #f8fafc;
}

.view { padding: 24px; }
.toolbar {
  align-items: center;
  margin-bottom: 18px;
  padding: 2px 0;
}
.toolbar h2 {
  font-size: 23px;
  font-weight: 900;
}
.toolbar p {
  color: #64748b;
  font-size: 13px;
}

.metrics {
  gap: 14px;
  margin-bottom: 18px;
}
.metrics article,
.panel {
  border-color: rgba(203, 213, 225, .92);
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.metrics article {
  position: relative;
  overflow: hidden;
  min-height: 100px;
  padding: 18px;
}
.metrics article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #2f78bd;
}
.metrics article:nth-child(2)::before { background: #0f766e; }
.metrics article:nth-child(3)::before { background: #b45309; }
.metrics article:nth-child(4)::before { background: #287a3e; }
.metrics span { color: #64748b; }
.metrics strong {
  color: #0f172a;
  font-size: 30px;
}

.panel-head {
  min-height: 54px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.panel-head h3 {
  font-size: 16px;
  font-weight: 900;
}
.panel-body { padding: 16px; }
.import-panel { margin-bottom: 16px; }
.import-note {
  border-left-color: #0f766e;
  border-radius: 8px;
  background: #eefcf9;
  color: #334155;
}

.stock-strip {
  gap: 12px;
}
.stock-card {
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff, #f3f7fc);
  border-color: #d6e2f0;
}
.warehouse-card {
  background: linear-gradient(180deg, #f7fffb, #effcf5);
  border-color: #cde9d8;
}
.stock-card strong { font-size: 28px; color: #0f172a; }
.clickable-card:hover {
  border-color: #2f78bd;
  box-shadow: 0 14px 28px rgba(47, 120, 189, .16);
}

.quick-actions {
  gap: 12px;
}
.quick-actions button {
  min-height: 58px;
  font-size: 14px;
}

.grid { gap: 16px; }
.form { gap: 12px 14px; }
.filter-row { gap: 10px; }
.check-item {
  border-radius: 8px;
  background: #fbfdff;
}
.preview-box {
  border-radius: 10px;
  background: #f8fafc;
}

table {
  font-size: 13px;
}
th {
  background: #f3f6fa;
  color: #475569;
  font-weight: 900;
}
th, td {
  padding: 11px 10px;
}
tr.clickable:hover td { background: #f3f8ff; }
.badge {
  border-radius: 999px;
  padding: 4px 9px;
}
.toast {
  border-radius: 10px;
  background: #172033;
  box-shadow: var(--shadow-strong);
}

@media (max-width: 940px) {
  body {
    background: #f4f7fb;
  }
  .app {
    padding-bottom: 82px;
  }
  aside {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 8px;
    border: 1px solid rgba(203, 213, 225, .9);
    border-radius: 14px;
    box-shadow: 0 -10px 34px rgba(15, 23, 42, .18);
  }
  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .nav-item {
    min-height: 42px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 900;
    background: #f8fafc;
    color: #334155;
  }
  .nav-item.active,
  .nav-item:hover {
    background: #172033;
    color: #fff;
    box-shadow: 0 8px 18px rgba(23, 32, 51, .2);
  }
  .guide-link,
  button.ghost {
    min-height: 26px;
    border-radius: 8px;
  }
  header {
    position: sticky;
    top: 0;
    padding: 13px 14px;
    background: rgba(255,255,255,.95);
    z-index: 15;
  }
  header h2 { font-size: 20px; }
  .view { padding: 14px; }
  .toolbar {
    display: block;
  }
  .toolbar > div + div,
  .toolbar > button {
    margin-top: 10px;
  }
  .panel,
  .metrics article {
    border-radius: 12px;
  }
  .panel-head {
    min-height: 50px;
    padding: 12px 14px;
  }
  .panel-body { padding: 14px; }
  .metrics {
    gap: 10px;
  }
  .metrics article {
    flex-basis: 148px;
    min-height: 84px;
  }
  .metrics strong { font-size: 26px; }
  .stock-card {
    flex-basis: 156px;
    min-height: 78px;
  }
  .quick-actions button {
    flex-basis: 158px;
    border-radius: 10px;
  }
  button, input, select, textarea {
    min-height: 46px;
    border-radius: 9px;
  }
  .scan-actions button {
    min-height: 54px;
  }
  th, td {
    padding: 10px 8px;
    white-space: nowrap;
  }
  .panel-body {
    overflow-x: auto;
  }
}

/* Final image theme priority overrides */
.login {
  background:
    linear-gradient(90deg, rgba(7, 17, 31, .96) 0%, rgba(7, 17, 31, .82) 42%, rgba(7, 17, 31, .44) 100%),
    var(--ops-visual) center right / cover no-repeat;
}

aside {
  background:
    linear-gradient(180deg, rgba(7, 17, 31, .96), rgba(20, 35, 56, .94)),
    var(--ops-visual) center left / auto 100% no-repeat;
}

header {
  background:
    linear-gradient(90deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.91) 54%, rgba(255,255,255,.78) 100%),
    var(--ops-visual) top right / 520px auto no-repeat;
}

@media (max-width: 940px) {
  .login {
    background:
      linear-gradient(180deg, rgba(7,17,31,.78), rgba(7,17,31,.94)),
      var(--ops-visual) center top / auto 100% no-repeat;
  }
  .app {
    background:
      linear-gradient(180deg, rgba(246,248,251,.94), rgba(238,242,246,.98)),
      var(--ops-visual) top right / 680px auto no-repeat;
  }
  aside {
    background:
      linear-gradient(180deg, rgba(7,17,31,.94), rgba(18,31,49,.94)),
      var(--ops-visual) center / cover no-repeat;
  }
  header {
    background:
      linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,.88)),
      var(--ops-visual) top right / 420px auto no-repeat;
  }
}

/* Mobile compact page intro */
@media (max-width: 940px) {
  header {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 14px 12px;
    min-height: 0;
    background:
      linear-gradient(90deg, rgba(255,255,255,.97), rgba(255,255,255,.92)),
      var(--ops-visual) top right / 360px auto no-repeat;
  }

  header h2 {
    font-size: 17px;
    line-height: 1.25;
  }

  header p {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.35;
  }

  #globalSearch {
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 999px;
  }
}

/* Absolute final responsive priority */
.app {
  width: 100%;
  max-width: 100%;
  grid-template-columns: clamp(212px, 17vw, 260px) minmax(0, 1fr);
}

main {
  width: 100%;
  max-width: 1680px;
  min-width: 0;
  margin-inline: auto;
}

.view {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: clamp(14px, 2vw, 28px);
}

#globalSearch {
  width: min(420px, 42vw);
  max-width: 100%;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.stock-strip,
.stock-strip.warehouse {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

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

.filter-row {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.panel,
.panel-body,
.panel-head,
header,
header > div {
  min-width: 0;
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

@media (max-width: 940px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app {
    display: block;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  main,
  .view {
    max-width: none;
  }

  .view {
    padding: clamp(10px, 3.4vw, 16px);
  }

  header {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: clamp(8px, 2.8vw, 12px) clamp(10px, 3.6vw, 14px);
  }

  header h2 {
    font-size: clamp(16px, 5vw, 19px);
    line-height: 1.25;
  }

  header p {
    font-size: clamp(10px, 3.2vw, 12px);
    line-height: 1.35;
  }

  #globalSearch {
    width: 100%;
    height: clamp(34px, 9.5vw, 40px);
    min-height: 0;
    font-size: clamp(12px, 3.5vw, 14px);
  }

  aside {
    position: fixed;
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    top: auto;
    z-index: 40;
    width: auto;
    max-height: 38vh;
    padding: clamp(6px, 2vw, 8px);
    overflow-y: auto;
  }

  .brand-row.side {
    display: none;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: clamp(5px, 1.8vw, 8px);
  }

  .nav-item {
    min-width: 0;
    min-height: clamp(38px, 11vw, 46px);
    padding: 6px 4px;
    font-size: clamp(10px, 3.1vw, 12px);
    line-height: 1.2;
    text-align: center;
    justify-content: center;
    word-break: keep-all;
  }

  .guide-link,
  button.ghost {
    width: auto;
    min-height: 28px;
    margin-top: 6px;
    padding: 5px 10px;
    font-size: clamp(10px, 3vw, 12px);
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: clamp(8px, 2.4vw, 12px);
    padding-bottom: 0;
  }

  .metrics article,
  .stock-card,
  .quick-actions button {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .grid,
  .form,
  .checklist,
  .filter-row {
    grid-template-columns: 1fr;
  }

  .scan-actions {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  button,
  input,
  select,
  textarea {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 340px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions,
  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Dashboard button auto-fit rows - final priority */
nav,
.quick-actions,
.panel-head > div,
.toolbar,
.scan-actions {
  min-width: 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  align-items: stretch;
}

.quick-actions button {
  width: 100%;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.panel-head {
  gap: 10px;
}

.panel-head button,
.toolbar button,
.scan-actions button {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
}

@media (min-width: 941px) {
  nav {
    display: grid;
    grid-template-columns: 1fr;
  }

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

@media (max-width: 940px) {
  nav {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: clamp(5px, 1.8vw, 8px);
  }

  .nav-item {
    flex: 1 1 clamp(78px, 24vw, 132px);
    width: auto;
  }

  .quick-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: clamp(8px, 2.4vw, 12px);
    scroll-snap-type: x proximity;
  }

  .quick-actions button {
    flex: 1 0 clamp(128px, 42vw, 180px);
    scroll-snap-align: start;
  }

  .panel-head button,
  .toolbar button,
  .scan-actions button {
    flex: 1 1 auto;
    min-width: min(100%, 112px);
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .nav-item {
    flex-basis: clamp(82px, 30vw, 124px);
  }

  .quick-actions button {
    flex-basis: clamp(132px, 48vw, 170px);
  }
}

/* Fold/tablet unfolded layout - final priority */
@media (min-width: 600px) and (max-width: 940px) {
  .app {
    display: block;
    padding-bottom: 0;
  }

  aside {
    position: static;
    width: 100%;
    max-height: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 10px 14px;
    overflow: visible;
  }

  .brand-row.side {
    display: flex;
    padding: 4px 0 10px;
    margin-bottom: 8px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
  }

  .nav-item {
    flex: none;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .guide-link,
  button.ghost {
    display: inline-flex;
    width: auto;
    min-height: 30px;
    margin-top: 8px;
  }

  header {
    padding: 12px 18px;
  }

  .view {
    padding: 16px 18px 24px;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .quick-actions button {
    flex: none;
    width: 100%;
    min-height: 58px;
  }
}

/* Wider fold/tablet safeguard - absolute final */
@media (min-width: 600px) and (max-width: 1100px) {
  .app {
    display: block;
    padding-bottom: 0;
  }

  aside {
    position: static;
    width: 100%;
    max-height: none;
    border-radius: 0;
    padding: 10px 14px;
    overflow: visible;
  }

  .brand-row.side {
    display: flex;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
  }

  .nav-item {
    flex: none;
    width: 100%;
  }

  main,
  .view {
    width: 100%;
    max-width: none;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .quick-actions button {
    flex: none;
    width: 100%;
  }
}

/* Part stock visibility in AS/DOA */
.part-stock-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 12px;
  border: 1px solid #cfd8e3;
  border-left: 4px solid #2563a6;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
}

.part-stock-info strong {
  grid-column: 1 / -1;
  color: #0f172a;
  font-size: 14px;
}

.part-stock-info.ok {
  border-left-color: #15803d;
  background: #f0fdf4;
}

.part-stock-info.low {
  border-left-color: #b45309;
  background: #fffbeb;
}

.part-stock-info.lack,
.part-stock-info.out {
  border-left-color: #b42318;
  background: #fff1f2;
}

.part-stock-badge {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 900;
  color: #fff;
  background: #2563a6;
}

.part-stock-badge.ok { background: #15803d; }
.part-stock-badge.low { background: #b45309; }
.part-stock-badge.lack,
.part-stock-badge.out { background: #b42318; }

.doa-return-fields {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  background: #fff;
}

.doa-decision-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.doa-decision-card {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 12px;
  text-align: left;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.doa-decision-card span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.doa-decision-card strong {
  color: #111827;
  font-size: 24px;
  line-height: 1;
}

.doa-decision-card small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.doa-decision-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(99, 91, 255, .12);
}

.subsection-title {
  margin: 0 0 12px;
  color: #111827;
  font-size: 14px;
  font-weight: 800;
}

.embedded-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
}

.embedded-form label {
  margin: 0;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
}

.embedded-form input,
.embedded-form select,
.embedded-form textarea {
  width: 100%;
  min-width: 0;
}

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

.embedded-form textarea.wide {
  min-height: 84px;
  resize: vertical;
}

@media (max-width: 760px) {
  .doa-return-fields {
    padding: 12px;
    border-radius: 10px;
  }

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

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

  .embedded-form label,
  .embedded-form .wide,
  .embedded-form textarea.wide {
    grid-column: 1;
  }
}

/* Customer service receipt media */
.service-media-box {
  border: 1px solid #dbe7f2;
  border-radius: 10px;
  background: #f8fbff;
  padding: 12px;
}
.media-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.media-box-head strong {
  color: #0f172a;
  font-size: 14px;
}
.media-box-head span {
  color: #64748b;
  font-size: 12px;
  text-align: right;
}
.service-media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.service-media-card {
  overflow: hidden;
  border: 1px solid #d8e2ec;
  border-radius: 10px;
  background: #fff;
}
.service-media-card img,
.service-media-card video {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: cover;
  background: #0f172a;
}
.service-media-card div {
  display: grid;
  gap: 4px;
  padding: 9px;
}
.service-media-card strong {
  color: #0f172a;
  font-size: 13px;
}
.service-media-card span,
.service-media-card a {
  color: #64748b;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.service-media-card a {
  color: #2563eb;
  font-weight: 800;
}

.part-scope {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #cfd8e3;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.part-scope.exception {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.part-scope.common {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.part-scope.assist {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.part-scope.manual {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.common-system-shortcuts {
  display: block;
  width: 100%;
  margin: 8px 0 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.common-system-shortcuts summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #eef5ff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.common-system-shortcuts summary::-webkit-details-marker { display: none; }

.common-system-shortcuts summary::after {
  content: "펼침";
  min-width: 42px;
  text-align: right;
  font-size: 11px;
  line-height: 1;
  color: #8cc8ff;
  opacity: .95;
}

.common-system-shortcuts[open] summary::after {
  content: "접힘";
}

.common-system-shortcut-list {
  display: grid;
  gap: 2px;
  margin: 0 0 10px;
  padding: 0 0 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.common-system-shortcut-list a {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #e5edf7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.common-system-shortcut-list a:hover,
.common-system-shortcut-list a:focus {
  background: rgba(125, 211, 252, .16);
  color: #fff;
  outline: none;
}

@media (max-width: 860px) {
  .common-system-shortcuts {
    width: 100%;
    margin: 4px 0 8px;
  }

  .common-system-shortcuts summary {
    min-height: 38px;
    padding: 0 2px;
    font-size: 12px;
  }

  .common-system-shortcut-list {
    grid-template-columns: 1fr;
    max-height: min(48vh, 280px);
    overflow: auto;
  }

  .common-system-shortcut-list a {
    min-height: 30px;
    font-size: 11px;
  }
}

.lookup-result {
  margin-top: 12px;
}

.cs-lookup-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #102236, #1f3f68);
  color: #fff;
}

.cs-lookup-summary h4 {
  margin: 3px 0;
  font-size: 22px;
}

.cs-lookup-summary p {
  margin: 0;
  color: rgba(255,255,255,.78);
  font-weight: 800;
}

.cs-quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cs-quick-actions button {
  min-height: 38px;
  padding: 0 12px;
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.96);
}

.cs-quick-actions button.primary {
  background: #51d4e8;
  color: #06111f;
  border-color: #51d4e8;
}

.cs-next-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid #b8d7ef;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef8ff, #ffffff);
}

.cs-next-action h4 {
  margin: 3px 0;
  font-size: 18px;
}

.cs-next-action p {
  margin: 0;
  color: #516174;
  font-weight: 800;
}

.cs-next-action strong {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #102236;
  color: #fff;
  white-space: nowrap;
}

.cs-candidate-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.cs-candidate-list h4 {
  margin: 0;
  font-size: 15px;
}

.cs-candidate-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d7dee8;
  border-radius: 12px;
  background: #fff;
}

.cs-candidate-list p,
.cs-candidate-list em,
.cs-candidate-list small {
  display: block;
  margin: 3px 0 0;
  color: #64748b;
  font-weight: 800;
  word-break: break-word;
}

.cs-candidate-list em {
  color: #1f3f68;
  font-style: normal;
}

.cs-candidate-list button {
  min-height: 36px;
  padding: 0 12px;
}

.cs-candidate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.cs-candidate-actions button {
  min-width: 62px;
}

.lookup-flow {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
}

.lookup-step {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #d7dee8;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.lookup-step.done {
  border-color: #1f3f68;
  background: #102236;
  color: #fff;
}

.lookup-step.pending {
  border-color: #d9e2ec;
  background: #f8fafc;
}

.lookup-hero {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(160px, 220px);
  gap: 16px;
  align-items: stretch;
  margin: 12px 0;
  padding: 16px;
  border: 1px solid #d7dee8;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(16,34,54,.97), rgba(31,63,104,.9));
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
}

.lookup-image {
  min-height: 150px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
}

.lookup-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lookup-image-placeholder {
  display: grid;
  align-content: center;
  justify-items: center;
  height: 100%;
  min-height: 150px;
  padding: 16px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.04)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 8px, transparent 8px 16px);
}

.lookup-image-placeholder span {
  font-size: 22px;
  font-weight: 1000;
  line-height: 1.2;
}

.lookup-image-placeholder small {
  margin-top: 8px;
  color: rgba(255,255,255,.72);
  font-weight: 800;
}

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

.lookup-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: #9ee7ff;
  font-size: 12px;
  font-weight: 1000;
}

.lookup-main h4 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.18;
}

.lookup-main p {
  margin: 8px 0 14px;
  color: rgba(255,255,255,.8);
  font-weight: 800;
}

.lookup-main dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
}

.lookup-main dt {
  color: rgba(255,255,255,.64);
  font-weight: 900;
}

.lookup-main dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
  font-weight: 900;
}

.lookup-decision {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.1);
}

.lookup-decision strong {
  font-size: 14px;
}

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

.lookup-grid article {
  padding: 14px;
  border: 1px solid #d7dee8;
  border-radius: 12px;
  background: rgba(255,255,255,.92);
}

.lookup-grid h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.lookup-grid dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
}

.lookup-grid dt {
  color: #64748b;
  font-weight: 800;
}

.lookup-grid dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.lookup-grid ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.lookup-grid li {
  margin: 5px 0;
  font-size: 13px;
}

.lookup-count {
  margin: 0 0 8px;
  color: #1f3f68;
  font-size: 20px;
  font-weight: 1000;
}

.lookup-history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lookup-history-list li {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.lookup-history-list span {
  min-width: 0;
  color: #475569;
  font-weight: 800;
  word-break: break-word;
}

.lookup-empty {
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 520px) {
  .cs-lookup-summary {
    grid-template-columns: 1fr;
  }

  .cs-next-action {
    grid-template-columns: 1fr;
  }

  .cs-next-action strong {
    justify-self: start;
  }

  .cs-quick-actions {
    justify-content: stretch;
  }

  .cs-quick-actions button {
    flex: 1 1 calc(50% - 8px);
  }

  .cs-candidate-list article {
    grid-template-columns: 1fr;
  }

  .cs-candidate-actions {
    justify-content: stretch;
  }

  .cs-candidate-actions button {
    flex: 1 1 0;
  }

  .part-stock-info {
    grid-template-columns: 1fr;
  }

  .lookup-hero {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .lookup-image,
  .lookup-image-placeholder {
    min-height: 130px;
  }

  .lookup-main dl {
    grid-template-columns: 96px 1fr;
  }

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

  .lookup-grid dl {
    grid-template-columns: 82px 1fr;
  }

  .lookup-history-list li {
    grid-template-columns: 1fr;
  }
}

/* Final layout controls: header search and user-resized panels. */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(540px, 50vw);
}

.header-actions #globalSearch {
  width: auto;
  flex: 1 1 300px;
}

button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.view.active .panel[data-panel-size-id] {
  transition: box-shadow .18s ease;
}

.view.active .panel[data-panel-size-id]:hover {
  box-shadow: 0 16px 34px rgba(15, 23, 42, .12);
}

.panel-resize-handle {
  display: none;
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  touch-action: none;
  cursor: ns-resize;
}

.panel-width-handle {
  position: absolute;
  top: 50%;
  right: 4px;
  z-index: 5;
  width: 28px;
  min-height: 58px;
  transform: translateY(-50%);
  border: 1px dashed #b6c3d4;
  border-radius: 999px;
  background: rgba(255, 255, 255, .98);
  color: #1f3f60;
  font-size: 10px;
  font-weight: 900;
  writing-mode: vertical-rl;
  touch-action: none;
  cursor: ew-resize;
  opacity: .72;
}

.panel-width-handle-left {
  left: 4px;
  right: auto;
  border-color: #8fb6d8;
  background: rgba(239, 248, 255, .98);
}

.panel:hover .panel-width-handle,
.panel-width-handle:focus,
.resizing-panel .panel-width-handle {
  opacity: 1;
}

.resizing-panel {
  user-select: none;
  box-shadow: 0 18px 38px rgba(15, 23, 42, .18) !important;
}

@media (max-width: 940px) {
  .header-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .header-actions #globalSearch {
    width: 100%;
    min-width: 0;
  }

  button.compact {
    min-height: 34px;
    padding: 0 9px;
    font-size: 11px;
  }
}

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

  button.compact {
    width: fit-content;
    justify-self: end;
  }
}

/* Mobile and foldable final override: keep navigation in normal flow. */
@media (max-width: 1180px) {
  body {
    min-width: 0;
    overflow-x: hidden;
  }

  .app {
    display: block;
    width: 100%;
    max-width: 100%;
    padding-bottom: 0;
  }

  aside {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    padding: 8px clamp(10px, 3vw, 16px) !important;
    box-shadow: none !important;
  }

  .brand-row.side {
    display: none;
  }

  nav {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
    margin: 0;
    max-height: none;
    overflow: visible;
  }

  .nav-item {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    justify-content: center;
    text-align: center;
    font-size: clamp(12px, 2.8vw, 14px);
    border-radius: 10px;
  }

  aside .guide-link,
  aside #logoutButton {
    display: inline-flex;
    width: auto;
    min-height: 32px;
    margin: 8px 6px 0 0;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 8px;
  }

  main {
    width: 100%;
    max-width: none;
  }

  header {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px clamp(12px, 3.5vw, 18px);
  }

  header h2 {
    font-size: clamp(20px, 5vw, 26px);
  }

  header p {
    font-size: clamp(12px, 3vw, 14px);
  }

  .view {
    padding: clamp(10px, 3.4vw, 16px);
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 10px;
    overflow: visible !important;
    scroll-snap-type: none !important;
  }

  .metrics article,
  .stock-card,
  .quick-actions button {
    min-width: 0 !important;
    width: 100%;
  }

  .grid,
  .two-col,
  .lookup-grid {
    grid-template-columns: 1fr !important;
  }

  .view.active > .panel,
  .view.active > .grid > .panel,
  .view.active > .grid section.panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    resize: vertical;
  }

  .panel-resize-handle {
    display: block;
  }

  .panel-width-handle {
    display: none;
  }

  .view.active > .panel::after,
  .view.active > .grid > .panel::after,
  .view.active > .grid section.panel::after {
    display: none;
  }
}

@media (min-width: 700px) and (max-width: 1180px) {
  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  nav,
  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Login page final override: keep pre-login screen intentionally minimal. */
#login.login {
  min-height: 100vh;
  padding: 20px;
  background: #f6f8fb;
}

#login.login::before {
  display: none;
}

#login .login-card {
  width: min(360px, 100%);
  padding: 22px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
  backdrop-filter: none;
}

#login .login-card label {
  margin-top: 12px;
}

#login .login-card label:first-child {
  margin-top: 0;
}

#login .login-help {
  margin: 14px 0 0;
  color: #475569;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

/* Resizable work layout: desktop uses large split handles, mobile keeps responsive flow. */
@media (min-width: 1181px) {
  .app {
    transition: grid-template-columns .12s ease;
  }

  aside {
    position: sticky;
    top: 0;
  }

  .shell-width-handle {
    position: absolute;
    top: 0;
    right: -7px;
    z-index: 30;
    width: 14px;
    height: 100%;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: ew-resize;
    touch-action: none;
  }

  .shell-width-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 5px;
    width: 4px;
    height: 64px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(95, 213, 199, .65);
  }

  .shell-width-handle:hover::after,
  .resizing-shell .shell-width-handle::after {
    background: #5fd5c7;
  }

  .panel-resize-handle,
  .panel-width-handle {
    display: none !important;
  }

  .grid.resizable-split {
    display: grid;
    grid-template-columns:
      minmax(280px, calc(var(--split-ratio, 50) * 1%))
      12px
      minmax(280px, 1fr);
    align-items: start;
    gap: 0;
    overflow: visible;
  }

  .grid.resizable-split > .panel {
    width: auto !important;
    min-width: 0;
    max-width: none;
  }

  .split-resize-handle {
    align-self: stretch;
    min-height: 160px;
    width: 12px;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
    position: relative;
    margin: 0;
  }

  .split-resize-handle::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 5px;
    width: 2px;
    border-radius: 999px;
    background: rgba(15, 35, 55, .12);
  }

  .split-resize-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 6px;
    height: 54px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(95, 213, 199, .65);
    box-shadow: 0 0 0 4px rgba(95, 213, 199, .12);
  }

  .split-resize-handle:hover::after,
  .resizing-split .split-resize-handle::after {
    background: #5fd5c7;
    box-shadow: 0 0 0 5px rgba(95, 213, 199, .2);
  }
}

@media (max-width: 1180px) {
  .shell-width-handle,
  .panel-resize-handle,
  .panel-width-handle,
  .split-resize-handle {
    display: none !important;
  }

  .app {
    grid-template-columns: 1fr !important;
  }

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

@media (max-width: 1180px) {
  aside {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
    align-items: stretch;
    position: sticky !important;
    top: 0 !important;
    z-index: 90 !important;
    transition: padding .18s ease, box-shadow .18s ease, background .18s ease;
  }

  aside .common-system-shortcuts {
    grid-column: 1 / -1;
  }

  aside nav {
    display: contents !important;
  }

  aside .guide-link,
  aside #logoutButton {
    width: 100% !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    justify-content: center;
    text-align: center;
    border-radius: 10px !important;
    font-size: clamp(12px, 2.8vw, 14px) !important;
    font-weight: 800;
  }

  body.mobile-menu-collapsed aside {
    display: block !important;
    padding: 6px clamp(10px, 3vw, 16px) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .18) !important;
  }

  body.mobile-menu-collapsed aside .guide-link,
  body.mobile-menu-collapsed aside #logoutButton {
    display: none !important;
  }

  body.mobile-menu-collapsed aside .common-system-shortcuts {
    display: block !important;
    margin: 0 0 6px !important;
    border-bottom: 1px solid rgba(255,255,255,.16);
  }

  body.mobile-menu-collapsed aside .common-system-shortcuts summary {
    min-height: 30px;
    padding: 0 2px;
    font-size: 12px;
  }

  body.mobile-menu-collapsed aside nav {
    display: block !important;
    margin: 0 !important;
    max-height: 42px;
    overflow: hidden;
  }

  body.mobile-menu-collapsed aside .nav-item {
    display: none !important;
  }

  body.mobile-menu-collapsed aside .nav-item.active {
    display: flex !important;
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    justify-content: center;
    border-radius: 10px;
    font-size: 13px;
  }

  body.mobile-menu-collapsed aside .nav-item.active::after {
    display: none;
  }
}

/* Executive dashboard polish */
.metrics {
  gap: 14px;
}

.metrics article {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 18px 18px 16px;
  border-radius: 6px;
  border: 1px solid #d5dce6;
  border-top: 4px solid #081827;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: 0 14px 32px rgba(8, 24, 39, .08);
}

.metrics article::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(11, 92, 171, .16);
  border-radius: 50%;
}

.metrics article:nth-child(2) {
  border-top-color: #0b5cab;
}

.metrics article:nth-child(3) {
  border-top-color: #b45309;
}

.metrics article:nth-child(4) {
  border-top-color: #087f5b;
}

.metrics article:nth-child(5) {
  border-top-color: #4b5563;
}

.metrics span {
  color: #5b6778;
  font-size: 12px;
  font-weight: 900;
}

.metrics strong {
  margin-top: 12px;
  color: #081827;
  font-size: clamp(34px, 3.4vw, 46px);
  line-height: 1;
  letter-spacing: 0;
}

.doa-stock-panel .panel-body {
  display: grid;
  gap: 14px;
}

.stock-strip,
.stock-strip.warehouse {
  gap: 12px;
}

.stock-card {
  min-height: 92px;
  padding: 14px 16px;
  border-radius: 6px;
  border: 1px solid #d5dce6;
  background: #fff;
  box-shadow: none;
}

.stock-card span {
  font-size: 12px;
  font-weight: 900;
  color: #5b6778;
}

.stock-card strong {
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  color: #081827;
}

.warehouse-card {
  background: linear-gradient(180deg, #fbfdff, #f5f8fb);
  border-left: 4px solid #0b5cab;
}

.clickable-card:hover,
.stock-card.clickable-card:hover {
  border-color: #0b5cab;
  box-shadow: 0 14px 28px rgba(11, 92, 171, .12);
  transform: translateY(-1px);
}

.quick-panel .panel-body.quick-actions {
  background: #fff;
}

.quick-actions {
  gap: 12px;
}

.quick-actions button {
  min-height: 58px;
  border-radius: 6px;
  border-color: #cfd8e3;
  background: #fff;
  color: #101820;
  font-weight: 900;
}

.quick-actions button.primary {
  background: #081827;
  border-color: #081827;
  color: #fff;
}

.quick-actions button:hover {
  border-color: #0b5cab;
  box-shadow: 0 10px 20px rgba(11, 92, 171, .12);
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 58px;
  padding: 16px 18px;
  background: #fff;
  border-bottom: 1px solid #d5dce6;
}

.panel-head h3 {
  font-size: 17px;
  font-weight: 900;
  color: #101820;
}

.panel-body {
  padding: 16px;
}

table {
  border: 1px solid #d5dce6;
  background: #fff;
}

th {
  padding: 12px 10px;
  background: #f3f6fa;
  color: #4c596b;
  font-size: 12px;
  font-weight: 900;
}

td {
  padding: 12px 10px;
  color: #172033;
}

tbody tr:hover td {
  background: #f8fbff;
}

@media (max-width: 1180px) {
  .metrics article {
    min-height: 104px;
    padding: 16px;
  }

  .metrics strong,
  .stock-card strong {
    font-size: clamp(30px, 8vw, 40px);
  }

  .stock-card {
    min-height: 86px;
  }
}

@media (max-width: 420px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .quick-actions {
    grid-template-columns: 1fr !important;
  }
}

/* Executive navy theme: internal SVC screen */
:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --ink: #101820;
  --muted: #647084;
  --line: #d5dce6;
  --nav: #081827;
  --nav2: #142b44;
  --blue: #0b5cab;
  --green: #087f5b;
  --red: #b42318;
  --amber: #b45309;
  --shadow: 0 18px 44px rgba(8, 24, 39, .10);
}

body {
  background:
    linear-gradient(180deg, rgba(238, 242, 247, .88), #eef2f7 460px),
    url("./assets/operations-hero.png") center top / cover fixed no-repeat;
}

aside {
  background:
    linear-gradient(180deg, rgba(8, 24, 39, .98), rgba(12, 31, 50, .96)),
    url("./assets/operations-hero.png") center / cover no-repeat;
  border-right: 1px solid rgba(255,255,255,.08);
}

.brand-row.side {
  border-bottom-color: rgba(255,255,255,.18);
}

.side .brand-mark {
  background: #fff;
  color: #081827;
  border-radius: 6px;
  box-shadow: 0 10px 22px rgba(0,0,0,.18);
}

.common-system-shortcuts {
  border-bottom-color: rgba(255,255,255,.18);
}

.common-system-shortcuts summary {
  color: #f8fafc;
  font-weight: 900;
}

.common-system-shortcut-list a {
  color: #dce8f5;
}

.common-system-shortcut-list a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.common-system-shortcut-link.active {
  position: relative;
  color: #fff;
  background: rgba(92, 169, 255, .16);
  font-weight: 900;
}

.common-system-shortcut-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: #5ca9ff;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 6px;
  color: #dbe5ef;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.14);
  color: #fff;
  transform: none;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 #5ca9ff;
}

.nav-item.active::after {
  display: none;
}

.guide-link,
button.ghost {
  border-radius: 6px;
  background: rgba(255,255,255,.92);
  color: #132033;
  border-color: rgba(255,255,255,.78);
}

.guide-link:hover,
button.ghost:hover {
  background: #fff;
  color: #081827;
}

header {
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(8, 24, 39, .06);
}

header h2,
.view-title h2,
.panel h2,
.panel h3 {
  letter-spacing: 0;
}

input,
select,
textarea {
  border-radius: 5px;
  border-color: #ccd5e1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0b5cab;
  box-shadow: 0 0 0 3px rgba(11, 92, 171, .14);
  outline: none;
}

button {
  border-radius: 5px;
}

button.primary {
  background: #081827;
  border-color: #081827;
}

button.primary:hover,
button:not(.ghost):not(.danger):hover {
  border-color: #0b5cab;
  box-shadow: 0 8px 20px rgba(11, 92, 171, .12);
}

.panel,
.metric-card,
.lookup-result,
.quick-card,
.mobile-card,
.service-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: rgba(255,255,255,.96);
}

.metric-card {
  border-top: 4px solid #081827;
}

.metric-card strong,
.metric-card b,
.stat-number {
  color: #081827;
}

.panel-head,
.section-head,
.table-head {
  border-bottom-color: var(--line);
}

table th,
.table th {
  background: #f3f6fa;
  color: #485466;
  font-size: 12px;
  font-weight: 900;
}

table td,
.table td {
  border-bottom-color: #e2e7ee;
}

.badge,
.status,
.pill {
  border-radius: 999px;
}

.view.active {
  animation-duration: .16s;
}

@media (max-width: 1180px) {
  aside {
    background:
      linear-gradient(180deg, rgba(8, 24, 39, .97), rgba(10, 30, 50, .95)),
      url("./assets/operations-hero.png") center / cover no-repeat;
    border-bottom: 1px solid rgba(255,255,255,.18) !important;
  }

  aside .nav-item,
  aside .guide-link,
  aside #logoutButton {
    border-radius: 8px !important;
  }

  aside .nav-item {
    background: rgba(255,255,255,.94);
    color: #132033;
    border-color: rgba(255,255,255,.55);
  }

  aside .nav-item.active,
  aside .nav-item:hover {
    background: #081827;
    color: #fff;
    border-color: rgba(92, 169, 255, .5);
    box-shadow: inset 0 -3px 0 #5ca9ff;
  }

  body.mobile-menu-collapsed aside .nav-item.active {
    background: rgba(255,255,255,.96);
    color: #081827;
    box-shadow: inset 3px 0 0 #5ca9ff;
  }

  header {
    background: rgba(255,255,255,.9);
  }
}

/* Final shared admin theme: Stripe Dashboard reference */
:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --nav: #ffffff;
  --nav2: #f4f0ff;
  --blue: #635bff;
  --green: #0e9f6e;
  --red: #e11d48;
  --amber: #b7791f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

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

.app,
main,
.view,
.grid,
.panel,
.panel-body,
.panel-head,
header,
.toolbar,
.filter-row {
  min-width: 0;
  max-width: 100%;
}

.app {
  grid-template-columns: 232px minmax(0, 1fr);
}

aside {
  background: #fff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: none;
  padding: 14px 12px;
}

aside::before {
  display: none;
}

.brand-row.side {
  padding: 0 4px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.brand-row.side strong {
  color: #111827;
  font-size: 14px;
}

.brand-row.side span {
  color: var(--muted);
  font-size: 11px;
}

.side .brand-mark,
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #635bff;
  color: #fff;
  box-shadow: none;
}

.common-system-shortcuts {
  width: 100%;
  margin: 0 0 10px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.common-system-shortcuts summary,
.common-system-shortcuts__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 0;
  color: #374151;
  background: #f9fafb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.common-system-shortcuts summary::-webkit-details-marker,
.common-system-shortcuts__summary::-webkit-details-marker {
  display: none;
}

.common-system-shortcuts summary::after,
.common-system-shortcuts__summary::after {
  content: "펼침";
  color: #635bff;
  font-size: 10px;
}

.common-system-shortcuts[open] summary::after,
.common-system-shortcuts[open] .common-system-shortcuts__summary::after {
  content: "접힘";
}

.common-system-shortcut-list,
.common-system-shortcuts__menu {
  display: grid;
  gap: 2px;
  margin: 6px 0 0;
  padding: 0;
}

.common-system-shortcut-list a,
.common-system-shortcut-link,
.common-system-shortcuts__link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.common-system-shortcut-list a:hover,
.common-system-shortcut-list a:focus,
.common-system-shortcuts__link:hover,
.common-system-shortcuts__link:focus {
  background: #f4f0ff;
  color: #4f46e5;
}

.common-system-shortcut-link.active,
.common-system-shortcuts__link.is-active {
  background: #f4f0ff;
  color: #4f46e5;
  font-weight: 900;
}

.common-system-shortcut-link.active::before,
.common-system-shortcuts__link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 999px;
  background: #635bff;
}

nav {
  gap: 2px;
  padding-top: 4px;
}

.nav-item {
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4b5563;
  font-size: 13px;
  font-weight: 750;
}

.nav-item.active,
.nav-item:hover {
  background: #f4f0ff;
  color: #4f46e5;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 #635bff;
}

.nav-item.active::after {
  display: none;
}

.guide-link,
button.ghost,
aside #logoutButton {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #4b5563;
  box-shadow: none;
}

.guide-link:hover,
button.ghost:hover,
aside #logoutButton:hover {
  background: #f9fafb;
  color: #111827;
}

header {
  min-height: auto;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 20px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

header h2 {
  font-size: 20px;
  color: #111827;
}

header p,
.toolbar p {
  color: var(--muted);
}

.header-actions {
  gap: 8px;
}

.header-actions #globalSearch,
input,
select,
textarea {
  min-height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #635bff;
  box-shadow: 0 0 0 3px rgba(99, 91, 255, .14);
}

.view {
  padding: 18px;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar h2,
.panel-head h3,
.panel h2,
.panel h3 {
  color: #111827;
  font-weight: 800;
}

.panel,
.metrics article,
.stock-card,
.lookup-result,
.quick-card,
.mobile-card,
.service-card,
.attachment-card,
.doa-photo-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.panel,
.metrics article {
  overflow: hidden;
}

.panel-head {
  min-height: 46px;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.panel-body {
  padding: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.metrics {
  gap: 12px;
}

.metrics article {
  min-height: 92px;
  padding: 14px;
  border-top: 0;
}

.metrics article::after {
  display: none;
}

.metrics span,
.stock-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metrics strong,
.stock-card strong {
  color: #111827;
  font-size: 30px;
  font-weight: 800;
}

.stock-card {
  min-height: 78px;
  padding: 12px;
}

.warehouse-card {
  border-left: 3px solid #635bff;
  background: #fff;
}

button {
  min-height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-weight: 750;
  box-shadow: none;
}

button:hover {
  background: #f9fafb;
  border-color: #c7ccd6;
  box-shadow: none;
}

button.primary,
.quick-actions button.primary {
  background: #635bff;
  border-color: #635bff;
  color: #fff;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.button-link:hover {
  background: #f9fafb;
  border-color: #c7ccd6;
}

.message-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.message-event-grid article {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #635bff;
  border-radius: 10px;
  background: #fff;
}

.message-event-grid strong {
  display: block;
  color: #111827;
  font-size: 13px;
}

.message-event-grid span {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
}

button.primary:hover,
.quick-actions button.primary:hover {
  background: #5147f5;
  border-color: #5147f5;
  box-shadow: none;
}

button.danger {
  border-color: #fecdd3;
  background: #fff;
  color: #be123c;
}

button.danger:hover {
  background: #fff1f2;
  border-color: #fda4af;
}

.quick-actions {
  gap: 10px;
}

.quick-actions button {
  min-height: 48px;
  border-radius: 10px;
  background: #fff;
  color: #374151;
}

.filter-row {
  gap: 8px;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: #374151;
}

th {
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover td {
  background: #fafafa;
}

tr.selected-row td {
  background: #f4f0ff;
  border-bottom-color: #ddd6fe;
}

.badge,
.status,
.pill,
.part-stock-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
}

.badge.good,
.status.good,
.part-stock-badge.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #047857;
}

.badge.warn,
.status.warn,
.part-stock-badge.low {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.badge.bad,
.status.bad,
.part-stock-badge.lack,
.part-stock-badge.out {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.toast,
.modal,
.dialog,
[role="dialog"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #111827;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  body {
    background: var(--bg);
  }

  .app {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  aside {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    position: sticky !important;
    top: 0 !important;
    z-index: 90 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 8px 10px !important;
    background: #fff !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    box-shadow: none !important;
  }

  .brand-row.side {
    display: none;
  }

  aside .common-system-shortcuts {
    grid-column: 1 / -1;
    margin: 0 !important;
    padding: 0 0 4px;
    border-bottom: 1px solid var(--line);
  }

  aside .common-system-shortcuts summary {
    min-height: 30px;
    color: #374151;
    background: #f9fafb;
  }

  aside nav {
    display: contents !important;
  }

  aside .nav-item,
  aside .guide-link,
  aside #logoutButton {
    width: 100% !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    justify-content: center;
    border-radius: 8px !important;
    background: #fff;
    color: #374151;
    border: 1px solid var(--line);
    font-size: 12px !important;
    box-shadow: none;
  }

  aside .nav-item.active,
  aside .nav-item:hover {
    background: #f4f0ff;
    color: #4f46e5;
    border-color: #ddd6fe;
    box-shadow: inset 0 -2px 0 #635bff;
  }

  body.mobile-menu-collapsed aside {
    display: grid !important;
    grid-template-columns: 1fr;
    padding: 6px 10px !important;
  }

  body.mobile-menu-collapsed aside .common-system-shortcuts {
    display: block !important;
    margin: 0 !important;
  }

  body.mobile-menu-collapsed aside nav {
    display: block !important;
    max-height: 34px;
    overflow: hidden;
  }

  body.mobile-menu-collapsed aside .nav-item {
    display: none !important;
  }

  body.mobile-menu-collapsed aside .nav-item.active {
    display: flex !important;
    min-height: 30px !important;
    background: #fff;
    color: #4f46e5;
    border-color: #ddd6fe;
  }

  body.mobile-menu-collapsed aside .guide-link,
  body.mobile-menu-collapsed aside #logoutButton {
    display: none !important;
  }

  header {
    position: static;
    padding: 10px 12px;
    background: #fff;
  }

  header h2 {
    font-size: 18px;
  }

  header p {
    font-size: 12px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .view {
    padding: 12px;
  }

  .metrics,
  .stock-strip,
  .stock-strip.warehouse,
  .quick-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .metrics article,
  .stock-card {
    min-height: 78px;
    padding: 12px;
  }

  .metrics strong,
  .stock-card strong {
    font-size: 26px;
  }

  .panel,
  .metrics article,
  .stock-card {
    border-radius: 10px;
  }

  .panel-head {
    min-height: 42px;
    padding: 10px 12px;
  }

  .panel-body {
    padding: 12px;
    overflow-x: auto;
  }

  table {
    min-width: 640px;
  }

  .view.active > .panel,
  .view.active > .grid > .panel,
  .view.active > .grid section.panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 390px) {
  .metrics,
  .stock-strip,
  .stock-strip.warehouse {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .quick-actions {
    grid-template-columns: 1fr !important;
  }

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

  .panel-body,
  .view,
  header {
    max-width: 100vw;
  }
}

/* Compact mobile shell: keep shortcuts accessible while reducing first-screen chrome. */
@media (max-width: 1180px) {
  aside {
    display: block !important;
    padding: 8px 10px !important;
  }

  aside .common-system-shortcuts {
    display: block !important;
    margin: 0 0 6px !important;
    padding: 0 0 6px !important;
  }

  aside nav {
    display: flex !important;
    gap: 6px !important;
    padding: 0 0 2px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  aside nav::-webkit-scrollbar {
    display: none;
  }

  aside .nav-item {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 92px !important;
    max-width: 150px !important;
    min-height: 32px !important;
    padding: 6px 10px !important;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  aside .guide-link,
  aside #logoutButton {
    display: inline-flex !important;
    width: auto !important;
    min-height: 28px !important;
    margin: 6px 4px 0 0 !important;
    padding: 5px 9px !important;
    font-size: 12px !important;
    vertical-align: top;
  }

  body.mobile-menu-collapsed aside {
    display: block !important;
    padding: 6px 10px !important;
  }

  body.mobile-menu-collapsed aside nav {
    display: block !important;
    max-height: 32px;
    overflow: hidden !important;
  }
}

/* Dashboard KPI final override: Stripe-style admin metrics, no hero imagery. */
body,
body::before,
body::after,
.app,
main,
header,
.view,
#dashboard,
#dashboard::before,
#dashboard::after {
  background-image: none !important;
}

body {
  background: #f7f8fb !important;
}

main {
  background: #f7f8fb !important;
}

header {
  background: #fff !important;
  border-bottom: 1px solid var(--line) !important;
  box-shadow: none !important;
}

#dashboard {
  position: relative;
  padding-top: 16px;
  background: #f7f8fb !important;
}

#dashboard .metrics,
.metrics {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px !important;
  width: 100%;
  margin: 0 0 14px !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#dashboard .metrics article,
.metrics article {
  position: relative;
  min-width: 0 !important;
  min-height: 82px !important;
  padding: 13px 14px 12px 16px !important;
  border: 1px solid #e5e7eb !important;
  border-left: 3px solid #635bff !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #111827 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
  overflow: hidden !important;
}

#dashboard .metrics article:nth-child(2),
.metrics article:nth-child(2) {
  border-left-color: #14b8a6 !important;
}

#dashboard .metrics article:nth-child(3),
.metrics article:nth-child(3) {
  border-left-color: #f59e0b !important;
}

#dashboard .metrics article:nth-child(4),
.metrics article:nth-child(4) {
  border-left-color: #22c55e !important;
}

#dashboard .metrics article:nth-child(5),
.metrics article:nth-child(5) {
  border-left-color: #3b82f6 !important;
}

#dashboard .metrics article::before,
#dashboard .metrics article::after,
.metrics article::before,
.metrics article::after {
  display: none !important;
  content: none !important;
}

#dashboard .metrics span,
.metrics span {
  display: block;
  color: #6b7280 !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  line-height: 1.35;
  white-space: normal;
}

#dashboard .metrics strong,
.metrics strong {
  display: block;
  margin-top: 8px !important;
  color: #111827 !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  line-height: 1;
}

#dashboard .panel,
#dashboard .quick-panel,
#dashboard .doa-stock-panel {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important;
}

@media (max-width: 1180px) {
  header {
    padding: 10px 12px !important;
  }

  #dashboard {
    padding: 12px !important;
  }

  #dashboard .metrics,
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  #dashboard .metrics article,
  .metrics article {
    min-height: 72px !important;
    padding: 11px 12px !important;
  }

  #dashboard .metrics strong,
  .metrics strong {
    font-size: 24px !important;
  }
}

@media (max-width: 390px) {
  header {
    padding: 9px 10px !important;
  }

  #dashboard {
    padding: 10px !important;
  }

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

  #dashboard .metrics article,
  .metrics article {
    min-height: 68px !important;
    padding: 10px !important;
  }

  #dashboard .metrics span,
  .metrics span {
    font-size: 11px !important;
  }

  #dashboard .metrics strong,
  .metrics strong {
    font-size: 22px !important;
  }
}
