:root {
  --bg: #ece9e4;
  --panel: #f8f6f2;
  --panel-soft: #f2efea;
  --line: #d9d2c9;
  --line-strong: #c8bdb1;
  --text: #2f2925;
  --muted: #746b63;
  --brand: #8f7f76;
  --brand-strong: #786961;
  --brand-soft: #e9e1da;
  --danger: #9d5c57;
  --danger-soft: #f5e8e5;
  --success: #667b6a;
  --success-soft: #e8efe8;
  --shadow: 0 18px 40px rgba(54, 45, 37, 0.08);
  --sidebar-width: 236px;
  --sidebar-collapsed-width: 72px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(205, 194, 183, 0.22), transparent 34%),
    linear-gradient(180deg, #f2f0ec 0%, var(--bg) 100%);
}

body.is-popup-mode {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(44, 39, 35, 0.92);
  backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.menu a {
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, transform 0.2s ease;
}

.menu a:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.menu a.is-active {
  background: rgba(255, 255, 255, 0.2);
}

.menu-link-initial {
  display: none;
}

.auth {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 248, 242, 0.85);
}

.auth a {
  color: #efe2d8;
}

.sidebar-nav-shell {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 12px;
  color: #ffffff;
  background: rgba(44, 39, 35, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 14px 0 30px rgba(54, 45, 37, 0.12);
  transition: width 0.18s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.sidebar-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 12px;
}

.sidebar-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-nav {
  display: grid;
  gap: 5px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-group {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.sidebar-group-title {
  padding: 7px 10px 3px;
  color: rgba(255, 248, 242, 0.58);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-link,
.sidebar-auth-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 10px;
  color: #ffffff;
  text-decoration: none;
  border-radius: 10px;
}

.sidebar-link:hover,
.sidebar-auth-link:hover,
.sidebar-link.is-active {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-link-initial {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.11);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-link-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-auth {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
  display: grid;
  gap: 2px;
  padding: 0 10px 4px;
}

.sidebar-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-user-role {
  color: rgba(255, 248, 242, 0.64);
  font-size: 11px;
  font-weight: 700;
}

.container {
  width: min(1480px, calc(100% - 24px));
  margin: 16px auto 28px;
  background: var(--panel);
  border: 1px solid rgba(200, 189, 177, 0.78);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

body.has-sidebar-layout .container {
  width: min(1480px, calc(100% - var(--sidebar-width) - 32px));
  margin-right: 16px;
  margin-left: calc(var(--sidebar-width) + 16px);
}

body.sidebar-is-collapsed .sidebar-nav-shell {
  width: var(--sidebar-collapsed-width);
}

body.sidebar-is-collapsed .container {
  width: min(1480px, calc(100% - var(--sidebar-collapsed-width) - 32px));
  margin-left: calc(var(--sidebar-collapsed-width) + 16px);
}

body.sidebar-is-collapsed .sidebar-header {
  justify-content: center;
}

body.sidebar-is-collapsed .sidebar-brand-text,
body.sidebar-is-collapsed .sidebar-group-title,
body.sidebar-is-collapsed .sidebar-link-label,
body.sidebar-is-collapsed .sidebar-user {
  display: none;
}

body.sidebar-is-collapsed .sidebar-brand {
  display: none;
}

body.sidebar-is-collapsed .sidebar-link {
  justify-content: center;
  padding: 0;
}

body.sidebar-is-collapsed .sidebar-link-initial {
  display: inline-flex;
}

body.sidebar-is-collapsed .sidebar-auth-link {
  justify-content: center;
  padding: 0 4px;
  font-size: 11px;
}

body.is-popup-mode .container {
  width: min(1600px, calc(100% - 16px));
  min-height: calc(100vh - 16px);
  margin: 8px auto;
  padding: 18px 20px;
}

.error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(167, 50, 50, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.success {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(31, 107, 70, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

h1, h2, h3 {
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

p, ul {
  color: var(--muted);
  margin: 0;
}

form {
  margin: 0;
}

label {
  display: inline-block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

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

input[type="text"],
input[type="search"],
input[type="date"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  color: var(--text);
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #b4a398;
  box-shadow: 0 0 0 4px rgba(180, 163, 152, 0.16);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.address-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.address-search-row .btn {
  white-space: nowrap;
}

.address-search-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.address-search-hint.is-error {
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

a.btn-secondary,
.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: rgba(39, 69, 47, 0.12);
}

a.btn-secondary:hover,
.btn-secondary:hover {
  background: #ddd2c8;
}

.period-preset-row {
  margin-top: 10px;
}

.period-preset-button.is-active {
  background: #27462f;
  border-color: #27462f;
  color: #ffffff;
}

.filter-toolbar {
  display: grid;
  gap: 12px;
}

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

.filter-main-row,
.filter-condition-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
}

.filter-main-row {
  justify-content: flex-start;
}

.filter-condition-row {
  justify-content: flex-start;
}

.filter-condition-row > div:not(.filter-date-range-field) {
  flex: 0 1 180px;
}

.filter-condition-row-bank > div:first-child,
.filter-condition-row-ledger > div:first-child {
  flex: 1 1 280px;
  max-width: 380px;
}

.filter-condition-row-bank > div:nth-child(2) {
  flex-basis: 130px;
}

.filter-condition-row-bank > div:nth-child(3) {
  flex-basis: 150px;
}

.filter-partner-field,
.filter-keyword-field {
  min-width: 0;
}

.filter-actions {
  display: inline-flex;
  align-items: end;
  justify-content: flex-start;
  gap: 8px;
  min-width: max-content;
}

.filter-main-row > .filter-actions .btn,
.compact-filter-actions .btn {
  height: 38px;
  min-height: 38px;
}

.filter-search-control {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 88px 88px;
  gap: 6px;
  max-width: 560px;
}

.filter-integrated-search {
  flex: 0 1 560px;
}

.compact-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
}

.compact-search-field {
  flex: 0 1 560px;
  min-width: 300px;
}

.compact-search-control {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 88px 72px;
  gap: 6px;
}

.compact-search-control > input,
.compact-search-control > .btn {
  height: 38px;
  min-height: 38px;
}

.compact-filter-field {
  flex: 0 1 180px;
}

.compact-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-search-control > input {
  min-width: 0;
  height: 38px;
  min-height: 38px;
  border-radius: 10px;
  appearance: none;
}

.filter-search-scope-button {
  width: 88px;
  min-width: 88px;
  height: 38px;
  min-height: 38px;
  padding-inline: 10px;
}

.filter-search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 88px;
  min-width: 88px;
  height: 38px;
  min-height: 38px;
  padding-inline: 10px;
}

.filter-search-submit svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-search-scope-popover {
  top: calc(100% + 8px);
  right: auto;
  width: min(820px, calc(100vw - 32px));
  min-width: 560px;
  margin-top: 0;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 14px;
}

.filter-search-scope-popover::before {
  right: auto;
  left: calc(var(--filter-popover-arrow-left, 20%) - 6px);
}

.filter-search-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-width: 320px;
}

.filter-search-mode-option {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.filter-search-mode-option input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.filter-search-field-title {
  margin-top: 12px;
}

.filter-search-field-options {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px 8px;
}

.filter-details,
.advanced-filter-details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.filter-details > summary,
.advanced-filter-details > summary {
  width: max-content;
  color: var(--brand);
  font-weight: 800;
  cursor: pointer;
}

.filter-details[open] > summary,
.advanced-filter-details[open] > summary {
  margin-bottom: 10px;
}

.filter-details .filter-condition-row,
.advanced-filter-details .filter-condition-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
}

.filter-popover-shell {
  position: relative;
}

.filter-summary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 150px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.filter-summary-button strong {
  color: var(--brand);
  white-space: nowrap;
}

.filter-date-range-field {
  flex: 0 1 410px;
  min-width: 360px;
}

.filter-field-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.filter-date-range-control {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr) 78px;
  gap: 6px;
  align-items: center;
}

.filter-date-range-control input {
  min-width: 0;
}

.filter-date-range-separator {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.filter-icon-button {
  width: 38px;
  min-width: 38px;
  height: 42px;
  padding: 0;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
}

.filter-period-button {
  width: 78px;
  min-width: 78px;
  height: 38px;
  min-height: 38px;
  gap: 5px;
  padding: 0 10px;
  border-radius: 10px;
  line-height: 1;
}

.filter-period-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-period-popover {
  top: calc(100% + 8px);
  right: auto;
  width: min(480px, calc(100vw - 32px));
  min-width: 420px;
  margin-top: 0;
  padding: 14px;
}

.filter-period-popover::before {
  right: auto;
  left: calc(var(--filter-popover-arrow-left, 50%) - 6px);
}

.filter-period-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.filter-period-popover-header .filter-popover-title {
  margin-bottom: 0;
}

.filter-period-custom-badge {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.filter-period-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.filter-period-options .filter-popover-option {
  justify-content: space-between;
  min-height: 38px;
  border-color: var(--line);
  background: #fbfaf8;
  white-space: nowrap;
}

.filter-period-active-mark {
  color: var(--brand);
  font-weight: 900;
}

.filter-popover {
  position: absolute;
  right: 0;
  z-index: 50;
  min-width: 210px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 12px 28px rgba(39, 35, 31, 0.16);
}

.filter-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 16px;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #fffdfa;
  transform: rotate(45deg);
}

.filter-popover-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filter-popover-options {
  display: grid;
  gap: 6px;
}

.filter-popover-option,
.filter-popover-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.filter-popover-option:hover,
.filter-popover-check:hover {
  background: var(--panel-soft);
}

.filter-popover-option.is-active {
  border-color: rgba(39, 69, 47, 0.22);
  background: var(--brand-soft);
  color: var(--brand);
}

.filter-popover-check input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.filter-popover-actions {
  position: sticky;
  bottom: -14px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 0 14px;
  border-top: 1px solid var(--line);
  background: #fffdfa;
}

.filter-popover-actions .btn {
  min-height: 34px;
}

@media (max-width: 980px) {
  .filter-integrated-search {
    flex-basis: min(560px, 100%);
  }

  .filter-search-scope-popover {
    width: min(620px, calc(100vw - 32px));
    min-width: 0;
  }

  .filter-period-popover {
    width: min(480px, calc(100vw - 32px));
    min-width: 0;
  }

  .filter-search-field-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .filter-main-row,
  .filter-condition-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-main-row > *,
  .filter-condition-row > div,
  .filter-date-range-field,
  .filter-actions {
    width: 100%;
    max-width: none;
    min-width: 0;
    flex-basis: auto;
  }

  .filter-summary-button {
    width: 100%;
  }

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

  .filter-search-control > input {
    grid-column: 1 / -1;
  }

  .filter-search-submit,
  .filter-search-scope-button {
    width: 100%;
    min-width: 0;
  }

  .filter-date-range-control {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .filter-date-range-control .filter-popover-shell {
    grid-column: 1 / -1;
  }

  .filter-period-button {
    width: 100%;
  }

  .compact-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .compact-search-field,
  .compact-filter-field,
  .compact-filter-actions {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex-basis: auto;
  }

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

  .compact-search-control > input {
    grid-column: 1 / -1;
  }

  .compact-search-control > .btn,
  .compact-filter-actions .btn {
    width: 100%;
  }

  .filter-details .filter-condition-row,
  .advanced-filter-details .filter-condition-row {
    grid-template-columns: 1fr;
  }

  .filter-popover {
    left: 0;
    right: auto;
    min-width: min(280px, 100%);
  }

  .filter-popover::before {
    left: 16px;
    right: auto;
  }

  .filter-search-scope-popover {
    right: 0;
    left: auto;
    width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
  }

  .filter-search-scope-popover::before {
    right: auto;
    left: calc(var(--filter-popover-arrow-left, calc(100% - 22px)) - 6px);
  }

  .filter-search-field-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-period-popover {
    width: calc(100vw - 32px);
  }

  .filter-period-popover::before {
    right: auto;
    left: calc(var(--filter-popover-arrow-left, 50%) - 6px);
  }
}

.voucher-business-status-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voucher-business-status-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
}

.voucher-business-status-option input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.multi-checkbox-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.multi-checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
}

.multi-checkbox-option input {
  width: auto;
  min-height: 0;
  margin: 0;
}

a.btn-danger,
.btn-danger {
  background: #a23434;
  color: #ffffff;
  border-color: #8b2b2b;
}

a.btn-danger:hover,
.btn-danger:hover {
  background: #8b2b2b;
}

a {
  color: var(--brand);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-soft);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.35;
}

tbody tr:hover {
  background: rgba(233, 225, 217, 0.55);
}

tbody tr[data-document-detail-row] {
  cursor: pointer;
}

tbody tr[data-document-detail-row]:focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: -2px;
}

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

.page-header p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.section-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.section-title {
  margin-bottom: 10px;
}

.page-stack {
  display: grid;
  gap: 14px;
}

.document-entry-header h1 {
  font-size: 30px;
  letter-spacing: 0;
}

.document-entry-header p {
  font-size: 16px;
}

.document-entry-form,
.document-entry-form > *,
.document-entry-form .section-card,
.document-entry-form .table-wrap {
  min-width: 0;
}

.document-entry-form .table-wrap {
  max-width: 100%;
}

.document-entry-form .section-title {
  font-size: 20px;
  letter-spacing: 0;
}

.document-entry-form label {
  font-size: 14px;
}

.document-entry-form .panel-note {
  font-size: 15px;
}

.document-entry-form .document-field-grid input,
.document-entry-form .document-field-grid select,
.document-entry-form .document-field-grid textarea {
  min-height: 42px;
  font-size: 18px;
}

.document-entry-form .sidebar-stack input,
.document-entry-form .sidebar-stack select,
.document-entry-form .sidebar-stack textarea {
  min-height: 42px;
  font-size: 18px;
}

.document-entry-form .document-action-row .btn {
  min-height: 40px;
  font-size: 18px;
}

.document-entry-form .js-line-manager {
  padding: 16px;
}

.document-entry-form .js-line-manager .section-heading {
  align-items: end;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.document-entry-form .js-line-manager .section-title {
  margin-bottom: 4px;
}

.document-entry-form .line-actions-row {
  gap: 6px;
  margin-top: 0;
}

.document-entry-form .line-actions-row .btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 16px;
}

.document-entry-form .line-manager-summary {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 15px;
}

.document-entry-form .js-line-manager .table-wrap {
  border-radius: 12px;
  background: var(--panel);
}

.document-entry-form .js-document-lines-table {
  min-width: 1440px;
  font-size: 16px;
}

.document-entry-form .js-document-lines-table thead th {
  padding: 8px 10px;
  font-size: 15px;
  line-height: 1.25;
  white-space: nowrap;
  background: #ebe5df;
}

.document-entry-form .js-document-lines-table tbody td {
  padding: 7px 10px;
  vertical-align: middle;
  line-height: 1.3;
}

.document-entry-form .js-document-lines-table input[type="text"],
.document-entry-form .js-document-lines-table input[type="date"],
.document-entry-form .js-document-lines-table select,
.document-entry-form .js-document-lines-table textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 16px;
}

.document-entry-form .js-document-lines-table .line-order-cell,
.document-entry-form .js-document-lines-table .line-order-heading {
  gap: 6px;
}

.document-entry-form .js-document-lines-table .line-selection-input {
  width: 15px;
  height: 15px;
}

.document-entry-form .js-document-lines-table .drag-handle {
  min-width: 18px;
}

.document-entry-form .js-document-lines-table th:nth-child(1),
.document-entry-form .js-document-lines-table td:nth-child(1) {
  width: 92px;
  min-width: 92px;
}

.document-entry-form .js-document-lines-table th:nth-child(2),
.document-entry-form .js-document-lines-table td:nth-child(2) {
  width: 114px;
  min-width: 114px;
}

.document-entry-form .js-document-lines-table .lookup-input-shell {
  width: 96px;
  flex: 0 0 96px;
}

.document-entry-form .js-document-lines-table .lookup-input-shell .js-lookup-input {
  padding-right: 34px;
}

.document-entry-form .js-document-lines-table .lookup-icon-button,
.document-entry-form .js-document-lines-table .line-inline-icon-button {
  width: 26px;
  height: 26px;
}

.document-entry-form .js-document-lines-table .lookup-icon-button {
  right: 5px;
}

.document-entry-form .js-document-lines-table .product-meta {
  min-width: 86px;
  font-size: 15.5px;
  line-height: 1.35;
}

.document-entry-form .js-document-lines-table .product-meta-input {
  width: 86px;
  min-width: 86px;
}

.document-entry-form .js-document-lines-table .js-line-quantity {
  width: 64px;
  max-width: 64px !important;
}

.document-entry-form .js-document-lines-table .line-unit-price-cell {
  min-width: 150px;
}

.document-entry-form .js-document-lines-table .line-unit-price-shell {
  width: 150px;
}

.document-entry-form .js-document-lines-table .line-unit-price-shell .js-line-unit-price {
  padding-left: 36px;
}

.document-entry-form .js-document-lines-table .line-amount-cell {
  min-width: 118px;
}

.document-entry-form .js-document-lines-table .line-amount-display-input {
  width: 118px;
}

.document-entry-form .js-document-lines-table [data-line-column="note"] input,
.document-entry-form .js-document-lines-table [data-line-column="description"] input {
  width: 84px;
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0;
}

.profile-detail-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.profile-detail-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-detail-grid dd {
  margin: 0;
  font-weight: 700;
}

.layout-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.layout-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
}

.layout-choice input {
  grid-row: span 2;
  margin: 0;
}

.layout-choice.is-selected {
  border-color: var(--brand);
  background: #eee8e2;
}

.layout-choice-title {
  font-weight: 800;
}

.layout-choice-copy {
  color: var(--muted);
  font-size: 12px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.document-form-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
}

.document-form-main {
  min-width: 0;
}

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

.document-required-label {
  color: var(--brand-strong);
}

.document-action-panel {
  display: grid;
  gap: 10px;
}

.document-action-panel .panel-note {
  margin-bottom: 0;
}

.document-action-row {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.document-action-row .btn {
  width: 100%;
}

@supports (container-type: inline-size) {
  .document-form-main {
    container-type: inline-size;
  }

  .form-grid.document-field-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  @container (max-width: 900px) {
    .form-grid.document-field-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  @container (max-width: 660px) {
    .form-grid.document-field-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @container (max-width: 430px) {
    .form-grid.document-field-grid {
      grid-template-columns: 1fr;
    }
  }
}

@media (max-width: 1100px) {
  .document-entry-form .document-form-layout {
    grid-template-columns: 1fr;
  }
}

.sidebar-stack {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.section-heading h2,
.section-heading h3 {
  margin-bottom: 4px;
}

.section-heading p {
  font-size: 13px;
  line-height: 1.45;
}

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

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

.field-compact input,
.field-compact select {
  max-width: 120px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f4f0;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pagination-controls {
  align-items: center;
  justify-content: flex-end;
}

.pagination-controls .inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-page-size-label {
  margin-bottom: 0;
}

.pagination-page-size-select {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  flex: 0 0 88px;
  text-align: right;
  text-align-last: right;
  padding-right: 28px;
}

.inline-form {
  display: inline;
}

.number-input {
  text-align: right;
}

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

.list-summary {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.product-meta {
  min-width: 90px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.lookup-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lookup-input-shell {
  position: relative;
  min-width: 0;
  flex: 1;
}

.lookup-field .js-lookup-input {
  min-width: 0;
  flex: 1;
}

.lookup-field .js-party-selection-display {
  min-width: 0;
  flex: 1;
}

.lookup-input-shell .js-lookup-input,
.lookup-input-shell .js-party-selection-display {
  padding-right: 44px;
}

.lookup-icon-button {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s ease, color 0.2s ease;
}

.lookup-icon-button:hover {
  background: rgba(180, 163, 152, 0.12);
  color: var(--brand);
}

.lookup-icon-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 163, 152, 0.16);
}

.lookup-icon-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.5;
}

.lookup-icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lookup-icon-button-toggle .lookup-icon-clear {
  display: none;
}

.lookup-icon-button-toggle.is-clear .lookup-icon-search {
  display: none;
}

.lookup-icon-button-toggle.is-clear .lookup-icon-clear {
  display: inline-flex;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(47, 41, 37, 0.4);
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-panel {
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(200, 189, 177, 0.92);
  background: var(--panel);
  box-shadow: 0 28px 60px rgba(54, 45, 37, 0.16);
}

.modal-header,
.modal-footer {
  padding: 14px 18px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  padding: 14px 18px;
  overflow: auto;
  max-height: calc(88vh - 120px);
}

.modal-close {
  min-width: 40px;
}

.lookup-modal-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.lookup-create-link {
  white-space: nowrap;
}

.lookup-modal--product .lookup-modal-panel {
  width: min(1280px, calc(100vw - 32px));
  max-height: 92vh;
}

.lookup-modal--product .modal-body {
  display: flex;
  flex-direction: column;
  max-height: calc(92vh - 78px);
  overflow: hidden;
}

.lookup-modal-controls {
  position: relative;
  z-index: 1;
  background: var(--panel);
}

.lookup-modal--product .lookup-modal-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 12px;
  flex: 0 0 auto;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.lookup-modal--product .lookup-field {
  grid-column: 1 / -1;
}

#lookup-modal-search {
  min-height: 42px;
}

.lookup-search-button {
  min-width: 68px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.lookup-filter-grid {
  margin-top: 10px;
}

.lookup-modal--product .lookup-filter-grid {
  display: block;
  min-width: 0;
  margin-top: 0;
}

.lookup-filter-toolbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
}

.lookup-filter-toolbar-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lookup-filter-toolbar-group-left {
  justify-self: start;
}

.lookup-filter-toolbar-group-right {
  justify-self: end;
  justify-content: flex-end;
  text-align: right;
}

.lookup-filter-summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.lookup-filter-summary::after {
  content: "v";
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
}

.lookup-filter-summary.is-active::after {
  content: "^";
}

.lookup-filter-summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 163, 152, 0.18);
}

.lookup-filter-panel-row {
  margin-top: 8px;
}

.lookup-filter-panel-row[data-active-panel="columns"] .lookup-filter-panel-columns {
  display: flex;
  justify-content: flex-end;
}

.lookup-filter-panel-row[data-active-panel="columns"] .lookup-filter-options {
  justify-content: flex-end;
}

.lookup-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.lookup-filter-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lookup-filter-actions .btn {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.lookup-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.lookup-filter-options label,
.lookup-filter-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

.lookup-results-empty {
  padding: 14px 0;
  color: var(--muted);
}

.lookup-results-status {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.lookup-modal--product .lookup-results-status {
  display: none;
  justify-self: end;
  align-self: center;
  min-height: 0;
  margin-top: 0;
  white-space: nowrap;
}

.lookup-results-table {
  margin-top: 14px;
}

.lookup-modal--product .lookup-results-table {
  flex: 1 1 auto;
  min-height: 280px;
  overflow: auto;
}

.lookup-modal--product .lookup-results-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--line-strong);
}

.lookup-results-table tbody tr {
  cursor: pointer;
}

.lookup-results-table tbody tr:focus-visible,
.lookup-results-table tbody tr.is-active {
  outline: 2px solid rgba(126, 95, 73, 0.45);
  outline-offset: -2px;
  background: rgba(233, 225, 217, 0.72);
}

.lookup-pagination {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
}

.lookup-pagination[hidden] {
  display: none;
}

.lookup-page-input-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lookup-page-input-label input {
  width: 72px;
  min-width: 72px;
  text-align: right;
}

.lookup-page-summary {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.lookup-highlight {
  border-radius: 3px;
  background: rgba(255, 209, 102, 0.45);
  color: inherit;
  font-weight: 800;
  padding: 0 2px;
}

.line-unit-price-cell {
  min-width: 176px;
}

.line-unit-price-shell {
  position: relative;
  width: min(176px, 100%);
}

.line-unit-price-shell .js-line-unit-price {
  max-width: none !important;
  padding-left: 40px;
}

.line-amount-cell {
  min-width: 132px;
}

.line-amount-display-input {
  width: min(132px, 100%);
  max-width: none !important;
}

.line-amount-display-input[readonly] {
  color: var(--muted);
  cursor: default;
}

.line-inline-icon-button {
  position: absolute;
  top: 50%;
  left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s ease, color 0.2s ease;
}

.line-inline-icon-button:hover {
  background: rgba(180, 163, 152, 0.12);
  color: var(--brand);
}

.line-inline-icon-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 163, 152, 0.16);
}

.line-inline-icon-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.5;
}

.line-inline-icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-manager-summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.line-actions-row {
  align-items: center;
  justify-content: flex-end;
}

.line-actions-row .btn {
  white-space: nowrap;
}

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

.table-column-settings-modal-panel {
  width: min(640px, 100%);
}

.line-settings-summary {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.line-preset-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.54);
}

.line-preset-field {
  display: grid;
  gap: 5px;
  margin-bottom: 0;
}

.line-preset-field span {
  font-size: 12px;
  font-weight: 800;
}

.line-preset-field select,
.line-preset-field input {
  min-height: 36px;
}

.line-preset-combo-shell {
  position: relative;
}

.line-preset-combo-shell input {
  padding-right: 40px;
}

.line-preset-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transform: translateY(-50%);
}

.line-preset-toggle:hover,
.line-preset-toggle.is-open {
  color: var(--brand);
  background: rgba(180, 163, 152, 0.14);
}

.line-preset-options {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 90;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 14px 28px rgba(54, 45, 37, 0.16);
}

.line-preset-option {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.line-preset-option:hover,
.line-preset-option:focus-visible {
  outline: none;
  background: var(--panel-soft);
}

.line-preset-option-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.line-preset-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.line-preset-actions .btn {
  min-height: 36px;
  white-space: nowrap;
}

.line-preset-status {
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 1.45;
}

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

.line-settings-header .modal-close {
  flex: 0 0 auto;
  min-width: 72px;
  white-space: nowrap;
}

.line-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.line-settings-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
}

.line-settings-option:hover {
  border-color: var(--line-strong);
  background: #faf7f3;
}

.line-settings-option input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin: 0;
}

.line-settings-option span {
  font-size: 13px;
}

.line-column-lists {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.line-column-list-section {
  min-width: 0;
}

.line-column-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.line-column-list-header h3 {
  margin: 0;
  font-size: 14px;
}

.line-column-list-header span {
  font-size: 12px;
}

.line-column-list {
  position: relative;
  display: grid;
  gap: 6px;
  max-height: 270px;
  min-height: 50px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.46);
}

.js-line-visible-options.is-column-drop-target {
  border-color: var(--brand);
  background: rgba(180, 163, 152, 0.1);
}

.line-column-drop-indicator {
  position: absolute;
  right: 11px;
  left: 11px;
  z-index: 3;
  height: 4px;
  min-height: 4px;
  margin: 0;
  border-radius: 2px;
  background: var(--brand);
  box-shadow: 0 0 0 2px rgba(180, 163, 152, 0.14);
  transform: translateY(-50%);
  pointer-events: none;
}

.line-column-setting-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.line-column-setting-item.is-dragging {
  opacity: 0.45;
}

.line-column-setting-item.is-newly-added {
  border-color: var(--brand);
  background: rgba(180, 163, 152, 0.18);
  box-shadow: 0 0 0 2px rgba(180, 163, 152, 0.12);
}

.line-column-state {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.line-column-setting-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.line-column-setting-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.line-column-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.line-column-icon-button:hover,
.line-column-icon-button:focus-visible {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.line-column-icon-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.line-column-drag-handle {
  cursor: grab;
}

.line-column-drag-handle:active {
  cursor: grabbing;
}

.line-column-hidden-list .line-column-setting-item {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  background: var(--panel-soft);
  color: var(--muted);
}

.line-column-hidden-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 220px;
}

.line-column-hidden-list .line-column-visible-actions,
.js-line-visible-options .line-column-hidden-actions,
.js-table-visible-options .line-column-hidden-actions {
  display: none;
}

.line-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.line-settings-actions .action-row {
  margin-top: 0;
  margin-left: auto;
}

.line-settings-actions .btn {
  min-width: 72px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .line-column-hidden-list {
    grid-template-columns: 1fr;
  }

  .line-settings-header {
    flex-direction: column;
    align-items: stretch;
  }

  .line-settings-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .line-settings-actions .action-row {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .line-preset-panel {
    grid-template-columns: 1fr;
  }

  .line-preset-actions {
    justify-content: flex-start;
  }
}

.line-selection-input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.line-order-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.js-line-row {
  transition: background-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.js-line-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.js-line-row.is-selected {
  background: rgba(255, 255, 255, 0.04);
}

.js-line-row.is-drag-over {
  box-shadow: inset 0 2px 0 rgba(180, 163, 152, 0.72);
}

.js-line-row.is-line-entering {
  animation: line-row-fade-in 0.18s ease;
}

@keyframes line-row-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.line-unit-price-cell .btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.line-hidden-template {
  display: none;
}

.line-deleted-inputs {
  display: none;
}

.recent-price-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.recent-price-product {
  font-weight: 700;
}

.recent-price-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
}

.recent-price-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

.recent-price-toolbar input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

.recent-price-results tr {
  cursor: pointer;
}

.recent-price-results td.number-input {
  white-space: nowrap;
}

.recent-price-results-empty {
  padding: 18px 0 4px;
  color: var(--muted);
}

.line-order-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  transition: color 0.18s ease;
}

.drag-handle:hover {
  color: var(--brand);
}

.drag-handle:active {
  cursor: grabbing;
}

.js-line-row.is-dragging {
  opacity: 0.45;
}

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

.summary-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 14px;
}

.detail-grid > div {
  min-width: 0;
}

.detail-grid label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

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

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.metric-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.metric-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.metric-item strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.actions-card {
  position: sticky;
  top: 72px;
}

.panel-note {
  font-size: 13px;
  line-height: 1.5;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.table-actions .inline-form {
  display: inline-flex;
}

.list-status-badge,
.list-deadline {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.list-status-badge.is-neutral,
.list-deadline.is-neutral {
  background: rgba(120, 113, 108, 0.1);
  color: var(--muted);
}

.list-status-badge.is-warning,
.list-deadline.is-warning {
  background: rgba(180, 120, 30, 0.13);
  color: #8a5a12;
}

.list-status-badge.is-success {
  background: rgba(39, 130, 82, 0.12);
  color: #236d49;
}

.list-status-badge.is-danger,
.list-deadline.is-danger {
  background: rgba(177, 55, 55, 0.12);
  color: #a23434;
}

.list-summary-cell {
  min-width: 150px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted-box {
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

@media (max-width: 800px) {
  .sidebar-nav-shell {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 8px;
  }

  .sidebar-header,
  .sidebar-auth,
  body.sidebar-is-collapsed .sidebar-header,
  body.sidebar-is-collapsed .sidebar-auth {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 2px;
  }

  .sidebar-group {
    display: flex;
    gap: 6px;
    margin-top: 0;
  }

  .sidebar-group-title,
  body.sidebar-is-collapsed .sidebar-group-title {
    display: none;
  }

  .sidebar-link {
    flex: 0 0 auto;
    padding: 0 10px;
  }

  body.sidebar-is-collapsed .sidebar-nav-shell {
    width: 100%;
  }

  body.sidebar-is-collapsed .sidebar-link {
    padding: 0 10px;
  }

  body.sidebar-is-collapsed .sidebar-link-label {
    display: inline;
  }

  body.sidebar-is-collapsed .sidebar-link-initial {
    display: none;
  }

  body.has-sidebar-layout .container,
  body.sidebar-is-collapsed .container {
    width: calc(100% - 16px);
    margin: 10px auto 18px;
  }

  .container {
    width: calc(100% - 16px);
    margin: 10px auto 18px;
    padding: 14px;
    border-radius: 16px;
  }

  .page-header {
    flex-direction: column;
  }

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

  .actions-card {
    position: static;
  }

  h1 {
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .menu a {
    font-size: 13px;
    padding: 7px 10px;
  }

  .address-search-row {
    grid-template-columns: 1fr;
  }

  thead th,
  tbody td {
    padding: 10px;
  }
}
