.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 100%;
  height: 5px;
  overflow: hidden;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-bar.is-visible {
  opacity: 1;
}

.loading-bar::before {
  display: block;
  width: 45%;
  height: 100%;
  background: var(--primary);
  content: '';
  animation: loading-slide 1s ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(230%);
  }
}

.panel {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.08);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 22px;
  border: 1px solid var(--primary);
  border-radius: 3px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
}

.button:hover,
button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--secondary);
  color: #1d1f21;
}

.secondary-button:hover {
  border-color: var(--input-border);
  background: var(--secondary-hover);
  color: var(--text);
}

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

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

.button-full {
  width: 100%;
}

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

.panel > h2,
.section-heading h2 {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.section-heading .button-row button {
  min-height: 30px;
  padding: 5px 18px;
  font-size: 12px;
}

.list-count-text {
  margin-left: 8px;
  color: #8a8d93;
  font-size: 11px;
  font-weight: 400;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.table-toolbar select {
  width: auto;
  min-height: 24px;
  padding: 2px 20px 2px 6px;
  border-radius: 0;
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--modal-backdrop);
}

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

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  padding: 20px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f3f3f3;
  color: var(--text);
  box-shadow: 0 12px 38px var(--shadow);
}

.modal h2 {
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.modal-form label {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.modal-form input {
  min-height: 32px;
  border-radius: 0;
  font-size: 12px;
}

.modal-form-actions {
  margin-top: 8px;
}

.customer-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
  border: 1px solid #999999;
  background: #ffffff;
}

.customer-list.table-list {
  display: block;
  border: 0;
  background: transparent;
}

.table-wrap {
  width: 100%;
  margin-top: 6px;
  overflow-x: auto;
  border: 1px solid #999999;
  background: var(--surface);
}

.crm-data-table {
  min-width: 1080px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 6px 7px;
  border: 1px solid #999999;
  text-align: center;
  vertical-align: top;
  white-space: nowrap;
  font-size: 11px;
}

th {
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

td {
  line-height: 1.25;
}

tbody tr:nth-child(odd) {
  background: #f2f2f2;
}

tbody tr:hover {
  background: #eeeeee;
}

.table-action-button {
  min-height: 22px;
  margin: 0 2px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.table-cell-button {
  width: 100%;
  min-height: 20px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #3746ab;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 2px;
}

.table-cell-button:hover {
  background: rgba(55, 147, 146, 0.08);
  color: var(--primary);
}

.table-checkbox {
  width: 16px;
  min-height: 16px;
  accent-color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
}

.badge-success {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 193, 7, 0.14);
  color: #9a7200;
}

.badge-danger {
  background: rgba(212, 100, 115, 0.12);
  color: var(--danger);
}

.memo-cell {
  min-width: 180px;
  max-width: 340px;
  white-space: normal;
}

.memo-preview-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  width: 100%;
  padding: 30px;
  border: 1px solid #dddddd;
  background: #ffffff;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.status-edit-button {
  min-height: 22px;
  padding: 2px 8px;
  width: 100%;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #6c757d;
  color: #ffffff;
  font-size: 11px;
}

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

.modal-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.modal-choice-button {
  min-height: 34px;
}

.detail-form-panel {
  padding: 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.08);
}

.detail-form-panel h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 12px;
}

.detail-form-body {
  display: grid;
  gap: 8px;
}

.detail-form-body label {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-form-body label span {
  display: block;
  margin-bottom: 4px;
}

.detail-form-body input,
.detail-form-body textarea {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.detail-form-body textarea {
  min-height: 140px;
  resize: vertical;
}

.detail-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.detail-save-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.detail-save-row button {
  min-width: 110px;
}

.settings-grid {
  align-items: start;
}

.settings-panel {
  min-height: 260px;
}

.settings-form {
  display: grid;
  gap: 8px;
}

.settings-form label {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-form input,
.settings-form textarea {
  min-height: 32px;
  border-radius: 0;
  font-size: 12px;
}

.settings-form textarea {
  min-height: 260px;
  resize: vertical;
}

.settings-form button {
  justify-self: start;
  margin-top: 6px;
}

.salesman-detail-shell {
  max-width: 760px;
  margin-left: 4px;
}

.salesman-detail-shell .detail-form-panel {
  padding: 18px 22px;
}

.salesman-detail-shell .settings-form input {
  min-height: 32px;
  border-radius: 0;
}

.salesman-detail-shell .detail-save-row {
  justify-content: center;
}

.detail-card {
  border: 1px solid #999999;
  background: #ffffff;
}

.detail-card h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #999999;
  color: var(--primary);
  font-size: 12px;
}

.detail-card dl {
  margin: 0;
}

.detail-card dl > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  border-bottom: 1px solid var(--border);
}

.detail-card dl > div:last-child {
  border-bottom: 0;
}

.detail-card dt,
.detail-card dd {
  min-height: 38px;
  margin: 0;
  padding: 9px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-card dt {
  border-right: 1px solid var(--border);
  background: #f2f2f2;
  color: var(--text-muted);
  font-weight: 700;
}

@media (max-width: 780px) {
  .section-heading {
    display: block;
  }

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

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

  .detail-two-column {
    grid-template-columns: 1fr;
  }
}
