/* 전체 레이아웃 및 타이포그래피 설정 */
:root {
  color-scheme: light;
  font-family: "Pretendard", "Segoe UI", Helvetica, Arial, sans-serif;
  background-color: #eaf3ff;
  color: #0d47a1;
  --primary: #1e88e5;
  --primary-dark: #1565c0;
  --primary-deep: #0d47a1;
  --secondary: #e3f2fd;
  --accent: #42a5f5;
  --gradient-start: #e3f2fd;
  --gradient-end: #bbdefb;
  --hero-glow: rgba(33, 150, 243, 0.25);
  --warning-bg: #fff7c2;
  --warning-border: #facc15;
  --border-color: #d1d5db;
  --shadow-elevated: 0 10px 25px rgba(15, 23, 42, 0.1);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Segoe UI", Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  color: var(--primary-deep);
}

.app-body {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
}

.app-header p {
  margin-top: 8px;
  color: #4b5563;
  line-height: 1.5;
}

.hero-banner {
  background: linear-gradient(120deg, #1565c0 0%, #1e88e5 60%, #64b5f6 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(21, 101, 192, 0.35);
  border-bottom: 4px solid rgba(255, 255, 255, 0.35);
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px;
  display: flex;
  gap: 40px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-content {
  flex: 1 1 320px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 16px;
  margin-bottom: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.hero-content h1 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.2;
  text-shadow: 0 6px 20px rgba(13, 71, 161, 0.45);
}

.hero-content p {
  margin-top: 14px;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}

.hero-highlights {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 24px 0 0;
}

.hero-highlights li {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  color: #e3f2fd;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.hero-illustration {
  position: relative;
  flex: 0 0 280px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
  box-shadow: 0 20px 50px rgba(13, 71, 161, 0.45);
}

.hero-illustration img {
  max-width: 220px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 25px rgba(13, 71, 161, 0.45));
}

.hero-badge {
  position: absolute;
  right: -10px;
  bottom: 18px;
  background: #fff;
  color: var(--primary-dark);
  padding: 12px 20px;
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(13, 71, 161, 0.25);
  text-align: right;
}

.hero-badge span {
  display: block;
  font-size: 0.75rem;
  color: #78909c;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-badge strong {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

/* 탭 UI */
.tabs {
  display: flex;
  gap: 8px;
  margin-top: 32px;
  margin-bottom: 24px;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(33, 150, 243, 0.15);
}

.tab-button {
  border: none;
  background: transparent;
  color: #6caef5;
  padding: 14px 26px;
  border-radius: 12px;
  font-size: 0.98rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tab-button.active {
  background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(33, 150, 243, 0.35);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 입력/자동화 영역 */
.automation-panel {
  display: grid;
  gap: 24px;
}

.card {
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 12px 28px rgba(15, 75, 140, 0.15);
  border: 1.5px solid rgba(66, 165, 245, 0.18);
  margin-bottom: 24px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(15, 75, 140, 0.25);
}

.card h2 {
  font-size: 1.35rem;
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: #1976d2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card h2::before {
  content: "📊";
  font-size: 1.4rem;
}

.card h3 {
  color: #1e88e5;
  margin-top: 0;
}

.input-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.input-mode-button {
  flex: 1;
  min-width: 180px;
  padding: 0.9rem 1.2rem;
  border: 2px solid #bbdefb;
  background: #f8fbff;
  color: #1565c0;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.input-mode-button.active {
  background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(33, 150, 243, 0.35);
}

.input-mode-panel {
  display: none;
}

.input-mode-panel.active {
  display: block;
  animation: fadeIn 0.35s ease;
}

.dropzone {
  border: 3px dashed rgba(66, 165, 245, 0.8);
  border-radius: 20px;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 60%, #e3f2fd 100%);
  padding: 48px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(66, 165, 245, 0.25);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.dropzone.dragover {
  border-color: #1e88e5;
  background: linear-gradient(135deg, #bbdefb 0%, #90caf9 50%, #bbdefb 100%);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 45px rgba(30, 136, 229, 0.35);
}

.dropzone-title {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.dropzone-help {
  color: #64748b;
  margin-top: 0;
  margin-bottom: 16px;
}

.dropzone button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

.dropzone-metadata {
  margin-top: 16px;
  color: #475569;
  font-size: 0.9rem;
}

.excel-dropzone-wrapper {
  margin-top: 1rem;
}

.excel-dropzone {
  border: 2px dashed rgba(99, 102, 241, 0.6);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  background: linear-gradient(120deg, rgba(236, 249, 255, 0.9), rgba(231, 235, 255, 0.9));
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.excel-dropzone.dragover {
  border-color: #4c51bf;
  box-shadow: 0 18px 32px rgba(76, 81, 191, 0.25);
  transform: translateY(-3px);
}

.excel-dropzone-icon {
  font-size: 2.75rem;
  margin-bottom: 0.35rem;
}

.excel-dropzone-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

.excel-dropzone-help {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.95rem;
}

.excel-dropzone-selected {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: #0f172a;
}

.tab-group-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tab-group-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-tabs {
  border-bottom: none;
  padding-bottom: 0.25rem;
}

.public-tabs {
  border-top: none;
  padding-top: 0.25rem;
}

.record-filter-box {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #f8fafc;
}

.record-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  align-items: end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}

.filter-field input {
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  font-size: 0.95rem;
  background: #fff;
}

.filter-field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-date-range .date-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-date-range .date-range-inputs span {
  color: #475569;
  font-size: 0.85rem;
}

.filter-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.contract-form {
  background: #fff;
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow-elevated);
}

.contract-form h2 {
  margin-top: 0;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.text-paste-area {
  width: 100%;
  min-height: 280px;
  border: 2px dashed #90caf9;
  border-radius: 12px;
  padding: 20px;
  resize: vertical;
  font-size: 0.95rem;
  line-height: 1.5;
  background: #fafdff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-paste-area:focus {
  outline: none;
  border-color: #42a5f5;
  box-shadow: 0 0 0 4px rgba(66, 165, 245, 0.2);
}

.text-parse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.text-parse-chip {
  background: #e3f2fd;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  border: 1px solid #bbdefb;
}

.text-parse-chip span {
  display: block;
  font-size: 0.75rem;
  color: #1e88e5;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.text-parse-chip strong {
  color: #0d47a1;
  font-size: 1rem;
  word-break: break-all;
}

.text-parse-table {
  overflow-x: auto;
  border: 1px solid #e3f2fd;
  border-radius: 12px;
}

.form-row label {
  font-weight: 600;
  margin-bottom: 8px;
}

.form-row input,
.form-row textarea {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.form-row input.warning,
.form-row textarea.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.info-box,
.warning-box,
.error-box {
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.info-box {
  background: #e3f2fd;
  border-left: 5px solid #2196f3;
  color: #0d47a1;
}

.warning-box {
  background: #fff9e6;
  border-left: 5px solid #ffc107;
  color: #f57c00;
}

.error-box {
  background: #fff5f5;
  border-left: 5px solid #e74c3c;
  color: #c62828;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(33, 150, 243, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(33, 150, 243, 0.45);
}

.btn-success {
  background: linear-gradient(135deg, #29b6f6 0%, #039be5 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(3, 155, 229, 0.35);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(3, 155, 229, 0.45);
}

.btn-secondary {
  background: #95a5a6;
  color: #fff;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(149, 165, 166, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(220, 38, 38, 0.45);
}

.duplicate-modal {
  position: fixed;
  inset: 0;
  background: rgba(13, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 10000;
}

.duplicate-modal.hidden {
  display: none;
}

.duplicate-modal-card {
  width: min(960px, 95vw);
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 30px 70px rgba(13, 71, 161, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.duplicate-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid #e0e7ff;
}

.duplicate-modal-header span {
  font-size: 2rem;
}

.duplicate-modal-header.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.duplicate-modal-header.warning {
  background: #fff7e5;
  color: #92400e;
}

.duplicate-modal-header.info {
  background: #e3f2fd;
  color: #0d47a1;
}

.duplicate-modal-header h3 {
  margin: 0;
}

.duplicate-modal-header p {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
}

.duplicate-modal-body {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.duplicate-modal-footer {
  padding: 1.2rem 1.75rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.duplicate-modal-message {
  margin: 0;
  font-weight: 600;
  color: #0d47a1;
}

.duplicate-modal-tip {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
}

.duplicate-modal-table-wrapper {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
}

.duplicate-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.duplicate-modal-table th {
  text-align: left;
  padding: 0.65rem;
  background: #eff6ff;
  color: #0d47a1;
  font-weight: 600;
}

.duplicate-modal-table td {
  padding: 0.65rem;
  border-top: 1px solid #e5e7eb;
}

.duplicate-modal-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.duplicate-modal-column {
  flex: 1 1 260px;
  background: #f8fbff;
  border: 1px solid #e3f2fd;
  border-radius: 1rem;
  padding: 1rem;
}

.duplicate-modal-column h4 {
  margin: 0 0 0.75rem;
  color: #1565c0;
}

.duplicate-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.duplicate-summary-table th {
  text-align: left;
  width: 40%;
  padding: 0.4rem 0.25rem;
  color: #5c6b8a;
  font-weight: 600;
}

.duplicate-summary-table td {
  padding: 0.4rem 0.25rem;
  color: #0f172a;
  font-weight: 600;
}

.duplicate-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #fde68a;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 700;
}

.duplicate-badge--danger {
  background: #fecaca;
  color: #7f1d1d;
}

.duplicate-badge--warning {
  background: #fef3c7;
  color: #92400e;
}

.duplicate-modal-table tbody tr.match-active {
  background: #fdf4d0;
}

.duplicate-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.duplicate-compare-table th,
.duplicate-compare-table td {
  border: 1px solid #e5e7eb;
  padding: 0.6rem 0.75rem;
  vertical-align: top;
}

.duplicate-compare-table tr.diff td {
  background: #fef2f2;
}

.duplicate-compare-json {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.duplicate-compare-json pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 0.75rem;
  border-radius: 0.75rem;
  max-height: 220px;
  overflow: auto;
  font-size: 0.8rem;
}

.warning-cell {
  background: #ffebee !important;
  border: 2px solid #e74c3c !important;
  box-shadow: inset 0 0 8px rgba(231, 76, 60, 0.3);
  animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
  0%,
  100% {
    background: #ffebee;
  }
  50% {
    background: #ffcdd2;
  }
}

.field-feedback {
  color: #ef4444;
  font-size: 0.85rem;
  min-height: 18px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.form-actions .primary {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease;
}

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

.form-actions .secondary {
  border: 1px solid var(--border-color);
  background: #fff;
  color: #1f2933;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.form-actions .secondary:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

/* 조회/확인 테이블 */
.table-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-elevated);
  padding: 24px;
  border: 1px solid rgba(33, 150, 243, 0.1);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.table-actions {
  display: flex;
  gap: 12px;
}

.table-actions button {
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
}

.table-actions .primary {
  border: none;
  background: var(--primary);
  color: #fff;
}

.table-actions .secondary {
  border: 1px solid var(--border-color);
  background: #fff;
  color: #1f2933;
}

.table-help {
  color: #4b5563;
  margin-bottom: 16px;
}

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

thead {
  background: linear-gradient(180deg, #42a5f5 0%, #2196f3 100%);
  color: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 0.95rem;
}

tbody tr:hover {
  background: #f8fafc;
}

table th {
  position: sticky;
  top: 0;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 3px solid #1976d2;
  box-shadow: 0 4px 8px rgba(33, 150, 243, 0.2);
}

table td {
  white-space: nowrap;
}

table tr:hover {
  background: linear-gradient(90deg, #e3f2fd 0%, #ffffff 100%);
}

td[contenteditable="true"] {
  cursor: text;
}

.save-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.save-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 반응형 대응 */
@media (max-width: 768px) {
  .app-shell {
    padding: 24px 16px 60px;
  }

  .contract-form {
    padding: 24px;
  }

  th,
  td {
    font-size: 0.85rem;
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 2rem;
}

.dashboard-panel {
  background: #fefefe;
  border-radius: 16px;
  border: 1px solid #e3f2fd;
  padding: 1.5rem;
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.08);
}

.dashboard-panel h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #1565c0;
  font-size: 1.3rem;
}

.chart-container {
  position: relative;
  height: 350px;
  margin-bottom: 1.5rem;
}

.chart-legend {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 4px;
  transition: background 0.2s;
}

.chart-legend-item:hover {
  background: #f0f0f0;
}

.chart-legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.chart-legend-label {
  flex: 1;
  font-size: 0.9rem;
  word-break: break-word;
  line-height: 1.4;
}

.chart-legend-value {
  font-weight: 600;
  color: #1565c0;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
  color: white;
  box-shadow: 0 6px 16px rgba(30, 136, 229, 0.25);
}

.stat-card span {
  font-size: 0.9rem;
  opacity: 0.85;
}

.stat-card strong {
  font-size: 1.4rem;
}

.excel-upload-status {
  margin-top: 0.75rem;
}

.excel-failure-list {
  margin-top: 0.5rem;
  background: #fff5f5;
  border-left: 4px solid #e74c3c;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  max-height: 160px;
  overflow-y: auto;
}

/* ============================================================================
   인증 및 역할 기반 UI
   ============================================================================ */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #f8faff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.admin-toolbar__status {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-toolbar__description {
  margin: 0;
  font-size: 0.95rem;
  color: #4b5563;
}

.admin-toolbar__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.admin-role-chip.role-viewer {
  background: #e5e7eb;
  color: #374151;
}

.admin-role-chip.role-sub_admin {
  background: #dcfce7;
  color: #166534;
}

.admin-role-chip.role-main_admin {
  background: #fde68a;
  color: #92400e;
}

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5f5;
  color: #1d4ed8;
}

.btn-outline:hover {
  border-color: #93c5fd;
  color: #1e40af;
}

.role-lock-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px dashed #bfdbfe;
  border-radius: 0.85rem;
  background: #ebf2ff;
}

.role-lock-banner__title {
  margin: 0 0 0.35rem 0;
  font-weight: 600;
  color: #1e3a8a;
}

.role-lock-banner__text {
  margin: 0;
  color: #3b4a75;
  font-size: 0.95rem;
}

.role-locked {
  opacity: 0.5;
  pointer-events: none;
}

.global-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.global-nav__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.nav-pill {
  border: 1px solid #dbeafe;
  background: #f8fbff;
  color: #1e3a8a;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-pill.active,
.nav-pill:hover {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 5px 15px rgba(37, 99, 235, 0.25);
}

.nav-pill--admin {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.nav-pill--admin:hover,
.nav-pill--admin.active {
  border-color: #f59e0b;
  background: #f59e0b;
  color: #fff7ed;
}

.nav-pill--locked,
.nav-pill--locked:hover {
  opacity: 0.55;
  border-style: dashed;
  background: #f8fbff;
  color: #94a3b8;
  box-shadow: none;
}

.admin-key-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.65);
  z-index: 2000;
  padding: 1rem;
}

.admin-key-modal.hidden {
  display: none;
}

.admin-key-modal__card {
  background: #ffffff;
  border-radius: 1.25rem;
  width: min(420px, 100%);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.18);
  position: relative;
}

.admin-key-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
}

.admin-key-modal__body {
  padding: 1.75rem 1.5rem 1.5rem;
}

.admin-key-modal__body h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #0f172a;
}

.admin-key-modal__body p {
  font-size: 0.95rem;
  color: #475569;
  margin: 0.5rem 0 1rem;
}

.admin-key-modal__form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.admin-key-modal__input {
  width: 100%;
  border: 1px solid #dbeafe;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.admin-key-modal__message {
  min-height: 1.25rem;
  margin: 0;
  font-size: 0.9rem;
  color: #dc2626;
}

.admin-key-modal__message[data-tone='success'] {
  color: #059669;
}

.admin-key-modal__message[data-tone='info'] {
  color: #2563eb;
}

.admin-key-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.backup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.backup-panel {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem;
  background: #fbfcff;
}

.backup-panel h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.backup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}

.backup-list li {
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.backup-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.backup-list__empty {
  text-align: center;
  color: #94a3b8;
  border-style: dashed;
}

.backup-input {
  width: 100%;
  border: 1px dashed #f59e0b;
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.95rem;
}

.backup-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #b45309;
}

.backup-notice {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-weight: 500;
}
