:root {
  --teal: #14a394;
  --teal-dark: #0a6e64;
  --red: #c0392b;
  --border: #e5e7eb;
  --muted: #6b7280;
  --bg-soft: #f9fafb;
}

body {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
  font-family: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  color: #212529;
  background: var(--bg-soft);
}

[hidden] {
  display: none !important;
}

h1 {
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 18px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  transition: background 0.15s ease;
}

#auth-section {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#auth-section button {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  background: var(--teal);
  color: white;
}

#auth-section button:hover {
  background: var(--teal-dark);
}

#user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

#user-bar button {
  font-size: 13px;
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--border);
}

#push-bar {
  margin-bottom: 18px;
}

#push-toggle-btn {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  background: white;
  border: 1px solid var(--border);
}

#push-toggle-btn.push-on {
  background: #e3f7f3;
  color: var(--teal-dark);
  border-color: var(--teal);
}

#push-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

#push-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

#add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

#add-form input,
#add-form select {
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  background: white;
  width: 100%;
  font-family: inherit;
}

.add-form-row {
  display: flex;
  gap: 10px;
}

.add-form-row select {
  flex: 1;
  min-width: 0;
}

.add-form-row input {
  flex: 1;
  min-width: 0;
}

#add-form button {
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  background: var(--teal);
  color: white;
}

#add-form button:hover {
  background: var(--teal-dark);
}

#view-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.view-btn {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}

.view-btn.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.info-icon {
  font-size: 11px;
  opacity: 0.6;
}

#status-filter {
  display: block;
  width: 100%;
  padding: 8px;
  font-size: 13px;
  color: var(--text, #212529);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}

#color-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.overdue-dot {
  background: var(--red);
}

.legend-dot.unpublished-dot {
  background: #7c3aed;
}

.legend-dot.completed-dot {
  background: var(--teal);
}

.legend-dot.paid-dot {
  background: #2563eb;
}

#sponsorship-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.list-pagination button {
  padding: 8px 14px;
  font-size: 13px;
  background: white;
  border: 1px solid var(--border);
}

.list-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.page-indicator {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

#calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#calendar-nav button {
  background: white;
  border: 1px solid var(--border);
  padding: 6px 12px;
}

#calendar-month-label {
  font-weight: 700;
  font-size: 15px;
}

#calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  padding-bottom: 4px;
}

.calendar-cell {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  font-size: 11px;
  background: white;
}

.calendar-cell.empty {
  border: none;
  background: transparent;
}

.calendar-cell.today {
  border-color: var(--teal);
  background: #eefbf9;
}

.calendar-date {
  font-weight: 700;
  margin-bottom: 2px;
}

.calendar-item {
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-item.overdue-flag {
  background: #fdecea;
  color: var(--red);
  font-weight: 700;
}

.calendar-item.unpublished {
  background: #f3e8ff;
  color: #7c3aed;
}

.calendar-item.completed {
  background: #e3f3f0;
  color: var(--teal-dark);
}

.calendar-item.paid {
  background: #dbeafe;
  color: #2563eb;
}

.calendar-item.in_progress {
  background: #fff4e5;
  color: #b45309;
}

#kanban-view {
  display: flex;
  gap: 10px;
}

.kanban-column {
  flex: 1;
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
}

.kanban-column h3 {
  font-size: 13px;
  margin: 0 0 8px;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow-y: auto;
}

.kanban-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

#sponsorship-list li.highlight {
  animation: highlight-bounce 0.6s ease-out;
}

@keyframes highlight-bounce {
  0% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-6px);
  }
  50% {
    transform: translateY(0);
  }
  70% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

#sponsorship-table tr.highlight td {
  animation: highlight-bounce 0.6s ease-out;
  position: relative;
}

.kanban-card.overdue {
  border-color: var(--red);
  background: #fdecea;
}

.kanban-card.unpublished {
  border-color: #7c3aed;
  background: #f3e8ff;
}

.kanban-card.completed {
  border-color: #b8e0d9;
  background: #f4f9f8;
  opacity: 0.75;
}

.kanban-card.in_progress {
  border-color: #b45309;
  background: #fff4e5;
}

.kanban-empty {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  margin: 0;
}

#sponsorship-list li {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

#sponsorship-list li .brand-name {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 2px;
}

#sponsorship-list li .amount {
  font-weight: 800;
  color: var(--teal-dark);
  font-size: 15px;
}

#sponsorship-list li .deadline {
  color: var(--red);
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

.channel-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 8px;
  background: #f0f0f0;
  color: #666;
}

.channel-badge.channel-naver_blog {
  background: #e6f4ea;
  color: #1a7f37;
}

.channel-badge.channel-instagram {
  background: #fce4f1;
  color: #c13584;
}

.channel-badge.channel-youtube {
  background: #fde8e8;
  color: #cc0000;
}

.channel-badge.channel-tiktok {
  background: #212121;
  color: #fff;
}

.channel-badge.channel-other {
  background: #f0f0f0;
  color: #666;
}

.status-badge.completed {
  background: #e3f7f3;
  color: var(--teal-dark);
}

.status-badge.in_progress {
  background: #fff4e5;
  color: #b45309;
}

#sponsorship-list li.overdue {
  border-color: var(--red);
  background: #fdecea;
}

#sponsorship-list li.unpublished {
  border-color: #7c3aed;
  background: #f3e8ff;
}

.overdue-badge {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}

#sponsorship-list li .unpublished-badge {
  color: #7c3aed;
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}

#sponsorship-list li.completed {
  border-color: #b8e0d9;
  background: #f4f9f8;
  opacity: 0.75;
}

.payment-badge {
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}

.payment-badge.paid {
  color: #2563eb;
}

.payment-badge.pending {
  color: #b45309;
}

#sponsorship-list li.completed.overdue {
  border-color: var(--red);
  background: #fdecea;
  opacity: 1;
}

#sponsorship-list li .invoice-btn,
#sponsorship-list li .status-btn,
#sponsorship-list li .payment-btn,
#sponsorship-list li .timeline-btn,
#sponsorship-list li .draft-btn,
#sponsorship-list li .delete-btn {
  margin-top: 8px;
  margin-right: 6px;
  padding: 8px 14px;
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

#sponsorship-list li .invoice-btn:active,
#sponsorship-list li .status-btn:active,
#sponsorship-list li .payment-btn:active,
#sponsorship-list li .timeline-btn:active,
#sponsorship-list li .draft-btn:active,
#sponsorship-list li .delete-btn:active {
  background: var(--border);
}

#sponsorship-list li .delete-btn {
  color: var(--red);
}

#sponsorship-list li .status-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

#sponsorship-list li .payment-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

#sponsorship-list li .timeline-btn.active,
#sponsorship-list li .draft-btn.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: white;
}

.timeline-box {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-stage {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.timeline-stage.done .timeline-label {
  color: var(--teal-dark);
  font-weight: 700;
}

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

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

.stage-record-btn {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--teal);
  color: white;
}

.draft-box {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.draft-type-select {
  padding: 6px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.draft-generate-btn,
.draft-copy-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--teal);
  color: white;
  align-self: flex-start;
}

.draft-status {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.draft-result {
  width: 100%;
  box-sizing: border-box;
  min-height: 100px;
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}

#sponsorship-list li.empty-state {
  border: 1px dashed #ccc;
  color: #9ca3af;
  text-align: center;
  font-size: 14px;
  background: transparent;
  box-shadow: none;
}

#profile-hint {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

#profile-section {
  margin-bottom: 22px;
  border: 1px solid #cdece7;
  border-radius: 12px;
  padding: 14px;
  background: #eefbf9;
}

#profile-section summary {
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#profile-section input {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#profile-section button {
  margin-top: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  width: 100%;
  background: var(--teal);
  color: white;
}

#profile-section button:hover {
  background: var(--teal-dark);
}

#mobile-guide-section {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: white;
  font-size: 13px;
}

#mobile-guide-section summary {
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#mobile-guide-section ol {
  margin: 6px 0 0;
  padding-left: 18px;
  line-height: 1.7;
}

.mobile-guide-group {
  margin-top: 12px;
}

.mobile-guide-group strong {
  font-size: 13px;
}

.extract-tip {
  margin: 10px 0;
  padding: 8px 10px;
  background: #e3f7f3;
  border-radius: 8px;
  color: var(--teal-dark);
  font-size: 12px;
  line-height: 1.5;
}

.mobile-guide-note {
  margin: 10px 0 0;
  padding: 8px;
  background: #fff8e1;
  border-radius: 8px;
  color: #92610a;
  font-size: 12px;
}

#premium-tools {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#premium-tools button {
  padding: 13px;
  font-size: 15px;
  background: white;
  border: 1px solid var(--border);
}

#summary-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-soft);
}

#summary-box .summary-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.brand-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.brand-card h3 {
  font-size: 15px;
  margin: 0 0 4px;
}

.brand-card-stats {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.brand-card-history {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-history-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-soft);
}

.brand-history-item.overdue {
  background: #fdecea;
  color: var(--red);
}

.brand-history-item.unpublished {
  background: #f3e8ff;
  color: #7c3aed;
}

.brand-history-item.completed {
  background: #e3f3f0;
  color: var(--teal-dark);
}

.brand-history-item.paid {
  background: #dbeafe;
  color: #2563eb;
}

.brand-history-item.in_progress {
  background: #fff4e5;
  color: #b45309;
}

#today-summary {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.today-card {
  flex: 1;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}

.today-card-num {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.today-card-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}

#ai-extract-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

#ai-extract-section summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--teal-dark);
}

#ai-extract-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 8px;
  min-height: 80px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

#ai-extract-image {
  display: block;
  margin-top: 8px;
  font-size: 12px;
}

#ai-extract-btn,
#ai-extract-add-btn {
  margin-top: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  background: var(--teal);
  color: white;
}

#ai-extract-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

#ai-extract-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#ai-extract-results li {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}

footer {
  margin-top: 20px;
  text-align: center;
  padding-bottom: 20px;
}

footer a {
  font-size: 12px;
  color: #9ca3af;
  text-decoration: none;
}

/* 데스크톱 표 뷰 — 기본(폰)은 숨김, 768px 이상에서만 표시 */
#sponsorship-table {
  display: none;
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: white;
}

#sponsorship-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
}

#sponsorship-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

#sponsorship-table tr.table-expand-row td {
  padding: 0 10px;
  border-bottom: none;
  font-size: 0;
  line-height: 0;
}

#sponsorship-table tr.table-expand-row .timeline-box:not([hidden]),
#sponsorship-table tr.table-expand-row .draft-box:not([hidden]) {
  font-size: 13px;
  line-height: 1.5;
}

/* td뿐 아니라 tr 자체에도 같은 배경을 줘서, 확대배율(예: 윈도우 125%/150%)에서
   border-collapse 표에 생기는 서브픽셀 반올림 틈이 흰색이 아니라 같은 색으로 비치게 함 */
#sponsorship-table tr.overdue,
#sponsorship-table tr.overdue td { background: #fdecea; }
#sponsorship-table tr.unpublished,
#sponsorship-table tr.unpublished td { background: #f3e8ff; }
#sponsorship-table tr.completed,
#sponsorship-table tr.completed td { background: #f4f9f8; }
#sponsorship-table tr.completed.overdue,
#sponsorship-table tr.completed.overdue td { background: #fdecea; }
#sponsorship-table tbody tr:not(.overdue):not(.unpublished):not(.completed):not(.table-expand-row) { background: white; }

#sponsorship-table .brand-cell { font-weight: 800; }
#sponsorship-table .deadline-cell { color: var(--red); font-weight: 600; white-space: nowrap; }
#sponsorship-table .amount-cell { font-weight: 800; color: var(--teal-dark); white-space: nowrap; }

#sponsorship-table th:last-child,
#sponsorship-table td.table-actions {
  width: 232px;
}

#sponsorship-table .table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 220px;
}

#sponsorship-table .table-actions button {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 700;
  background: #ffffff;
  color: #374151;
  border: 1px solid #c3cad2;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

#sponsorship-table .table-actions button:hover {
  background: #f3f4f6;
  border-color: #a8b1bb;
}

#sponsorship-table .delete-btn { color: var(--red); border-color: #f0c3bd; }
#sponsorship-table .status-btn.active { background: var(--teal); border-color: var(--teal); color: white; }
#sponsorship-table .payment-btn.active { background: #2563eb; border-color: #2563eb; color: white; }
#sponsorship-table .timeline-btn.active,
#sponsorship-table .draft-btn.active { background: #7c3aed !important; border-color: #7c3aed !important; color: white !important; }

/* 활성 상태 버튼은 마우스를 올려도 일반 호버 회색으로 안 덮이고 색이 유지되게 */
#sponsorship-table .status-btn.active:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: white; }
#sponsorship-table .payment-btn.active:hover { background: #1d4ed8; border-color: #1d4ed8; color: white; }
#sponsorship-table .timeline-btn.active:hover,
#sponsorship-table .draft-btn.active:hover { background: #6d28d9 !important; border-color: #6d28d9 !important; color: white !important; }

#sponsorship-table .empty-state-row td {
  text-align: center;
  color: #9ca3af;
  padding: 24px 10px;
}

@media (min-width: 768px) {
  body { max-width: 960px; }

  #sponsorship-list { display: none; }

  .table-scroll { overflow-x: auto; }

  #sponsorship-table { display: table; }
}
