/* ===================================================
   ROUNZ PB 디자인 토큰 + 레이아웃 + 컴포넌트
   Phase 0.5
   =================================================== */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800;900&family=Noto+Sans+KR:wght@400;500;600;700;800;900&display=swap');

:root {
    /* ----- 컬러 ----- */
    --pb-bg:           #f7f6f3;
    --pb-surface:      #ffffff;
    --pb-surface-2:    #fafaf8;
    --pb-ink:          #0f1419;
    --pb-text:         #1a1d23;
    --pb-text-soft:    #6b7280;
    --pb-text-mute:    #9ca3af;
    --pb-line:         #e7e5e0;
    --pb-line-soft:    #f0eeea;
    --pb-line-strong:  #d4d2cc;
    --pb-accent:       #1729EC;
    --pb-accent-soft:  #eff1ff;
    --pb-error:        #dc2626;
    --pb-error-soft:   #fef2f2;
    --pb-success:      #059669;
    --pb-warning-soft: #fef3c7;

    /* ----- 라운드 ----- */
    --pb-r-xs: 6px;
    --pb-r-sm: 8px;
    --pb-r-md: 12px;
    --pb-r-lg: 16px;
    --pb-r-xl: 22px;

    /* ----- 그림자 ----- */
    --pb-shadow-card: 0 1px 2px rgba(15,20,25,0.04),
                      0 8px 24px rgba(15,20,25,0.05);
    --pb-shadow-card-hover: 0 1px 2px rgba(15,20,25,0.06),
                            0 12px 32px rgba(15,20,25,0.08);
    --pb-shadow-focus: 0 0 0 4px rgba(23,41,236,0.12);

    /* ----- 트랜지션 ----- */
    --pb-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --pb-t-fast: 120ms var(--pb-ease);
    --pb-t-base: 180ms var(--pb-ease);
    --pb-t-slow: 280ms var(--pb-ease);

    /* ----- 레이아웃 ----- */
    --pb-header-h: 56px;
    --pb-sidebar-w: 240px;
    --pb-content-max: 1280px;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: 'Noto Sans KR', 'Pretendard', 'Montserrat', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', sans-serif;
    background: var(--pb-bg);
    color: var(--pb-text);
    font-size: 15.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

/* ===================================================
   레이아웃 — 헤더 + 사이드바 + 본문
   =================================================== */

body.pb-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ----- 글로벌 헤더 ----- */
.pb-header {
    height: var(--pb-header-h);
    background: var(--pb-surface);
    border-bottom: 1px solid var(--pb-line-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
}
.pb-header__left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.pb-header__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pb-header__menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: var(--pb-r-sm);
    color: var(--pb-text);
    transition: var(--pb-t-fast);
}
.pb-header__menu-toggle:hover { background: var(--pb-line-soft); }

.pb-brand {
    display: flex;
    align-items: baseline;
    gap: 7px;
}
.pb-brand__name {
    font-family: 'Montserrat', 'Noto Sans KR', sans-serif;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--pb-accent);
    line-height: 1;
}
.pb-brand__suffix {
    font-family: 'Montserrat', 'Noto Sans KR', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--pb-ink);
    letter-spacing: 0.4px;
    line-height: 1;
}

.pb-header__user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
.pb-header__store {
    font-weight: 600;
    color: var(--pb-text);
}
.pb-header__role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-left: 4px;
}
.pb-header__role-badge--master {
    background: var(--pb-ink);
    color: #fff;
}
.pb-header__role-badge--group-master {
    background: var(--pb-accent-soft);
    color: var(--pb-accent);
}
.pb-header__role-badge--partner {
    background: var(--pb-line-soft);
    color: var(--pb-text-soft);
}

/* ----- 셸 (사이드바 + 본문) ----- */
.pb-shell {
    flex: 1;
    display: flex;
    min-height: calc(100vh - var(--pb-header-h));
}

/* ----- 사이드바 ----- */
.pb-sidebar {
    width: var(--pb-sidebar-w);
    background: var(--pb-surface);
    border-right: 1px solid var(--pb-line-soft);
    padding: 20px 14px;
    flex-shrink: 0;
    position: sticky;
    top: var(--pb-header-h);
    height: calc(100vh - var(--pb-header-h));
    overflow-y: auto;
}

.pb-nav__section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--pb-text-mute);
    letter-spacing: 1px;
    padding: 4px 12px 10px;
}

.pb-nav__list { display: flex; flex-direction: column; gap: 2px; }

.pb-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--pb-r-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--pb-text);
    transition: var(--pb-t-fast);
    cursor: pointer;
    line-height: 1.3;
}
.pb-nav__item:hover {
    background: var(--pb-line-soft);
}
.pb-nav__item.is-active {
    background: var(--pb-ink);
    color: #fff;
    font-weight: 600;
}
.pb-nav__item.is-active .pb-nav__icon { color: #fff; }

.pb-nav__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--pb-text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pb-nav__label { flex: 1; }
.pb-nav__badge {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--pb-accent);
    color: #fff;
}
.pb-nav__badge--soon {
    background: var(--pb-line);
    color: var(--pb-text-soft);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: -0.2px;
}
.pb-nav__item.is-active .pb-nav__badge--soon {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.75);
}

.pb-nav__divider {
    height: 1px;
    background: var(--pb-line-soft);
    margin: 14px 8px;
}

/* ----- 본문 ----- */
.pb-main {
    flex: 1;
    padding: 32px;
    min-width: 0; /* flex 자식 overflow 방지 */
}
.pb-main__inner {
    max-width: var(--pb-content-max);
    margin: 0 auto;
}

/* ----- 모바일 백드롭 ----- */
.pb-backdrop {
    display: none;
    position: fixed;
    inset: var(--pb-header-h) 0 0 0;
    background: rgba(15, 20, 25, 0.4);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--pb-t-base);
}
.pb-backdrop.is-visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ===================================================
   페이지 헤더 (공통)
   =================================================== */

.pb-page__header {
    margin-bottom: 28px;
}
.pb-page__eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--pb-accent);
    letter-spacing: 0.6px;
    background: var(--pb-accent-soft);
    padding: 4px 10px;
    border-radius: 99px;
    margin-bottom: 14px;
}
.pb-page__title {
    font-size: 28px;
    font-weight: 800;
    color: var(--pb-ink);
    letter-spacing: -0.8px;
    margin: 0 0 8px;
    line-height: 1.25;
}
.pb-page__desc {
    font-size: 15px;
    color: var(--pb-text-soft);
    margin: 0;
    line-height: 1.55;
}

/* ===================================================
   카드 그리드 — 홈 화면 빠른 액션
   =================================================== */

.pb-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.pb-quick-card {
    background: var(--pb-surface);
    border: 1px solid var(--pb-line-soft);
    border-radius: var(--pb-r-lg);
    padding: 22px 22px 20px;
    transition: var(--pb-t-base);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}
.pb-quick-card:hover {
    border-color: var(--pb-line-strong);
    box-shadow: var(--pb-shadow-card-hover);
    transform: translateY(-1px);
}

.pb-quick-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--pb-r-md);
    background: var(--pb-accent-soft);
    color: var(--pb-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.pb-quick-card__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--pb-ink);
    letter-spacing: -0.3px;
}
.pb-quick-card__desc {
    font-size: 13px;
    color: var(--pb-text-soft);
    line-height: 1.5;
    margin-top: 2px;
}
.pb-quick-card__arrow {
    position: absolute;
    top: 22px;
    right: 22px;
    color: var(--pb-text-mute);
    transition: var(--pb-t-fast);
}
.pb-quick-card:hover .pb-quick-card__arrow {
    color: var(--pb-ink);
    transform: translateX(2px);
}

/* ===================================================
   공통 컴포넌트 (Phase 0에서 이어받음)
   =================================================== */

.pb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--pb-r-md);
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    transition: var(--pb-t-fast);
    user-select: none;
}

.pb-btn--primary {
    background: var(--pb-ink);
    color: #fff;
    width: 100%;
    padding: 16px 20px;
}
.pb-btn--primary:hover { background: #1f252e; }
.pb-btn--primary:active { transform: scale(0.99); }
.pb-btn--primary:disabled {
    background: var(--pb-line);
    color: var(--pb-text-mute);
    cursor: not-allowed;
}

.pb-btn--ghost {
    background: transparent;
    color: var(--pb-text-soft);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--pb-r-sm);
}
.pb-btn--ghost:hover {
    color: var(--pb-ink);
    background: var(--pb-line-soft);
}

.pb-input {
    width: 100%;
    padding: 16px 16px;
    background: var(--pb-surface);
    border: 1.5px solid var(--pb-line);
    border-radius: var(--pb-r-md);
    font-size: 15px;
    color: var(--pb-text);
    transition: var(--pb-t-fast);
    outline: none;
    -webkit-appearance: none;
}
.pb-input::placeholder { color: var(--pb-text-mute); }
.pb-input:hover { border-color: var(--pb-line-strong); }
.pb-input:focus {
    border-color: var(--pb-accent);
    box-shadow: var(--pb-shadow-focus);
}
.pb-input.is-error {
    border-color: var(--pb-error);
    background: var(--pb-error-soft);
}
.pb-input.is-error:focus {
    box-shadow: 0 0 0 4px rgba(220,38,38,0.12);
}

.pb-field { margin-bottom: 10px; }
.pb-field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-text-soft);
    margin-bottom: 8px;
    letter-spacing: -0.1px;
}
.pb-field__error {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--pb-error);
    min-height: 18px;
}

/* ===================================================
   반응형
   =================================================== */

@media (max-width: 900px) {
    .pb-main { padding: 24px 20px; }
}

@media (max-width: 768px) {
    .pb-header { padding: 0 14px; }
    .pb-header__menu-toggle { display: flex; }
    .pb-header__user { display: none; }

    .pb-sidebar {
        position: fixed;
        top: var(--pb-header-h);
        left: 0;
        width: 280px;
        height: calc(100vh - var(--pb-header-h));
        z-index: 45;
        transform: translateX(-100%);
        transition: transform var(--pb-t-base);
        box-shadow: 0 8px 32px rgba(15,20,25,0.12);
    }
    .pb-sidebar.is-open { transform: translateX(0); }

    .pb-main { padding: 24px 16px; }
    .pb-page__title { font-size: 22px; }
    .pb-quick-grid { grid-template-columns: 1fr; }
}
