﻿:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --line: #d8dee7;
  --text: #17202a;
  --muted: #667085;
  --primary: #1f6f5b;
  --primary-dark: #185748;
  --accent: #a05a2c;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

html {
  scroll-padding-top: 12px;
}

button {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #18212b;
  color: #f8fafc;
  padding: 16px 12px;
}

.brand {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  color: #aeb8c4;
  font-size: 12px;
}

.exchange-rate-text {
  grid-column: 1 / -1;
  margin: -4px 0 0 0;
  color: #111827;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: none;
  padding-left: 2px;
}

.exchange-rate-text .exchange-value {
  color: #111827;
  font-weight: 800;
}

.exchange-rate-text.exchange-up .exchange-value {
  color: #dc2626;
}

.exchange-rate-text.exchange-down .exchange-value {
  color: #2563eb;
}

.exchange-rate-text .exchange-time {
  color: #111827;
  font-weight: 700;
}

.system-shortcuts {
  margin: 0;
}

.shortcut-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: #263241;
  color: #ffffff;
  padding: 0 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.shortcut-toggle span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-chevron {
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.18s ease;
}

.system-shortcuts:not(.collapsed) .shortcut-chevron {
  transform: rotate(180deg);
}

.shortcut-list {
  display: grid;
  gap: 0;
  margin-top: 4px;
  padding: 4px 0 6px;
  border-left: 1px solid rgba(203, 213, 225, 0.18);
  border-right: 1px solid rgba(203, 213, 225, 0.18);
  border-bottom: 1px solid rgba(203, 213, 225, 0.18);
  border-radius: 0 0 6px 6px;
  background: rgba(16, 25, 38, 0.72);
  overflow: hidden;
}

.system-shortcuts.collapsed .shortcut-list {
  display: none;
}

.shortcut-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-radius: 6px;
  color: #e2e8f0;
  padding: 0 12px 0 16px;
  text-decoration: none;
  font-weight: 700;
}

.shortcut-link:hover,
.shortcut-link:focus-visible {
  background: #263241;
  color: #ffffff;
  outline: 0;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #263241;
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 18px;
}

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

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

h1 {
  font-size: 22px;
  line-height: 1.25;
}

h2 {
  font-size: 15px;
}

h3 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 13px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.login-form input {
  width: 116px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  font: inherit;
}

.login-request {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.login-request strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 14px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0 8px 0 10px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

body.auth-locked {
  background: #f7f9fb;
}

body.auth-locked .app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

body.auth-locked .sidebar,
body.auth-locked .title-block,
body.auth-locked .visual-card,
body.auth-locked .metrics,
body.auth-locked main > section,
body.auth-locked .top-actions > :not(.login-form):not(.login-request) {
  display: none !important;
}

body.auth-locked .main {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

body.auth-locked .topbar {
  width: min(420px, 100%);
  margin: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
}

body.auth-locked .top-actions {
  width: 100%;
  display: grid;
  gap: 12px;
  justify-content: stretch;
}

body.auth-locked .login-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

body.auth-locked .login-form input,
body.auth-locked .login-form button {
  width: 100%;
}

.button {
  min-height: 36px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.button.accent {
  border-color: var(--accent);
  background: var(--accent);
}

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

.button.small {
  min-height: 32px;
  padding: 0 10px;
}

.button.tiny {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

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

.metric,
.panel,
.list-pane,
.detail-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 10px 12px;
}

.metric-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  font-size: 21px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(310px, 0.7fr);
  gap: 12px;
}

.workspace.has-layout-splitter {
  grid-template-columns: minmax(280px, var(--split-left, 68%)) 10px minmax(310px, 1fr);
  gap: 0;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.pane-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

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

.table-wrap {
  overflow: auto;
  max-height: min(560px, calc(100vh - 245px));
}

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

th,
td {
  height: 38px;
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

td {
  white-space: nowrap;
}

tr[data-id] {
  cursor: pointer;
}

tr[data-id]:hover,
tr.selected {
  background: #eef6f3;
}

.right {
  text-align: right;
}

.detail-pane {
  min-height: 460px;
}

.empty {
  padding: 24px 14px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.view-hidden {
  display: none !important;
}

.forwarder-mode .metrics,
.forwarder-mode .ledger-toolbar,
.forwarder-mode .workspace,
.forwarder-mode .bottom-grid,
.forwarder-mode .settlement-section,
.forwarder-mode .manual-section,
.forwarder-mode .erp-section,
.forwarder-mode .master-section,
.forwarder-mode .contract-section,
.forwarder-mode .user-section,
.forwarder-mode .audit-section,
.forwarder-mode .pi-upload-panel {
  display: none;
}

.forwarder-mode .pi-section {
  display: block;
}

.detail-content {
  padding: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 10px;
  margin: 0 0 14px;
}

.detail-grid dt {
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-pill {
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.status-pill.confirmed {
  background: #dcfce7;
  color: #166534;
}

.status-pill.hold {
  background: #fef3c7;
  color: var(--warning);
}

.status-pill.export {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-pill.rejected {
  background: #fee2e2;
  color: var(--danger);
}

.issue-list,
.action-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.issue-list li,
.action-list li,
.compact-list > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfe;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.bottom-grid.has-layout-splitter {
  grid-template-columns: minmax(260px, var(--split-left, 50%)) 10px minmax(260px, 1fr);
  gap: 0;
}

.erp-report-grid.has-layout-splitter {
  grid-template-columns: minmax(360px, var(--split-left, 60%)) 12px minmax(320px, 1fr);
  gap: 0;
}

.user-workspace.has-layout-splitter {
  grid-template-columns: minmax(360px, var(--split-left, 42%)) 12px minmax(360px, 1fr);
  gap: 0;
}

.has-layout-splitter > :not(.layout-splitter) {
  min-width: 0;
}

.panel {
  min-height: 168px;
}

.resizable-panel {
  resize: none;
  position: relative;
  overflow: auto;
  min-width: min(100%, 280px);
  min-height: 180px;
  max-width: 100%;
  max-height: none;
}

.layout-splitter {
  cursor: col-resize;
  align-self: stretch;
  min-height: 100%;
  position: relative;
  touch-action: none;
  display: flex;
  align-items: stretch;
  justify-content: center;
  z-index: 3;
  background:
    linear-gradient(90deg, transparent 0, transparent 4px, rgba(148, 163, 184, 0.3) 4px, rgba(148, 163, 184, 0.3) 8px, transparent 8px);
}

.layout-splitter::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 0 0 5px rgba(148, 163, 184, 0.12);
}

.layout-splitter::after {
  content: "좌우 조절";
  position: sticky;
  top: 10px;
  align-self: flex-start;
  writing-mode: vertical-rl;
  transform: translateY(10px);
  color: #64748b;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 7px 2px;
  font-size: 10px;
  pointer-events: none;
}

.layout-splitter:hover::before,
.has-layout-splitter.is-splitting .layout-splitter::before {
  background: #2dd4bf;
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.2), 0 0 0 6px rgba(45, 212, 191, 0.18);
}

.layout-splitter:hover::after,
.has-layout-splitter.is-splitting .layout-splitter::after {
  color: #0f766e;
  border-color: rgba(20, 184, 166, 0.35);
}

.panel-height-dragger {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  margin-top: 6px;
  cursor: row-resize;
  touch-action: none;
  background:
    linear-gradient(90deg, transparent, #cbd5e1 35%, #cbd5e1 65%, transparent);
  border-radius: 999px;
  opacity: 0.8;
}

.panel-height-dragger:hover,
.resizable-panel.is-resizing .panel-height-dragger {
  background:
    linear-gradient(90deg, transparent, #2dd4bf 35%, #2dd4bf 65%, transparent);
  opacity: 1;
}

.resizable-panel::after {
  content: "크기 조절";
  position: sticky;
  display: inline-block;
  margin-left: auto;
  bottom: 12px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #64748b;
  background: rgba(248, 250, 252, 0.86);
  font-size: 11px;
  pointer-events: none;
}

.compact-list,
.master-grid {
  padding: 12px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

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

.master-grid div {
  background: var(--surface-soft);
  border-radius: 6px;
  padding: 12px;
}

.master-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.master-grid strong {
  font-size: 22px;
}

.master-section,
.user-section,
.manual-section,
.settlement-section,
.erp-section,
.contract-section,
.audit-section {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settlement-workspace {
  padding: 12px;
}

.erp-workspace {
  display: grid;
  gap: 12px;
  padding: 12px;
}

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

.erp-summary-grid div {
  border: 1px solid #dbe7e4;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8fbfc 0, #eef6f4 100%);
  padding: 10px;
}

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

.erp-summary-grid strong {
  font-size: 21px;
  font-weight: 780;
}

.erp-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 12px;
}

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

.erp-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.inventory-filter {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(5, minmax(110px, 1fr)) auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.inventory-filter input,
.inventory-filter select {
  min-width: 0;
}

.erp-form input,
.erp-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.erp-form button {
  width: 100%;
}

.erp-table {
  min-width: 840px;
}

.erp-table-wrap {
  max-height: 340px;
}

.settlement-form {
  display: grid;
  grid-template-columns: 120px repeat(4, 150px) 88px 88px;
  gap: 8px;
  margin-bottom: 12px;
}

.settlement-form input,
.settlement-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.settlement-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.settlement-grid div {
  background: var(--surface-soft);
  border-radius: 6px;
  padding: 10px;
}

.settlement-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.settlement-grid strong {
  font-size: 21px;
}

.settlement-table {
  min-width: 820px;
}

.manual-workspace {
  padding: 12px;
}

.manual-form {
  display: grid;
  grid-template-columns: 110px 130px repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.manual-form input,
.manual-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

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

.contract-workspace {
  padding: 12px;
}

.contract-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.contract-form input,
.contract-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.contract-form input[type="file"] {
  padding: 6px 9px;
}

.contract-table {
  min-width: 1120px;
}

.contract-text-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.contract-detected-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.contract-detected-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fbfc;
}

.contract-detected-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

#contractExtractedText {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Malgun Gothic", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.user-workspace {
  padding: 12px;
}

.forwarder-admin-card {
  margin: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f8fb 100%);
}

.forwarder-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.forwarder-admin-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.forwarder-admin-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.forwarder-table-wrap {
  max-height: 240px;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.permission-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.user-form input,
.user-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0 9px;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.user-table-wrap {
  max-height: 320px;
}

.master-workspace {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.master-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.master-card h3 {
  margin-top: 0;
}

.master-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.master-form input,
.master-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.master-form button {
  width: 100%;
}

.mini-table-wrap {
  overflow: auto;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.mini-table {
  min-width: 420px;
}

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

.audit-table-wrap {
  max-height: 360px;
  margin: 14px;
}

.mini-table th,
.mini-table td {
  height: 36px;
  padding: 0 9px;
  font-size: 12px;
}

.mini-table tbody tr {
  cursor: pointer;
}

.mini-table tbody tr:hover {
  background: #eef6f3;
}

.mini-table tbody tr.stock-negative {
  background: #fff1f1;
}

.mini-table tbody tr.stock-negative:hover {
  background: #ffe4e4;
}

.mini-table tbody tr.stock-empty {
  background: #fff8e6;
}

.mini-table tbody tr.stock-empty:hover {
  background: #fff1c2;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  min-height: 40px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  padding: 11px 14px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
  }

  .brand {
    margin-bottom: 0;
    min-width: 260px;
  }

  .brand-subtitle {
    display: none;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: thin;
    align-items: stretch;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .system-shortcuts {
    flex: 0 0 auto;
    position: relative;
  }

  .shortcut-toggle {
    height: 34px;
    min-height: 34px;
    white-space: nowrap;
    padding: 0 10px;
  }

  .shortcut-list {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    z-index: 35;
    width: 210px;
    max-height: min(310px, 65vh);
    overflow-y: auto;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.26);
  }

  .shortcut-link {
    white-space: nowrap;
  }

  .workspace,
  .bottom-grid,
  .master-workspace,
  .erp-report-grid,
  .erp-master-grid,
  .inventory-filter,
  .settlement-form,
  .settlement-grid,
  .erp-summary-grid,
  .permission-grid,
  .manual-form,
  .contract-form,
  .contract-detected-grid,
  .user-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions,
  .login-form {
    justify-content: flex-start;
  }

  .forwarder-admin-head {
    display: grid;
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .workspace.has-layout-splitter,
  .bottom-grid.has-layout-splitter {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .layout-splitter {
    display: none;
  }

  .resizable-panel {
    resize: none;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
  }

  .panel-height-dragger,
  .resizable-panel::after {
    display: none;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 13px;
    background: #ffffff;
  }

  .main {
    padding: 10px;
  }

  .sidebar {
    grid-template-columns: 1fr;
    gap: 8px;
    transition: padding 180ms ease, gap 180ms ease, box-shadow 180ms ease;
  }

  .brand {
    gap: 8px;
    min-width: 0;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 16px;
  }

  .nav {
    margin: 0 -2px;
    max-height: 42px;
    opacity: 1;
    overflow-y: visible;
    transition: max-height 180ms ease, opacity 150ms ease, margin 180ms ease, padding 180ms ease;
  }

  .system-shortcuts {
    position: static;
  }

  .shortcut-list {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 116px;
    z-index: 80;
    width: auto;
    max-height: 42vh;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  }

  .shortcut-link {
    color: var(--text);
  }

  .shortcut-link:hover,
  .shortcut-link:focus-visible {
    background: #eef6f3;
    color: var(--text);
  }

  body.mobile-top-menu-collapsed .sidebar {
    gap: 0;
    padding-top: 6px;
    padding-bottom: 6px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
  }

  body.mobile-top-menu-collapsed .sidebar .nav {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    margin: 0;
    padding: 0;
  }

  body.mobile-top-menu-collapsed .system-shortcuts .shortcut-list {
    display: none;
  }

  .top-actions,
  .action-row {
    justify-content: flex-start;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 10px;
    transition: margin 180ms ease;
  }

  h1 {
    font-size: 19px;
  }

  .topbar p {
    display: none;
  }

  .top-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: thin;
    transition: max-height 180ms ease, opacity 150ms ease, padding 180ms ease;
  }

  .brand .exchange-rate-text {
    max-width: none;
    font-size: 10px;
    line-height: 1.2;
  }

  .top-actions .button,
  .top-actions .user-badge {
    flex: 0 0 auto;
    width: auto;
    min-height: 32px;
    padding-left: 10px;
    padding-right: 10px;
    white-space: nowrap;
  }

  body.mobile-top-menu-collapsed .top-actions {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    padding: 0;
  }

  body.mobile-top-menu-collapsed .topbar {
    margin-bottom: 4px;
  }

  .login-form {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
    width: 100%;
  }

  .login-form input {
    width: 100%;
  }

  .user-badge {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }

  .metric {
    min-height: 62px;
    padding: 8px;
  }

  .metric-label {
    margin-bottom: 5px;
    font-size: 11px;
  }

  .metric strong {
    font-size: 18px;
  }

  .workspace {
    gap: 10px;
  }

  .detail-pane {
    min-height: 0;
  }

  .pane-header {
    min-height: 38px;
    padding: 0 10px;
  }

  .table-wrap {
    max-height: none;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    height: 40px;
    padding: 0 8px;
  }

  #salesTable td:nth-child(2),
  #salesTable td:nth-child(3),
  #salesTable td:nth-child(5),
  .table-wrap th:nth-child(2),
  .table-wrap th:nth-child(3),
  .table-wrap th:nth-child(5) {
    display: none;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel {
    min-height: 0;
  }

  .settlement-form,
  .manual-form,
  .user-form,
  .master-form,
  .erp-form {
    gap: 7px;
  }

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

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

  .settlement-grid div {
    padding: 9px;
  }

  .settlement-grid strong {
    font-size: 18px;
  }

  .manual-table,
  .settlement-table,
  .erp-table,
  .audit-table {
    min-width: 620px;
  }

  .master-card {
    padding: 10px;
  }

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

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }
}

/* Responsive visual and ledger controls */
.title-block {
  min-width: 0;
}

.visual-card {
  width: clamp(220px, 26vw, 360px);
  height: 92px;
  overflow: hidden;
  border: 1px solid rgba(215, 222, 231, 0.88);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

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

.ledger-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 150px;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
}

.ledger-toolbar input,
.ledger-toolbar select,
.payment-form input,
.payment-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.payment-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  margin: 0 0 12px;
}

.modal-open {
  overflow: hidden;
}

.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.guide-overlay.hidden {
  display: none;
}

.guide-panel {
  width: min(920px, 100%);
  max-height: min(82vh, 820px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0, #f8fbfc 100%);
}

.guide-header h2 {
  font-size: 18px;
}

.guide-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.guide-content {
  display: grid;
  gap: 12px;
  max-height: calc(min(82vh, 820px) - 74px);
  overflow: auto;
  padding: 14px 18px 18px;
  scrollbar-width: thin;
  scrollbar-color: #b6c2cf transparent;
}

.guide-content article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0, #fbfcfe 100%);
  padding: 13px 14px;
}

.guide-content h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.guide-content p,
.guide-content li {
  color: #334155;
  line-height: 1.62;
}

.guide-content p + p {
  margin-top: 7px;
}

.guide-content ol {
  margin: 0;
  padding-left: 20px;
}

@media (min-width: 1280px) {
  .main {
    padding: 22px 24px;
  }

  .topbar {
    align-items: center;
  }
}

@media (max-width: 1100px) {
  .visual-card {
    display: none;
  }

  .ledger-toolbar {
    grid-template-columns: minmax(180px, 1fr) 140px 140px;
  }
}

@media (max-width: 720px) {
  .ledger-toolbar,
  .payment-form {
    grid-template-columns: 1fr;
  }

  .ledger-toolbar {
    padding: 8px;
    gap: 7px;
  }

  .payment-form {
    gap: 7px;
  }

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

  .login-form .button {
    grid-column: 1 / -1;
  }

  .guide-overlay {
    align-items: stretch;
    padding: 10px;
  }

  .guide-panel {
    max-height: calc(100vh - 20px);
  }

  .guide-header {
    display: grid;
    padding: 13px;
  }

  .guide-header .button {
    width: 100%;
  }

  .guide-content {
    max-height: calc(100vh - 126px);
    padding: 10px;
  }

  .guide-content article {
    padding: 11px;
  }
}

/* Premium finish */
:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f4f7fa;
  --surface-tint: #f8fbfc;
  --line: #d7dee7;
  --line-strong: #c6d0dc;
  --text: #111827;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #e6f4f2;
  --accent: #9a5b24;
  --accent-soft: #fff4e8;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px rgba(15, 23, 42, 0.07);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05);
}

body {
  background:
    linear-gradient(180deg, #f8fafc 0, #eef2f5 280px, #e9eef3 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.sidebar {
  background: #111827;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.brand-mark {
  background: #0f766e;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.28);
}

.brand-title {
  letter-spacing: 0;
}

.nav-item {
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.nav-item.active {
  background: #1f2937;
  color: #ffffff;
  box-shadow: inset 3px 0 0 #2dd4bf;
}

.nav-item:hover {
  background: #243244;
}

.main {
  max-width: 1600px;
  width: 100%;
}

h1 {
  font-weight: 750;
}

h2 {
  font-weight: 750;
}

.metric,
.panel,
.list-pane,
.detail-pane,
.master-section,
.user-section,
.manual-section,
.settlement-section,
.contract-section,
.audit-section {
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 82px;
  background: linear-gradient(180deg, #ffffff 0, var(--surface-tint) 100%);
  border-top-color: #ffffff;
}

.metric:first-child {
  border-color: #c9e4df;
  background: linear-gradient(180deg, #ffffff 0, var(--primary-soft) 100%);
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  font-weight: 780;
  letter-spacing: 0;
}

.pane-header {
  background: linear-gradient(180deg, #ffffff 0, #fbfcfe 100%);
}

.button {
  font-weight: 700;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.06);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.button.secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: var(--line-strong);
}

.button.accent {
  color: #ffffff;
}

input,
select {
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.user-badge,
.checkbox-line {
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.table-wrap,
.mini-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #b6c2cf transparent;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #526173;
  border-bottom-color: var(--line-strong);
  text-transform: none;
}

td {
  background-clip: padding-box;
}

tr[data-id]:hover,
tr.selected,
.mini-table tbody tr:hover {
  background: #edf8f6;
}

tr.selected {
  box-shadow: inset 3px 0 0 var(--primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  font-weight: 700;
}

.status-pill.confirmed {
  background: #dff7e8;
  border-color: #b9e8ca;
  color: #14713c;
}

.status-pill.hold {
  background: #fff4d6;
  border-color: #f4d58b;
  color: #895c00;
}

.status-pill.export {
  background: #e6f0ff;
  border-color: #bfd6ff;
  color: #2355a7;
}

.status-pill.rejected {
  background: #ffe6e6;
  border-color: #ffc5c5;
  color: #a92720;
}

.issue-list li,
.action-list li,
.compact-list > div,
.master-card {
  background: linear-gradient(180deg, #ffffff 0, #fbfcfe 100%);
  border-color: var(--line);
}

.master-grid div,
.settlement-grid div {
  border: 1px solid #dbe7e4;
  background: linear-gradient(180deg, #f8fbfc 0, #eef6f4 100%);
}

.master-grid span,
.settlement-grid span {
  font-size: 12px;
  font-weight: 700;
}

.master-grid strong,
.settlement-grid strong {
  font-weight: 780;
}

.permission-grid {
  background: linear-gradient(180deg, #f8fbfc 0, #f1f5f9 100%);
  border-color: var(--line);
}

.permission-grid label {
  min-height: 30px;
  border-radius: 6px;
  color: #334155;
}

.toast {
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.26);
}

@media (max-width: 1100px) {
  .sidebar {
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
  }

  .nav-item.active {
    box-shadow: inset 0 -2px 0 #2dd4bf;
  }
}

@media (max-width: 720px) {
  body {
    background: #f8fafc;
  }

  .main {
    max-width: none;
  }

  .metric,
  .panel,
  .list-pane,
  .detail-pane,
  .master-section,
  .user-section,
  .manual-section,
  .settlement-section,
  .contract-section,
  .audit-section {
    box-shadow: var(--shadow-soft);
  }

  .metric {
    min-height: 66px;
  }

  .button:hover:not(:disabled) {
    transform: none;
  }
}







