@import url("https://fonts.googleapis.com/css2?family=Sunflower:wght@300;500;700&family=Josefin+Sans:wght@400;500;600&display=swap");
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css");

:root {
    color-scheme: light;
    --ink: #222222;
    --ink-2: #3b3b3b;
    --muted: #767676;
    --muted-2: #9a9a9a;
    --border: #e6e6e6;
    --border-strong: #ddd;
    --paper: #ffffff;
    --paper-soft: #fbfbfb;
    --paper-sunken: #f4f4f4;
    --accent-green: #86db76;
    --accent-green-fg: #3f7a34;
    --accent-green-bg: #ecf8e9;
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Malgun Gothic",
        sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 14px;
}

.display {
    font-family: "Sunflower", "Pretendard Variable", sans-serif;
    font-weight: 700;
}

.label {
    font-size: 11.5px;
    color: var(--muted);
}

.app-loading,
.panel-loading,
.panel-error {
    padding: 48px;
    text-align: center;
    color: var(--muted);
}

.panel-error {
    color: #b3572f;
}

.form-error {
    color: #b3572f;
    font-size: 12px;
}

/* ---------- Login ---------- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper-sunken);
}

.login-card {
    width: 320px;
    background: var(--paper);
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-title {
    font-size: 20px;
    font-weight: 600;
    font-family: "Sunflower", sans-serif;
}

.login-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.login-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

.login-card input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--paper-soft);
    color: var(--ink);
}

.login-error {
    color: #b3572f;
    font-size: 13px;
}

.login-card button {
    margin-top: 8px;
    padding: 11px;
    border-radius: 999px;
    background: var(--ink-2);
    color: #fff;
    border: none;
    cursor: pointer;
}

/* ---------- App shell ---------- */
.app-shell {
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
}

.app-title {
    font-size: 18px;
    color: var(--ink);
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-user-email {
    font-size: 13px;
    color: var(--muted);
}

.tab-nav {
    display: flex;
    gap: 6px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
}

.tabs {
    display: inline-flex;
    gap: 6px;
    background: var(--paper-sunken);
    padding: 4px;
    border-radius: 999px;
}

.tab-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    border-radius: 999px;
}

.tab-btn.active {
    background: var(--ink-2);
    color: #fff;
}

.app-main {
    padding: 32px;
    max-width: 1520px;
    margin: 0 auto;
}

/* ---------- Two-column review workspace (gallery + analysis engine) ---------- */
.review-split {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
    gap: 24px;
    align-items: start;
}

.review-gallery {
    min-width: 0;
}

.cluster-analysis-panel {
    position: sticky;
    top: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

@media (max-width: 1100px) {
    .review-split {
        grid-template-columns: 1fr;
    }
    .cluster-analysis-panel {
        position: static;
        max-height: none;
    }
}

/* ---------- Panel ---------- */
.panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.panel-title {
    font-size: 17px;
    font-weight: 500;
    color: var(--ink);
}

/* ---------- Buttons (pill) ---------- */
.btn {
    background: var(--paper);
    color: var(--ink-2);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn:hover {
    background: var(--paper-sunken);
}

.btn-solid {
    background: var(--ink-2);
    color: #fff;
    border-color: var(--ink-2);
}

.btn-solid:hover {
    background: #262626;
}

.btn-gray {
    background: var(--muted);
    color: #fff;
    border-color: var(--muted);
}

.btn-gray:hover {
    background: #6a6a6a;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ---------- Report cards (Panel 1) ---------- */
.report-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-card {
    border: 1px solid var(--border);
    background: var(--paper);
    border-radius: 16px;
    overflow: hidden;
}

.report-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
    background: var(--paper-soft);
}

.report-user {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.report-nickname {
    font-family: "Sunflower", sans-serif;
    font-weight: 500;
    font-size: 15px;
    color: var(--ink);
}

.report-email {
    font-size: 12px;
    color: var(--muted);
}

.report-email.none {
    color: var(--muted-2);
}

.swatch {
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    background: var(--paper-sunken);
}

/* ---------- Image gallery (replaces the old row list) ---------- */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    padding: 16px 20px;
}

.image-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--paper);
    display: flex;
    flex-direction: column;
}

.image-card-selected {
    outline: 2px solid var(--ink-2);
    outline-offset: -2px;
}

.image-card-thumb-wrap {
    position: relative;
}

.image-card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--paper-sunken);
    cursor: zoom-in;
}

.image-card-select {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.image-card-select input {
    width: 15px;
    height: 15px;
    accent-color: var(--ink-2);
    cursor: pointer;
}

.image-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.image-card-body .cluster-status {
    margin-top: 2px;
}

.image-card-body .row-actions {
    margin-top: 6px;
}

/* ---------- Lightbox ---------- */
.lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 40px;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.image-subject {
    font-size: 13.5px;
    color: var(--ink);
}

.image-location {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

.image-code {
    font-size: 10px;
    color: var(--muted-2);
    margin-top: 2px;
}

.cluster-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.status-chip {
    font-size: 11.5px;
    padding: 4px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

.status-chip.assigned {
    background: var(--accent-green-bg);
    color: var(--accent-green-fg);
}

.status-chip.pending {
    background: var(--paper-sunken);
    color: var(--muted);
    border: 1px solid var(--border-strong);
}

.status-chip.rejected {
    background: var(--paper-sunken);
    color: var(--muted-2);
    text-decoration: line-through;
}

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

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
}

/* ---------- Candidate table (Panel 2) ---------- */
.table-scroll {
    overflow-x: auto;
}

.candidate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.candidate-table th {
    text-align: left;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-strong);
}

.candidate-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.candidate-table tr:hover td {
    background: var(--paper-soft);
}

.cand-name-cell {
    display: flex;
    align-items: center;
    gap: 9px;
}

.status-pill {
    font-size: 10.5px;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.status-pill.exploring {
    background: var(--paper-sunken);
    color: var(--muted);
}

.status-pill.verifying {
    background: var(--paper-sunken);
    color: var(--ink-2);
    border: 1px solid var(--border-strong);
}

.status-pill.candidate {
    background: var(--ink-2);
    color: #fff;
}

.status-pill.promoted {
    background: var(--accent-green-bg);
    color: var(--accent-green-fg);
}

.status-pill.rejected {
    background: var(--paper-sunken);
    color: var(--muted-2);
}

.cand-name {
    font-family: "Sunflower", sans-serif;
    font-weight: 500;
    color: var(--ink);
}

.cand-num {
    color: var(--ink-2);
}

.cand-principle {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Principle list (Panel 3) ---------- */
.principle-list {
    border-top: 1px solid var(--border-strong);
}

.principle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.principle-row .code {
    font-weight: 600;
    margin-right: 8px;
    color: var(--ink);
}

.status-toggle {
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    padding: 4px 13px;
    cursor: pointer;
    font-size: 11.5px;
}

.status-toggle.on {
    background: var(--accent-green-bg);
    color: var(--accent-green-fg);
    border-color: transparent;
}

.status-toggle.off {
    background: var(--paper);
    color: var(--muted);
}

/* ---------- Dialog ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(34, 34, 34, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}

.modal {
    background: var(--paper);
    width: 100%;
    max-width: 600px;
    max-height: 86vh;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border);
}

.modal-head h2 {
    font-family: "Sunflower", sans-serif;
    font-weight: 500;
    font-size: 18px;
    margin: 0;
    color: var(--ink);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--muted);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-section-title {
    font-size: 12px;
    color: var(--muted);
}

.modal-hint {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
    background: var(--paper-soft);
    border-radius: 10px;
    padding: 10px 13px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 24px 20px;
    border-top: 1px solid var(--border);
}

/* cluster checklist */
.check-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 13px;
}

.check-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.check-item-code {
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
}

.check-item-title {
    color: var(--muted);
    font-size: 12.5px;
}

.check-item-fields {
    display: flex;
    gap: 8px;
    margin-top: 9px;
}

.check-item-fields input {
    flex: 1;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--paper);
}

.check-item-fields input:first-child {
    max-width: 88px;
    flex: none;
}

.badge-subtle {
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 1px 8px;
    margin-left: auto;
}

.quick-add-cluster {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.quick-add-cluster input {
    padding: 8px 11px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--paper-soft);
}

/* promote / general fields */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12px;
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--paper-soft);
    color: var(--ink);
    font-family: inherit;
}

.field textarea {
    resize: vertical;
    min-height: 64px;
}

/* ---------- Analysis panel ---------- */
.selected-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
}

.selected-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.selected-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.analysis-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.analysis-card {
    display: flex;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.analysis-card-column {
    flex-direction: column;
}

.analysis-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--paper-sunken);
}

.analysis-thumb-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.analysis-thumb-sm {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--paper-sunken);
}

.analysis-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.analysis-match {
    display: flex;
}

.analysis-reason {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.5;
}

/* sheet paste helper */
.sheet-paste-block {
    background: var(--paper-sunken);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sheet-paste-label {
    font-size: 12px;
    color: var(--muted);
}

.sheet-paste-text {
    font-family: "Pretendard Variable", sans-serif;
    font-size: 12.5px;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--ink);
    line-height: 1.6;
}

.done-banner {
    background: var(--accent-green-bg);
    color: var(--accent-green-fg);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px;
}

/* image grid inside dialogs */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}

.image-grid .swatch {
    width: 100%;
    height: 70px;
}

.image-grid figcaption {
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
}

.image-grid figure {
    margin: 0;
}

/* 리포트 머리의 등재 결정 영역 (2026-10-27) */
.report-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
