* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, Arial, sans-serif;
    background: #f4f7fb;
    color: #172033;
}

.wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.hero {
    width: 100%;
    max-width: 820px;
    padding: 56px 48px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(23, 32, 51, 0.08);
}

.badge {
    display: inline-block;
    margin: 0 0 18px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #1f5bd8;
    font-weight: 700;
    font-size: 14px;
}

h1 {
    margin: 0 0 18px;
    font-size: 42px;
    line-height: 1.2;
}

.desc {
    margin: 0;
    font-size: 18px;
    line-height: 1.7;
    color: #52607a;
}

@media (max-width: 768px) {
    .hero {
        padding: 36px 24px;
    }

    h1 {
        font-size: 30px;
    }

    .desc {
        font-size: 16px;
    }
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(23, 32, 51, 0.08);
    z-index: 10;
}

.topbar-inner {
    max-width: 1120px;
    height: 72px;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-inner strong {
    font-size: 20px;
}

.logout-btn {
    appearance: none;
    border: none;
    background: #172033;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    padding: 11px 18px;
    border-radius: 12px;
    cursor: pointer;
}

.logout-btn:hover {
    opacity: 0.92;
}

.dashboard-wrap {
    padding-top: 120px;
}

.login-page {
    background: #f4f7fb;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 44px 38px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(23, 32, 51, 0.08);
}

.login-card h1 {
    margin: 0 0 12px;
    font-size: 36px;
}

.login-form {
    margin-top: 28px;
    display: grid;
    gap: 18px;
}

.login-form label {
    display: grid;
    gap: 8px;
}

.login-form span {
    font-weight: 700;
    color: #26324a;
}

.login-form input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid #d7dfeb;
    border-radius: 14px;
    font-size: 16px;
    background: #ffffff;
}

.login-form input:focus {
    outline: 2px solid #2e6cff;
    border-color: transparent;
}

.login-form button {
    height: 56px;
    border: none;
    border-radius: 14px;
    background: #1f5bd8;
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
}

.login-form button:hover {
    opacity: 0.95;
}

.alert-wrap {
    margin-top: 20px;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.5;
}

.alert-error {
    background: #fff1f1;
    color: #c62828;
    border: 1px solid #f3c7c7;
}

@media (max-width: 768px) {
    .topbar-inner {
        padding: 0 18px;
    }

    .login-card {
        padding: 34px 22px;
    }

    .login-card h1 {
        font-size: 30px;
    }
}

.page-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 40px 28px 80px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
}

.topbar h1 {
    margin: 6px 0 0;
    font-size: 38px;
}

.eyebrow {
    margin: 0;
    color: #2563eb;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.04em;
}

.top-actions {
    display: flex;
    gap: 10px;
}

.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: #ffffff;
    color: #172033;
    text-decoration: none;
    font-weight: 700;
}

.panel {
    background: #ffffff;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(23, 32, 51, 0.06);
}

.panel-head {
    margin-bottom: 22px;
}

.panel-head h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.panel-head p {
    margin: 0;
    color: #64748b;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

.data-table th,
.data-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: #64748b;
    font-size: 14px;
    font-weight: 800;
}

.data-table td {
    font-size: 15px;
}

.table-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 800;
}

.status,
.level {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-running {
    background: #fef3c7;
    color: #92400e;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.level-must_write {
    background: #dbeafe;
    color: #1d4ed8;
}

.level-recommended {
    background: #dcfce7;
    color: #166534;
}

.level-watch {
    background: #fef3c7;
    color: #92400e;
}

.level-skip {
    background: #e5e7eb;
    color: #374151;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.summary-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 16px 40px rgba(23, 32, 51, 0.05);
}

.summary-card span {
    display: block;
    margin-bottom: 10px;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
}

.summary-card strong {
    font-size: 28px;
    color: #172033;
}

.empty-cell {
    text-align: center;
    color: #64748b;
    padding: 40px 20px !important;
}

@media (max-width: 960px) {
    .topbar {
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 28px 16px 60px;
    }

    .topbar h1 {
        font-size: 30px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Keyword Pilot Dashboard Layout
========================================================= */

.pilot-body {
    margin: 0;
    background: #f3f6fb;
    color: #162033;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Pretendard, "Noto Sans KR", Arial, sans-serif;
}

.dashboard-shell {
    width: min(1280px, calc(100% - 48px));
    margin: 0 auto;
    padding: 42px 0 80px;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 30px;
}

.dashboard-kicker {
    margin: 0 0 10px;
    color: #2563eb;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.dashboard-title {
    margin: 0;
    font-size: 42px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.dashboard-subtitle {
    margin: 14px 0 0;
    color: #66758f;
    font-size: 17px;
    line-height: 1.6;
}

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

.outline-button {
    height: 46px;
    padding: 0 20px;
    border: 1px solid #d7e0ee;
    border-radius: 14px;
    background: #ffffff;
    color: #162033;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
}

.outline-button:hover {
    transform: translateY(-1px);
    border-color: #b8c7de;
    box-shadow: 0 8px 24px rgba(22, 32, 51, 0.08);
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.dashboard-panel {
    width: 100%;
    padding: 30px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 20px 55px rgba(22, 32, 51, 0.08);
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.panel-title-row h2 {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.panel-title-row p {
    margin: 0;
    color: #6b7890;
    font-size: 15px;
}

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

.pilot-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

.pilot-table th,
.pilot-table td {
    padding: 18px 16px;
    border-bottom: 1px solid #e9eef6;
    text-align: left;
    vertical-align: middle;
    font-size: 15px;
}

.pilot-table th {
    color: #64748b;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.pilot-table tbody tr:hover {
    background: #f8fbff;
}

.keyword-cell {
    font-weight: 800;
    color: #111827;
}

.score-cell {
    font-weight: 900;
    color: #111827;
}

.action-cell {
    white-space: nowrap;
}

.text-link {
    color: #2563eb;
    font-weight: 800;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.status-badge,
.level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-running {
    background: #fef3c7;
    color: #92400e;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.level-must_write {
    background: #dbeafe;
    color: #1d4ed8;
}

.level-recommended {
    background: #dcfce7;
    color: #166534;
}

.level-watch {
    background: #fef3c7;
    color: #92400e;
}

.level-skip {
    background: #e5e7eb;
    color: #374151;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card {
    min-height: 126px;
    padding: 24px;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 16px 42px rgba(22, 32, 51, 0.07);
}

.metric-card span {
    display: block;
    margin-bottom: 14px;
    color: #697890;
    font-size: 14px;
    font-weight: 800;
}

.metric-card strong {
    display: block;
    font-size: 30px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.empty-row {
    padding: 42px 16px !important;
    text-align: center !important;
    color: #738099;
}

@media (max-width: 1024px) {
    .dashboard-shell {
        width: min(100% - 32px, 1280px);
        padding-top: 28px;
    }

    .dashboard-header {
        flex-direction: column;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-title {
        font-size: 36px;
    }
}

@media (max-width: 640px) {
    .dashboard-shell {
        width: calc(100% - 24px);
        padding: 22px 0 50px;
    }

    .dashboard-title {
        font-size: 30px;
    }

    .dashboard-subtitle {
        font-size: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-panel {
        padding: 20px;
        border-radius: 22px;
    }

    .panel-title-row h2 {
        font-size: 22px;
    }
}

/* =========================================================
   Analyze Form
========================================================= */

.analyze-panel {
    margin-bottom: 24px;
}

.analyze-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.analyze-input-wrap {
    flex: 1;
}

.analyze-input-wrap label {
    display: block;
    margin-bottom: 10px;
    color: #334155;
    font-size: 14px;
    font-weight: 800;
}

.analyze-input-wrap input {
    width: 100%;
    height: 54px;
    padding: 0 18px;
    border: 1px solid #d8e1ee;
    border-radius: 16px;
    background: #ffffff;
    color: #162033;
    font-size: 17px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.analyze-input-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.primary-button {
    height: 54px;
    padding: 0 24px;
    border: none;
    border-radius: 16px;
    background: #2563eb;
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    background: #1d4ed8;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.flash-wrap {
    margin-bottom: 18px;
}

.flash-message {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 768px) {
    .analyze-form {
        flex-direction: column;
        align-items: stretch;
    }

    .primary-button {
        width: 100%;
    }
}
