/* ============================================================
   THE CLIFF NEWS — COMPLETE DESIGN SYSTEM
   Professional White & Orange Editorial Newsroom Theme
   ============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES (THEME TOKENS)
   ============================================================ */
:root {
    /* Backgrounds */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-glass: #f1f5f9;
    --bg-glass-hover: #e2e8f0;
    --bg-input: #ffffff;
    --bg-modal: rgba(15, 23, 42, 0.65);

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-white: #ffffff;

    /* Brand Accents — The Cliff News Signature Orange */
    --accent-orange: #ea580c;
    --accent-orange-hover: #c2410c;
    --accent-orange-light: #fff7ed;
    --accent-orange-border: #fed7aa;
    --accent-blue: #ea580c; /* Primary mapped to brand orange */
    --accent-blue-glow: rgba(234, 88, 12, 0.2);
    --accent-purple: #ea580c;
    --accent-amber: #f59e0b;
    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --accent-cyan: #0284c7;

    /* Borders */
    --border-glass: #e2e8f0;
    --border-input: #cbd5e1;
    --border-focus: #ea580c;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    --gradient-card: #ffffff;
    --gradient-green: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    --gradient-amber: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-red: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);

    /* Typography */
    --font-en: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-hi: 'Noto Sans Devanagari', -apple-system, sans-serif;
    --font-family: var(--font-en);
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.84rem;
    --font-size-md: 0.95rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.35rem;
    --font-size-2xl: 1.75rem;
    --font-size-3xl: 2.25rem;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 6px 16px -2px rgba(0, 0, 0, 0.09), 0 2px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 12px var(--accent-blue-glow);
    --shadow-btn: 0 2px 8px rgba(234, 88, 12, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --topbar-height: 60px;
    --bottomnav-height: 64px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Hindi font activation */
body.lang-hi {
    --font-family: var(--font-hi);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

a {
    color: var(--accent-orange);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-primary);
}

.loading-logo {
    text-align: center;
    animation: fadeInUp 0.4s ease;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #fed7aa;
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: var(--space-md) auto 0;
}

/* ============================================================
   TOP BAR (White & Orange)
   ============================================================ */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    padding-top: var(--safe-area-top);
    background: #ffffff;
    border-bottom: 2px solid var(--accent-orange);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.brand-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    color: #ffffff;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
    flex-shrink: 0;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    color: #0f172a;
    text-transform: uppercase;
}

.brand-panel-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: #ea580c;
    letter-spacing: 0.2px;
}

.top-bar-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Language Toggle */
.lang-toggle {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-full);
    padding: 2px;
    cursor: pointer;
    position: relative;
    height: 32px;
}

.lang-toggle-option {
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    color: var(--text-secondary);
    z-index: 1;
    user-select: none;
    white-space: nowrap;
}

.lang-toggle-option.active {
    color: var(--text-white);
    background: var(--accent-orange);
    box-shadow: 0 1px 3px rgba(234, 88, 12, 0.3);
}

/* User Button */
.user-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    border: 2px solid #ea580c;
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.user-btn:active {
    transform: scale(0.92);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(var(--topbar-height) + 4px);
    right: var(--space-md);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    min-width: 210px;
    z-index: 1001;
    overflow: hidden;
    animation: fadeInDown 0.2s ease;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-header {
    padding: var(--space-md);
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.user-dropdown-header .name {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.user-dropdown-header .role {
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: 2px;
}

.user-dropdown-item {
    padding: 10px var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid #f8fafc;
}

.user-dropdown-item:hover {
    background: #fff7ed;
    color: var(--accent-orange);
}

.user-dropdown-item.danger {
    color: var(--accent-red);
}

.user-dropdown-item.danger:hover {
    background: #fef2f2;
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-height);
    padding-bottom: var(--safe-area-bottom);
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-xs) var(--space-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    min-width: 64px;
}

.bottom-nav-item.active {
    color: var(--accent-orange);
    font-weight: 700;
}

.bottom-nav-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
}

.bottom-nav-item .nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

.user-dropdown-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    color: var(--text-secondary);
}

.user-dropdown-item:hover svg {
    color: var(--accent-orange);
}

.user-dropdown-item.danger svg {
    color: var(--accent-red);
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
    color: var(--text-muted);
}

.upload-icon svg {
    width: 32px;
    height: 32px;
    stroke-width: 1.8;
    color: var(--accent-orange);
}

.news-card-thumb-placeholder svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
    color: var(--text-muted);
}

.bottom-nav-item .nav-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
    padding-top: calc(var(--topbar-height) + var(--safe-area-top) + var(--space-md));
    padding-bottom: calc(var(--bottomnav-height) + var(--safe-area-bottom) + var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    min-height: 100vh;
    min-height: 100dvh;
    animation: fadeIn 0.25s ease;
    max-width: 1400px;
    margin: 0 auto;
}

.page-content.no-bottom-nav {
    padding-bottom: var(--space-xl);
}

.page-header {
    margin-bottom: var(--space-lg);
}

.page-header h2 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.page-header p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-card-hover);
}

.card.greyed-out {
    background: #f8fafc;
    border-color: #e2e8f0;
    opacity: 0.75;
}

.copied-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: var(--space-sm);
}

/* News Card */
.news-card {
    cursor: pointer;
}

.news-card-header {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.news-card-thumb {
    width: 76px;
    height: 76px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.news-card-thumb-placeholder {
    width: 76px;
    height: 76px;
    border-radius: var(--radius-md);
    background: #fff7ed;
    border: 1px solid #fed7aa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    color: #ea580c;
}

.news-card-info {
    flex: 1;
    min-width: 0;
}

.news-card-headline {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.news-card-body {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    flex-wrap: wrap;
}

.news-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.news-card-actions-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px dashed #e2e8f0;
    flex-wrap: wrap;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.raw {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.status-badge.processing {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.status-badge.processed {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.status-badge.forwarded {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-badge.active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    min-height: 40px;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    color: #ffffff;
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #c2410c 0%, #ea580c 100%);
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
}

.btn-amber {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--accent-orange);
    padding: 6px 12px;
}

.btn-sm {
    padding: 7px 14px;
    font-size: var(--font-size-xs);
    min-height: 34px;
    border-radius: var(--radius-sm);
}

.btn-xs {
    padding: 5px 11px;
    font-size: 0.74rem;
    min-height: 28px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.1rem;
}

/* FAB */
.fab {
    position: fixed;
    bottom: calc(var(--bottomnav-height) + var(--safe-area-bottom) + var(--space-md));
    right: var(--space-md);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    border: none;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.4);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.fab:active {
    transform: scale(0.92);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px var(--space-md);
    background: #ffffff;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    transition: var(--transition-fast);
    outline: none;
    min-height: 44px;
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    resize: vertical;
    line-height: 1.6;
}

select.form-input {
    cursor: pointer;
    background-color: #ffffff;
}

/* Image Upload Area */
.image-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    background: #f8fafc;
}

.image-upload-area:hover {
    border-color: var(--accent-orange);
    background: #fff7ed;
}

.image-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-upload-icon {
    font-size: 2.2rem;
    color: var(--accent-orange);
    margin-bottom: var(--space-xs);
}

.image-upload-text {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.image-upload-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.image-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-sm);
    border: 1px solid #e2e8f0;
}

.image-preview img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.image-preview .remove-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.7);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   SPLIT SCREEN (Editor Panel)
   ============================================================ */
.split-tabs {
    display: flex;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-full);
    padding: 3px;
    margin-bottom: var(--space-md);
}

.split-tab {
    flex: 1;
    padding: 8px 12px;
    text-align: center;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.split-tab.active {
    background: var(--accent-orange);
    color: white;
    box-shadow: 0 1px 4px rgba(234, 88, 12, 0.3);
}

.split-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.12);
    font-size: var(--font-size-xs);
    margin-left: 4px;
    padding: 0 4px;
}

.split-screen {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.split-pane {
    display: none;
    animation: fadeIn 0.25s ease;
}

.split-pane.active {
    display: block;
}

@media (min-width: 768px) {
    .split-tabs {
        display: none;
    }

    .split-screen {
        flex-direction: row;
        gap: var(--space-lg);
    }

    .split-pane {
        display: block !important;
        flex: 1;
        min-width: 0;
        max-height: calc(100vh - var(--topbar-height) - var(--bottomnav-height) - 80px);
        overflow-y: auto;
        padding-right: var(--space-sm);
    }

    .split-pane::-webkit-scrollbar {
        width: 6px;
    }

    .split-pane::-webkit-scrollbar-track {
        background: transparent;
    }

    .split-pane::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

    .split-pane-header {
        position: sticky;
        top: 0;
        background: var(--bg-primary);
        padding-bottom: var(--space-sm);
        z-index: 5;
    }
}

.split-pane-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.split-pane-header h3 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: var(--font-size-md);
    font-weight: 700;
    color: var(--text-primary);
}

.split-pane-header .pane-count {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--accent-orange);
}

/* ============================================================
   MODAL (Article Reader) — Clean White & Top Actions
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: #ffffff;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow-modal);
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: var(--space-sm) auto var(--space-md);
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: #e2e8f0;
}

@media (max-width: 767px) {
    .modal-close {
        position: fixed;
        top: 24px;
        right: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1000;
    }
}

.modal-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-bottom: 1px solid #e2e8f0;
}

.modal-body {
    padding: var(--space-md) var(--space-lg) var(--space-xl);
}

.modal-headline {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    margin-bottom: var(--space-sm);
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid #e2e8f0;
}

/* TOP ACTIONS BAR (No scrolling needed!) */
.modal-actions-top {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: var(--space-sm) 0 var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.08);
}

.modal-actions-top .btn {
    flex: 1;
    min-width: 120px;
    font-size: var(--font-size-xs);
    padding: 8px 14px;
    min-height: 36px;
}

.modal-article {
    font-size: 0.98rem;
    color: #334155;
    line-height: 1.85;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-top: var(--space-md);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 120px;
}

@media (min-width: 768px) {
    .modal-content {
        max-width: 680px;
        border-radius: var(--radius-xl);
        margin-bottom: var(--space-xl);
        max-height: 85vh;
        border: 1px solid #e2e8f0;
    }

    .modal-overlay {
        align-items: center;
    }
}

/* ============================================================
   LOGIN PAGE (White & Orange Theme)
   ============================================================ */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--space-xl);
    animation: fadeIn 0.4s ease;
    background: #f8fafc;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.brand-logo-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    color: #ffffff;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 1px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
    margin-bottom: var(--space-xs);
}

.brand-tagline-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ea580c;
    margin-top: 6px;
    letter-spacing: 0.3px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ea580c, #f97316);
}

.login-lang-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.login-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: #b91c1c;
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-md);
    display: none;
}

.login-error.show {
    display: block;
    animation: shakeX 0.5s ease;
}

/* ============================================================
   STATS CARDS (Admin Dashboard)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

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

.stat-card.blue::before { background: var(--gradient-primary); }
.stat-card.green::before { background: var(--gradient-green); }
.stat-card.amber::before { background: var(--gradient-amber); }
.stat-card.purple::before { background: linear-gradient(135deg, #ea580c, #c2410c); }

.stat-card .stat-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}

.stat-card .stat-value {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: #0f172a;
}

.stat-card .stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 2px;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================================
   USER LIST (Admin)
   ============================================================ */
.user-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-md);
    color: white;
    flex-shrink: 0;
}

.user-avatar.reporter { background: var(--gradient-amber); }
.user-avatar.editor { background: var(--gradient-primary); }
.user-avatar.operator { background: var(--gradient-green); }
.user-avatar.admin { background: linear-gradient(135deg, #0f172a, #334155); }

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .name {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.user-info .username {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.user-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-status.active { background: var(--accent-green); }
.user-status.inactive { background: var(--accent-red); }

/* ============================================================
   ROLE FILTER TABS
   ============================================================ */
.role-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-xs);
}

.role-tabs::-webkit-scrollbar { display: none; }

.role-tab {
    padding: 7px 16px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.role-tab.active {
    background: var(--accent-orange);
    color: white;
    border-color: var(--accent-orange);
    box-shadow: 0 1px 4px rgba(234, 88, 12, 0.3);
}

/* ============================================================
   SETTINGS SECTIONS (Admin)
   ============================================================ */
.settings-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.settings-section-title {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: var(--font-size-md);
    font-weight: 700;
    color: #0f172a;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + var(--space-md));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    pointer-events: none;
    width: 90%;
    max-width: 420px;
}

.toast {
    padding: 12px var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    pointer-events: auto;
    animation: fadeInDown 0.3s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.toast.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
}

.toast.error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.toast.info {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
}

.toast.removing {
    animation: fadeOutUp 0.3s ease forwards;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
    opacity: 0.6;
}

.empty-text {
    font-size: var(--font-size-md);
    font-weight: 500;
}

/* ============================================================
   CUSTOM REWRITE SETTINGS MODAL
   ============================================================ */
.custom-rewrite-section {
    margin-bottom: var(--space-md);
}

.custom-rewrite-label {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.selector-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.selector-pill {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.selector-pill:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.selector-pill.active {
    background: var(--accent-orange);
    color: #ffffff;
    border-color: var(--accent-orange);
    box-shadow: 0 1px 4px rgba(234, 88, 12, 0.35);
}

/* Retry Error Box */
.rewrite-error-box {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md) 0;
    text-align: center;
}

.rewrite-error-title {
    color: #b91c1c;
    font-weight: 700;
    font-size: var(--font-size-md);
    margin-bottom: 4px;
}

.rewrite-error-desc {
    color: #7f1d1d;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.confirm-dialog {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 360px;
    width: 100%;
    text-align: center;
    animation: scaleIn 0.2s ease;
    box-shadow: var(--shadow-modal);
}

.confirm-dialog .confirm-icon {
    font-size: 2.2rem;
    margin-bottom: var(--space-md);
}

.confirm-dialog .confirm-title {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: #0f172a;
    margin-bottom: var(--space-sm);
}

.confirm-dialog .confirm-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.confirm-dialog .confirm-actions {
    display: flex;
    gap: var(--space-sm);
}

.confirm-dialog .confirm-actions .btn {
    flex: 1;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-16px); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-sm { gap: var(--space-sm); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   SVG ICON SYSTEM
   ============================================================ */
.svg-icon {
    display: inline-flex;
    flex-shrink: 0;
    vertical-align: middle;
    fill: none;
}

.empty-icon-svg {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--text-muted);
    opacity: 0.5;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.spin-icon {
    animation: spin 1s linear infinite;
}

/* ============================================================
   MULTI-IMAGE UPLOAD (Reporter)
   ============================================================ */
.multi-upload-zone {
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-glass);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.multi-upload-zone:hover,
.multi-upload-zone.drag-over {
    border-color: var(--accent-orange);
    background: var(--accent-orange-light);
}

.upload-icon-svg {
    color: var(--text-muted);
    margin-bottom: 4px;
    transition: color 0.2s;
}

.multi-upload-zone:hover .upload-icon-svg {
    color: var(--accent-orange);
}

.multi-image-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    min-height: 80px;
    align-items: flex-start;
}

.multi-thumb-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.multi-thumb-item:first-child {
    border-color: var(--accent-orange);
}

.multi-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.multi-thumb-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(234,88,12,0.85);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    padding: 2px;
    letter-spacing: 0.5px;
}

.multi-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(220,38,38,0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
}

.multi-thumb-remove:hover {
    background: #b91c1c;
}

.multi-thumb-add {
    width: 72px;
    height: 72px;
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.65rem;
    transition: border-color 0.15s, color 0.15s;
}

.multi-thumb-add:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

/* ============================================================
   EDITOR IMAGE PICKER
   ============================================================ */
.editor-image-picker {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.editor-image-picker-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.editor-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-img-tile {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
}

.editor-img-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.editor-img-tile:hover {
    transform: scale(1.04);
    border-color: var(--accent-orange);
}

.editor-img-tile.selected {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(22,163,74,0.25);
}

.editor-img-selected-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(22,163,74,0.88);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

/* ============================================================
   OPERATOR IMAGE GALLERY
   ============================================================ */
.operator-image-gallery {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.operator-gallery-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.operator-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.operator-gallery-tile {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: zoom-in;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.operator-gallery-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.operator-gallery-tile.selected {
    border-color: var(--accent-orange);
}

.operator-img-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(234,88,12,0.85);
    color: white;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.operator-img-download-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.15s;
}

.operator-img-download-btn:hover {
    background: var(--accent-orange);
}

