/* ========== Reset ========== */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { 
    font-family: 'Pretendard', system-ui, -apple-system, Segoe UI, Roboto, Arial; 
    color: #0f172a; 
    background: #fbfbfd; 
    letter-spacing: -0.2px; 
}

/* ========== Layout ========== */
.app {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.sidebar {
    background: #fff7dc;
    border-right: 1px solid #f2e8bf;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100vh;
    position: relative;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: #fff7dc;
    border: none;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    border-radius: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.sidebar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #0f172a;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.content {
    background: #ffffff;
    height: 100vh;
    overflow-y: auto;
    padding: 18px 22px;
}

/* ========== Brand ========== */
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 14px;
}
.brand-logo { width: 18px; height: 18px; }

/* ========== Profile ========== */
.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
    text-decoration: none;
    color: inherit;
    cursor: default !important;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #d4d4d8;
    flex-shrink: 0;
}

.profile-info .name { font-weight: 700; font-size: 13px; }


/* ========== Menu ========== */
.menu,
.menu-secondary {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-secondary {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
}

.menu-item.active,
.menu-item:hover {
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}

/* button 태그 menu-item — a 태그와 완전히 동일한 크기/스타일 */
.menu-item-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    /* 브라우저 button 기본값 제거 */
    margin: 0;
    padding: 9px 10px;        /* .menu-item과 동일 */
    font-size: 14px;          /* .menu-item과 동일 */
    font-family: inherit;
    line-height: 1.4;
    box-sizing: border-box;
    color: #334155;
    -webkit-appearance: none;
    appearance: none;
}

/* ========== Page Header ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.3px;
}

/* ========== Card ========== */
.card {
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(17,24,39,0.04);
}

.card + .card { margin-top: 12px; }

.card h2 {
    margin: 0 0 14px 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

/* ========== Form ========== */
.form-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 14px; 
}

.form-field { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}

.form-field label { 
    font-size: 13px; 
    color: #6b7280; 
}

.form-field input, 
.form-field select, 
.form-field textarea { 
    padding: 10px; 
    border: 1px solid #e5e7eb; 
    border-radius: 10px; 
}

.form-field textarea { min-height: 100px; }

/* ========== Button ========== */
.btn { 
    border: 1px solid #e5e7eb; 
    background: #f9fafb; 
    padding: 8px 12px; 
    border-radius: 10px; 
    cursor: pointer; 
    line-height: 1; 
}

.btn.primary { 
    background: #2563eb; 
    color: #fff; 
    border-color: #2563eb; 
}

/* ========== Badge ========== */
.badge { 
    display: inline-block; 
    border-radius: 8px; 
    padding: 4px 8px; 
    font-size: 12px; 
}

.badge.green { background: #dcfce7; color: #166534; }
.badge.purple { background: #ede9fe; color: #6d28d9; }
.badge.gray { background: #eef2f7; color: #334155; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.blue { background: #e0f2fe; color: #2563eb; }

/* ========== 모바일 상단 바 ========== */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: #fff7dc;
    border-bottom: 1px solid #f2e8bf;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.mobile-topbar-brand {
    font-weight: 800;
    font-size: 15px;
    color: #0f172a;
    letter-spacing: -0.3px;
}

.mobile-menu-btn {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(0,0,0,0.06);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #0f172a;
    border-radius: 2px;
    transition: all 0.25s ease;
}

/* ========== Responsive — 768px 이하 (모바일) ========== */
/* 포스기(1024px)에서는 사이드바 유지, 모바일에서만 숨김 */
@media (max-width: 768px) {
    .mobile-topbar { display: flex; }

    .app {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 260px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid #f2e8bf;
        z-index: 1050;
        overflow-y: auto;
        padding-top: 16px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.12);
    }

    .sidebar.open { transform: translateX(0); }

    .content {
        margin-left: 0;
        padding: 12px 14px;
        padding-top: 64px;      /* mobile topbar 52px + 여백 12px */
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
    }

    .page-header { margin-bottom: 12px; }
    .page-header h1 { font-size: 18px; }

    .card { padding: 12px 14px; border-radius: 12px; }
    .card h2 { font-size: 15px; margin-bottom: 10px; }
    .card + .card { margin-top: 10px; }

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

    .form-field input,
    .form-field select,
    .form-field textarea {
        padding: 10px 12px;
        font-size: 16px;        /* iOS 자동 확대 방지 */
    }

    .btn { padding: 10px 14px; font-size: 14px; }
}

/* ========== Responsive — 480px 이하 (소형 모바일) ========== */
@media (max-width: 480px) {
    .content { padding: 10px 12px; padding-top: 64px; }
    .page-header h1 { font-size: 16px; }
    .card { padding: 10px 12px; }
}

/* ========== 4:3 포스기 최적화 (769px ~ 1280px) ========== */
@media (min-width: 769px) and (max-width: 1280px) {
    .content { padding: 14px 18px; }
    .page-header { margin-bottom: 14px; }
    .card { padding: 14px; }
    .form-grid { gap: 10px; }
    .form-field input,
    .form-field select,
    .form-field textarea { padding: 8px 10px; }
}

