:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1b1a18;
  --muted: #6b6b63;
  --accent: #d9c2a6;
  --line: #e6e2db;
}
body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: linear-gradient(
    140deg,
    #f6f3ee 0%,
    #efe8dc 60%,
    #f6f3ee 100%
  );
  color: var(--ink);
}
.wrap {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px 60px;
}
header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}
.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
}
.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}
.auth-user img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.auth-actions {
  display: flex;
  gap: 8px;
}
h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.provider {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--line);
  width: fit-content;
}
.provider label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}
.layout {
  display: grid;
  grid-template-columns: 720px 1.3fr;
  gap: 18px;
  align-items: start;
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
th,
td {
  border-bottom: 1px solid var(--line);
  padding: 6px 6px;
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
#holdings th:nth-child(4),
#holdings td:nth-child(4),
#holdings th:nth-child(5),
#holdings td:nth-child(5),
#holdings th:nth-child(6),
#holdings td:nth-child(6),
#subtotalTable th:nth-child(2),
#subtotalTable td:nth-child(2),
#subtotalTable th:nth-child(3),
#subtotalTable td:nth-child(3) {
  text-align: right;
}
#holdings th:nth-child(6),
#holdings td:nth-child(6) {
  width: 105px;
}
#holdings th:nth-child(5),
#holdings td:nth-child(5) {
  width: 100px;
}
th {
  color: var(--muted);
  font-weight: 600;
  background: #faf8f4;
}
input[type="text"],
input[type="number"] {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  box-sizing: border-box;
  background: #faf9f6;
  color: #2a2824;
}
input[type="number"] {
  text-align: right;
}
textarea {
  width: 100%;
  border: 1px solid #e1ddd5;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  box-sizing: border-box;
  resize: vertical;
  min-height: 120px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  background: #faf9f6;
  color: #2a2824;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}
button.secondary,
button.ghost {
  background: var(--accent);
  color: #fff;
  border: none;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.total {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  font-size: 18px;
  font-weight: 700;
}
.error {
  color: #b91c1c;
  font-size: 13px;
}
.loading {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}
.side-card h2 {
  margin: 0 0 24px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.side-card table th,
.side-card table td {
  font-size: 13px;
}
#subtotalTable {
  width: 105%;
}
#subtotalTable th:first-child,
#subtotalTable td:first-child {
  width: 40%;
}
#subtotalTable th:nth-child(2),
#subtotalTable td:nth-child(2) {
  width: 18%;
  white-space: nowrap;
}
#subtotalTable th:nth-child(3),
#subtotalTable td:nth-child(3) {
  width: 28%;
  white-space: nowrap;
}
#subtotalTable th:nth-child(4),
#subtotalTable td:nth-child(4) {
  width: 12%;
  white-space: nowrap;
}
.chart {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}
.legend {
  margin-top: 24px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #1b1a18;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 9999;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  #subtotalTable {
    width: 100%;
  }
  #holdings th:nth-child(5),
  #holdings td:nth-child(5),
  #holdings th:nth-child(6),
  #holdings td:nth-child(6) {
    width: auto;
  }
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }
  thead {
    display: none;
  }
  tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
    overflow: hidden;
  }
  td {
    border: none;
    padding: 6px 4px;
    width: 100%;
  }
  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    display: block;
    margin-bottom: 4px;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .actions button,
  .actions textarea {
    width: 100%;
  }
  #subtotalTable td:nth-child(2),
  #subtotalTable td:nth-child(3),
  #subtotalTable td:nth-child(4) {
    text-align: right;
  }
  .toast {
    left: 50%;
    right: auto;
    bottom: 16px;
    transform: translate(-50%, 8px);
  }
  .toast.show {
    transform: translate(-50%, 0);
  }
}
.subtitle {
  font-size: 16px;
  color: var(--muted);
  margin: 8px 0 20px 0;
  line-height: 1.5;
}
.features, .how-to-use, .supported-stocks {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.features h2, .how-to-use h2, .supported-stocks h2 {
  margin: 0 0 24px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.features ul, .how-to-use ol {
  margin: 0;
  padding-left: 20px;
}
.features li, .how-to-use li {
  margin-bottom: 24px;
  line-height: 1.5;
  color: var(--ink);
  font-size: 14px;
}
.stock-cat.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.category {
  background: #faf8f4;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
}
.category h3 {
  margin: 0 0 24px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.category p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.seo-info {
  margin-top: 18px;
}
.info-section {
  margin-bottom: 24px;
}
.info-section h3 {
  margin: 0 0 24px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.info-section p, .info-section ul {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.info-section ul {
  padding-left: 16px;
}
.seo-content {
  margin-top: 24px;
}
.seo-content article {
  line-height: 1.6;
}
.seo-content h2 {
  margin: 0 0 24px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}
.seo-content h3 {
  margin: 24px 0 24px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.seo-content p {
  margin: 0 0 24px 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.admin-menu {
  display: none;
  justify-content: flex-end;
  margin-bottom: 14px;
  width: 100%;
}
.admin-menu.show {
  display: flex;
}
.admin-dashboard {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 24px;
}
.admin-dashboard.show {
  display: block;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}
.user-table th,
.user-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.user-table th {
  background: #faf8f4;
  font-weight: 600;
  color: var(--muted);
}
.user-actions {
  display: flex;
  gap: 8px;
}
.btn-small {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}
.btn-edit {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}
.btn-delete {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}
.btn-add {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}
.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-group input[type="checkbox"] {
  width: auto;
}
.admin-badge {
  background: #f59e0b;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
