/* =====================================================
   Client Contract Manager - Main Stylesheet
   Color Scheme: Navy #1a3a5c, Teal #00a8b5, White
   ===================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #1a3a5c;
  --navy-dark: #122840;
  --navy-light: #254d78;
  --teal: #00a8b5;
  --teal-dark: #0090a0;
  --teal-light: #e0f7fa;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #2980b9;
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --border-radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --transition: 0.25s ease;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', 'Noto Sans KR', Arial, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  overflow: hidden;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ===================== SIDEBAR ===================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  max-height: -webkit-fill-available;
  max-height: 100dvh;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
}

.mobile-sidebar-backdrop {
  display: none;
}

.mobile-sidebar-backdrop[hidden] {
  display: none !important;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 20px;
  color: var(--teal);
}

.logo-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin: 2px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--border-radius);
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
}

.nav-link.active {
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,168,181,0.4);
}

.nav-icon {
  font-size: 10px;
  opacity: 0.7;
}

.nav-link.active .nav-icon {
  opacity: 1;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
  overflow: hidden;
}

.main-content.expanded {
  margin-left: 0;
}

/* ===================== TOPBAR ===================== */
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-600);
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--gray-100);
  color: var(--navy);
}

.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-date {
  font-size: 13px;
  color: var(--gray-500);
}

.auto-save-label {
  font-size: 11px;
  color: var(--gray-400);
}

/* ── Sync indicator ── */
.sync-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.sync-online  { background: #22c55e; box-shadow: 0 0 4px #22c55e80; }
.sync-offline { background: var(--gray-300); }

/* ── Online users ── */
.online-users {
  display: flex; gap: 4px;
}
.online-user {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
}

/* ── User badge ── */
.user-badge {
  font-size: 13px; font-weight: 600;
  color: var(--navy);
  padding: 2px 8px;
  background: var(--gray-100);
  border-radius: 4px;
}
.user-role-badge {
  font-size: 10px;
  color: var(--gray-500);
  padding: 1px 6px;
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  text-transform: uppercase;
}

/* ===================== CONTENT SECTIONS ===================== */
.content-section {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

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

/* 계약관리 탭: flex 레이아웃으로 sticky header 지원 */
#section-contracts.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#contractsContainer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ===================== DASHBOARD ===================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dashboard-row .card-body.p0 {
  max-height: 400px;
  overflow-y: auto;
}

/* ===================== CARDS ===================== */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: auto;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.card-body {
  padding: 14px 16px;
}

.card-body.p0 {
  padding: 0;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.2;
}

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

.btn-primary {
  background: var(--teal);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--teal-dark);
  box-shadow: 0 2px 8px rgba(0,168,181,0.35);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-300);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

.btn-warning {
  background: var(--warning);
  color: var(--white);
}

.btn-warning:hover:not(:disabled) {
  background: #d68910;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.85);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.7);
  color: var(--white);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
  font-size: 14px;
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--navy);
}

/* ===================== FORMS ===================== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,168,181,0.12);
}

.form-control[readonly] {
  background: var(--gray-100);
  cursor: default;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Date input - 달력 아이콘 강조 */
input[type="date"].form-control {
  cursor: pointer;
  position: relative;
}
input[type="date"].form-control::-webkit-calendar-picker-indicator {
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
  padding: 2px;
}
input[type="date"].form-control::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

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

.form-hint {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 4px;
  display: block;
}

.required {
  color: var(--danger);
}

.checkbox-inline {
  padding-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-inline label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-700);
  margin: 0;
}

/* ===================== TABLES ===================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 11px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-200);
}

.data-table th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--gray-600);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--teal-light);
}

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

.data-table tr.clickable {
  cursor: pointer;
}

/* 상세 행을 열어도 상위 표의 열 폭이 재계산되지 않도록 고정 */
.stable-detail-table {
  table-layout: fixed;
}

.stable-detail-table > thead > tr > th,
.stable-detail-table > tbody > tr:not(.stl-detail-row) > td,
.stable-detail-table > tfoot > tr > td {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.stable-detail-table > tbody > tr:not(.stl-detail-row) > td {
  white-space: nowrap;
}

.stable-detail-table > tbody > tr.stl-detail-row > td {
  overflow: visible;
  white-space: normal;
}

.stable-detail-table .amount-neutral,
.stable-detail-table .amount-positive,
.stable-detail-table .amount-negative {
  white-space: nowrap;
}

.stable-detail-table > tbody > tr:not(.stl-detail-row) > td[data-action-stop] {
  overflow: visible;
}

/* ===================== TOOLBAR / FILTERS ===================== */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.toolbar-right {
  display: flex;
  gap: 8px;
}

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

.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--teal);
}

.search-input {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  outline: none;
  width: 200px;
  transition: border-color var(--transition);
}

.search-input:focus {
  border-color: var(--teal);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
  white-space: nowrap;
}

/* ===================== FILTER CHECKBOX PANELS ============ */
.filter-checkbox-group {
  position: relative;
  display: inline-block;
}

.filter-checkbox-label {
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  background: var(--white);
  white-space: nowrap;
  user-select: none;
}

.filter-checkbox-label:hover {
  border-color: var(--teal);
}

.filter-checkbox-label.has-selection {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--navy);
  font-weight: 600;
}

.filter-checkbox-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 8px 0;
  min-width: 180px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
}

.filter-checkbox-panel label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
}

.filter-checkbox-panel label:hover {
  background: var(--gray-50);
}
.filter-select-all-row {
  display: flex;
  gap: 8px;
  padding: 2px 0 6px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 4px;
  font-size: 11px;
}
.filter-select-all-row a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.filter-select-all-row a:hover {
  text-decoration: underline;
}

/* ===================== CONTEXT MENU ===================== */
.contract-context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 4px 0;
  min-width: 140px;
}

.contract-context-menu .ctx-item {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
}

.contract-context-menu .ctx-item:hover {
  background: var(--teal-light);
  color: var(--navy);
}

.contract-context-menu .ctx-separator {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

.contract-context-menu .ctx-item-danger {
  color: var(--danger);
}

.contract-context-menu .ctx-item-danger:hover {
  background: #ffeaea;
  color: #c0392b;
}

/* ===================== MULTI-SELECT ===================== */
.data-table tbody tr.row-selected {
  background: #e0f2fe !important;
}
.data-table tbody tr.row-selected:hover {
  background: #bae6fd !important;
}

/* ===================== STATUS BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-before-upload {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.badge-after-upload {
  background: #d4edda;
  color: #155724;
  border: 1px solid #28a745;
}

.badge-annual-fee {
  background: #cce5ff;
  color: #004085;
  border: 1px solid #007bff;
}

.badge-cancelled {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #dc3545;
}

.badge-completed {
  background: var(--gray-200);
  color: var(--gray-600);
  border: 1px solid var(--gray-400);
}

/* ===================== CONTRACT GROUPS ===================== */
.channel-group {
  margin-bottom: 20px;
}

.channel-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--navy);
  color: var(--white);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  cursor: pointer;
}

.channel-group-header:hover {
  background: var(--navy-light);
}

.channel-group-name {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.channel-group-count {
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 12px;
}

.channel-group-toggle {
  font-size: 12px;
  opacity: 0.7;
  transition: transform var(--transition);
}

.channel-group.collapsed .channel-group-toggle {
  transform: rotate(-90deg);
}

.channel-group-body {
  overflow: hidden;
}

.channel-group.collapsed .channel-group-body {
  display: none;
}

.channel-group .data-table th:first-child {
  border-top-left-radius: 0;
}

/* ===================== MODALS ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.25s ease;
}

.modal-lg {
  max-width: 720px;
}

.modal-sm {
  max-width: 380px;
}

@keyframes modalIn {
  from { transform: scale(0.94) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gray-500);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ===================== CONTRACT DETAIL ===================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 28px;
  margin-bottom: 20px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-field .field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-field .field-value {
  font-size: 14px;
  color: var(--gray-800);
  font-weight: 500;
  line-height: 1.5;
}

.detail-field .field-value.amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.detail-divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 22px 0;
}

.detail-notes {
  background: var(--gray-50);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  color: var(--gray-700);
  min-height: 60px;
  white-space: pre-wrap;
}

/* ===================== SETTINGS ===================== */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  height: calc(100vh - var(--topbar-height) - 48px);
}

.settings-sidebar {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow-y: auto;
  padding: 16px 12px;
}

.settings-sidebar h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  font-weight: 700;
  margin-bottom: 10px;
  padding: 0 8px;
}

.settings-client-list {
  list-style: none;
}

.settings-client-list li {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
  transition: all var(--transition);
  margin-bottom: 2px;
}

.settings-client-list li:hover {
  background: var(--teal-light);
  color: var(--navy);
}

.settings-client-list li.active {
  background: var(--teal);
  color: var(--white);
  font-weight: 600;
}

.settings-main {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow-y: auto;
  padding: 18px;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--teal);
  display: inline-block;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--navy);
  color: var(--white);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.tag-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: color var(--transition);
}

.tag-remove:hover {
  color: var(--white);
}

.tag-input-row {
  display: flex;
  gap: 8px;
}

.tag-input-row .form-control {
  flex: 1;
}

/* ===================== PIN PROMPT ===================== */
.pin-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  text-align: center;
}

.pin-icon {
  font-size: 40px;
  margin-bottom: 4px;
}

.pin-input {
  text-align: center;
  font-size: 18px;
  letter-spacing: 4px;
  max-width: 200px;
}

.error-msg {
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

/* ===================== HISTORY ===================== */
.history-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--teal);
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.history-summary-card {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  border: 1px solid var(--gray-200);
}

.history-summary-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
}

.history-summary-label {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 3px;
}

/* ===================== EMPTY STATE ===================== */
.empty-msg {
  color: var(--gray-500);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--gray-400);
  font-size: 14px;
}

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--gray-800);
  color: var(--white);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  max-width: 320px;
  border-left: 4px solid var(--teal);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

@keyframes toastIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100px); opacity: 0; }
}

.toast.hiding {
  animation: toastOut 0.3s ease forwards;
}

/* ===================== AMOUNT DISPLAY ===================== */
.amount-positive { color: var(--success); font-weight: 700; font-size: 12px; }
.amount-negative { color: var(--danger); font-weight: 700; font-size: 12px; }
.amount-neutral { color: var(--navy); font-weight: 700; font-size: 12px; }

/* ===================== UTILITY ===================== */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12px; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.center { text-align: center; padding: 40px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body.mobile-menu-open {
    overflow: hidden;
  }

  .sidebar {
    width: min(86vw, var(--sidebar-width));
    max-width: 320px;
    height: -webkit-fill-available;
    height: 100dvh;
    max-height: -webkit-fill-available;
    max-height: 100dvh;
    transform: translateX(calc(-1 * var(--sidebar-width)));
    z-index: 220;
    overflow: hidden;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .mobile-sidebar-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(18, 40, 64, 0.44);
    backdrop-filter: blur(1px);
    z-index: 190;
  }
  .main-content {
    margin-left: 0;
  }
  .topbar {
    height: 56px;
    padding: 0 10px;
    gap: 8px;
  }
  .sidebar-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--gray-200);
    background: var(--white);
  }
  .page-title {
    min-width: 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-actions {
    gap: 6px;
    min-width: 0;
  }
  .online-users,
  .auto-save-label {
    display: none;
  }
  .user-badge {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-role-badge {
    flex-shrink: 0;
  }
  .content-section {
    padding: 10px;
  }
  .section-toolbar {
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }
  .toolbar-left,
  .toolbar-right,
  .filter-group {
    width: 100%;
  }
  .toolbar-left,
  .filter-group {
    align-items: stretch;
  }
  .toolbar-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .search-input,
  .filter-select,
  .form-control,
  .filter-checkbox-label {
    min-height: 40px;
  }
  .filter-checkbox-label {
    display: inline-flex;
    align-items: center;
  }
  .search-input,
  .filter-select {
    flex: 1 1 150px;
  }
  .filter-checkbox-group {
    position: relative;
  }
  .filter-checkbox-panel {
    max-width: calc(100vw - 24px);
    min-width: min(220px, calc(100vw - 24px));
    z-index: 240;
  }
  .btn {
    min-height: 40px;
    padding: 9px 12px;
  }
  .btn-sm,
  .btn-xs,
  .btn-icon {
    min-width: 40px;
    min-height: 40px;
  }
  .card,
  .card-body.p0 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 760px;
  }
  .stable-detail-table {
    table-layout: fixed;
  }
  .contracts-card,
  .settlement-card {
    max-width: 100%;
  }
  .contracts-scroll-wrapper,
  .settlement-scroll-wrapper {
    max-height: calc(100dvh - 56px - 118px);
    -webkit-overflow-scrolling: touch;
  }
  .contracts-table {
    min-width: 1180px;
  }
  .settlement-table {
    min-width: 980px;
  }
  .contracts-summary-bar {
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .modal {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    margin: 10px 0;
  }
  .modal-header,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
  .modal-body {
    padding: 14px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
  .settings-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .history-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding-right: 8px;
  }
  .current-date {
    display: none;
  }
  .user-badge {
    max-width: 72px;
  }
  .content-section {
    padding: 8px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .modal-footer {
    justify-content: stretch;
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 120px;
  }
}

/* ===================== PAYMENT TYPE TOGGLE ===================== */
.payment-calc-note {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ===================== CONTRACT TABLE TOTALS ===================== */
.totals-row td {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
}

.totals-row td:first-child {
  border-radius: 0 0 0 var(--border-radius);
}

.totals-row td:last-child {
  border-radius: 0 0 var(--border-radius) 0;
}



/* ===================== CHANNEL MONTHLY SETTLEMENT SUMMARY ===================== */
.channel-month-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}
.channel-month-navigator {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.channel-month-arrow {
  min-width: 36px;
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  background: #fff;
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.channel-month-arrow:hover:not(:disabled) {
  background: var(--gray-100);
}
.channel-month-arrow:disabled {
  color: var(--gray-300);
  cursor: not-allowed;
}
.channel-month-label {
  min-width: 112px;
  padding: 0 12px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.channel-month-group {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}
.channel-month-group + .channel-month-group {
  border-top: 2px solid var(--gray-300);
}
.channel-month-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px 8px;
  color: var(--gray-900);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}
.channel-month-summary strong {
  color: var(--navy);
  font-size: 13px;
  margin-right: 4px;
}
.channel-month-summary span {
  color: var(--gray-900);
  font-size: 12px;
  font-weight: 700;
}
.channel-month-summary .amount-paid {
  color: #166534;
}
.channel-month-summary .amount-unpaid {
  color: #991b1b;
}
.channel-type-badge {
  display: inline-block;
  min-width: 46px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.channel-type-production {
  color: #075985;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
}
.channel-type-rs {
  color: #6d28d9;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
}

/* ===================== STAT ROW ===================== */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f4f8;
}

/* ===================== SETTLEMENT ===================== */
.settlement-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.stl-card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  border-top: 2px solid var(--teal);
}

.stl-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 2px;
}

.stl-label {
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 600;
}

.settlement-card {
  overflow: hidden !important;
}

.settlement-scroll-wrapper {
  max-height: calc(100vh - var(--topbar-height) - 140px);
  min-height: 320px;
  overflow: auto;
  position: relative;
}

.settlement-table {
  border-collapse: separate;
  border-spacing: 0;
}

.settlement-table th,
.settlement-table td {
  padding: 7px 10px;
}

.settlement-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-300);
  box-shadow: 0 1px 0 var(--gray-200);
}

.settlement-table tfoot .totals-row td {
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
.settlement-table tfoot .totals-row td.amount-neutral {
  color: #93c5fd;
}
.settlement-table tfoot .totals-row td.amount-positive {
  color: #86efac;
}
.settlement-table tfoot .totals-row td.amount-negative {
  color: #fca5a5;
}

.monthly-settlement-table .monthly-settlement-item {
  font-weight: 800;
  color: var(--navy);
  vertical-align: middle;
  background: #f8fafc;
  border-right: 1px solid var(--gray-200);
}

.monthly-settlement-table .monthly-settlement-category {
  font-weight: 700;
  color: var(--gray-800);
}

.monthly-settlement-table .monthly-settlement-rs td {
  border-top: 1px solid var(--gray-200);
}

/* Settlement expandable rows */
.stl-expandable {
  cursor: pointer;
}
.stl-expandable:hover td {
  background: var(--gray-100);
}
.stl-detail-row td {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-300);
}
.stl-detail-row .data-table {
  border-left: 3px solid var(--gray-300);
  table-layout: fixed;
  width: 100%;
}
.stl-detail-row .data-table th {
  background: var(--gray-100);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stl-detail-row .data-table td {
  font-size: 12px;
  padding: 8px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================== SORTABLE COLUMN HEADERS ===================== */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.data-table th.sortable:hover {
  background: var(--gray-200);
}
.sort-arrow {
  font-size: 10px;
  color: var(--gray-400);
  margin-left: 3px;
}
.sort-arrow.active {
  color: var(--teal);
}

/* ===================== CONTRACTS SUMMARY BAR ===================== */
.contracts-summary-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  font-size: 11.5px;
  color: var(--gray-700);
  flex-shrink: 0;
}
.contracts-summary-bar + .contracts-card {
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ===================== CONTRACTS TABLE (계약관리 탭 전용) ===================== */
.contracts-table {
  border-collapse: separate;
  border-spacing: 0;
}
.contracts-table thead {
  position: sticky;
  top: 0;
  z-index: 12;
}
.contracts-table thead th {
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-300);
  padding: 4px 6px;
  font-size: 10px;
  white-space: nowrap;
  line-height: 1.3;
}
.contracts-table td {
  padding: 3px 6px;
  font-size: 11px;
  white-space: nowrap;
}

/* ===================== PAID ROW (입금 후) - 진행완료 표시를 기존보다 약 20% 더 진하게 ===================== */
.data-table tbody tr.row-paid {
  background: var(--gray-200);
  opacity: 0.62;
}
.data-table tbody tr.row-paid:hover {
  opacity: 0.86;
  background: var(--gray-300);
}
.data-table tbody tr.row-paid td {
  color: var(--gray-600);
}

/* ===================== ACTIVE ROW (입금 전) - 눈에 잘 띄게 ===================== */
.data-table tbody tr.row-active {
  background: var(--white);
}
.data-table tbody tr.row-active:hover {
  background: var(--teal-light);
}

/* ===================== INVOICE PENDING (계산서 미발행) ===================== */

/* ===================== COLUMN RESIZE HANDLE ===================== */
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 14;
}
.col-resize-handle:hover,
.contracts-table thead th.resizing .col-resize-handle {
  background: var(--teal);
  opacity: 0.5;
}
.contracts-table thead th.resizing {
  user-select: none;
}

/* ===================== SORTABLE HEADERS ===================== */
.sortable-th {
  cursor: pointer;
  user-select: none;
}
.sortable-th:hover {
  background: var(--gray-200) !important;
}
.sortable-th.sorted {
  background: var(--teal-light) !important;
  color: var(--navy);
}
.sort-icon {
  font-size: 9px;
  color: var(--gray-400);
  margin-left: 2px;
}
.sort-icon.active {
  color: var(--teal);
}

/* ===================== CONTRACTS TABLE CELL OVERFLOW ===================== */
.contracts-table td {
  overflow: hidden;
}

/* ===================== COLUMN GROUP HEADERS (플랫폼/채널 구분) ===================== */
.contracts-table thead th.col-group-platform {
  background: #e0f2fe;
}
.contracts-table thead th.col-group-channel {
  background: #fce4ec;
}
.contracts-table thead th.col-group-platform.sorted {
  background: #bae6fd !important;
}
.contracts-table thead th.col-group-channel.sorted {
  background: #f8bbd0 !important;
}
.col-group-separator-th,
.col-group-separator-td {
  border-left: 3px solid var(--gray-400) !important;
}

/* ===================== HEADER CONTEXT MENU ===================== */
.header-context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  padding: 4px 0;
}
.header-context-menu .ctx-item {
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.header-context-menu .ctx-item:hover {
  background: var(--gray-100);
}
.header-context-menu .ctx-separator {
  border-top: 1px solid var(--gray-200);
  margin: 4px 0;
}
.header-context-menu .ctx-item.ctx-group-platform {
  color: #0284c7;
}
.header-context-menu .ctx-item.ctx-group-channel {
  color: #db2777;
}

/* ===================== VERTICAL BORDERS (계약관리 테이블) ===================== */
.contracts-table th,
.contracts-table td {
  border-right: 1px solid var(--gray-100);
}
.contracts-table th:last-child,
.contracts-table td:last-child {
  border-right: none;
}

/* ===================== PLATFORM CHECKBOX GROUP ===================== */
.platform-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: var(--white);
  max-height: 100px;
  overflow-y: auto;
}
.platform-checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.platform-checkbox-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* ===================== INLINE STATUS DROPDOWN ===================== */
.inline-status-select {
  padding: 2px 4px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  width: 100%;
  min-width: 55px;
  box-sizing: border-box;
}
.inline-status-before_payment {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}
.inline-status-after_payment {
  background: #d4edda;
  color: #155724;
  border-color: #28a745;
}
.inline-status-cancelled {
  background: #f8d7da;
  color: #721c24;
  border-color: #dc3545;
}
.inline-progress-not_started {
  background: var(--gray-200);
  color: var(--gray-600);
  border-color: var(--gray-400);
}
.inline-progress-in_progress {
  background: #cce5ff;
  color: #004085;
  border-color: #007bff;
}
.inline-progress-completed {
  background: #d4edda;
  color: #155724;
  border-color: #28a745;
}
.inline-invoice-before_invoice {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}
.inline-invoice-after_invoice {
  background: #d4edda;
  color: #155724;
  border-color: #28a745;
}
.inline-invoice-production_only {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}
.inline-invoice-rs_only {
  background: #d1ecf1;
  color: #0c5460;
  border-color: #17a2b8;
}
.inline-settlement-pending,
.settlement-status-pending {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}
.inline-settlement-paid,
.settlement-status-paid {
  background: #d4edda;
  color: #155724;
  border-color: #28a745;
}
.settlement-status-badge {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}
.settlement-summary-item {
  display: inline-block;
  margin: 1px 0;
}
.settlement-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
}

/* ── Invoice Request List ─────────────── */
.invoice-req-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
}
.invoice-req-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}
.invoice-req-item:last-child { border-bottom: none; }
.invoice-req-item:hover { background: var(--gray-50); }

/* ===================== INLINE DATE INPUT ===================== */
/* ===================== INVOICE DATE ROW (dual-line) ============== */
.invoice-date-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}
.invoice-date-row:last-child {
  margin-bottom: 0;
}
.invoice-date-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--navy);
  min-width: 28px;
  flex-shrink: 0;
  text-align: right;
}
.invoice-date-row .inline-date-input {
  width: auto;
  flex: 1;
  min-width: 80px;
}

.inline-date-input {
  padding: 1px 2px;
  border: 1px solid var(--gray-300);
  border-radius: 3px;
  font-size: 10px;
  color: var(--gray-700);
  background: transparent;
  cursor: pointer;
  outline: none;
  width: 100%;
  min-width: 80px;
}
.inline-date-input[type="datetime-local"] {
  min-width: 120px;
}
.inline-date-input:focus {
  border-color: var(--teal);
}
.inline-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
.inline-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ===================== INLINE YOUTUBE LINK ===================== */
.inline-youtube-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 160px;
}
.inline-youtube-input {
  flex: 1;
  min-width: 120px;
  padding: 2px 4px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 10px;
  color: var(--gray-700);
  background: var(--white);
  outline: none;
}
.inline-youtube-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0,168,181,0.12);
}
.inline-youtube-open {
  flex-shrink: 0;
  color: var(--info);
  font-size: 10px;
  font-weight: 700;
  text-decoration: underline;
}

/* ===================== INLINE CHANNEL SELECT ===================== */
.inline-channel-select {
  padding: 1px 2px;
  border: 1px solid var(--gray-300);
  border-radius: 3px;
  font-size: 10px;
  color: var(--gray-700);
  background: transparent;
  cursor: pointer;
  outline: none;
  width: 100%;
  min-width: 55px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.inline-channel-select:focus {
  border-color: var(--teal);
}

/* ===================== PAYMENT TYPE BADGE ===================== */
.badge-pay-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pay-production {
  background: #e8f4fd;
  color: var(--info);
}
.badge-pay-rs {
  background: #fef3e2;
  color: #e67e22;
}
.badge-pay-production_rs {
  background: #f0e6ff;
  color: #7c3aed;
}

/* ===================== CALENDAR ===================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border-radius: var(--border-radius);
  overflow: hidden;
}
.calendar-header-cell {
  background: var(--navy);
  color: var(--white);
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
}
.calendar-cell {
  background: var(--white);
  min-height: 100px;
  padding: 4px;
  font-size: 11px;
  vertical-align: top;
  position: relative;
}
.calendar-cell.other-month {
  background: var(--gray-50);
  color: var(--gray-400);
}
.calendar-cell.today {
  background: var(--teal-light);
}
.calendar-day-num {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 2px;
  color: var(--gray-700);
}
.calendar-cell.other-month .calendar-day-num {
  color: var(--gray-400);
}
.calendar-event {
  display: block;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 3px;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.calendar-event.shooting {
  background: #cce5ff;
  color: #004085;
}
.calendar-event.upload {
  background: #d4edda;
  color: #155724;
}
.calendar-event.webinar {
  background: #fff3cd;
  color: #856404;
}
.calendar-event-group {
  font-weight: 700;
}
.calendar-event-details {
  margin: -1px 0 3px 8px;
  padding-left: 5px;
  border-left: 2px solid var(--gray-300);
}
.calendar-event-detail {
  display: block;
  padding: 1px 3px;
  margin-bottom: 1px;
  border-radius: 3px;
  font-size: 9px;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event-detail.shooting {
  background: #e7f1ff;
  color: #004085;
}
.calendar-event-detail.upload {
  background: #e6f4ea;
  color: #155724;
}
.calendar-event-detail.webinar {
  background: #fff8df;
  color: #856404;
}

/* ===================== PROFIT TABLE ===================== */
.profit-table {
  width: 100%;
  border-collapse: collapse;
}
.profit-table th,
.profit-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-200);
}
.profit-table th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--gray-600);
  font-size: 11.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.profit-table tfoot td {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
}

/* ===================== CONTRACTS SCROLL & STICKY COLUMN ===================== */
.contracts-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}
.contracts-scroll-wrapper {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
/* row-active / row-invoice-pending 시각 표시 (첫 번째 td에 border-left) */
.contracts-table tbody tr.row-active > td:first-child {
  border-left: 3px solid var(--teal);
}
.contracts-table tbody tr.row-invoice-pending > td:first-child {
  border-left: 3px solid var(--warning);
}

/* ===================== PLATFORM CARDS ===================== */
.platform-card {
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.platform-card-expanded {
  border-color: var(--teal);
}
.platform-card-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.platform-card-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.platform-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  white-space: nowrap;
}
.platform-card-meta {
  font-size: 11px;
  color: var(--gray-500);
  white-space: nowrap;
}
.platform-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.platform-card-body {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  padding: 10px 14px;
}

/* ===================== SIDEBAR FOOTER (LOGOUT) ===================== */
.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: var(--navy);
}
.sidebar-footer-btn {
  width: 100%;
}
.sidebar-footer-btn + .sidebar-footer-btn {
  margin-top: 8px;
}
.sidebar-logout-btn {
  color: var(--gray-400);
  border-color: rgba(255,255,255,0.15);
  font-size: 13px;
}
.sidebar-logout-btn:hover {
  color: var(--white);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
}

@media (max-width: 768px) {
  .sidebar-footer {
    position: sticky;
    bottom: 0;
    padding: 12px 16px 18px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 18px rgba(18, 40, 64, 0.22);
  }
  .sidebar-footer-btn {
    min-height: 44px;
  }
}

/* ===================== SIDEBAR MENU EDIT ===================== */
.sidebar-menu-edit {
  padding: 8px 12px;
  text-align: center;
}
.sidebar-edit-list {
  list-style: none;
  padding: 0;
}
.sidebar-edit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: grab;
  transition: background var(--transition);
}
.sidebar-edit-item:hover {
  background: var(--teal-light);
}
.sidebar-edit-item.dragging {
  opacity: 0.5;
  background: var(--gray-200);
}
.sidebar-edit-drag {
  color: var(--gray-400);
  font-size: 14px;
  cursor: grab;
}
.sidebar-edit-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.sidebar-edit-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}
.sidebar-edit-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 20px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
}
.sidebar-edit-toggle input:checked + .toggle-slider {
  background: var(--teal);
}
.sidebar-edit-toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* ===================== LECTURER STYLES ===================== */
.lecturer-name-link {
  color: var(--teal-dark);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.lecturer-name-link:hover {
  color: var(--teal);
  text-decoration: underline;
}
.file-preview {
  margin-top: 6px;
}
.file-preview-img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
}

/* ===================== EXPANDABLE ROW (공통 — 월별정산 스타일 통일) ===================== */
.lecturer-expand-row td {
  padding: 0 !important;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-300);
}
/* 확장 영역 컨테이너 */
.expand-panel {
  padding: 24px 28px;
  background: var(--gray-50);
}
.expand-panel h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
}
/* 확장 영역 내 테이블 — 월별정산 stl-detail-row 동일 스타일 */
.expand-panel .data-table {
  font-size: 13.5px;
  margin-bottom: 0;
  border-left: 3px solid var(--gray-300);
}
.expand-panel .data-table th {
  font-size: 12px;
  padding: 12px 16px;
  background: var(--gray-100);
}
.expand-panel .data-table td {
  font-size: 13.5px;
  padding: 12px 16px;
}
.expand-panel .data-table tbody tr:hover {
  background: var(--teal-light);
}
/* 확장 영역 내 tfoot */
.expand-panel .data-table tfoot td {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-weight: 700;
  font-size: 13.5px;
  padding: 12px 16px;
}
/* 확장 패널 색상 변형 (채널 이력/RS) */
.expand-panel--warm {
  background: #fffdf5;
}
.expand-panel--warm .data-table {
  border-left-color: var(--warning);
}
/* 확장 패널 색상 변형 (채널 정보) */
.expand-panel--cool {
  background: #f6fbfe;
}
.expand-panel--cool .data-table {
  border-left-color: var(--info);
}
.lecturer-row-clickable {
  cursor: pointer;
}
.lecturer-row-clickable:hover {
  background: var(--teal-light);
}

/* ── Contract Modal Groups ──────────────────────────────── */
.contract-modal-group {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px 14px 10px;
  margin-bottom: 14px;
}
.contract-modal-group legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  padding: 0 8px;
  margin-left: -4px;
}

/* ── Batch Action Bar ──────────────────────────────────── */
.batch-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 8px;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  border-radius: 8px;
}

/* ── Contract Highlight (cross-page nav) ─────────────── */
.contract-highlight {
  background-color: var(--teal-light) !important;
  outline: 2px solid var(--teal);
  outline-offset: -1px;
}

/* ── Print Styles (#22) ────────────────────────────── */
@media print {
  .sidebar, .topbar, .sidebar-toggle, .section-toolbar,
  .modal-overlay, .toast-container, .login-overlay,
  .db-actions, .sidebar-footer, .btn { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; overflow: visible !important; height: auto !important; }
  .content-section { overflow: visible !important; height: auto !important; }
  .content-section.active { display: block !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc; }
  body { overflow: visible !important; font-size: 11px; }
}

/* ── Login Page ─────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo-icon {
  display: inline-block;
  font-size: 36px;
  color: var(--teal);
  margin-bottom: 8px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}
.login-form-group {
  margin-bottom: 20px;
}
.login-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.login-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 168, 181, 0.15);
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  background: var(--teal);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.login-btn:hover {
  background: var(--teal-dark);
}
@media (max-width: 480px) {
  .login-container {
    margin: 16px;
    padding: 32px 24px 28px;
  }
}

/* ===================== USERS / ROLE BADGES ===================== */
.badge-role {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.role-admin {
  background: #ffe0e6;
  color: #c0392b;
  border: 1px solid #e74c3c;
}
.role-developer {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #8b5cf6;
}
.role-editor {
  background: #e8f4fd;
  color: #2471a3;
  border: 1px solid #3498db;
}
.role-viewer {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.badge-self {
  font-size: 10px;
  font-weight: 600;
  color: var(--teal);
  margin-left: 2px;
}

/* ===================== LOG AUDIT ===================== */
.log-audit-toolbar .filter-select {
  min-width: 150px;
}
.log-audit-summary .log-audit-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--gray-500);
  font-size: 12px;
}
.log-audit-table-wrap {
  overflow-x: auto;
}
.log-audit-table {
  min-width: 980px;
}
.log-audit-table th,
.log-audit-table td {
  vertical-align: top;
}
.log-audit-detail {
  max-width: 360px;
  max-height: 120px;
  overflow: auto;
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-700);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===================== AI CONTRACT PROTOTYPE ===================== */
.sidebar-prototype-menu {
  margin: 10px 8px 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-section-label {
  padding: 0 12px 6px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.nav-link-prototype {
  border: 1px solid rgba(0,168,181,0.35);
  background: rgba(0,168,181,0.08);
}

.ai-contract-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.4fr);
  gap: 16px;
  align-items: start;
}

.ai-contract-card .card-header h2 {
  font-size: 15px;
}

.ai-status {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.ai-status code {
  font-size: 11.5px;
  background: rgba(255,255,255,0.65);
  border-radius: 4px;
  padding: 1px 4px;
}

.ai-status-ok {
  color: #0f5132;
  background: #d1e7dd;
  border: 1px solid #badbcc;
}

.ai-status-warn {
  color: #664d03;
  background: #fff3cd;
  border: 1px solid #ffecb5;
}

.ai-security-note {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--gray-700);
  font-size: 12.5px;
  line-height: 1.55;
}

.ai-security-note ul {
  margin: 6px 0 0 18px;
}

.ai-contract-textarea {
  min-height: 910px;
  line-height: 1.55;
}

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

.ai-action-row-bottom {
  margin-top: 14px;
}

.ai-draft-summary {
  font-size: 13px;
  color: var(--navy);
  font-weight: 700;
  margin-bottom: 10px;
}

.ai-create-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--gray-50);
  font-size: 12.5px;
  color: var(--gray-700);
}

.ai-create-options label {
  display: flex;
  gap: 5px;
  align-items: center;
  cursor: pointer;
}

.ai-draft-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-draft-card {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.ai-draft-head,
.ai-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ai-confidence {
  font-size: 11.5px;
  color: var(--gray-500);
}

.ai-match-row {
  justify-content: flex-start;
}

.ai-match-row span {
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
}

.ai-match-row .ok {
  color: #0f5132;
  background: #d1e7dd;
}

.ai-match-row .warn {
  color: #664d03;
  background: #fff3cd;
}

.ai-warning-list {
  margin: 8px 0 12px 18px;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.55;
}

.ai-warning-ok {
  margin-left: 0;
  color: var(--success);
}

.ai-draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px 12px;
}

.ai-draft-section {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  background: var(--gray-50);
}

.ai-draft-section legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
}

.ai-notes-field {
  margin-top: 8px;
}

@media (max-width: 1180px) {
  .ai-contract-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .ai-draft-grid { grid-template-columns: 1fr; }
  .ai-contract-textarea { min-height: 630px; }
}

/* ===================== SCOPED VIEWER MOBILE ESSENTIAL CARDS ===================== */
.scoped-mobile-card-list,
.scoped-settlement-mobile-list {
  display: none;
}

.scoped-contract-mobile-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--teal);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 12px;
}
.scoped-contract-mobile-card.is-settled {
  border-left-color: var(--success);
  background: #fbfefc;
}
.scoped-mobile-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.scoped-mobile-title-wrap {
  min-width: 0;
  flex: 1;
}
.scoped-mobile-title {
  display: block;
  font-size: 16px;
  line-height: 1.35;
  color: var(--navy);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.scoped-mobile-subtitle {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--gray-600);
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.scoped-mobile-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.scoped-mobile-primary-box {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px;
  background: var(--gray-50);
  min-width: 0;
}
.scoped-mobile-primary-box.money {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.scoped-mobile-primary-box.date {
  background: #f0fdfa;
  border-color: #99f6e4;
}
.scoped-mobile-primary-box span,
.scoped-mobile-edit-block label,
.scoped-mobile-readonly-link span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--gray-600);
  margin-bottom: 4px;
}
.scoped-mobile-primary-box strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
  color: var(--navy);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.scoped-mobile-primary-box.money strong {
  font-size: 20px;
}
.scoped-mobile-primary-box em,
.scoped-mobile-amount-sub {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 11.5px;
  color: var(--gray-600);
  line-height: 1.3;
}
.scoped-mobile-settlement-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.scoped-mobile-settlement-item,
.scoped-mobile-settlement-empty {
  display: grid;
  grid-template-columns: minmax(78px, 0.9fr) minmax(110px, 1.2fr) auto;
  align-items: center;
  gap: 6px;
  padding: 8px 9px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  min-width: 0;
}
.scoped-mobile-settlement-empty {
  display: block;
  color: var(--gray-500);
  font-size: 12px;
}
.scoped-mobile-settlement-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--navy);
  white-space: normal;
}
.scoped-mobile-settlement-date {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray-800);
  white-space: normal;
}
.scoped-mobile-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 2px;
}
.scoped-mobile-edit-block,
.scoped-mobile-readonly-link {
  padding: 9px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
}
.scoped-mobile-edit-block .inline-date-input,
.scoped-mobile-edit-block .inline-youtube-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
}
.scoped-mobile-edit-block .inline-youtube-cell {
  width: 100%;
  min-width: 0;
  gap: 8px;
}
.scoped-mobile-edit-block .inline-youtube-open,
.scoped-mobile-readonly-link .inline-youtube-open {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--info);
  color: var(--white);
  text-decoration: none;
  font-size: 12px;
}
.scoped-mobile-readonly-link a {
  color: var(--info);
  word-break: break-all;
}
.scoped-settlement-mobile-total {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--white);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-md);
}
.scoped-settlement-mobile-total span,
.scoped-settlement-mobile-total em {
  display: block;
  font-size: 12px;
  opacity: 0.82;
  font-style: normal;
}
.scoped-settlement-mobile-total strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
  line-height: 1.2;
}
.scoped-mobile-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-200);
  font-size: 12px;
  color: var(--gray-600);
}

@media (max-width: 768px) {
  .scoped-contracts-table-card,
  .scoped-settlement-table-card {
    display: none;
  }
  .scoped-mobile-card-list,
  .scoped-settlement-mobile-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #section-contracts.active {
    overflow-y: auto;
  }
  #contractsContainer {
    min-height: auto;
  }
  .contracts-summary-bar + .scoped-mobile-card-list,
  .scoped-settlement-mobile-total + .scoped-contract-mobile-card {
    margin-top: 0;
  }
}

@media (max-width: 390px) {
  .scoped-mobile-primary-grid {
    grid-template-columns: 1fr;
  }
  .scoped-mobile-settlement-item {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .scoped-mobile-settlement-item .settlement-status-badge {
    justify-self: start;
  }
}

/* ── 촬영·업로드 일정 (Schedule) — 모바일 우선 ───────────────────────── */
.sch-wrap { max-width: 760px; margin: 0 auto; }
.sch-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 4px 14px;
  position: sticky;
  top: 0;
  background: var(--gray-50);
  z-index: 2;
}
.sch-nav {
  width: 40px; height: 40px;
  border: 1px solid var(--gray-200);
  background: #fff;
  border-radius: var(--border-radius);
  font-size: 1.3rem; line-height: 1;
  color: var(--navy);
  cursor: pointer;
}
.sch-nav:hover { background: var(--gray-100); }
.sch-month { font-size: 1.05rem; font-weight: 700; color: var(--navy); min-width: 110px; text-align: center; }
.sch-today-btn {
  margin-left: 6px;
  padding: 8px 12px;
  border: 1px solid var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
  border-radius: var(--border-radius);
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
}
.sch-cards { display: flex; flex-direction: column; gap: 10px; }

.sch-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: #fff;
  overflow: hidden;
}
.sch-card-missing { border-color: var(--warning); }
.sch-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--gray-50);
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sch-card-missing .sch-card-head { background: #fff7ec; }
.sch-chevron { color: var(--gray-500); font-size: .9rem; width: 14px; flex: 0 0 auto; }
.sch-card-title { font-weight: 700; color: var(--navy); flex: 1 1 auto; }
.sch-card-sub { font-weight: 400; font-size: .8rem; color: var(--gray-500); }
.sch-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.sch-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.sch-badge-shoot { background: var(--teal-light); color: var(--teal-dark); }
.sch-badge-upload { background: #eef2fb; color: var(--navy); }
.sch-badge-warn { background: #fdece1; color: var(--danger); }
.sch-badge-past { background: var(--gray-200); color: var(--gray-500); }

/* 이미 지난 촬영 주차: 하단에 뮤트 처리 */
.sch-card-past { opacity: .82; }
.sch-card-past .sch-card-head { background: var(--gray-100); }
.sch-card-past .sch-card-title { color: var(--gray-600, #6c757d); }

.sch-card.collapsed .sch-card-body { display: none; }

.sch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 14px;
  padding: 11px 14px;
  border-top: 1px solid var(--gray-100);
}
.sch-platform { flex: 1 1 100%; font-weight: 600; color: var(--navy); }
.sch-datecol { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.sch-lbl {
  font-size: .72rem; color: var(--gray-500);
  background: var(--gray-100); padding: 1px 6px; border-radius: 4px;
}
.sch-date { font-variant-numeric: tabular-nums; }
.sch-none { color: var(--gray-500); }
.sch-hl-shoot { color: var(--teal-dark); font-weight: 700; }
.sch-hl-upload { color: var(--navy); font-weight: 700; }

/* 데스크톱: 플랫폼과 날짜를 한 줄로 */
@media (min-width: 769px) {
  .sch-platform { flex: 1 1 auto; }
  .sch-row { gap: 6px 20px; }
}

/* 강사명 · 랜딩링크 (공용) */
.sch-lecturer { color: var(--teal-dark); font-weight: 600; }
.sch-landing { font-size: .75rem; color: var(--teal-dark); text-decoration: underline; white-space: nowrap; }
.sch-date-input { font-size: .78rem; padding: 2px 4px; }

/* PC 캘린더 */
.sch-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.sch-cal-head .sch-cal-wd { text-align: center; font-weight: 600; padding: 6px 0; color: var(--gray-500); font-size: .85rem; }
.sch-cal-body { border-top: 1px solid var(--gray-200); border-left: 1px solid var(--gray-200); border-radius: var(--border-radius); overflow: hidden; }
.sch-cal-cell {
  min-height: 104px;
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  padding: 4px 5px;
  background: #fff;
  vertical-align: top;
}
.sch-cal-out { background: var(--gray-50); }
.sch-cal-today { background: var(--teal-light); }
.sch-cal-daynum { font-size: .78rem; color: var(--gray-500); font-weight: 700; }
.sch-cal-today .sch-cal-daynum { color: var(--teal-dark); }
.sch-cal-chip {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 3px 5px;
  margin-top: 3px;
  font-size: .8rem;
  line-height: 1.3;
}
.sch-cal-name { display: block; }
.sch-cal-chip .sch-shoot-edit { margin-top: 3px; }

/* 촬영일 인라인 편집기 (저장/삭제) */
.sch-shoot-edit { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sch-mini-btn {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--gray-300, #ced4da);
  background: #fff;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}
.sch-mini-save { border-color: var(--teal); color: var(--teal-dark); }
.sch-mini-del { border-color: var(--danger); color: var(--danger); }
.sch-mini-btn:hover { filter: brightness(0.97); }

/* 일정 미입력 패널 (PC) */
.sch-miss-panel { margin-top: 16px; border: 1px solid var(--warning); border-radius: var(--border-radius); overflow: hidden; }
.sch-miss-head { background: #fff7ec; padding: 10px 14px; font-weight: 700; color: var(--navy); }
.sch-miss-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--gray-100);
}
.sch-miss-input { margin-left: auto; }
