:root {
    --bg-app: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --border-light: #e2e8f0;
    --primary: #1e3a8a;
    --primary-hover: #172554;
    --primary-soft: #eff6ff;
    --emerald: #047857;
    --emerald-hover: #065f46;
    --emerald-soft: #ecfdf5;
    --amber: #b45309;
    --amber-soft: #fffbeb;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
}

/* Top Navbar */
.topbar {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.5px;
}

.brand-text h1 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text span {
    font-size: 11.5px;
    color: #94a3b8;
    display: block;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.2;
}

.btn-lg {
    padding: 12px 20px;
    font-size: 14.5px;
}

.btn-sm {
    padding: 6px 11px;
    font-size: 12.5px;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--emerald);
    color: #ffffff;
}
.btn-success:hover {
    background: var(--emerald-hover);
}

.btn-outline {
    background: #ffffff;
    color: var(--text-main);
    border-color: var(--border-color);
}
.btn-outline:hover {
    background: var(--bg-subtle);
    border-color: #94a3b8;
}

.btn-dark-outline {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.2);
}
.btn-dark-outline:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}
.btn-danger:hover {
    background: #fee2e2;
}

/* Containers & Alerts */
.container {
    max-width: 1280px;
    margin: 24px auto;
    padding: 0 20px;
}

.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.alert-success {
    background: var(--emerald-soft);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--danger-soft);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--amber-soft);
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Dashboard Stats & Cards */
.hero-banner {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}

.hero-banner h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.hero-banner p {
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 4px;
}

.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.search-bar {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 440px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13.8px;
    color: var(--text-main);
    background: #ffffff;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

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

/* Table */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    background: var(--bg-subtle);
}

.data-table tr:hover td {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
}

.badge-green {
    background: var(--emerald-soft);
    color: var(--emerald);
}

/* Editor Split Layout */
.editor-ActionBar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    top: 60px;
    z-index: 40;
}

.save-status {
    font-size: 12.5px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.save-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}

.editor-workspace {
    display: grid;
    grid-template-columns: 52% 48%;
    gap: 0;
    min-height: calc(100vh - 115px);
}

.editor-form-pane {
    padding: 20px 24px 60px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.editor-preview-pane {
    background: #cbd5e1;
    padding: 16px;
    position: sticky;
    top: 115px;
    height: calc(100vh - 115px);
    display: flex;
    flex-direction: column;
}

.preview-header-bar {
    background: #1e293b;
    color: #f8fafc;
    padding: 8px 14px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
}

.preview-iframe-wrapper {
    flex: 1;
    background: #e2e8f0;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    border: 1px solid #94a3b8;
    border-top: none;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #eef2f6;
}

/* Section Nav Pills */
.section-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.section-pill {
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-secondary);
}
.section-pill:hover,
.section-pill.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Template Selector Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.template-option {
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.15s;
}

.template-option:hover {
    border-color: #94a3b8;
}

.template-option.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.template-option strong {
    display: block;
    font-size: 13px;
    color: var(--text-main);
}

.template-option small {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
    display: block;
    margin-top: 2px;
}

/* Form Accordion Sections */
.form-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.form-section-header {
    padding: 14px 18px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.form-section-header h3 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section.collapsed .form-section-body {
    display: none;
}

.form-section.collapsed .form-section-header {
    border-bottom: none;
}

.form-section-body {
    padding: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.8px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.hide-toggle {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* Repeatable Cards (Experience, Education, Courses) */
.repeater-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
    margin-bottom: 12px;
}

.repeater-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.repeater-item-title {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--primary);
}

.repeater-actions {
    display: flex;
    gap: 5px;
}

/* Skill Tags */
.skills-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 10px 0;
    min-height: 36px;
    padding: 8px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
}

.skill-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12.8px;
    font-weight: 500;
}

.skill-chip button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 2px;
}
.skill-chip button:hover {
    color: var(--danger);
}

.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.suggestion-pill {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}
.suggestion-pill:hover {
    background: #dbeafe;
}

/* Login Box */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}

.login-card {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

/* Mobile Tabs for Editor / Preview */
.mobile-view-switcher {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    padding: 5px;
    border-radius: 28px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 90;
    gap: 6px;
}

.mobile-view-switcher button {
    border: none;
    background: transparent;
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: 22px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.mobile-view-switcher button.active {
    background: #2563eb;
    color: #ffffff;
}

@media (max-width: 1024px) {
    .editor-workspace {
        grid-template-columns: 1fr;
    }
    .editor-preview-pane {
        display: none;
        position: static;
        height: 82vh;
    }
    .editor-workspace.show-preview-mobile .editor-form-pane {
        display: none;
    }
    .editor-workspace.show-preview-mobile .editor-preview-pane {
        display: flex;
    }
    .mobile-view-switcher {
        display: flex;
    }
}

@media (max-width: 680px) {
    .col-8, .col-6, .col-4, .col-3 {
        grid-column: span 12;
    }
    .topbar {
        padding: 10px 14px;
    }
    .editor-form-pane {
        padding: 14px 14px 80px;
    }
}
