@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

/* ===== Reset / Base ===== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
    color: #0f172a;
    background:
        radial-gradient(circle at 15% 20%, rgba(37,99,235,0.08) 0%, transparent 26%),
        radial-gradient(circle at 85% 0%, rgba(16,185,129,0.08) 0%, transparent 20%),
        linear-gradient(135deg, #eef2f7 0%, #f8fafc 100%);
    min-height: 100vh;
}

body,
button,
input,
select,
textarea,
table,
th,
td,
a,
div,
span,
p,
h1,
h2,
h3,
h4,
h5,
h6,
label {
    font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
}

a {
    color: inherit;
}

h1, h2, h3, h4, h5, h6, p {
    margin-top: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* ===== Layout ===== */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    background:
        radial-gradient(circle at top right, rgba(255,255,255,0.08) 0%, transparent 24%),
        linear-gradient(180deg, #0f172a 0%, #13213f 45%, #0f1b36 100%);
    color: #fff;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.06);
    height: 100vh;
    min-height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 170px;
}

.brand-card {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
    padding: 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    font-weight: 900;
    letter-spacing: -0.5px;
    box-shadow: 0 10px 20px rgba(37,99,235,0.28);
    flex-shrink: 0;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.72);
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.nav-section-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    font-weight: 800;
    padding: 10px 10px 4px;
    letter-spacing: 0.2px;
}

.nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    text-decoration: none;
    color: rgba(255,255,255,0.88);
    font-size: 14px;
    font-weight: 700;
    transition: background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    transform: translateY(-1px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(59,130,246,0.28) 0%, rgba(37,99,235,0.22) 100%);
    border: 1px solid rgba(96,165,250,0.2);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.sidebar-bottom {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
}

.profile-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.profile-name {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 6px;
}

.profile-meta,
.profile-role {
    font-size: 13px;
    color: rgba(255,255,255,0.72);
    line-height: 1.6;
}

.logout-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 14px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.16);
    transform: translateY(-1px);
}

.main-content {
    min-width: 0;
    padding: 28px 28px 36px;
}

.page-header {
    margin-bottom: 18px;
}

.page-title {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: -0.7px;
    color: #0f172a;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 14px;
    color: #64748b;
    line-height: 1.7;
}

/* ===== Cards ===== */
.card {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(148,163,184,0.18);
    box-shadow: 0 18px 36px rgba(15,23,42,0.08);
    border-radius: 24px;
    padding: 22px;
}

.meta-text {
    color: #64748b;
    font-size: 13px;
    line-height: 1.7;
}

/* ===== Toast Popup ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-message {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 480px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    border: 1px solid transparent;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    animation: toast-in 0.35s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-message.toast-hide {
    opacity: 0;
    transform: translateX(30px);
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.toast-text {
    flex: 1;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    padding: 0 0 0 8px;
    line-height: 1;
    color: inherit;
}

.toast-close:hover {
    opacity: 1;
}

.toast-message.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.toast-message.success .toast-icon {
    background: #047857;
}

.toast-message.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.toast-message.error .toast-icon {
    background: #b91c1c;
}

.toast-message.warning {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}

.toast-message.warning .toast-icon {
    background: #c2410c;
}

.toast-message.info,
.toast-message.message {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.toast-message.info .toast-icon,
.toast-message.message .toast-icon {
    background: #1d4ed8;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="file"],
input[type="time"],
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #fff;
    color: #0f172a;
    padding: 0 14px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="time"],
select {
    height: 44px;
}

input[type="file"] {
    height: 44px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
    font-size: 14px;
    color: #334155;
}

input[type="file"]::file-selector-button {
    height: 30px;
    margin-right: 12px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

input[type="file"]::file-selector-button:hover {
    background: #eef2f7;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

input[type="file"]::-webkit-file-upload-button {
    height: 30px;
    margin-right: 12px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

input[type="file"]::-webkit-file-upload-button:hover {
    background: #eef2f7;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

textarea {
    min-height: 110px;
    padding-top: 12px;
    padding-bottom: 12px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

input[type="file"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

button {
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
    box-shadow: 0 14px 24px rgba(37,99,235,0.18);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(37,99,235,0.22);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.danger-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 14px 24px rgba(220,38,38,0.16);
}

.summary-box {
    min-width: 120px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
}

.checkbox-inline input {
    width: 16px;
    height: 16px;
}

/* ===== Table ===== */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

thead th {
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

tbody tr:hover {
    background: rgba(248,250,252,0.7);
}

/* ===== Pagination ===== */
.pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-link,
.page-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
}

.page-link {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

.page-link:hover {
    background: #f8fafc;
}

.page-current {
    background: #eff6ff;
    color: #1d4ed8;
}

/* ===== Status ===== */
.status-approved,
.status-active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: 11px;
    font-weight: 800;
}

.status-second,
.status-inactive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
}

.empty-box {
    padding: 32px 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
}

/* ===== 모바일 햄버거 / 닫기 버튼 (데스크탑에서는 숨김) ===== */
.mobile-menu-btn,
.mobile-close-btn {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    /* 사이드바: 모바일에서는 숨기고 햄버거로 토글 */
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        min-height: 100vh;
        z-index: 1000;
        border-right: none;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    /* 오버레이 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.open {
        display: block;
    }

    /* 햄버거 버튼 */
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 998;
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 12px;
        background: #1d4ed8;
        cursor: pointer;
        align-items: center;
        box-shadow: 0 4px 12px rgba(29,78,216,0.3);
    }

    .mobile-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: #fff;
        border-radius: 2px;
    }

    /* 닫기 버튼 */
    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 10px;
        background: rgba(255,255,255,0.12);
        color: #fff;
        font-size: 22px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .main-content {
        padding: 20px;
        padding-top: 72px;
    }

    .page-header {
        margin-top: 0;
    }
}

@media (max-width: 760px) {
    .card {
        border-radius: 20px;
        padding: 18px;
    }

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

    .page-title {
        font-size: 24px;
    }

    .main-content {
        padding: 16px;
        padding-top: 72px;
    }
}