:root {
    /* Design Tokens */
    --primary-color: #1E5149;
    --primary-lv-0: #e9eeed;
    --primary-lv-1: #D2DCDB;
    --primary-lv-8: #193833;
    --bg-default: #FFFFFF;
    --bg-muted: #F9FAFB;
    --text-main: #2D3748;
    --text-sub: #718096;
    --border-color: #E2E8F0;
    --hover-bg: #F7FAFC;
    --header-gradient: linear-gradient(90deg, #193833 0%, #1e5149 100%);
    --ai-gradient: linear-gradient(180deg, #da8cf1 0%, #8bb1f2 100%);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
    --space-xl: 64px;
    --radius-sm: 4px;
    --radius-lg: 8px;
    --fz-h1: 20px;
    --fz-h2: 16px;
    --fz-body: 13px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --box-shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', sans-serif;
    font-size: var(--fz-body);
    color: var(--text-main);
    background: var(--bg-default);
    min-height: 100vh;
}

/* 메일 관리자 전용: 전체 스크롤 방지 */
body:has(.mail-wrapper) {
    height: 100vh;
    overflow: hidden;
}

input, select, textarea, button {
    font-family: 'Pretendard', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

/* Layout Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Components: Topbar */
.topbar {
    width: 100%;
    background: var(--header-gradient);
    color: #fff;
    padding: 0 var(--space-lg);
    position: fixed;
    top: 0;
    height: 36px;
    display: flex;
    align-items: center;
    z-index: 1000;
}

.topbar-header {
    margin-right: 60px;
    font-weight: 700;
}

.topbar-header h2 {
    font-size: 16px;
    color: white;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: var(--space-sm);
}

.nav-item {
    padding: 4px 8px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    transition: 0.2s;
    font-size: 14px;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--primary-lv-1);
    color: #fff;
}

.nav-item.active {
    background: var(--primary-lv-0);
    color: var(--primary-color) !important;
    font-weight: 700;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--box-shadow-lg);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.modal-close {
    cursor: pointer;
    font-size: 20px;
}

/* Modal Form Elements */
.select-group {
    margin-bottom: 16px;
    text-align: left;
}

.select-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.modal-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    outline: none;
}

.modal-select:focus {
    border-color: var(--primary-color);
}

/* Data Tables inside Modals */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.data-table th {
    color: var(--text-sub);
    font-weight: 600;
    background: var(--bg-muted);
}

.data-table tr:hover {
    background: var(--hover-bg);
}

/* Utils: Buttons */
._button-xsmall {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
}

._button-small {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

._button-medium {
    padding: 10px 20px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
}

.btn-confirm {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

/* Spinner */
.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.badge {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}
