* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
    color: #1f2937;
    background: #f3f4f6;
}

a {
    text-decoration: none;
    color: inherit;
}

.public-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.public-container {
    width: 100%;
    max-width: 480px;
    padding: 24px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08);
}

.login-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.login-header p {
    margin: 0 0 24px;
    color: #6b7280;
}

.login-form,
.form-panel form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.input {
    width: 100%;
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    background: #fff;
}

.validation-summary,
.field-validation {
    color: #dc2626;
    font-size: 13px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-outline {
    background: #fff;
    border-color: #cbd5e1;
    color: #334155;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.login-help {
    margin-top: 24px;
    font-size: 13px;
    color: #4b5563;
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
}

.admin-body {
    min-height: 100vh;
    background: #f8fafc;
}

.admin-header {
    height: 64px;
    background: #111827;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-badge {
    background: #374151;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 64px);
}

.admin-sidebar {
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 20px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 12px 14px;
    border-radius: 10px;
    color: #374151;
}

    .nav-item.active {
        background: #dbeafe;
        color: #1d4ed8;
        font-weight: 700;
    }

    .nav-item.disabled {
        background: #f8fafc;
        color: #94a3b8;
        cursor: default;
    }

.sidebar-note {
    margin-top: 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 13px;
    color: #4b5563;
}

.admin-content {
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

    .page-header h1 {
        margin: 0 0 6px;
        font-size: 28px;
    }

    .page-header p {
        margin: 0;
        color: #6b7280;
    }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.kpi-title {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
}

.panel {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    margin-bottom: 20px;
}

.panel-header {
    margin-bottom: 16px;
}

    .panel-header h2 {
        margin: 0;
        font-size: 20px;
    }

.table {
    width: 100%;
    border-collapse: collapse;
}

    .table th,
    .table td {
        padding: 12px 10px;
        border-bottom: 1px solid #e5e7eb;
        text-align: left;
        vertical-align: middle;
        font-size: 14px;
    }

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

    .status-badge.success {
        background: #dcfce7;
        color: #166534;
    }

    .status-badge.muted {
        background: #e5e7eb;
        color: #374151;
    }

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 600;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

.guide-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

    .form-actions.center {
        justify-content: center;
    }

.logout-form {
    margin: 0;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

    .toolbar-group .input {
        min-width: 180px;
        max-width: 260px;
    }

.toolbar-actions {
    display: flex;
    gap: 8px;
}

.tenant-grid {
    width: 100%;
    height: 620px;
}

.grid-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.grid-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}

.grid-inline-form {
    margin: 0;
}

.grid-delete-btn {
    min-height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.form-panel {
    max-width: 980px;
}

@media (max-width: 1024px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}


.subtle-text {
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
}

.form-group-span-2 {
    grid-column: span 2;
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-actions.split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.connection-result {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
}

    .connection-result.info {
        background: #eff6ff;
        color: #1d4ed8;
    }

    .connection-result.success {
        background: #dcfce7;
        color: #166534;
    }

    .connection-result.error {
        background: #fee2e2;
        color: #991b1b;
    }
