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

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2d3448; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4560; }
* { scrollbar-width: thin; scrollbar-color: #2d3448 transparent; }

.price-cell { cursor: pointer; text-decoration: underline dotted; display: block; text-align: right; }
.price-cell:hover { color: #60a5fa; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  font-size: 14px;
  background: #0f1117;
  color: #e2e8f0;
  line-height: 1.5;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* ── 헤더 ──────────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}

.bond-badge {
  display: inline-block;
  padding: 4px 10px;
  background: #1e3a5f;
  color: #60a5fa;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.stock-search-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.stock-search {
  width: 100%;
  max-width: 320px;
  padding: 7px 12px;
  border: 1.5px solid #2d3448;
  border-radius: 6px;
  font-size: 13px;
  color: #e2e8f0;
  background: #1a1d27;
  outline: none;
  transition: border-color 0.15s;
}
.stock-search:focus { border-color: #4b5563; }
.stock-search::placeholder { color: #4b5563; }

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  white-space: nowrap;
}

.auth-name {
  font-size: 13px;
  color: #94a3b8;
}

.auth-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1.5px solid #2d3448;
  color: #94a3b8;
  background: #1a1d27;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-btn:hover { background: #252836; }
.login-btn { border-color: #3b82f6; color: #60a5fa; }
.login-btn:hover { background: #1e3a5f; }

.refresh-wrap {
  position: relative;
  display: flex;
}

#refresh-btn {
  padding: 7px 14px;
  background: #1a1d27;
  border: 1.5px solid #2d3448;
  border-right: none;
  color: #94a3b8;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
#refresh-btn:hover { border-color: #4b5563; background: #252836; }
#refresh-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.refresh-arrow {
  padding: 7px 9px;
  background: #1a1d27;
  border: 1.5px solid #2d3448;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-size: 11px;
  color: #4b5563;
  transition: all 0.15s;
}
.refresh-arrow:hover { border-color: #4b5563; background: #252836; }

.refresh-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1a1d27;
  border: 1px solid #2d3448;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.refresh-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid #252836;
  cursor: pointer;
  font-size: 13px;
  color: #94a3b8;
  text-align: left;
  transition: background 0.1s;
}
.refresh-menu button:last-child { border-bottom: none; }
.refresh-menu button:hover { background: #252836; }

.speed {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #14532d;
  color: #4ade80;
  font-weight: 500;
}
.speed.slow {
  background: #450a0a;
  color: #f87171;
}

/* ── 필터 카드 ──────────────────────────────────────────── */

.filter-card {
  background: #1a1d27;
  border: 1px solid #2d3448;
  border-radius: 10px;
  padding: 18px 20px 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.filter-groups {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.filter-group {
  flex: 1;
  min-width: 0;
  padding: 0 20px;
}

.filter-group:first-child { padding-left: 0; }
.filter-group:last-child  { padding-right: 0; }

.filter-divider {
  width: 1px;
  background: #2d3448;
  margin: 0;
  align-self: stretch;
}

.group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid;
}

.dividend-title { color: #60a5fa; border-color: #60a5fa; }
.value-title    { color: #4ade80; border-color: #4ade80; }
.growth-title   { color: #f87171; border-color: #f87171; }

.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
  transition: background 0.1s;
}

.filter-row:hover { background: #252836; }

.filter-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  background: #0f1117;
  border: 1.5px solid #3d4560;
  border-radius: 3px;
  transition: background 0.1s, border-color 0.1s;
}
.filter-row input[type="checkbox"]:checked {
  background: #2563eb;
  border-color: #2563eb;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l3 3 5-6' stroke='%23fff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 10px 8px;
  background-repeat: no-repeat;
  background-position: center;
}

.filter-label {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-row input[type="number"] {
  width: 70px;
  padding: 3px 7px;
  border: 1px solid #2d3448;
  border-radius: 4px;
  text-align: right;
  font-size: 13px;
  color: #e2e8f0;
  background: #0f1117;
  transition: border-color 0.15s;
}

.filter-row input[type="number"]:focus {
  outline: none;
  border-color: #4b5563;
  background: #0f1117;
}

.filter-unit {
  font-size: 12px;
  color: #4b5563;
  flex-shrink: 0;
}

/* 체크 상태일 때 행 강조 */
.filter-row:has(input[type="checkbox"]:checked) {
  background: #1e3a5f;
}
.filter-row:has(input[type="checkbox"]:checked) .filter-label {
  color: #60a5fa;
  font-weight: 500;
}

/* ── 필터 하단 ──────────────────────────────────────────── */

.filter-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #252836;
}

.result-count {
  font-size: 13px;
  color: #4b5563;
}

.btn-apply {
  padding: 7px 22px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-apply:hover { background: #1d4ed8; }
.btn-apply:active { background: #1e40af; }

/* ── 알림 ──────────────────────────────────────────────── */

.alert-warning {
  padding: 10px 14px;
  background: #422006;
  border: 1px solid #92400e;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #fbbf24;
}

.alert-info {
  padding: 10px 14px;
  background: #1e3a5f;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #93c5fd;
}

/* ── 테이블 카드 ────────────────────────────────────────── */

.table-card {
  background: #1a1d27;
  border: 1px solid #2d3448;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  overflow: hidden;
}

/* DataTables 오버라이드 */
.dataTables_wrapper {
  font-size: 13px;
  color: #e2e8f0;
}

.dataTables_wrapper .dataTables_filter {
  margin-bottom: 10px;
}

.dt-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
}
.dt-bottom .dataTables_length { margin: 0; }
.dt-bottom .dataTables_info   { padding-top: 0; }
.dt-bottom .dataTables_paginate { padding-top: 0; }

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #2d3448;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 13px;
  outline: none;
  background: #0f1117;
  color: #e2e8f0;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #4b5563;
}

.dataTables_wrapper .dataTables_info {
  font-size: 12px;
  color: #4b5563;
  padding-top: 10px;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #94a3b8 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: #2563eb;
  color: #fff !important;
  border: 1px solid #2563eb;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #252836;
  color: #e2e8f0 !important;
  border: 1px solid #2d3448;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: #2d3448 !important;
  background: transparent;
  border: 1px solid transparent;
  cursor: default;
}

table.dataTable {
  border-collapse: collapse;
  width: 100% !important;
}

table.dataTable thead th {
  background: #252836;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  padding: 9px 10px;
  border-bottom: 2px solid #2d3448;
  white-space: nowrap;
}

table.dataTable thead th:nth-child(n+5),
table.dataTable tbody td:nth-child(n+5) {
  text-align: right;
}

table.dataTable thead th:hover { background: #2d3448; }

table.dataTable tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid #1f2235;
  white-space: nowrap;
  color: #e2e8f0;
  background: #1a1d27;
}

table.dataTable tbody tr:hover td { background: #1e2d45; }

table.dataTable tbody a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
}
table.dataTable tbody a:hover { text-decoration: underline; }

.stale  { color: #f87171; font-size: 12px; font-weight: 500; }
.fresh  { color: #4ade80; font-size: 12px; }
.yield-spread { color: #4b5563; font-size: 11px; margin-left: 3px; }

/* ── 모달 ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: #1a1d27;
  border: 1px solid #2d3448;
  border-radius: 12px;
  padding: 28px;
  max-width: 820px;
  width: 95%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: #252836;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: #2d3448; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  padding-right: 44px;
}

.btn-ai-analyze {
  flex-shrink: 0;
  padding: 6px 14px;
  background: #6d28d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-ai-analyze:hover { background: #5b21b6; }

#modal-content h2 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #f1f5f9;
}

#modal-content h2 small {
  font-size: 13px;
  color: #4b5563;
  font-weight: 400;
  margin-left: 6px;
}

.modal-meta {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 16px;
}

#modal-content h3 {
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  margin: 18px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

#modal-content h3 .unit {
  font-size: 12px;
  font-weight: 400;
  color: #4b5563;
  text-transform: none;
  letter-spacing: 0;
}

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

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.detail-table th,
.detail-table td {
  padding: 8px 12px;
  border: 1px solid #2d3448;
  text-align: right;
  color: #e2e8f0;
}

.detail-table th:first-child,
.detail-table td:first-child { text-align: left; }

.detail-table thead th {
  background: #252836;
  font-weight: 600;
  color: #94a3b8;
}

.detail-table .estimate-row td {
  background: #1e2d45;
}

.detail-table .stale-row td {
  color: #fbbf24;
  background: #2d1f06;
}

.detail-table .empty {
  text-align: center;
  color: #4b5563;
  padding: 16px;
}

/* ── 관심종목 ──────────────────────────────────────────── */

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: #2d3448;
  padding: 0;
  line-height: 1;
  transition: color 0.15s, transform 0.1s;
}
.star-btn:hover { color: #f59e0b; transform: scale(1.2); }
.star-btn.starred { color: #f59e0b; }

.watchlist-filter {
  margin-right: auto;
  padding: 4px 8px;
  background: #2d1f06;
  border: 1px solid #92400e;
  border-radius: 5px;
}
.watchlist-filter .filter-label {
  color: #fbbf24;
  font-weight: 600;
}
.watchlist-filter input[type="checkbox"] {
  accent-color: #f59e0b;
}

/* ── 피드백 ────────────────────────────────────────────── */

.feedback-btn {
  background: #252836;
  border: 1px solid #2d3448;
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.feedback-btn:hover { background: #2d3448; color: #e2e8f0; }

.feedback-modal {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0 0 16px 0;
}

.feedback-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding-right: 4px;
}

.feedback-item {
  background: #252836;
  border: 1px solid #2d3448;
  border-radius: 8px;
  padding: 12px 14px;
}

.feedback-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.feedback-author {
  font-size: 13px;
  font-weight: 600;
  color: #60a5fa;
}

.feedback-date {
  font-size: 12px;
  color: #64748b;
  flex: 1;
}

.feedback-delete {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.feedback-delete:hover { background: #2d1f1f; }

.feedback-content {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.feedback-loading,
.feedback-empty {
  color: #64748b;
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

.feedback-form-area {
  border-top: 1px solid #2d3448;
  padding-top: 14px;
}

.feedback-write {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-textarea {
  width: 100%;
  background: #252836;
  border: 1px solid #2d3448;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 14px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  box-sizing: border-box;
}
.feedback-textarea:focus {
  outline: none;
  border-color: #3b82f6;
}
.feedback-textarea::placeholder { color: #4b5563; }

.feedback-write-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.feedback-char-count {
  font-size: 12px;
  color: #64748b;
}

.feedback-login-prompt {
  text-align: center;
  padding: 12px 0 4px;
}

.btn-google-login {
  display: inline-block;
  background: #252836;
  border: 1px solid #2d3448;
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-google-login:hover { background: #2d3448; color: #e2e8f0; }

/* ── 반응형 ────────────────────────────────────────────── */

@media (max-width: 900px) {
  .filter-groups {
    flex-direction: column;
  }
  .filter-divider {
    width: auto;
    height: 1px;
    margin: 8px 0;
  }
  .filter-group {
    padding: 0;
  }
}
