:root {
    --bg: #f3f6fb;
    --bg-2: #eef3f9;
    --paper: #ffffff;
    --paper-soft: #f8fafc;
    --paper-blue: #f5f8ff;
    --line: #dbe4f0;
    --line-soft: #eef2f7;
    --text: #111827;
    --sub: #64748b;
    --sub-2: #94a3b8;
    --blue: #2563eb;
    --blue-2: #1d4ed8;
    --blue-soft: #dbeafe;
    --navy: #111827;
    --navy-2: #172033;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --orange: #d97706;
    --orange-soft: #fef3c7;
    --red: #dc2626;
    --red-soft: #fee2e2;
    --purple: #7c3aed;
    --purple-soft: #ede9fe;
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;
    --shadow-sm: 0 8px 18px rgba(15, 23, 42, .045);
    --shadow: 0 18px 45px rgba(15, 23, 42, .075);
    --shadow-deep: 0 24px 60px rgba(15, 23, 42, .16);
    --sidebar: 282px;
    --topbar: 74px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.10), transparent 34%),
        linear-gradient(180deg, #f7faff 0%, var(--bg) 260px, var(--bg) 100%);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: -0.015em;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
strong { font-weight: 900; }

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    position: fixed;
    z-index: 100;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    overflow-y: auto;
    padding: 18px 14px;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.35), transparent 28%),
        linear-gradient(180deg, #0f172a 0%, #111827 58%, #0b1120 100%);
    color: #fff;
    box-shadow: 20px 0 45px rgba(15, 23, 42, .08);
}
.admin-sidebar::-webkit-scrollbar { width: 7px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 999px; }

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    margin-bottom: 14px;
}
.admin-brand-mark {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 55%, #facc15 100%);
    color: #fff;
    font-size: 20px;
    font-weight: 1000;
    box-shadow: 0 16px 30px rgba(37,99,235,.34);
}
.admin-brand strong {
    display: block;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -0.05em;
}
.admin-brand span {
    display: block;
    margin-top: 5px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.admin-nav-section { margin: 13px 0 18px; }
.admin-nav-title {
    padding: 8px 10px 7px;
    color: #8fa1bb;
    font-size: 11px;
    font-weight: 1000;
    letter-spacing: .10em;
}
.admin-nav { display: grid; gap: 5px; }
.admin-nav a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 10px 11px 10px 13px;
    border-radius: 14px;
    color: #d9e3f0;
    font-weight: 900;
    transition: .16s ease;
}
.admin-nav a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    transform: translateX(2px);
}
.admin-nav a.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 10px 22px rgba(37,99,235,.28);
}
.admin-nav a.active::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 999px;
    background: #facc15;
}
.admin-nav a small {
    min-width: 32px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.09);
    color: #cbd5e1;
    font-size: 10px;
    text-align: center;
    font-weight: 1000;
}

/* Main */
.admin-main {
    width: calc(100% - var(--sidebar));
    margin-left: var(--sidebar);
    min-height: 100vh;
}
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    height: var(--topbar);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(219,228,240,.88);
}
.admin-topbar-left,
.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-topbar strong {
    display: block;
    font-size: 15px;
    letter-spacing: -0.03em;
}
.admin-topbar span {
    display: block;
    margin-top: 2px;
    color: var(--sub);
    font-size: 12px;
    font-weight: 750;
}
.mobile-menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font-weight: 1000;
    box-shadow: var(--shadow-sm);
}
.admin-content {
    max-width: 1540px;
    padding: 30px;
}

/* Page header */
.page-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}
.page-title h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.18;
    letter-spacing: -0.06em;
}
.page-title p {
    margin: 8px 0 0;
    color: var(--sub);
    font-weight: 750;
}
.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 9px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-2);
    font-size: 12px;
    font-weight: 1000;
}

/* Layout helpers */
.grid { display: grid; gap: 15px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stack { display: grid; gap: 12px; }
.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Card */
.card,
.search-card,
.table-card,
.info-card,
.panel {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(219,228,240,.98);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card,
.info-card,
.panel {
    padding: 20px;
}
.card:hover,
.stat-card:hover {
    box-shadow: var(--shadow);
}
.card-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}
.card-title h2,
.card-title h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: -0.045em;
}
.card-title p {
    margin: 5px 0 0;
    color: var(--sub);
    font-size: 13px;
    font-weight: 740;
}

/* Stats */
.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 126px;
    padding: 18px;
    border: 1px solid rgba(219,228,240,.98);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow-sm);
}
.stat-card::after {
    content: "";
    position: absolute;
    width: 94px;
    height: 94px;
    right: -42px;
    top: -42px;
    border-radius: 999px;
    background: rgba(37,99,235,.08);
}
.stat-card span {
    display: block;
    position: relative;
    z-index: 1;
    color: var(--sub);
    font-size: 13px;
    font-weight: 1000;
}
.stat-card strong {
    display: block;
    position: relative;
    z-index: 1;
    margin-top: 9px;
    font-size: 29px;
    line-height: 1.08;
    letter-spacing: -0.065em;
}
.stat-card small {
    display: block;
    position: relative;
    z-index: 1;
    margin-top: 9px;
    color: var(--sub);
    font-weight: 760;
}
.stat-card.primary { background: linear-gradient(180deg, #eff6ff, #fff); border-color: #bfdbfe; }
.stat-card.primary::after { background: rgba(37,99,235,.13); }
.stat-card.success { background: linear-gradient(180deg, #f0fdf4, #fff); border-color: #bbf7d0; }
.stat-card.success::after { background: rgba(22,163,74,.13); }
.stat-card.warning { background: linear-gradient(180deg, #fffbeb, #fff); border-color: #fde68a; }
.stat-card.warning::after { background: rgba(217,119,6,.13); }
.stat-card.danger { background: linear-gradient(180deg, #fef2f2, #fff); border-color: #fecaca; }
.stat-card.danger::after { background: rgba(220,38,38,.12); }
.stat-card.purple { background: linear-gradient(180deg, #f5f3ff, #fff); border-color: #ddd6fe; }
.stat-card.purple::after { background: rgba(124,58,237,.12); }

/* Forms */
.search-card {
    padding: 16px;
    margin-bottom: 16px;
}
.search-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}
.form-field label {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 1000;
}
input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
    transition: .14s ease;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea {
    min-height: 120px;
    resize: vertical;
}

/* Table */
.table-card { overflow: hidden; }
.table-card > .card-title {
    padding: 18px 18px 0;
}
.table-scroll { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th,
td {
    padding: 13px 13px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}
th {
    background: var(--paper-soft);
    color: #475569;
    font-size: 12px;
    font-weight: 1000;
    white-space: nowrap;
}
td { font-size: 14px; }
tbody tr:hover { background: #f8fafc; }
.td-muted {
    color: var(--sub);
    font-size: 12px;
    font-weight: 740;
}

/* Buttons / badges */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: var(--blue);
    color: #fff;
    font-weight: 1000;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(37,99,235,.18);
    transition: .15s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--blue-2); }
.btn.gray {
    background: #fff;
    color: #334155;
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}
.btn.gray:hover { background: #f8fafc; }
.btn.green { background: var(--green); }
.btn.orange { background: var(--orange); }
.btn.red { background: var(--red); }
.btn.small {
    min-height: 31px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 26px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-2);
    font-size: 12px;
    font-weight: 1000;
    white-space: nowrap;
}
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.green { background: var(--green-soft); color: #15803d; }
.badge.orange { background: var(--orange-soft); color: #b45309; }
.badge.red { background: var(--red-soft); color: #b91c1c; }
.badge.purple { background: var(--purple-soft); color: #6d28d9; }

/* Message */
.alert {
    padding: 13px 14px;
    border: 1px solid;
    border-radius: 15px;
    font-weight: 820;
}
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.alert.success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

.empty {
    padding: 38px 18px;
    text-align: center;
    color: var(--sub);
    font-weight: 780;
}
.empty strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
    font-size: 17px;
}

/* Dashboard extras */
.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border: 1px solid #bfdbfe;
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(37,99,235,.18), transparent 30%),
        linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    box-shadow: var(--shadow);
}
.hero-panel h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.055em;
}
.hero-panel p {
    max-width: 760px;
    margin: 9px 0 0;
    color: var(--sub);
    font-weight: 760;
}
.hero-panel .hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.category-chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-weight: 900;
}
.category-chip small {
    color: var(--sub);
    font-size: 12px;
    font-weight: 800;
}
.flow-list { display: grid; gap: 10px; }
.flow-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-radius: 17px;
    background: var(--paper-soft);
}
.flow-no {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-weight: 1000;
}
.flow-item strong { display: block; }
.flow-item span {
    display: block;
    margin-top: 2px;
    color: var(--sub);
    font-size: 12px;
    font-weight: 760;
}
.footer-note {
    margin-top: 16px;
    color: var(--sub);
    font-size: 12px;
    font-weight: 760;
}

@media (max-width: 1280px) {
    .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    :root { --sidebar: 282px; }
    .mobile-menu-btn { display: inline-grid; place-items: center; }
    .admin-sidebar {
        transform: translateX(-110%);
        transition: .18s ease;
        box-shadow: var(--shadow-deep);
    }
    body.sidebar-open .admin-sidebar { transform: translateX(0); }
    body.sidebar-open::after {
        content: "";
        position: fixed;
        z-index: 90;
        inset: 0;
        background: rgba(15,23,42,.42);
    }
    .admin-main {
        width: 100%;
        margin-left: 0;
    }
    .admin-topbar {
        height: 66px;
        padding: 0 14px;
    }
    .admin-content { padding: 16px; }
    .page-title {
        display: grid;
        gap: 13px;
    }
    .page-title h1 { font-size: 25px; }
    .page-actions { justify-content: flex-start; }
    .grid-6,
    .grid-5,
    .grid-4,
    .grid-3,
    .grid-2,
    .search-grid {
        grid-template-columns: 1fr;
    }
    th, td { padding: 11px 10px; }
    .hero-panel { padding: 19px; }
}
