@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
    /* "연화" (lotus) palette — bright blooming rose in place of the old deep pine/corporate tone */
    --jade-950: #9c3d68;
    --jade-900: #b84a78;
    --jade-800: #dd5f8c;
    --jade-700: #ea82a5;
    --jade-600: #f4a8c0;
    --jade-100: #fde6f0;
    --jade-50: #fef8fb;

    --ivory: #fff8f4;
    --ivory-warm: #fdeee5;
    --paper: #ffffff;

    --ink: #2e1f28;
    --ink-soft: #6b4f5c;
    --ink-faint: #a3899e;

    --gold: #e8a34a;
    --gold-light: #f4c583;
    --gold-dark: #c17f2e;

    --success: #4a9d6f;
    --warning: #d68a3a;
    --critical: #c9463a;

    --border: #f3ddd5;
    --shadow-sm: 0 1px 2px rgba(156, 61, 104, 0.06);
    --shadow-md: 0 6px 20px rgba(156, 61, 104, 0.08);
    --shadow-lg: 0 16px 40px rgba(156, 61, 104, 0.16);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --sidebar-w: 240px;
    --font-ui: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
    --font-display: 'Cormorant Garamond', 'Pretendard', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-ui);
    background: var(--ivory);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--gold-light); color: var(--ink); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: linear-gradient(185deg, var(--jade-900), var(--jade-950));
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px 28px; }
.sidebar-brand .mark { font-family: var(--font-display); font-size: 1.7em; font-weight: 600; letter-spacing: 0.04em; }
.sidebar-brand .sub { font-size: 0.68em; color: rgba(255,255,255,0.55); letter-spacing: 0.08em; }

.sidebar-search { position: relative; margin-bottom: 18px; }
.search-box { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 9px 12px; }
.search-box i { color: rgba(255,255,255,0.4); font-size: 0.82em; }
.search-box input { background: none; border: none; outline: none; color: #fff; font-size: 0.82em; font-family: inherit; width: 100%; }
.search-box input::placeholder { color: rgba(255,255,255,0.35); }
.search-results { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: -260px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50; max-height: 360px; overflow-y: auto; }
.search-results.open { display: block; }
.search-result { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--ink); }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--jade-50); }
.search-result .sr-type { font-size: 0.66em; font-weight: 700; color: var(--jade-800); background: var(--jade-50); padding: 3px 7px; border-radius: 5px; flex: none; }
.search-result .sr-text { display: flex; flex-direction: column; min-width: 0; }
.search-result .sr-label { font-size: 0.85em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result .sr-sub { font-size: 0.72em; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 16px; text-align: center; font-size: 0.8em; color: var(--ink-faint); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.72); font-size: 0.92em; font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: 0.95em; color: rgba(255,255,255,0.5); }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav a.active i { color: var(--gold-light); }

.sidebar-foot { padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 14px; }
.sidebar-foot .user { display: flex; align-items: center; gap: 10px; }
.sidebar-foot .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--jade-950); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85em; flex: none; }
.sidebar-foot .name { font-size: 0.85em; font-weight: 600; }
.sidebar-foot .role { font-size: 0.72em; color: rgba(255,255,255,0.5); }

.role-switch { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 5px; }
.role-switch span { font-size: 0.66em; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255,255,255,0.35); margin-bottom: 2px; }
.role-switch a { font-size: 0.76em; color: rgba(255,255,255,0.55); padding: 5px 8px; border-radius: 5px; }
.role-switch a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.role-switch a.current { background: rgba(255,255,255,0.1); color: var(--gold-light); font-weight: 600; }

.main {
    flex: 1;
    min-width: 0;
    padding: 32px 40px 60px;
}

.topbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.topbar .eyebrow { font-size: 0.78em; color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.topbar h1 { font-size: 1.7em; }
.topbar .meta { font-size: 0.85em; color: var(--ink-soft); }

/* ---------- Cards / common ---------- */
.card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}
.card-title { font-size: 0.95em; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.card-sub { font-size: 0.78em; color: var(--ink-faint); }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } .main { padding: 20px; } .sidebar { display: none; } }

.kpi-card .kpi-label { font-size: 0.78em; color: var(--ink-faint); margin-bottom: 8px; }
.kpi-card .kpi-value { font-size: 1.7em; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-card .kpi-delta { font-size: 0.8em; margin-top: 6px; font-weight: 600; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--critical); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 0.74em; font-weight: 600; }
.badge-jade { background: var(--jade-100); color: var(--jade-800); }
.badge-gold { background: #fbe6c8; color: var(--gold-dark); }
.badge-success { background: #e3f3e9; color: var(--success); }
.badge-warning { background: #fbe8d0; color: var(--warning); }
.badge-critical { background: #fbe2de; color: var(--critical); }
.badge-neutral { background: var(--ivory-warm); color: var(--ink-soft); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); font-size: 0.85em; font-weight: 600; border: 1px solid transparent; transition: all 0.15s; }
.btn-primary { background: var(--jade-800); color: #fff; }
.btn-primary:hover { background: var(--jade-700); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--ink-soft); }
.btn-outline:hover { border-color: var(--jade-800); color: var(--jade-800); }
.btn-sm { padding: 6px 12px; font-size: 0.78em; }

/* ---------- Table ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 14px; border-bottom: 1px solid var(--border); font-size: 0.88em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: var(--jade-50); }

/* ---------- Filters ---------- */
.filter-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filter-chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.8em; font-weight: 600; color: var(--ink-soft); background: var(--paper); }
.filter-chip.active { background: var(--jade-800); border-color: var(--jade-800); color: #fff; }

.date-range-row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.date-range-row .sep { color: var(--ink-faint); font-size: 0.82em; }
.date-range-row input[type="date"] { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8em; font-family: inherit; color: var(--ink); background: var(--paper); }
.date-range-row input[type="date"]:focus { outline: none; border-color: var(--jade-700); }
.date-range-row .range-label { font-size: 0.74em; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }

/* ---------- Scrollable wide content ---------- */
.scroll-x { overflow-x: auto; }
