/* 운영툴(ProjectWarrior BackOfficeTools site.css)과 같은 모양 — 색·왼쪽 메뉴·숫자 카드·기능 카드·표·막대 그래프 */
:root {
    --bg: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e6e9f0;
    --border-strong: #d6dbe6;

    --text: #2b3445;
    --text-strong: #1e293b;
    --muted: #6b7488;
    --muted-2: #98a1b3;

    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-700: #3730a3;
    --primary-soft: #eef0fe;

    --success: #16a34a;
    --success-soft: #e8f6ee;
    --danger: #dc2626;
    --danger-soft: #fdeaea;
    --warning: #d97706;
    --warning-soft: #fdf3e7;
    --info: #0ea5e9;

    --sidebar-bg-1: #232a3b;
    --sidebar-bg-2: #161b29;
    --sidebar-text: #c4cbda;
    --sidebar-muted: #8a93a8;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 6px 18px rgba(16, 24, 40, .08);
    --radius: 12px;
    --radius-sm: 8px;

    --font-sans: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
        "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font-sans); color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }

.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; }

/* ---------- 틀: 왼쪽 메뉴 + 본문 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    flex: 0 0 236px;
    display: flex;
    flex-direction: column;
    color: var(--sidebar-text);
    background: linear-gradient(185deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 100%);
    box-shadow: var(--shadow-md);
    z-index: 5;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.15rem 1.1rem .9rem;
    margin-bottom: .35rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.sidebar__brand:hover { color: #fff; }
.sidebar__menu { flex: 1; padding: .5rem .6rem; }
.sidebar__group {
    margin: 1.1rem .8rem .35rem;
    color: var(--sidebar-muted);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 1px 0;
    padding: .58rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: .92rem;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
.sidebar__link .icon { color: var(--sidebar-muted); }
.sidebar__link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar__link.active {
    color: #fff;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-600) 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.sidebar__link:hover .icon, .sidebar__link.active .icon { color: inherit; }
.sidebar__foot { padding: .5rem .6rem 1rem; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar__user { display: flex; align-items: center; gap: .65rem; padding: .5rem .8rem .3rem; color: #fff; font-size: .88rem; font-weight: 600; }
.sidebar__user .icon { color: var(--sidebar-muted); }
.sidebar__role { margin-left: auto; color: var(--sidebar-muted); font-size: .74rem; font-weight: 500; }
.sidebar__logout { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }

.content { flex: 1; min-width: 0; padding: 1.35rem 2rem 2.5rem; }

@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { position: static; height: auto; flex-basis: auto; }
    .content { padding: 1rem; }
}

/* ---------- 제목 ---------- */
.page-heading { margin: .35rem 0 1.25rem; }
.page-heading__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    color: var(--text-strong);
    font-size: 1.5rem;
    font-weight: 800;
}
.page-heading__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 1rem;
}
.page-heading__note {
    margin-top: .55rem;
    padding: .6rem .85rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: .86rem;
    line-height: 1.6;
}
.page-heading__note b { color: var(--text); }

.section-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1.6rem 0 .9rem;
    color: var(--text-strong);
    font-size: 1.05rem;
    font-weight: 700;
}
.section-label .muted-note { font-weight: 500; }
.section-label__link { margin-left: auto; font-size: .85rem; font-weight: 600; }
.muted-note { color: var(--muted); font-size: .85rem; }

/* ---------- 숫자 카드 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
a[href].stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.stat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 1.25rem;
}
.stat-card__icon--green { color: var(--success); background: var(--success-soft); }
.stat-card__icon--amber { color: var(--warning); background: var(--warning-soft); }
.stat-card__icon--sky { color: var(--info); background: #e6f6fe; }
.stat-card__body { min-width: 0; }
.stat-card__label, .stat-card__value, .stat-card__sub { display: block; }
.stat-card__label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-card__value { color: var(--text-strong); font-size: 1.6rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.stat-card__unit { margin-left: .2rem; color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-card__sub { color: var(--muted-2); font-size: .74rem; }

/* ---------- 기능 카드 ---------- */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));   /* 카드 몇 장이 한 줄을 채운다 */
    gap: .9rem;
}
.quick-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .95rem 1.05rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); color: var(--text); }
.quick-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 1.1rem;
}
.quick-card__title { display: block; color: var(--text-strong); font-size: .95rem; font-weight: 700; }
.quick-card__desc { display: block; color: var(--muted); font-size: .8rem; }
.quick-card__arrow { margin-left: auto; color: var(--muted-2); }

/* ---------- 카드·표 ---------- */
.card {
    margin-bottom: 1.25rem;
    padding: 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));   /* 그래프 4개 = 2×2 */
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.card-grid .card { margin-bottom: 0; }
@media (max-width: 1100px) { .card-grid { grid-template-columns: 1fr; } }

.table-wrap {
    overflow-x: auto;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; color: var(--text); }
.table th {
    padding: .7rem .9rem;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: .76rem;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}
.table td { padding: .65rem .9rem; border-top: 1px solid var(--border); font-size: .88rem; vertical-align: top; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: var(--primary-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .copy { min-width: 220px; color: var(--text-strong); font-weight: 600; }
.table tr.failed td { color: var(--muted); }
.table tr.failed td.copy { font-weight: 500; }
.table .error-text { color: var(--danger); font-size: .8rem; }

/* ---------- 로그인·가입 (운영툴 login 그대로) ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(79, 70, 229, .18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(14, 165, 233, .14), transparent 55%),
        linear-gradient(160deg, #1e2536 0%, #0f1422 100%);
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    padding: 2rem 1.9rem;
}
.login-card__brand { text-align: center; margin-bottom: 1.4rem; }
.login-card__logo {
    width: 52px; height: 52px;
    margin: 0 auto .7rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
    color: #fff; font-size: 1.4rem;
    box-shadow: 0 8px 20px rgba(79, 70, 229, .4);
}
.login-card__title { color: var(--text-strong); font-size: 1.18rem; font-weight: 800; margin: 0; }
.login-card__sub { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.login-field { display: block; margin-bottom: .9rem; color: var(--text-strong); font-size: .85rem; font-weight: 600; }
.login-field input { display: block; width: 100%; margin-top: .35rem; padding: .55rem .7rem; }
.login-field__hint { margin-left: .3rem; color: var(--muted-2); font-size: .78rem; font-weight: 400; }
.login-card .btn--primary { margin-top: .3rem; }
.login-divider {
    display: flex; align-items: center; gap: .7rem;
    color: var(--muted-2); font-size: .76rem;
    margin: 1.2rem 0 1rem;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-msg {
    margin-top: 1rem;
    text-align: center;
    font-size: .85rem;
    padding: .55rem .7rem;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger);
}
.login-msg--ok { background: var(--success-soft); color: var(--success); }
.login-foot { margin-top: 1.1rem; text-align: center; font-size: .82rem; color: var(--muted); }
.login-foot a { font-weight: 600; margin-left: .25rem; }

/* ---------- 입력·버튼 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.card .toolbar { margin-bottom: .5rem; }
.toolbar__gap { width: .8rem; }
.field { display: inline-flex; align-items: center; gap: .45rem; color: var(--text-strong); font-size: .85rem; font-weight: 600; }

select, input, textarea {
    padding: .4rem .6rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: .9rem;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }
input[type=number] { width: 84px; }
textarea { resize: vertical; }

/* 입력 폼 — 밈 직접 추가 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; margin: 1rem 0 .9rem; }
.form-field { display: flex; flex-direction: column; gap: .3rem; color: var(--text-strong); font-size: .85rem; font-weight: 600; }
.form-field .muted-note { font-weight: 500; font-size: .78rem; }
.form-field--wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }

/* 접어 둔 설명 — 밈 위험 기준 */
.criteria { margin-top: .6rem; color: var(--text); font-size: .85rem; }
.criteria summary { color: var(--primary-700); font-weight: 600; cursor: pointer; }
.criteria ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.criteria li { margin-bottom: .3rem; }

/* 표 안 승인·거절 칸 */
.table .decide { min-width: 190px; }
.table .decide > * { margin-bottom: .35rem; }
.table .decide .btn { margin-right: .3rem; }
.table .decide .field { white-space: nowrap; }
.decide__note { display: block; width: 100%; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .48rem 1.05rem;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn--primary {
    color: #fff;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-600) 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(79, 70, 229, .28);
}
.btn--primary:hover { filter: brightness(1.06); background: linear-gradient(90deg, var(--primary) 0%, var(--primary-600) 100%); }
.btn--sm { padding: .3rem .75rem; font-size: .8rem; }
.btn--block { display: flex; width: 100%; justify-content: center; }
.btn--on, .btn--on:hover { color: #fff; background: var(--primary); border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: default; filter: none; box-shadow: none; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
}

/* ---------- 상태·알림 ---------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .14rem .55rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill--on { color: var(--success); background: var(--success-soft); }
.status-pill--wait { color: var(--warning); background: var(--warning-soft); }
.status-pill--off { color: var(--muted); background: var(--surface-2); }
.status-pill--danger { color: var(--danger); background: var(--danger-soft); }

.alert { margin-bottom: 1rem; padding: .7rem .95rem; border-radius: var(--radius-sm); font-size: .88rem; }
.alert--danger { color: var(--danger); background: var(--danger-soft); }
.alert--info { color: var(--primary-700); background: var(--primary-soft); }

/* 생성 중 — 끝을 모르는 작업이라 오가는 막대 */
.progress { height: 6px; margin-top: .8rem; overflow: hidden; border-radius: 999px; background: var(--primary-soft); }
.progress__bar { width: 30%; height: 100%; border-radius: 999px; background: var(--primary); animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ---------- 막대 그래프 (운영툴 ColumnChart) ---------- */
.col-chart__title { margin-bottom: .35rem; color: var(--text-strong); font-weight: 700; }
.col-chart__title .muted-note { margin-left: .35rem; font-weight: 500; }
.col-chart__svg { display: block; width: 100%; height: auto; }
.col-chart__grid { stroke: var(--border); stroke-width: 1; }
.col-chart__axis { stroke: var(--border-strong); stroke-width: 1; }
.col-chart__tick { fill: var(--muted-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.col-chart__value { fill: var(--text-strong); font-size: 12px; font-weight: 700; }
.col-chart__bar { fill: var(--primary); }
.col-chart__hit { fill: transparent; }
.col-chart__col:hover .col-chart__hit { fill: var(--primary-soft); }

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: .7rem 1.5rem;
    background: #fff8c5;
    border-top: 1px solid var(--border);
    z-index: 10;
}
