/* =============================================
   ePaper Manager — Public Styles
   News-Site Layout + Inline Viewer + Theme Switcher
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=Source+Serif+4:wght@400;600&family=DM+Sans:wght@400;500;600&display=swap');

/* ---- Themes ---- */
:root,
[data-epm-theme="red"] {
    --epm-primary:       #c0392b;
    --epm-primary-dark:  #922b21;
    --epm-primary-light: #f5d5d3;
    --epm-accent:        #e74c3c;
    --epm-bg:            #f7f5f0;
    --epm-card-bg:       #ffffff;
    --epm-toolbar-bg:    #1a0d0b;
    --epm-toolbar-color: #fff;
    --epm-masthead-bg:   #c0392b;
    --epm-masthead-color:#fff;
    --epm-border:        #e0dbd5;
    --epm-text:          #1a1a1a;
    --epm-text-muted:    #6b6462;
    --epm-radius:        4px;
    --epm-shadow:        0 1px 4px rgba(0,0,0,.10);
    --epm-shadow-card:   0 2px 12px rgba(0,0,0,.08);
}
[data-epm-theme="navy"] {
    --epm-primary:       #1e3a5f;
    --epm-primary-dark:  #122540;
    --epm-primary-light: #d0daea;
    --epm-bg:            #f0f4f8;
    --epm-card-bg:       #ffffff;
    --epm-toolbar-bg:    #0d1f35;
    --epm-masthead-bg:   #1e3a5f;
    --epm-masthead-color:#fff;
    --epm-border:        #d5dde6;
    --epm-text:          #0d1f35;
    --epm-text-muted:    #607080;
    --epm-radius:        4px;
    --epm-shadow:        0 1px 4px rgba(0,0,0,.10);
    --epm-shadow-card:   0 2px 12px rgba(0,0,0,.08);
}
[data-epm-theme="forest"] {
    --epm-primary:       #2d6a4f;
    --epm-primary-dark:  #1b4332;
    --epm-primary-light: #d8f3dc;
    --epm-bg:            #f4f7f4;
    --epm-card-bg:       #ffffff;
    --epm-toolbar-bg:    #1b4332;
    --epm-masthead-bg:   #2d6a4f;
    --epm-masthead-color:#fff;
    --epm-border:        #d0e8d4;
    --epm-text:          #1b2e20;
    --epm-text-muted:    #5a7060;
    --epm-radius:        4px;
    --epm-shadow:        0 1px 4px rgba(0,0,0,.10);
    --epm-shadow-card:   0 2px 12px rgba(0,0,0,.08);
}
[data-epm-theme="gold"] {
    --epm-primary:       #9a6b00;
    --epm-primary-dark:  #6b4a00;
    --epm-primary-light: #fff3cd;
    --epm-bg:            #faf8f2;
    --epm-card-bg:       #ffffff;
    --epm-toolbar-bg:    #3d2900;
    --epm-masthead-bg:   #9a6b00;
    --epm-masthead-color:#fff;
    --epm-border:        #e8dfc4;
    --epm-text:          #2a1f00;
    --epm-text-muted:    #7a6a40;
    --epm-radius:        4px;
    --epm-shadow:        0 1px 4px rgba(0,0,0,.10);
    --epm-shadow-card:   0 2px 12px rgba(0,0,0,.08);
}
[data-epm-theme="slate"] {
    --epm-primary:       #334155;
    --epm-primary-dark:  #1e293b;
    --epm-primary-light: #dde3ed;
    --epm-bg:            #f1f5f9;
    --epm-card-bg:       #ffffff;
    --epm-toolbar-bg:    #0f172a;
    --epm-toolbar-color: #f8fafc;
    --epm-masthead-bg:   #334155;
    --epm-masthead-color:#fff;
    --epm-border:        #e2e8f0;
    --epm-text:          #0f172a;
    --epm-text-muted:    #64748b;
    --epm-radius:        4px;
    --epm-shadow:        0 1px 4px rgba(0,0,0,.10);
    --epm-shadow-card:   0 2px 12px rgba(0,0,0,.08);
}
[data-epm-theme="dark"] {
    --epm-primary:       #e74c3c;
    --epm-primary-dark:  #c0392b;
    --epm-primary-light: #3d1a18;
    --epm-bg:            #111418;
    --epm-card-bg:       #1c2028;
    --epm-toolbar-bg:    #0a0c0f;
    --epm-toolbar-color: #f0f0f0;
    --epm-masthead-bg:   #0a0c0f;
    --epm-masthead-color:#f0f0f0;
    --epm-border:        #2a2f38;
    --epm-text:          #e8e8e8;
    --epm-text-muted:    #8a909c;
    --epm-radius:        4px;
    --epm-shadow:        0 1px 4px rgba(0,0,0,.4);
    --epm-shadow-card:   0 2px 14px rgba(0,0,0,.35);
}

/* =============================================
   BASE
   ============================================= */
.epm-wrap {
    font-family: 'DM Sans', sans-serif;
    color: var(--epm-text);
    background: var(--epm-bg);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 40px;
}

/* =============================================
   MASTHEAD
   ============================================= */
.epm-masthead {
    background: var(--epm-masthead-bg);
    color: var(--epm-masthead-color);
    border-bottom: 3px solid rgba(255,255,255,.12);
    margin-bottom: 0;
}
.epm-masthead-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
}
.epm-masthead-brand {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.epm-masthead-icon { font-size: 26px; line-height: 1; }
.epm-masthead-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.3px;
    line-height: 1.1;
    margin: 0;
    color: var(--epm-masthead-color);
}
.epm-masthead-tagline {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: .65;
    margin-top: 2px;
}
.epm-masthead-controls {
    display: flex;
    align-items: stretch;
    padding: 0 8px;
}
.epm-masthead-search {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-left: 1px solid rgba(255,255,255,.1);
}
.epm-masthead-search input {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.18);
    color: var(--epm-masthead-color);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    width: 200px;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    transition: background .2s;
}
.epm-masthead-search input::placeholder { color: rgba(255,255,255,.45); }
.epm-masthead-search input:focus { background: rgba(255,255,255,.2); }

/* Theme switcher */
.epm-theme-switcher {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    border-left: 1px solid rgba(255,255,255,.1);
}
.epm-theme-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: .6;
    white-space: nowrap;
    color: var(--epm-masthead-color);
}
.epm-theme-dots { display: flex; gap: 5px; }
.epm-theme-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,.25);
    transition: transform .15s, border-color .15s;
}
.epm-theme-dot:hover { transform: scale(1.2); border-color: rgba(255,255,255,.85); }
.epm-theme-dot.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); transform: scale(1.1); }
.epm-theme-dot[data-theme="red"]    { background: #c0392b; }
.epm-theme-dot[data-theme="navy"]   { background: #1e3a5f; }
.epm-theme-dot[data-theme="forest"] { background: #2d6a4f; }
.epm-theme-dot[data-theme="gold"]   { background: #9a6b00; }
.epm-theme-dot[data-theme="slate"]  { background: #334155; }
.epm-theme-dot[data-theme="dark"]   { background: #1c2028; }

/* =============================================
   FILTER BAR below masthead
   ============================================= */
.epm-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--epm-card-bg);
    border-bottom: 1px solid var(--epm-border);
    flex-wrap: wrap;
    gap: 8px;
}
.epm-filter-box { display: flex; gap: 8px; }
.epm-filter-box select {
    padding: 6px 10px;
    border: 1px solid var(--epm-border);
    border-radius: var(--epm-radius);
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    background: var(--epm-bg);
    color: var(--epm-text);
    font-weight: 500;
}
.epm-filter-date { font-size: 12px; color: var(--epm-text-muted); font-weight: 500; }

/* =============================================
   SECTION HEADER
   ============================================= */
.epm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 2px solid var(--epm-primary);
    margin-bottom: 0;
}
.epm-section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--epm-text);
    margin: 0;
    letter-spacing: -.2px;
}
.epm-section-title span { color: var(--epm-primary); }

/* =============================================
   NEWS LAYOUT
   ============================================= */
.epm-news-body {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 0;
}
.epm-news-main {
    border-right: 1px solid var(--epm-border);
    padding: 20px 24px 20px 20px;
}
.epm-news-sidebar {
    padding: 20px 16px 20px 20px;
}

/* Featured card */
.epm-featured-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--epm-card-bg);
    border: 1px solid var(--epm-border);
    border-radius: var(--epm-radius);
    overflow: hidden;
    box-shadow: var(--epm-shadow-card);
    cursor: pointer;
    transition: box-shadow .2s;
    margin-bottom: 20px;
}
.epm-featured-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.14); }
.epm-featured-thumb {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}
.epm-featured-thumb-placeholder {
    height: 250px;
    background: linear-gradient(135deg, var(--epm-primary-light), var(--epm-bg));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
}
.epm-featured-info {
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.epm-featured-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--epm-primary);
    background: var(--epm-primary-light);
    padding: 3px 8px;
    border-radius: 2px;
    margin-bottom: 10px;
    width: fit-content;
}
.epm-featured-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--epm-text);
    margin: 0 0 10px;
}
.epm-featured-meta {
    font-size: 12px;
    color: var(--epm-text-muted);
    margin-bottom: 16px;
}
.epm-featured-meta strong { color: var(--epm-primary); font-weight: 600; }
.epm-featured-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--epm-primary);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: var(--epm-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background .2s;
    width: fit-content;
}
.epm-featured-btn:hover { background: var(--epm-primary-dark); }

/* Secondary row */
.epm-secondary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

/* =============================================
   CARD
   ============================================= */
.epm-card {
    background: var(--epm-card-bg);
    border: 1px solid var(--epm-border);
    border-radius: var(--epm-radius);
    box-shadow: var(--epm-shadow-card);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .2s, transform .15s;
    display: flex;
    flex-direction: column;
}
.epm-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.13); transform: translateY(-2px); }
.epm-card-thumb {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}
.epm-card-thumb-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, var(--epm-primary-light), var(--epm-bg));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--epm-text-muted);
}
.epm-card-body { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; }
.epm-card-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: 13px;
    margin: 0 0 5px;
    line-height: 1.35;
    color: var(--epm-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.epm-card-date { font-size: 11px; color: var(--epm-primary); font-weight: 600; }
.epm-card-author { font-size: 11px; color: var(--epm-text-muted); margin-top: 2px; }
.epm-card-read-btn {
    display: block;
    margin-top: auto;
    padding: 6px;
    background: var(--epm-primary);
    color: #fff;
    text-align: center;
    border-radius: var(--epm-radius);
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: 'DM Sans', sans-serif;
    transition: background .2s;
    margin-top: 10px;
}
.epm-card-read-btn:hover { background: var(--epm-primary-dark); }

/* Grid */
.epm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

/* =============================================
   LOADING
   ============================================= */
.epm-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 40px;
    color: var(--epm-text-muted);
    font-size: 14px;
}
.epm-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid var(--epm-border);
    border-top-color: var(--epm-primary);
    border-radius: 50%;
    animation: epm-spin .7s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes epm-spin { to { transform: rotate(360deg); } }

/* =============================================
   PAGINATION
   ============================================= */
.epm-pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 4px 0 4px;
}
.epm-pagination button {
    padding: 5px 11px;
    border: 1px solid var(--epm-border);
    border-radius: var(--epm-radius);
    background: var(--epm-card-bg);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--epm-text);
    font-family: 'DM Sans', sans-serif;
    transition: all .15s;
}
.epm-pagination button:hover { background: var(--epm-primary); color: #fff; border-color: var(--epm-primary); }
.epm-pagination button.active { background: var(--epm-primary); color: #fff; border-color: var(--epm-primary); }
.epm-pagination button:disabled { opacity: .35; cursor: default; }

/* =============================================
   SIDEBAR
   ============================================= */
.epm-sidebar-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--epm-text);
    border-bottom: 2px solid var(--epm-primary);
    padding-bottom: 7px;
    margin: 0 0 12px;
}
.epm-sidebar-block { margin-bottom: 24px; }

/* Calendar sidebar */
.epm-calendar-section {
    background: var(--epm-card-bg);
    border: 1px solid var(--epm-border);
    border-radius: var(--epm-radius);
    padding: 12px;
}
.epm-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.epm-cal-title { font-weight: 700; font-size: 13px; color: var(--epm-text); }
.epm-cal-prev, .epm-cal-next {
    background: none; border: none;
    font-size: 18px; cursor: pointer;
    color: var(--epm-primary);
    padding: 0 4px;
}
.epm-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
}
.epm-cal-day-label { font-size: 10px; font-weight: 700; color: var(--epm-text-muted); padding: 3px 0; }
.epm-cal-day { font-size: 12px; padding: 5px 2px; border-radius: 50%; cursor: default; color: var(--epm-text); }
.epm-cal-day.has-paper { background: var(--epm-primary); color: #fff; cursor: pointer; font-weight: 700; }
.epm-cal-day.has-paper:hover { background: var(--epm-primary-dark); }
.epm-cal-day.today { outline: 2px solid var(--epm-primary); outline-offset: -1px; }
.epm-cal-day.empty { color: transparent; pointer-events: none; }

/* Sidebar list */
.epm-sidebar-list { list-style: none; padding: 0; margin: 0; }
.epm-sidebar-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--epm-border);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
}
.epm-sidebar-list li:last-child { border-bottom: none; }
.epm-sidebar-list-thumb {
    width: 52px; height: 68px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
    background: var(--epm-primary-light);
}
.epm-sidebar-list-thumb-placeholder {
    width: 52px; height: 68px;
    background: var(--epm-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 2px;
    flex-shrink: 0;
}
.epm-sidebar-list-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--epm-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 3px;
}
.epm-sidebar-list-date { font-size: 11px; color: var(--epm-primary); font-weight: 600; }

/* =============================================
   INLINE VIEWER (same-page, not fullscreen)
   ============================================= */
.epm-inline-viewer-wrap {
    display: none;
    background: var(--epm-toolbar-bg);
    border-radius: var(--epm-radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.epm-inline-viewer-wrap.active { display: flex; flex-direction: column; }

/* Viewer toolbar */
.epm-viewer-toolbar {
    background: var(--epm-toolbar-bg);
    color: #fff;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.epm-viewer-info { display: flex; flex-direction: column; min-width: 140px; }
.epm-viewer-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}
.epm-viewer-meta { font-size: 11px; color: rgba(255,255,255,.45); }
.epm-viewer-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.epm-ctrl-group { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.epm-ctrl-group label {
    font-size: 9px; font-weight: 800; letter-spacing: 1.5px;
    color: rgba(255,255,255,.35); text-transform: uppercase;
}
.epm-ctrl-group > div, .epm-ctrl-group > span { display: flex; align-items: center; gap: 4px; }

.epm-btn {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--epm-radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: background .15s;
    font-family: 'DM Sans', sans-serif;
}
.epm-btn:hover { background: var(--epm-primary); border-color: var(--epm-primary); color: #fff; }
.epm-btn-clip { background: rgba(231,76,60,.2); border-color: rgba(231,76,60,.35); }
.epm-btn-clip.clipping { background: var(--epm-primary); }
.epm-btn-screenshot { background: rgba(41,182,246,.18); border-color: rgba(41,182,246,.3); }

.epm-page-display { display: flex; align-items: center; gap: 4px; }
.epm-page-display input {
    width: 42px; padding: 4px 6px; text-align: center;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.08);
    color: #fff; border-radius: var(--epm-radius);
    font-size: 12px; font-family: 'DM Sans', sans-serif;
}
.epm-page-display span { font-size: 12px; color: rgba(255,255,255,.5); }

.epm-viewer-close {
    background: rgba(231,76,60,.3); border: none; color: #fff;
    font-size: 16px; width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s; flex-shrink: 0;
}
.epm-viewer-close:hover { background: #e74c3c; }

/* Viewer body */
.epm-viewer-body {
    display: flex;
    height: 680px;
    overflow: hidden;
    position: relative;
}

/* Thumb strip */
.epm-thumb-strip {
    width: 110px; flex-shrink: 0;
    background: rgba(0,0,0,.35);
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,.05);
}
.epm-thumb-strip-inner { padding: 6px; }
.epm-strip-page {
    margin-bottom: 6px; cursor: pointer;
    border-radius: 2px; overflow: hidden;
    border: 2px solid transparent;
    transition: border-color .15s; position: relative;
}
.epm-strip-page:hover { border-color: rgba(255,255,255,.25); }
.epm-strip-page.active { border-color: var(--epm-primary); }
.epm-strip-page canvas { width: 100% !important; height: auto !important; display: block; }
.epm-strip-label {
    text-align: center; font-size: 10px; color: rgba(255,255,255,.35);
    padding: 2px 0 3px; background: rgba(0,0,0,.3);
}

/* Canvas area */
.epm-canvas-wrap {
    flex: 1; overflow: auto;
    display: flex; justify-content: center; align-items: flex-start;
    background: #1e1e2e; padding: 20px; position: relative;
}
.epm-canvas-container { position: relative; box-shadow: 0 4px 32px rgba(0,0,0,.5); line-height: 0; }
#epm-main-canvas { display: block; max-width: 100%; }

/* Clip overlay */
.epm-clip-overlay { position: absolute; inset: 0; cursor: crosshair; z-index: 20; }
.epm-clip-selection {
    position: absolute;
    border: 2px dashed #e74c3c;
    background: rgba(231,76,60,.1);
    pointer-events: none;
}
.epm-clip-hint {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.7); color: #fff;
    padding: 6px 14px; border-radius: 20px; font-size: 12px;
    white-space: nowrap; pointer-events: none;
}

/* Footer nav */
.epm-viewer-footer {
    background: rgba(0,0,0,.3);
    border-top: 1px solid rgba(255,255,255,.05);
    padding: 8px 14px;
    display: flex; align-items: center; justify-content: center;
    gap: 8px; flex-shrink: 0;
}
.epm-btn-lg {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.14);
    color: #fff; padding: 6px 13px; border-radius: var(--epm-radius);
    cursor: pointer; font-size: 12px; font-weight: 600;
    font-family: 'DM Sans', sans-serif; transition: background .15s;
}
.epm-btn-lg:hover { background: var(--epm-primary); border-color: var(--epm-primary); }
#vwr-foot-label { color: rgba(255,255,255,.5); font-size: 12px; min-width: 90px; text-align: center; }

/* =============================================
   PAGE POPUP
   ============================================= */
.epm-page-popup-overlay {
    display: none; position: fixed; inset: 0;
    z-index: 1000001; background: rgba(0,0,0,.7);
    align-items: center; justify-content: center;
}
.epm-page-popup-overlay.active { display: flex; }
.epm-page-popup {
    background: #1a1a2e; border-radius: 8px; overflow: hidden;
    max-width: 90vw; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 10px 60px rgba(0,0,0,.6);
}
.epm-page-popup-header {
    background: var(--epm-toolbar-bg); padding: 10px 16px;
    display: flex; align-items: center; justify-content: space-between;
    color: #fff; font-weight: 700; gap: 12px;
}
.epm-popup-actions { display: flex; gap: 8px; align-items: center; }
.epm-popup-btn {
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
    color: #fff; padding: 6px 11px; border-radius: var(--epm-radius);
    cursor: pointer; font-size: 12px; font-weight: 600;
    text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
    transition: background .15s; font-family: 'DM Sans', sans-serif;
}
.epm-popup-btn:hover { background: var(--epm-primary); border-color: var(--epm-primary); color: #fff; }
.epm-popup-close {
    background: rgba(231,76,60,.4); border: none; color: #fff;
    font-size: 15px; width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.epm-popup-close:hover { background: #e74c3c; }
.epm-page-popup-body { overflow: auto; padding: 16px; position: relative; flex: 1; }
#epm-popup-canvas { display: block; max-width: 100%; }
.epm-popup-crop-overlay {
    position: absolute; top: 16px; left: 16px; right: 16px; bottom: 16px;
    cursor: crosshair; z-index: 5;
}
.epm-popup-crop-sel {
    position: absolute; border: 2px dashed #e74c3c;
    background: rgba(231,76,60,.1); pointer-events: none;
}

/* =============================================
   CLIP RESULT MODAL
   ============================================= */
.epm-clip-result-overlay {
    display: none; position: fixed; inset: 0;
    z-index: 1000002; background: rgba(0,0,0,.75);
    align-items: center; justify-content: center;
}
.epm-clip-result-overlay.active { display: flex; }
.epm-clip-result {
    background: #fff; border-radius: 8px; overflow: hidden;
    max-width: 80vw; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 10px 50px rgba(0,0,0,.5);
}
.epm-clip-result-header {
    background: #1a1a2e; color: #fff; padding: 10px 16px;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-family: 'DM Sans', sans-serif;
}
.epm-clip-result-header button {
    background: rgba(231,76,60,.5); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
#epm-clip-result-img { max-width: 100%; object-fit: contain; }
.epm-clip-result-actions {
    padding: 12px 16px; background: #f4f4f4;
    display: flex; justify-content: flex-end;
}

/* =============================================
   LATEST WIDGET
   ============================================= */
.epm-latest-wrap { display: flex; flex-wrap: wrap; gap: 14px; }
.epm-latest-card {
    display: flex; gap: 12px;
    background: var(--epm-card-bg); border: 1px solid var(--epm-border);
    border-radius: var(--epm-radius); padding: 12px;
    box-shadow: var(--epm-shadow-card); align-items: flex-start;
    max-width: 400px; cursor: pointer;
}
.epm-latest-card img { width: 70px; border-radius: 2px; border: 1px solid var(--epm-border); }
.epm-latest-info { display: flex; flex-direction: column; gap: 4px; }
.epm-latest-info strong { font-family: 'Source Serif 4', Georgia, serif; font-size: 14px; color: var(--epm-text); }
.epm-latest-info span { font-size: 11px; color: var(--epm-text-muted); }
.epm-btn-read {
    display: inline-block; margin-top: 8px; padding: 6px 14px;
    background: var(--epm-primary); color: #fff; border-radius: var(--epm-radius);
    font-size: 12px; font-weight: 700; border: none; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}
.epm-btn-read:hover { background: var(--epm-primary-dark); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
    .epm-news-body { grid-template-columns: 1fr; }
    .epm-news-main { border-right: none; padding-right: 20px; border-bottom: 1px solid var(--epm-border); padding-bottom: 20px; margin-bottom: 20px; }
    .epm-news-sidebar { padding-left: 20px; }
    .epm-featured-card { grid-template-columns: 1fr; }
    .epm-featured-thumb, .epm-featured-thumb-placeholder { height: 180px; }
    .epm-secondary-row { grid-template-columns: repeat(2, 1fr); }
    .epm-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .epm-masthead-controls { width: 100%; border-top: 1px solid rgba(255,255,255,.1); }
    .epm-masthead-search input { width: 150px; }
    .epm-secondary-row { grid-template-columns: 1fr; }
    .epm-grid { grid-template-columns: repeat(2, 1fr); }
    .epm-viewer-body { height: 480px; }
    .epm-thumb-strip { width: 80px; }
    .epm-ctrl-group label { display: none; }
    .epm-viewer-title { max-width: 140px; }
}
