/* ============================================
   KPA Admin — Editorial Design System
   Museum / Gallery CMS — Unified with front-end
   Purple accent (#310096) · Inter Tight headings
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w: 260px;
    --header-h: 0px;

    /* === Brand Colors === */
    --purple: #310096;
    --purple-light: #4a11b8;
    --purple-dark: #240070;
    --purple-subtle: rgba(49, 0, 150, 0.06);
    --purple-ring: rgba(49, 0, 150, 0.18);
    --purple-wash: rgba(49, 0, 150, 0.03);

    --ink: #2c2c2c;
    --red: #c23616;
    --red-subtle: rgba(194, 54, 22, 0.07);
    --navy: #1b3a5c;
    --navy-subtle: rgba(27, 58, 92, 0.06);

    /* === Neutral palette === */
    --gray-50: #f7f7f5;
    --gray-100: #eee;
    --gray-200: #e0ddd8;
    --gray-300: #d0cdc7;
    --gray-400: #a8a49d;
    --gray-500: #7a7670;
    --gray-600: #56534e;
    --gray-700: #3d3b37;
    --gray-800: #2a2826;
    --gray-900: #1a1918;
    --gray-950: #111010;

    --white: #ffffff;
    --black: #0a0a0a;

    /* === Semantic colors === */
    --success: #1a7a3d;
    --success-subtle: rgba(26, 122, 61, 0.08);
    --warning: #b8860b;
    --warning-subtle: rgba(184, 134, 11, 0.08);
    --danger: #c23616;
    --danger-subtle: rgba(194, 54, 22, 0.07);
    --info: #1b3a5c;
    --info-subtle: rgba(27, 58, 92, 0.06);

    /* === Semantic tokens === */
    --bg: #eee;
    --surface: var(--white);
    --surface-raised: var(--white);
    --border: var(--gray-200);
    --border-light: var(--gray-100);
    --border-hover: var(--gray-300);
    --text: var(--ink);
    --text-secondary: var(--gray-500);
    --text-muted: var(--gray-400);
    --text-inverse: var(--white);

    /* === Typography === */
    --font-sans: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-display: 'Inter Tight', 'Inter', 'Noto Sans KR', sans-serif;
    --font-serif: 'Noto Serif KR', 'Georgia', serif;

    /* === Sizing === */
    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-full: 9999px;

    /* === Shadows === */
    --shadow-xs: 0 1px 2px rgba(49, 0, 150, 0.04);
    --shadow-sm: 0 1px 3px rgba(49, 0, 150, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 12px -2px rgba(49, 0, 150, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 28px -6px rgba(49, 0, 150, 0.10), 0 4px 10px -4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 24px 48px -10px rgba(49, 0, 150, 0.12), 0 8px 16px -8px rgba(0, 0, 0, 0.06);
    --shadow-ring: 0 0 0 1px var(--border);

    /* === Transitions === */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --duration: 0.15s;
    --duration-md: 0.25s;
}


/* ============================================
   Keyframe Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}


/* ============================================
   Base Styles
   ============================================ */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.006em;
    position: relative;
}

/* Subtle 24-column grid background — editorial feel matching front-end */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent calc(100% / 24 - 1px),
        rgba(49, 0, 150, 0.03) calc(100% / 24 - 1px),
        rgba(49, 0, 150, 0.03) calc(100% / 24)
    );
    opacity: 0.5;
}

/* Ensure all content sits above the grid background */
body > * {
    position: relative;
    z-index: 1;
}

a {
    color: var(--purple);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
a:hover { color: var(--purple-light); text-decoration: none; }

::selection { background: rgba(49, 0, 150, 0.12); color: var(--purple-dark); }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: var(--radius-xs); }


/* ============================================
   Layout
   ============================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}


/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-w);
    background: #141214;
    color: var(--gray-400);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(49, 0, 150, 0.12);
    transition: transform var(--duration-md) var(--ease);
}

/* Subtle purple gradient wash at top of sidebar */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(49, 0, 150, 0.08) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.sidebar > * {
    position: relative;
    z-index: 1;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(49, 0, 150, 0.3); border-radius: 3px; }

.sidebar-top {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 28px 22px 28px;
}
.sidebar-logo a {
    color: var(--white);
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 2px;
}
.logo-accent {
    background: linear-gradient(135deg, var(--purple), #6a3de8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.sidebar-nav {
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    color: var(--gray-400);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 450;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    position: relative;
    letter-spacing: 0.01em;
}
.nav-item i,
.nav-item svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--duration) var(--ease);
}
.nav-item:hover {
    background: rgba(49, 0, 150, 0.1);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}
.nav-item:hover i,
.nav-item:hover svg { opacity: 0.85; }

.nav-item.active {
    background: rgba(49, 0, 150, 0.15);
    color: var(--white);
    font-weight: 550;
}
.nav-item.active i,
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    background: var(--purple);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(49, 0, 150, 0.4);
}


/* ===== Sidebar Bottom ===== */
.sidebar-bottom {
    padding: 16px 14px;
    border-top: 1px solid rgba(49, 0, 150, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--purple), #6a3de8);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    font-family: var(--font-display);
}

.admin-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.admin-name {
    color: var(--gray-200);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-role {
    color: var(--gray-500);
    font-size: 11px;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

.logout-link {
    color: var(--gray-500);
    padding: 6px;
    border-radius: var(--radius);
    transition: all var(--duration) var(--ease);
    display: flex;
}
.logout-link i,
.logout-link svg { width: 15px; height: 15px; }
.logout-link:hover {
    color: var(--purple-light);
    background: rgba(49, 0, 150, 0.1);
    text-decoration: none;
}


/* ===== Mobile Sidebar Toggle ===== */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 300;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--duration) var(--ease);
    color: var(--text);
}
.sidebar-toggle:hover {
    background: var(--purple-subtle);
    border-color: var(--purple);
    color: var(--purple);
}
.sidebar-toggle i,
.sidebar-toggle svg { width: 18px; height: 18px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    transition: opacity var(--duration-md) var(--ease);
}
.sidebar-overlay.active { display: block; opacity: 1; }


/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 40px 44px 80px;
    max-width: calc(var(--sidebar-w) + 1200px);
    animation: fadeIn 0.4s var(--ease);
}

.admin-footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--text-muted);
    font-size: 11px;
    margin-left: var(--sidebar-w);
    letter-spacing: 0.02em;
    font-family: var(--font-sans);
}


/* ============================================
   Page Header
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
}
.page-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
    text-transform: uppercase;
}
.page-title small {
    font-size: 13px;
    font-weight: 400;
    font-family: var(--font-sans);
    color: var(--text-muted);
    margin-left: 10px;
    text-transform: none;
    letter-spacing: 0;
}


/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    font-family: var(--font-sans);
    line-height: 1.5;
    user-select: none;
    letter-spacing: 0.01em;
}
.btn:hover {
    background: var(--gray-50);
    border-color: var(--border-hover);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--purple-ring); }

.btn-primary {
    background: var(--purple);
    color: var(--text-inverse);
    border-color: var(--purple);
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
    background: var(--purple-light);
    border-color: var(--purple-light);
    box-shadow: var(--shadow-sm);
    color: var(--text-inverse);
}

.btn-accent {
    background: var(--purple);
    color: var(--text-inverse);
    border-color: var(--purple);
}
.btn-accent:hover {
    background: var(--purple-light);
    border-color: var(--purple-light);
    color: var(--text-inverse);
}

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger-subtle);
    color: var(--danger);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--purple-subtle);
    color: var(--purple);
}

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }


/* ============================================
   Alerts & Toasts
   ============================================ */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 13px;
    font-weight: 450;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s var(--ease);
}
.alert-success { background: var(--success-subtle); border-color: rgba(26, 122, 61, 0.2); color: #15803d; }
.alert-error   { background: var(--danger-subtle);  border-color: rgba(194, 54, 22, 0.2); color: #a52d14; }
.alert-warning { background: var(--warning-subtle); border-color: rgba(184, 134, 11, 0.2); color: #8a6508; }
.alert-info    { background: var(--info-subtle);    border-color: rgba(27, 58, 92, 0.2);  color: #1b3a5c; }

/* Toast */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--gray-900);
    color: var(--white);
    padding: 13px 20px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 450;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.4s var(--ease);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 380px;
    border-left: 3px solid var(--purple);
}
.toast.toast-success {
    background: #0d3320;
    border-left-color: var(--success);
}
.toast.toast-error {
    background: #3d1008;
    border-left-color: var(--danger);
}


/* ============================================
   Tables
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-ring), var(--shadow-xs);
}
.table th,
.table td {
    padding: 12px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.table th {
    background: color-mix(in srgb, var(--purple) 4%, var(--gray-50));
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11px;
    color: var(--purple);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 11px 18px;
    border-bottom: 2px solid color-mix(in srgb, var(--purple) 12%, transparent);
}
.table tbody tr {
    transition: background var(--duration) var(--ease);
}
.table tbody tr:hover { background: var(--purple-wash); }
.table tbody tr:last-child td { border-bottom: none; }

.table a { color: var(--text); font-weight: 500; }
.table a:hover { color: var(--purple); }

td.actions { white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
td.actions .btn:first-child { margin-left: 0; }


/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--gray-100);
    color: var(--gray-600);
    font-family: var(--font-sans);
    text-transform: uppercase;
}
.badge--published,
.badge--active,
.badge--ongoing {
    background: var(--success-subtle);
    color: #15803d;
}
.badge--draft,
.badge--inactive {
    background: var(--gray-100);
    color: var(--gray-500);
}
.badge--hidden {
    background: var(--warning-subtle);
    color: #8a6508;
}
.badge--super {
    background: var(--purple-subtle);
    color: var(--purple);
}
.badge--admin {
    background: var(--navy-subtle);
    color: var(--navy);
}
.badge--editor {
    background: var(--gray-100);
    color: var(--gray-600);
}
.badge--upcoming {
    background: var(--navy-subtle);
    color: var(--navy);
}
.badge--ended {
    background: var(--gray-100);
    color: var(--gray-500);
}
.badge--banned {
    background: var(--danger-subtle);
    color: var(--danger);
}


/* ============================================
   Forms
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
    letter-spacing: -0.01em;
    font-family: var(--font-display);
}

.form-control {
    display: block;
    width: 100%;
    padding: 9px 13px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--text);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    font-family: var(--font-sans);
    line-height: 1.5;
}
.form-control:hover { border-color: var(--border-hover); }
.form-control:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-ring);
}
.form-control::placeholder { color: var(--text-muted); }

.form-control-lg {
    font-family: var(--font-display);
    font-size: 20px;
    padding: 14px 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.form-control-sm {
    width: auto;
    display: inline-block;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8a49d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 100px; }

input[type="file"].form-control {
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
}
input[type="file"].form-control::file-selector-button {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--text);
    cursor: pointer;
    margin-right: 10px;
    transition: all var(--duration) var(--ease);
}
input[type="file"].form-control::file-selector-button:hover {
    background: var(--purple-subtle);
    border-color: var(--purple);
    color: var(--purple);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    align-items: start;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}
.form-card h3 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid color-mix(in srgb, var(--purple) 10%, transparent);
    color: var(--text);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.form-section-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    margin: 32px 0 18px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
    color: var(--text);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}
.form-section-title:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 450;
    color: var(--gray-700);
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--purple);
    border-radius: 3px;
}

small,
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-center { text-align: center; }

.current-image {
    margin-bottom: 12px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: var(--radius);
    display: inline-block;
    border: 1px solid var(--border-light);
}
.current-image img { border-radius: var(--radius-sm); display: block; }


/* ============================================
   Filters
   ============================================ */
.filters { margin-bottom: 24px; }
.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-form .form-control { width: auto; min-width: 160px; font-size: 13px; padding: 7px 10px; }
.filter-form select.form-control { min-width: 130px; }


/* ============================================
   Dashboard
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    transition: all var(--duration-md) var(--ease);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-200);
    transition: background var(--duration) var(--ease);
}
.stat-card:nth-child(1)::before { background: var(--purple); }
.stat-card:nth-child(2)::before { background: var(--navy); }
.stat-card:nth-child(3)::before { background: var(--success); }
.stat-card:nth-child(4)::before { background: var(--red); }
.stat-card:nth-child(5)::before { background: var(--warning); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: color-mix(in srgb, var(--purple) 20%, var(--border));
}

.stat-number {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--text);
}
.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 8px 0 14px;
    font-weight: 450;
    letter-spacing: 0.01em;
}
.stat-link {
    font-size: 12px;
    color: var(--purple);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-family: var(--font-display);
}
.stat-link:hover { color: var(--purple-light); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
}
.dashboard-section h2 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.02em;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 2px solid color-mix(in srgb, var(--purple) 10%, transparent);
}


/* ============================================
   Design Settings
   ============================================ */
.design-section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-xs);
    transition: all var(--duration) var(--ease);
}
.design-section-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: color-mix(in srgb, var(--purple) 15%, var(--border));
}
.design-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}


/* ============================================
   Editor
   ============================================ */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 7px 10px;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.editor-toolbar button {
    padding: 5px 10px;
    font-size: 13px;
    font-family: var(--font-sans);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-width: 30px;
    color: var(--gray-600);
    transition: all var(--duration) var(--ease);
    line-height: 1.4;
}
.editor-toolbar button:hover {
    background: var(--white);
    border-color: var(--border);
    color: var(--purple);
    box-shadow: var(--shadow-xs);
}
.editor-toolbar button.active {
    background: var(--purple);
    color: var(--white);
    border-color: var(--purple);
}
.toolbar-sep {
    width: 1px;
    background: var(--border);
    margin: 2px 6px;
    align-self: stretch;
}

.editor-content {
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 24px;
    min-height: 380px;
    background: var(--white);
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.9;
    outline: none;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    color: var(--text);
}
.editor-content:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-ring);
}
.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-xs);
    margin: 10px 0;
    cursor: pointer;
}
.editor-content h2 {
    font-family: var(--font-display);
    font-size: 22px;
    margin: 24px 0 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.editor-content h3 {
    font-family: var(--font-display);
    font-size: 18px;
    margin: 18px 0 8px;
    font-weight: 600;
    color: var(--ink);
}
.editor-content p { margin-bottom: 14px; }
.editor-content ul,
.editor-content ol { margin: 10px 0 10px 24px; }
.editor-content blockquote {
    border-left: 3px solid var(--purple);
    padding: 10px 20px;
    margin: 14px 0;
    background: var(--purple-subtle);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--gray-700);
    font-style: italic;
}


/* ============================================
   Editor Tabs (Edit / Preview toggle)
   ============================================ */
.editor-tabs {
    display: flex;
    gap: 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 2;
}
.editor-tab {
    padding: 10px 22px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--duration) var(--ease);
}
.editor-tab:hover {
    color: var(--purple);
    background: var(--purple-wash);
}
.editor-tab.active {
    background: var(--white);
    color: var(--purple);
    border-color: var(--border);
    position: relative;
}
.editor-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--white);
}


/* ============================================
   Preview Pane
   ============================================ */
.preview-pane {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 32px;
    min-height: 380px;
    overflow-y: auto;
}

.preview-pane .article-body-content {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.15rem;
    line-height: 1.85;
    color: color-mix(in srgb, #310096 80%, black);
    max-width: 720px;
}

.preview-pane .article-body-content p {
    margin-bottom: 1.5em;
}

.preview-pane .article-body-content h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    margin: 2em 0 0.8em;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-transform: uppercase;
    line-height: 1.2;
}

.preview-pane .article-body-content h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.5em 0 0.6em;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.preview-pane .article-body-content img {
    max-width: 100%;
    height: auto;
    margin: 2em 0;
    display: block;
}

.preview-pane .article-body-content blockquote {
    border-left: 2px solid var(--purple);
    padding: 16px 24px;
    margin: 2em 0;
    font-style: italic;
    color: var(--gray-600);
    background: var(--purple-wash);
}

.preview-pane .article-body-content a {
    color: var(--purple);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--purple) 30%, transparent);
    text-underline-offset: 3px;
    transition: text-decoration-color var(--duration) var(--ease);
}
.preview-pane .article-body-content a:hover {
    text-decoration-color: var(--purple);
}

.preview-pane .preview-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
}


/* ============================================
   Image Upload Zone
   ============================================ */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-md) var(--ease);
    background: var(--gray-50);
    margin-bottom: 18px;
    position: relative;
}
.upload-zone:hover {
    border-color: var(--purple);
    background: var(--purple-subtle);
}
.upload-zone.drag-over {
    border-color: var(--purple);
    background: var(--purple-subtle);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px var(--purple-ring);
}
.upload-zone.uploading {
    pointer-events: none;
    opacity: 0.65;
}
.upload-zone-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    color: var(--purple);
    opacity: 0.4;
}
.upload-zone-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 450;
}
.upload-zone-text strong {
    color: var(--purple);
    font-weight: 600;
}
.upload-zone-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}
.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-zone-sm {
    padding: 20px 18px;
}
.upload-zone-sm .upload-zone-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}


/* ===== Upload Progress ===== */
.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 12px;
    border: 1px solid var(--border-light);
}
.upload-progress-item .filename {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-weight: 450;
}
.upload-progress-bar {
    width: 80px;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.upload-progress-bar-fill {
    height: 100%;
    background: var(--purple);
    border-radius: 2px;
    transition: width 0.3s var(--ease);
    width: 0%;
}
.upload-progress-item.done .upload-progress-bar-fill { background: var(--success); width: 100%; }
.upload-progress-item.error .upload-progress-bar-fill { background: var(--danger); width: 100%; }
.upload-progress-item .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}
.upload-progress-item.done .status-icon { color: var(--success); }
.upload-progress-item.error .status-icon { color: var(--danger); }


/* ============================================
   Image Gallery
   ============================================ */
.image-gallery {
    margin-bottom: 22px;
}
.image-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.image-gallery-header h4 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.image-gallery-header .count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 6px;
}
.image-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--duration) var(--ease);
    background: var(--gray-100);
}
.image-gallery-item:hover {
    border-color: var(--purple);
    transform: scale(1.04);
    box-shadow: var(--shadow-sm);
}
.image-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.image-gallery-item .insert-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(49, 0, 150, 0.6);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-display);
}
.image-gallery-item:hover .insert-badge { opacity: 1; }
.image-gallery-item .delete-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}
.image-gallery-item:hover .delete-btn { opacity: 1; }
.image-gallery-item .delete-btn:hover { background: var(--danger); }


/* ============================================
   File List
   ============================================ */
.file-list {
    list-style: none;
    margin-bottom: 12px;
}
.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 13px;
    border: 1px solid var(--border-light);
    transition: background var(--duration) var(--ease);
}
.file-list li:hover {
    background: var(--purple-wash);
    border-color: color-mix(in srgb, var(--purple) 10%, var(--border-light));
}


/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
}
/* Grid lines on login page too */
.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent calc(100% / 24 - 1px),
        rgba(49, 0, 150, 0.025) calc(100% / 24 - 1px),
        rgba(49, 0, 150, 0.025) calc(100% / 24)
    );
    opacity: 0.5;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 44px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 1;
}
.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--purple), #6a3de8, var(--purple));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.login-box h1 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    text-align: center;
    text-transform: uppercase;
    color: var(--text);
}
.login-box .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 36px;
}


/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 56px 28px;
    color: var(--text-muted);
}
.empty-state p {
    font-size: 14px;
    line-height: 1.6;
}


/* ============================================
   Utility
   ============================================ */
small,
.text-muted {
    color: var(--text-muted);
    font-size: 12px;
}
.text-center { text-align: center; }


/* ============================================
   Responsive — 1100px
   ============================================ */
@media (max-width: 1100px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-card { position: static; }
    .dashboard-grid { grid-template-columns: 1fr; }
}


/* ============================================
   Responsive — 768px
   ============================================ */
@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }

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

    .main-content {
        margin-left: 0;
        padding: 24px 18px 60px;
        padding-top: 64px;
    }
    .admin-footer { margin-left: 0; }

    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-title { font-size: 20px; }

    .filter-form { flex-direction: column; }
    .filter-form .form-control { width: 100%; }

    .table { font-size: 12px; }
    .table th,
    .table td { padding: 10px 12px; }

    .image-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    }

    .preview-pane { padding: 20px; }
    .preview-pane .article-body-content { font-size: 1rem; }
}


/* ============================================
   Responsive — 480px
   ============================================ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .main-content { padding: 16px 14px 40px; padding-top: 56px; }

    .image-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .editor-tabs {
        overflow-x: auto;
    }
    .editor-tab {
        padding: 8px 16px;
        font-size: 11px;
    }
}
