@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f0f2f8;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(15, 23, 42, 0.08);
    --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --brand: #6366f1;
    --brand-dark: #4f46e5;
    --brand-light: #eef2ff;
    --brand-glow: rgba(99, 102, 241, 0.18);
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #0ea5e9;
    --info-light: #f0f9ff;
    --sidebar-1: #0c1222;
    --sidebar-2: #151d32;
    --sidebar-accent: #6366f1;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(ellipse 900px 500px at 0% -5%, rgba(99, 102, 241, 0.12), transparent 55%),
        radial-gradient(ellipse 700px 400px at 100% 0%, rgba(16, 185, 129, 0.08), transparent 50%),
        var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
    margin: 0 0 8px;
    letter-spacing: -0.03em;
    font-weight: 800;
}

h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p { margin: 0 0 10px; color: var(--muted); }

/* ── Sidebar ── */
.sidebar-toggle { display: none; }
.sidebar-overlay { display: none; }

.sidebar-toggle-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle-btn:hover {
    background: var(--brand-light);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--brand-dark);
}

.sidebar {
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: linear-gradient(175deg, var(--sidebar-1) 0%, var(--sidebar-2) 100%);
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
}

.sidebar .brand {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.sidebar .brand::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 80px;
    height: 80px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 50%;
}

.brand-logo {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    font-weight: 900;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    position: relative;
    z-index: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.brand-text .brand-label {
    font-size: 11px;
    opacity: 0.6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.brand-text .brand-name {
    font-size: 15px;
    font-weight: 800;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    padding: 11px 14px;
    margin-bottom: 3px;
    border-radius: 11px;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    border: 1px solid transparent;
}

.sidebar a .nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.06);
}

.sidebar a.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(79, 70, 229, 0.85));
    color: #fff;
    font-weight: 600;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.sidebar a.active .nav-icon { opacity: 1; }

.sidebar .sidebar-section { padding-top: 4px; }

.sidebar .sidebar-bottom {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .sidebar-bottom a {
    color: rgba(255, 255, 255, 0.55);
}

.sidebar .sidebar-bottom a:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.15);
}

.menu-group { margin-top: 10px; }

.menu-title {
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
    text-transform: uppercase;
    margin: 14px 14px 6px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

/* ── Main ── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Topbar ── */
.topbar {
    height: 68px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar .title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.topbar .page-breadcrumb {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 1px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar .user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a5b4fc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.user-info .user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.user-info .user-role {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

/* ── Content ── */
.content {
    padding: 28px;
    flex: 1;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.09);
}

.card + .card { margin-top: 16px; }

.card-nested {
    padding: 18px;
    margin: 14px 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03), rgba(16, 185, 129, 0.02));
    border: 1px dashed rgba(99, 102, 241, 0.15);
    border-radius: 12px;
}

.card input[type="text"],
.card input[type="number"],
.card input[type="date"],
.card input[type="file"],
.card input[type="email"],
.card input[type="password"],
.card textarea,
.card select {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fafbfc;
    color: var(--text);
    transition: var(--transition);
}

.card input:hover,
.card textarea:hover,
.card select:hover {
    border-color: rgba(99, 102, 241, 0.25);
    background: #fff;
}

.card input:focus,
.card textarea:focus,
.card select:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.card textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.55;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.span-2 { grid-column: span 2; }

.card label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: rgba(15, 23, 42, 0.75);
    letter-spacing: 0.01em;
}

/* ── Buttons ── */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    white-space: nowrap;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--surface);
    color: rgba(15, 23, 42, 0.8);
    border: 1.5px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--brand-light);
    border-color: rgba(99, 102, 241, 0.25);
    color: var(--brand-dark);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-light);
    border: 1.5px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: rgba(239, 68, 68, 0.35);
}

.btn-link {
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-link:hover {
    color: var(--brand);
    text-decoration: underline;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: 8px;
}

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header .subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--muted);
    font-weight: 400;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Welcome banner ── */
.welcome-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    border-radius: var(--radius);
    padding: 28px 32px;
    color: #fff;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.35);
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -20px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: 80px;
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.welcome-banner h1 {
    font-size: 24px;
    color: #fff;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.welcome-banner p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 0;
    position: relative;
    z-index: 1;
}

.welcome-banner .banner-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.btn-white {
    background: rgba(255, 255, 255, 0.95);
    color: var(--brand-dark);
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: inherit;
}

.btn-white:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-ghost-white {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: inherit;
}

.btn-ghost-white:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ── Alerts ── */
.alert {
    border-radius: 12px;
    padding: 13px 16px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: var(--success-light);
    color: #065f46;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert::before { content: '✓'; font-size: 16px; }

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-danger::before { content: '⚠'; }

/* ── Tables ── */
.table-wrap {
    overflow: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    background: var(--surface);
}

.table th,
.table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 14px;
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: var(--muted);
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    padding: 12px 18px;
    z-index: 1;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.table-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text);
}

.table-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-light), #e0e7ff);
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-indigo {
    background: var(--brand-light);
    color: var(--brand-dark);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.badge-green {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge-slate {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

/* ── Stat cards ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    grid-column: span 4;
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-card.indigo::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card.green::before  { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.amber::before  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.sky::before    { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card.indigo .stat-icon { background: var(--brand-light); }
.stat-card.green .stat-icon  { background: var(--success-light); }
.stat-card.amber .stat-icon  { background: var(--warning-light); }
.stat-card.sky .stat-icon    { background: var(--info-light); }

.stat-card .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 700;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -0.04em;
    line-height: 1;
}

.stat-card .hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
}

.stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
}

.stat-trend.up {
    background: var(--success-light);
    color: #065f46;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ── Settings ── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

/* ── Code chips ── */
.code-chip {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.12);
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--brand-dark);
    font-weight: 500;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* ── Template editor ── */
.template-editor {
    width: 100%;
    min-height: 130px;
    padding: 14px 16px;
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    border-radius: 12px;
    background: #fafbfc;
    color: var(--text);
    line-height: 1.65;
    outline: none;
    overflow: auto;
    transition: var(--transition);
    font-family: inherit;
    font-size: 14px;
}

.template-editor:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.template-editor-lg { min-height: 360px; }

.template-editor table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.template-editor th,
.template-editor td {
    border: 1px solid rgba(15, 23, 42, 0.2);
    padding: 8px;
}

/* ── Login page ── */
.login-page {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 600px 400px at 20% 50%, rgba(99, 102, 241, 0.3), transparent),
        radial-gradient(ellipse 500px 350px at 80% 20%, rgba(16, 185, 129, 0.2), transparent),
        linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
    font-family: 'Inter', sans-serif;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    padding: 36px 32px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand .login-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.login-brand h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.login-brand p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.7);
    margin-bottom: 7px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fafbfc;
    transition: var(--transition);
}

.login-form input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.btn-login {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    margin-top: 6px;
}

.btn-login:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.5);
}

.error-box {
    background: var(--danger-light);
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-weight: 500;
}

/* ── Image grid (template editor) ── */
.image-grid {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.image-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    width: 220px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.image-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.image-card-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.image-card-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-card-preview {
    margin-top: 10px;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.placeholder-section {
    margin: 18px 0;
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(16, 185, 129, 0.03));
    border: 1px solid rgba(99, 102, 241, 0.1);
}

/* ── Responsive ── */
@media (max-width: 980px) {
    .sidebar { width: 230px; }
    .stat-card { grid-column: span 6; }
    .table { min-width: 640px; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    body { display: block; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 30;
        width: min(82vw, 300px);
        max-width: 300px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 20px 0 40px rgba(15, 23, 42, 0.3);
    }

    .sidebar-toggle-btn { display: inline-flex; }

    .sidebar-toggle:checked ~ .sidebar { transform: translateX(0); }

    .sidebar-toggle:checked ~ .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 20;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(2px);
    }

    .main { width: 100%; }
    .topbar { padding: 0 16px; }
    .content { padding: 16px; }
    .stat-card { grid-column: span 12; }
    .table { min-width: 560px; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .welcome-banner { padding: 22px 20px; }
    .welcome-banner h1 { font-size: 20px; }
    .user-info { display: none; }
}
