/* V0.8.2.1 UI Polish */

/* 기본 구버전 화면(head/form/table)을 ERP 카드 UI로 보정 */
.erp-content {
  max-width: 1320px;
  margin: 0 auto;
}

.head,
.form,
.box,
.detail-card,
.form-card,
.page-header,
.table-card {
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045);
}

.head h1,
.page-header h1 {
  margin: 0 0 8px;
  color: #1f3a5f;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 900;
}

.head p,
.page-header p {
  margin: 0;
  color: #667085;
  font-weight: 700;
  line-height: 1.5;
}

.head.row,
.page-header.row-between,
.row-between,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.btn,
.primary-link,
.secondary-link,
.small-btn,
.primary-btn,
button {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 900;
  font-family: inherit;
  min-height: 38px;
  cursor: pointer;
}

.primary-link,
.primary-btn {
  background: #1f3a5f;
  color: #ffffff;
  border: 1px solid #1f3a5f;
  text-decoration: none;
}

.secondary-link,
.small-btn,
.btn {
  background: #eef2f7;
  color: #344054;
  border: 1px solid #d9e1ec;
  text-decoration: none;
}

.form,
.form-card {
  max-width: 1180px;
}

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

label {
  display: block;
  margin: 12px 0 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid #cfd8e3;
  border-radius: 10px;
  background: #ffffff;
  color: #202939;
  font-family: inherit;
  font-size: 14px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #6a1b9a;
  box-shadow: 0 0 0 3px rgba(106, 27, 154, .12);
}

.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.check-line,
.permission-line {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.check-line label,
.permission-check,
.check-single {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  white-space: nowrap;
}

.check-line input,
.permission-check input,
.check-single input {
  width: auto;
  min-height: auto;
}

.permission-box,
.permission-box-compact {
  margin-top: 18px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #e6edf5;
  border-radius: 14px;
}

.permission-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.permission-title-row h2,
.permission-box h2 {
  margin: 0;
  color: #1f3a5f;
  font-size: 18px;
  font-weight: 900;
}

.permission-title-row p,
.permission-box p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}

.permission-check {
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: 999px;
  font-weight: 900;
}

/* Raw table도 카드처럼 */
.erp-content > table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045);
  margin-bottom: 18px;
}

.table-card table {
  border: none;
  box-shadow: none;
  margin-bottom: 0;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* 사이드바 메인 항목별 얇은 구분선 */
.erp-sidebar-group {
  position: relative;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.erp-sidebar-group:not(:last-child)::after {
  content: "";
  display: block;
  height: 1px;
  margin: 10px 12px 0;
  background: rgba(255, 255, 255, 0.12);
}

.erp-sidebar a.active {
  background: #40516b !important;
  color: #ffffff !important;
  box-shadow: inset 4px 0 0 #ffffff;
}

.erp-footer {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1000px) {
  .head.row,
  .page-header.row-between,
  .row-between,
  .row,
  .permission-title-row {
    display: block;
  }

  .inline-actions {
    margin-top: 12px;
  }

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

  .erp-content {
    max-width: 100%;
  }
}
