/* ============================================================
   Inkara Admin Dashboard — Shared Styles
   Matches Widget Dashboard brand: Inter + DM Serif Display,
   warm cream/paper palette, rose/mauve accent
   ============================================================ */

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

:root {
    /* Brand tokens */
    --ink: #1a1a2e;
    --paper: #faf9f6;
    --accent: #af2860;
    --accent-dark: #8e1f4d;
    --accent-light: #f4e2e8;
    --border: #e2ddd5;
    --muted: #8a8477;
    --success: #2d6a4f;
    --danger: #c0392b;
    --warning: #f39c12;
    --radius: 6px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #2c2c44;
    --card-bg: #fff;

    /* Aliases for backward compat (used in views.js inline styles) */
    --bg: var(--paper);
    --primary: var(--accent);
    --primary-dark: var(--accent-dark);
    --text: var(--ink);
    --text-light: var(--muted);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* --- Login --- */
#login-screen {
    background: #faf9f6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding-top: 60px;
}
.login-box {
    text-align: center;
    padding: 2.5rem 3rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 350px;
    height: fit-content;
}
.login-logo {
    height: 80px;
    width: auto;
    margin-bottom: 1.25rem;
}
.login-heading {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    color: var(--ink);
    line-height: 1.4;
    margin-bottom: 1.5rem;
    letter-spacing: -0.3px;
}
.login-subtitle {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.login-field {
    text-align: left;
    margin-bottom: 1rem;
}
.login-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}
.login-field input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    background: #fff;
    color: var(--ink);
    transition: border-color 0.15s;
}
.login-field input:focus {
    outline: none;
    border-color: var(--accent);
}
.btn-block {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    margin-top: 0.5rem;
}
.login-link {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}
.login-link:hover {
    color: var(--accent);
}
.login-error {
    background: #fdf0f0;
    border: 1px solid #e8c4c4;
    color: #8b2020;
    font-size: 0.8rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: left;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--ink);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Action menu (3-dot dropdown) --- */
.action-menu-btn { font-size: 1.2rem; line-height: 1; padding: 0.2rem 0.5rem; letter-spacing: 1px; background: var(--paper); border: 1px solid var(--accent); color: var(--accent); cursor: pointer; border-radius: 4px; transition: all 0.15s; font-weight: 900; }
.action-menu-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.action-menu { position: absolute; right: 0; top: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.08); z-index: 100; min-width: 150px; padding: 4px 0; }
.action-menu-item { display: block; width: 100%; padding: 8px 16px; border: none; background: none; text-align: left; cursor: pointer; font-size: 0.85rem; font-family: 'Inter', sans-serif; color: var(--ink); transition: background 0.15s, color 0.15s; }
.action-menu-item:hover { background: var(--accent-light); color: var(--accent); }

/* --- Layout --- */
#main-screen { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--paper);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0;
    border-right: none;
    transition: width 0.2s ease;
    overflow: hidden;
    z-index: 50;
}
.sidebar-header { padding: 1.5rem; }
.sidebar-header-row { display: flex; align-items: center; justify-content: space-between; }
.sidebar-header img.sidebar-logo { height: 63px; width: auto; }
.sidebar-collapse-btn { background: none; border: none; cursor: pointer; padding: 4px; color: var(--muted); transition: color 0.15s; }
.sidebar-collapse-btn:hover { color: var(--ink); }
.sidebar-collapse-btn svg { width: 18px; height: 18px; }
.nav-links a.nav-disabled { color: var(--muted); opacity: 0.5; cursor: default; pointer-events: none; }
#nav-logout { color: var(--muted); }
#nav-logout:hover { color: var(--accent); background: rgba(175,40,96,0.04); }
.user-email { font-size: 0.75rem; color: var(--muted); word-break: break-all; display: block; margin-top: 0.35rem; }

.nav-links { list-style: none; padding: 0.5rem 0; flex: 1; }
.nav-links a {
    display: block;
    padding: 0.5rem 1.5rem;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.nav-links a:hover, .nav-links a.active {
    background: rgba(175,40,96,0.04);
    color: var(--accent);
}
.nav-links a.active { border-left-color: var(--accent); }

/* Nav icons */
.nav-links a svg, .nav-accordion-toggle svg { width: 16px; height: 16px; vertical-align: -2px; margin-right: 8px; stroke-width: 2; }

/* Nav accordions */
.nav-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-left: none !important;
}
.nav-accordion-toggle::after {
    content: '\203A';
    font-size: 1.2rem;
    line-height: 1;
    color: var(--muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    display: inline-block;
    vertical-align: -3px;
    transform: rotate(90deg);
}
.nav-accordion.open > .nav-accordion-toggle::after {
    transform: rotate(-90deg);
}
.nav-sub {
    list-style: none;
    display: none;
    padding: 0;
}
.nav-accordion.open > .nav-sub {
    display: block;
}
.nav-sub a {
    padding-left: 2.5rem !important;
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
    font-size: 0.85rem !important;
}

.sidebar-user-card {
    margin: 0.75rem 0.75rem 0.75rem 1rem; padding: 0.75rem 1rem;
    border-radius: 10px; text-align: center;
    font-size: 0.8rem; line-height: 1.5;
}
.suc-info:hover { opacity: 0.85; }
#suc-account-filter-slot { padding: 0 1rem; }
.suc-account-select {
    width: 100%; padding: 5px 8px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: var(--ink);
    font-size: 0.78rem; font-family: 'Inter', sans-serif;
    cursor: pointer; outline: none; display: block;
}
.sidebar-collapsed #suc-account-filter-slot { display: none; }
.suc-account-select:focus { border-color: var(--accent); }
.sidebar-user-card .suc-name { font-weight: 700; color: var(--ink); }
.sidebar-user-card .suc-role { color: var(--ink); opacity: 0.7; font-size: 0.75rem; }
.sidebar-user-card .suc-account { color: var(--ink); opacity: 0.7; font-size: 0.75rem; }
.sidebar-user-card .suc-email { color: var(--ink); opacity: 0.6; font-size: 0.7rem; word-break: break-all; }
.sidebar-collapsed .sidebar-user-card { display: none; }
.sidebar-user-avatar {
    display: none; /* hidden when expanded */
}
.sidebar-collapsed .sidebar-user-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    margin: 0 auto 12px; cursor: pointer;
    font-size: 0.85rem; font-weight: 700; color: var(--ink);
    transition: opacity 0.15s;
}
.sidebar-collapsed .sidebar-user-avatar:hover { opacity: 0.75; }

.sidebar-account { padding: 1rem 1.5rem; }
.sidebar-account label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.4rem; }
.sidebar-account select { width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 0.8rem; font-family: 'Inter', sans-serif; cursor: pointer; }
.sidebar-account select:focus { outline: none; border-color: var(--accent); }


.content { margin-left: 240px; padding: 2rem; flex: 1; min-width: 0; transition: margin-left 0.2s ease; }

/* --- Sidebar expand button (visible only when collapsed) --- */
.sidebar-expand { display: none; position: fixed; top: 14px; left: 14px; cursor: pointer; z-index: 100; }
.sidebar-expand-icon { width: 28px; height: 28px; border-radius: 4px; }
.sidebar-expand-icon:hover { opacity: 0.7; }

/* --- Sidebar collapsed state --- */
.sidebar-collapsed .sidebar { width: 56px; background: #f3efe8; }
.sidebar-collapsed .sidebar-header { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.sidebar-collapsed .sidebar-header-row { justify-content: center; }
.sidebar-collapsed .sidebar-logo { display: none; }
.sidebar-collapsed .sidebar-collapse-btn { padding: 6px; }
.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapsed .user-email { display: none; }
.sidebar-collapsed .nav-links a span,
.sidebar-collapsed .nav-accordion-toggle span { display: none; }
.sidebar-collapsed .nav-links a { padding: 0.75rem 0; text-align: center; border-left: none; }
.sidebar-collapsed .nav-links a svg { margin-right: 0; }
.sidebar-collapsed .nav-sub { display: none !important; }
.sidebar-collapsed .nav-accordion-toggle { justify-content: center; padding: 0.75rem 0; }
.sidebar-collapsed .nav-accordion-toggle::after { display: none; }

/* --- Flyout: sub-menu as a floating panel when sidebar is collapsed --- */
/* JS sets .flyout-open on the <li.nav-accordion> plus inline `top` on the
   .nav-sub so the popover aligns with the clicked icon. */
.sidebar-collapsed .nav-accordion.flyout-open .nav-sub {
    display: block !important;
    position: fixed;
    left: 56px;                /* matches .sidebar-collapsed .sidebar width */
    min-width: 200px;
    padding: 4px 0;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    animation: flyoutFade 0.12s ease-out;
}
/* In flyout mode, items use regular horizontal padding (not the 2.5rem
   indent used by the in-sidebar expanded accordion). Show the text labels
   that are hidden in the collapsed sidebar itself. */
.sidebar-collapsed .nav-accordion.flyout-open .nav-sub a {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}
.sidebar-collapsed .nav-accordion.flyout-open .nav-sub a span {
    display: inline;
}
.sidebar-collapsed .nav-accordion.flyout-open .nav-sub a svg {
    width: 14px;
    height: 14px;
    margin-right: 0;
}
@keyframes flyoutFade {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}
.sidebar-collapsed .nav-links a.active { border-left: none; color: var(--accent); }
/* sidebar-account removed — filter now in suc-account-filter-slot */
.sidebar-collapsed .content { margin-left: 56px; }
.sidebar-collapsed .sidebar-expand { display: none; }

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.card-header h3 { font-family: 'DM Serif Display', serif; font-size: 1.1rem; letter-spacing: -0.3px; }

/* --- Stats row --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-card .label { font-size: 0.75rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; color: var(--ink); }
.stat-card .sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

/* --- Tables --- */
.table-wrap { overflow: visible; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 0.75rem; border-bottom: 2px solid var(--border); color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
tr:hover td { background: #f8f6f2; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-hidden { background: #fff3cd; color: #856404; }
.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-unmatched { background: #ffe0b2; color: #e65100; }
.badge-failed { background: #f8d7da; color: #721c24; }
.badge-succeeded { background: #d4edda; color: #155724; }
.badge-processing { background: #d1ecf1; color: #0c5460; }

/* Feedback status badges */
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-open { background: #fef3c7; color: #92400e; }
.badge-awaiting-user { background: #fef3c7; color: #92400e; }
.badge-awaiting-inkara { background: #ede9fe; color: #5b21b6; }
.badge-closed { background: #d1fae5; color: #065f46; }

/* Feedback table + modal */
.feedback-table tr { cursor: pointer; }
.feedback-clip { vertical-align: middle; }
th[data-sort-key] { cursor: pointer; user-select: none; }
th[data-sort-key]:hover { color: var(--accent); }
th .sort-arrow { font-size: 0.65rem; margin-left: 4px; }
.modal-feedback { max-width: 900px; max-height: 85vh; overflow-y: auto; }
.feedback-detail-grid {
    display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
    font-size: 0.85rem; margin-bottom: 16px;
}
.feedback-detail-label { color: var(--muted); font-weight: 500; }
.feedback-detail-comment {
    background: var(--cream, #faf9f5); border: 1px solid var(--border);
    border-radius: 6px; padding: 12px; margin: 0 0 16px;
    white-space: pre-wrap; font-size: 0.85rem; line-height: 1.5;
}
.feedback-detail-screenshot img {
    width: 100%; border-radius: 6px; border: 1px solid var(--border); margin-top: 8px;
    cursor: pointer; transition: opacity 0.15s;
}
.feedback-detail-screenshot img:hover { opacity: 0.85; }

/* Feedback thread — message bubbles inside the detail modal */
.fb-thread {
    max-height: 360px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.fb-msg {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
}
.fb-msg-user {
    background: var(--cream, #faf9f5);
    border: 1px solid var(--border);
    margin-right: 24px;
}
.fb-msg-admin {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    margin-left: 24px;
}
.fb-msg-header {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.fb-msg-email { margin-left: 4px; }
.fb-msg-time { margin-left: 8px; }
.fb-msg-body { white-space: pre-wrap; word-break: break-word; }
.fb-msg-screenshot img {
    max-width: 100%;
    border-radius: 4px;
    border: 1px solid var(--border);
    margin-top: 6px;
    cursor: pointer;
    max-height: 200px;
    object-fit: cover;
}
.fb-msg-screenshot img:hover { opacity: 0.85; }

/* Reply form */
.fb-reply-form {
    margin-top: 8px;
}
.fb-reply-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    min-height: 60px;
    background: var(--paper, #fff);
    color: var(--ink);
}
.fb-reply-textarea:focus { outline: none; border-color: var(--accent); }

/* Feedback screenshot lightbox — full-screen overlay with a dark top bar */
.feedback-lightbox {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(0,0,0,0.92);
    display: flex; flex-direction: column;
    cursor: pointer;
}
.feedback-lightbox-bar {
    flex-shrink: 0; height: 40px;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: flex-end;
    padding: 0 12px;
}
.feedback-lightbox-close {
    background: none; border: none; color: #fff; cursor: pointer;
    font-size: 1.2rem; line-height: 1; padding: 4px 8px; opacity: 0.8;
    transition: opacity 0.15s;
}
.feedback-lightbox-close:hover { opacity: 1; }
.feedback-lightbox-body {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 16px; overflow: auto;
}
.feedback-lightbox-body img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    border-radius: 4px; pointer-events: none;
}
.badge-received { background: #e2e3e5; color: #383d41; }
.badge-format { background: #e8e6e1; color: #383d41; }
.badge-full { background: #d1ecf1; color: #0c5460; }
.badge-partial { background: #fff3cd; color: #856404; }

/* --- Page header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    letter-spacing: -0.3px;
}

/* --- Page Hero Header --- */
.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
    border-radius: 14px;
    min-height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
}
.page-hero.has-dropdown { overflow: visible; }
.page-hero:not(.has-dropdown) { overflow: hidden; }
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.45), rgba(0,0,0,0.25));
    border-radius: 14px;
}
.page-hero > * { position: relative; z-index: 2; }
.page-hero h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
    letter-spacing: -0.3px;
    color: #fff;
    margin: 0;
}
.page-hero .btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.6);
    backdrop-filter: blur(4px);
}
.page-hero .btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: #fff;
}

/* Hero stream switcher (pill-style dropdown in hero banner) */
.hero-stream-switcher {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px; padding: 6px 14px;
    color: #fff; cursor: pointer; font-size: 0.85rem; font-weight: 500;
    user-select: none; white-space: nowrap;
}
.hero-stream-switcher:hover { background: rgba(255,255,255,0.25); }
.hero-stream-dropdown {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 220px; z-index: 1000;
    max-height: 300px; overflow-y: auto;
}
.hero-stream-dropdown.open { display: block; }
.hero-stream-option {
    padding: 10px 14px; cursor: pointer; color: var(--ink); font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.hero-stream-option:last-child { border-bottom: none; }
.hero-stream-option:hover { background: var(--cream); }
.hero-stream-option.active { color: var(--accent); font-weight: 600; }

/* --- Compact Hero (Inklet Editor) --- */
.page-hero-sm {
    min-height: 50px !important;
    padding: 0.8rem 2rem !important;
    overflow: visible !important;
}
.page-hero-sm h2 { font-size: 1.2rem; }

/* --- Inline Name Editor --- */
.ie-editor-name {
    background: none; border: none; border-bottom: 1px solid transparent;
    color: #fff; font-family: 'DM Serif Display', serif;
    font-size: 1.1rem; outline: none; padding: 2px 4px;
    flex: 1; min-width: 150px; max-width: 500px;
}
.ie-editor-name:focus {
    border-bottom-color: rgba(255,255,255,0.6);
}
.ie-editor-name::placeholder { color: rgba(255,255,255,0.4); }

/* --- Channel Switcher --- */
.ie-channel-switcher {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px; padding: 4px 12px 4px 4px;
    color: #fff; cursor: pointer; position: relative;
    font-size: 0.85rem; white-space: nowrap;
    transition: background 0.15s;
}
.ie-channel-switcher:hover { background: rgba(255,255,255,0.25); }
.ie-channel-switcher > img {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
}
.ie-channel-dropdown {
    display: none; position: absolute; top: 100%; left: 0;
    margin-top: 6px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 6px 0;
    min-width: 200px; z-index: 1000;
}
.ie-channel-dropdown.open { display: block; }
.ie-channel-option {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; cursor: pointer; color: var(--ink);
    font-size: 0.85rem; transition: background 0.1s;
}
.ie-channel-option:hover { background: var(--cream); }
.ie-channel-option.active { color: var(--accent); font-weight: 600; }
.ie-channel-option img {
    width: 24px; height: 24px; border-radius: 4px; object-fit: cover;
}

/* --- Forms --- */
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; flex: 1; min-width: 200px; }
.form-group label { font-size: 0.75rem; font-weight: 500; color: var(--muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    background: var(--paper);
    color: var(--ink);
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* --- Filter bar --- */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-bar .form-group { min-width: 150px; flex: 0 0 auto; }
.filter-bar input[type="text"] { width: 250px; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,26,46,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.modal h3 { font-family: 'DM Serif Display', serif; margin-bottom: 1.25rem; letter-spacing: -0.3px; }

/* Run detail modal — large, near-fullscreen */
.modal-run-detail {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 92%;
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: slideUp 0.25s ease;
    overflow: hidden;
}
.modal-run-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    flex-shrink: 0;
}
.modal-run-header h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    letter-spacing: -0.3px;
    margin: 0;
}
.modal-run-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.modal-run-close:hover { color: var(--ink); }
.modal-run-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.modal-user { max-width: 425px; }
.modal-apikeys { max-width: 650px; }
.form-row-name { flex-wrap: nowrap; }
.form-row-name .form-group:first-child { flex: 1; min-width: 0; }
.form-row-name .form-group:last-child { flex: 2; min-width: 0; }
.modal-actions, .form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 3rem; }

/* --- Colour Picker --- */
.colour-picker { display: flex; gap: 10px; margin-top: 4px; }
.colour-swatch {
    width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, transform 0.15s; padding: 0;
}
.colour-swatch:hover { transform: scale(1.12); }
.colour-swatch.selected { border-color: var(--ink); }

/* --- Loading --- */
.loading { text-align: center; padding: 3rem; color: var(--muted); }
.loading::after { content: ''; display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; margin-left: 0.5rem; vertical-align: middle; }

/* --- Clickable rows --- */
.clickable { cursor: pointer; }
.clickable:hover td { background: #f5efe8; }

/* --- Pagination --- */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 200;
    animation: fadeInUp 0.3s ease-out;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Detail view --- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.detail-item .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .value { font-size: 1rem; margin-top: 0.15rem; }

/* --- Tabs --- */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.tab-btn { padding: 0.6rem 1.2rem; border: none; background: none; cursor: pointer; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.15s, border-color 0.15s; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Breadcrumb --- */
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* --- ISBN Emporium --- */

/* CTA button */
.ie-cta-wrap { text-align: center; margin: 3rem 0 2rem; }
.ie-cta-btn {
    display: inline-block; padding: 18px 48px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 30px;
    font-size: 1.3rem; font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer; transition: background 0.2s, transform 0.15s;
}
.ie-cta-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.ie-cta-sub {
    margin-top: 12px; font-size: 0.85rem;
    color: var(--ink); max-width: 500px;
    margin-left: auto; margin-right: auto;
    line-height: 1.5;
}

/* Create modal */
.ie-create-modal { align-items: flex-start; justify-content: center; padding-top: 50px; }
.ie-create-panel {
    background: var(--card-bg); border-radius: 16px;
    padding: 2.5rem; position: relative;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.ie-create-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 1.5rem;
    color: var(--muted); cursor: pointer;
}
.ie-create-close:hover { color: var(--ink); }
.ie-create-options { display: flex; gap: 40px; justify-content: center; padding: 1rem 0; }
.ie-create-option-wrap { text-align: center; }
.ie-create-option {
    width: 190px; height: 190px;
    background: #f0f0f0; border: none;
    border-radius: 16px; cursor: pointer;
    display: block; position: relative;
    padding: 0; overflow: hidden; transition: all 0.2s;
}
.ie-create-option:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.ie-create-option.disabled {
    opacity: 0.4; cursor: default; pointer-events: none;
}
.ie-create-option-img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 16px;
}
.ie-create-option-label {
    margin-top: 12px; font-size: 0.85rem; color: var(--ink);
    font-weight: 500; line-height: 1.4;
}
.ie-create-option-label.ie-label-disabled { opacity: 0.4; }
.ie-label-isbn { font-weight: 500; }

/* Wizard modal */
.ie-wizard-panel { width: 820px; max-width: 90vw; }
.ie-wiz-step { margin-bottom: 8px; }
.ie-wiz-header {
    font-size: 0.82rem; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 10px;
}
.ie-wiz-summary {
    padding: 10px 14px; background: var(--cream); border-radius: 8px;
    font-size: 0.85rem; color: var(--ink); display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.ie-wiz-change {
    color: var(--accent); font-size: 0.78rem; text-decoration: none;
    margin-left: auto; white-space: nowrap;
}
.ie-wiz-change:hover { text-decoration: underline; }

/* Search inside wizard */
.ie-modal-search-title { font-family: 'DM Serif Display', serif; font-size: 1.2rem; color: var(--ink); margin-bottom: 1rem; letter-spacing: -0.3px; }
.ie-wiz-step .ie-search-container { max-width: 100%; width: 100%; }
.ie-wiz-step .ie-search-box { border-radius: 12px; }
.ie-wiz-step .ie-results { border-radius: 0 0 12px 12px; max-height: 350px; }
.ie-modal-back:hover { color: var(--ink); }

/* Browse tabs + book cards */
.ie-new-books-section { margin-top: 1.5rem; }
.ie-browse-tabs {
    display: flex; gap: 4px; margin-bottom: 1rem;
    border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.ie-browse-tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: 8px 14px; font-size: 0.82rem; font-weight: 500;
    color: var(--muted); cursor: pointer; transition: all 0.2s;
    margin-bottom: -1px;
}
.ie-browse-tab:hover:not(.disabled) { color: var(--ink); }
.ie-browse-tab.active {
    color: var(--accent); border-bottom-color: var(--accent); font-weight: 600;
}
.ie-browse-tab.disabled {
    opacity: 0.35; cursor: default; pointer-events: none;
}
.ie-new-books-scroll { max-height: 420px; overflow-y: auto; }
.ie-new-books-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
    align-items: start;
}
.ie-book-card {
    cursor: pointer; text-align: center; transition: transform 0.15s;
    display: flex; flex-direction: column;
}
.ie-book-card:hover { transform: translateY(-2px); }
.ie-book-card-cover-wrap {
    width: 100%; height: 190px;
    border-radius: 6px; overflow: hidden;
    background: #ccc;
}
.ie-book-card-cover-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.ie-book-card-placeholder {
    background: #ccc;
}
.ie-book-card-title {
    font-size: 0.78rem; font-weight: 600; color: var(--ink);
    margin-top: 6px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.ie-book-card-author {
    font-size: 0.72rem; color: var(--muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ie-book-card-stream {
    font-size: 0.65rem; color: var(--text-light); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-style: italic;
}
.ie-view-more-btn {
    background: var(--card-bg); color: var(--ink);
    border: 1px solid var(--border); padding: 8px 24px;
    border-radius: 20px; font-size: 0.85rem; cursor: pointer;
    transition: all 0.2s;
}
.ie-view-more-btn:hover {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

.ie-channel-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-top: 16px;
}
.ie-channel-card {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 12px 10px; border-radius: 10px; border: 2px solid var(--border);
    background: var(--cream); cursor: pointer; transition: all 0.15s;
}
.ie-channel-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.ie-channel-card-icon { margin-bottom: 6px; opacity: 0.6; line-height: 1; }
.ie-channel-card-icon svg { width: 28px; height: 28px; }
.ie-channel-card-name { font-weight: 700; font-size: 0.9rem; color: var(--ink); margin-bottom: 4px; }
.ie-channel-card-dims { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.ie-channel-card-desc { font-size: 0.72rem; color: var(--text-light); line-height: 1.3; }

/* Column accordions in Display tab (two-column mode) */
.col-accordion-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: var(--cream); border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem;
    color: var(--ink); user-select: none;
}
.col-accordion-header:hover { background: #f0ede8; }
.col-accordion-header.active { border-color: var(--accent); color: var(--accent); }
.col-accordion-arrow { font-size: 0.7rem; transition: transform 0.2s; }
.col-accordion-header.active .col-accordion-arrow { transform: rotate(180deg); }
.col-accordion-body { padding: 8px 0; }

/* Display sub-tab panes */
.display-tab-pane { display: none; padding-top: 12px; }
.display-tab-pane.active { display: block; }
.ie-channel-card-img {
    width: 150px; height: 150px; border-radius: 12px; overflow: hidden;
    background: #f0ede8; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ie-channel-card-img img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.ie-channel-card-name {
    font-size: 0.82rem; font-weight: 600; color: var(--ink);
    margin-top: 8px; text-align: center;
}
.ie-channel-card-summary {
    font-size: 0.7rem; color: var(--muted); text-align: center;
    margin-top: 2px;
}
.ie-channel-card-dims {
    font-size: 0.65rem; color: var(--text-light); text-align: center;
    margin-top: 1px;
}

.ie-search-wrap { display: flex; justify-content: center; margin: 2rem 0; }
.ie-search-container { position: relative; width: 100%; max-width: 650px; }
.ie-search-box {
    display: flex; align-items: stretch;
    border: 2px solid var(--border); border-radius: 30px;
    background: var(--card-bg); transition: border-color 0.2s;
    overflow: visible;
}
.ie-search-box:focus-within { border-color: var(--accent); }

/* Custom stream picker */
.ie-stream-picker {
    position: relative; flex-shrink: 0;
    border-right: 1px solid var(--border);
    cursor: pointer; user-select: none;
}
.ie-stream-display {
    display: flex; flex-direction: column; justify-content: center;
    padding: 10px 28px 10px 20px; min-width: 120px; max-width: 220px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8477' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.ie-stream-label {
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--ink);
}
.ie-stream-name {
    font-size: 0.8rem; color: var(--muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ie-stream-dropdown {
    display: none; position: absolute; top: calc(100% + 6px); left: 0;
    min-width: 220px; max-height: 280px; overflow-y: auto;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 200;
}
.ie-stream-dropdown.open { display: block; }
.ie-stream-option {
    padding: 10px 16px; font-size: 0.85rem; cursor: pointer;
    border-bottom: 1px solid var(--border); transition: background 0.15s;
}
.ie-stream-option:last-child { border-bottom: none; }
.ie-stream-option:hover { background: var(--paper); }
.ie-stream-option.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }

.ie-search {
    flex: 1; padding: 18px 20px 18px 16px; font-size: 1.2rem;
    border: none; outline: none; background: transparent;
    font-family: 'Inter', sans-serif; box-sizing: border-box;
    min-width: 0;
}
.ie-subtitle { font-family: 'DM Serif Display', serif; font-size: 1.2rem; color: var(--ink); margin: 2rem 0 1rem; }
.ie-categories { display: flex; gap: 12px; flex-wrap: wrap; }
.ie-category {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: 24px;
    font-size: 0.9rem; font-weight: 500; color: var(--ink);
    cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.ie-category:hover { background: var(--accent-light); border-color: var(--accent); }
.ie-category svg { width: 16px; height: 16px; }

/* Search results dropdown */
.ie-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 420px; overflow-y: auto; z-index: 100;
}
.ie-result {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: default;
}
.ie-result:last-child { border-bottom: none; }
.ie-result:hover { background: var(--paper); }
.ie-result-img {
    width: 40px; height: 40px; object-fit: cover;
    border-radius: 4px; background: #eee; flex-shrink: 0;
}
.ie-result-img.author { border-radius: 50%; }
.ie-result-info { flex: 1; min-width: 0; }
.ie-result-title {
    font-weight: 500; font-size: 0.9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ie-result-sub { font-size: 0.8rem; color: var(--muted); }

/* --- Widget Grid (ISBN Emporium) --- */
.ie-widget-grid {
    display: flex; flex-wrap: wrap; gap: 16px; justify-content: flex-start;
}
.ie-widget-card {
    width: 120px; height: 110px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    background: var(--cream); border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; transition: all 0.15s ease; text-decoration: none; color: var(--ink);
}
.ie-widget-card:hover {
    border-color: var(--accent); box-shadow: 0 2px 8px rgba(175,40,96,0.12);
    transform: translateY(-2px);
}
.ie-widget-icon { width: 32px; height: 32px; color: var(--ink); }
.ie-widget-icon svg { width: 100%; height: 100%; }
.ie-widget-label { font-size: 0.75rem; font-weight: 500; text-align: center; line-height: 1.2; }

/* --- Widget Editor (Inklet Editor) --- */
.ie-editor-widget-switcher {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px; padding: 6px 14px 6px 8px;
    color: #fff; cursor: pointer; font-size: 0.85rem; font-weight: 500;
    position: relative; user-select: none;
}
.ie-editor-widget-switcher:hover { background: rgba(255,255,255,0.25); }
.ie-editor-widget-icon-sm { width: 20px; height: 20px; }
.ie-editor-widget-icon-sm svg { width: 100%; height: 100%; }
.ie-editor-widget-dropdown {
    display: none; position: absolute; top: 60px; left: 16px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 220px; z-index: 1000;
    max-height: 400px; overflow-y: auto;
}
.ie-editor-widget-dropdown.open { display: block; }
.ie-editor-widget-option {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; cursor: pointer; color: var(--ink); font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.ie-editor-widget-option:last-child { border-bottom: none; }
.ie-editor-widget-option:hover { background: var(--cream); }
.ie-editor-widget-option.active { color: var(--accent); font-weight: 600; }
.ie-editor-widget-option .ie-editor-widget-icon { width: 22px; height: 22px; flex-shrink: 0; }
.ie-editor-widget-option .ie-editor-widget-icon svg { width: 100%; height: 100%; }

/* --- Inklet Gallery --- */
.inklet-gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
}
.inklet-gallery-card {
    position: relative; border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; cursor: pointer; background: var(--paper);
    transition: box-shadow 0.15s, transform 0.15s;
}
.inklet-gallery-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.inklet-gallery-thumb {
    width: 100%; aspect-ratio: 1; overflow: hidden;
    background: linear-gradient(110deg, #f0ede8 30%, #e8e4de 50%, #f0ede8 70%);
    background-size: 200% 100%;
    animation: img-skeleton 1.5s ease-in-out infinite;
}
.inklet-gallery-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    opacity: 0; transition: opacity 0.3s ease;
}
.inklet-gallery-thumb img.loaded { opacity: 1; }
@keyframes img-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.inklet-gallery-meta { padding: 10px 12px; }
.inklet-gallery-name {
    font-size: 0.82rem; font-weight: 600; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inklet-gallery-badge {
    display: inline-block; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px;
    background: var(--sand); color: var(--muted); margin-top: 4px;
}
.inklet-gallery-date { font-size: 0.68rem; color: var(--muted); margin-top: 4px; }
.inklet-gallery-delete {
    position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
    border-radius: 50%; border: none; background: rgba(0,0,0,0.5); color: #fff;
    font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.15s;
}
.inklet-gallery-card:hover .inklet-gallery-delete { opacity: 1; }
.inklet-gallery-delete:hover { background: var(--danger); }

/* --- Feedback Widget --- */
.ie-feedback-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    transition: background 0.15s, transform 0.15s;
}
.ie-feedback-btn:hover { background: #8a1f3c; transform: scale(1.05); }
/* Red dot indicator for unread replies */
.ie-feedback-btn.has-unread::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--paper, #fff);
    pointer-events: none;
}
.ie-feedback-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 9999;
    width: 360px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    font-family: 'Inter', sans-serif;
}
.ie-feedback-header {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.ie-feedback-email {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 12px;
}
.ie-feedback-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 8px;
    background: var(--paper, #fff);
    color: var(--ink);
}
.ie-feedback-textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.ie-feedback-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 12px;
    cursor: pointer;
}
.ie-feedback-status {
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
    margin-top: 8px;
    min-height: 1em;
}

/* Ticket list in the feedback panel */
.ie-fb-ticket-list {
    max-height: 340px;
    overflow-y: auto;
}
.ie-fb-ticket-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.8rem;
}
.ie-fb-ticket-row:hover { background: var(--cream, #faf9f5); }
.ie-fb-ticket-row:last-child { border-bottom: none; }
.ie-fb-ticket-info { flex: 1; min-width: 0; }
.ie-fb-ticket-comment {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
    margin-bottom: 2px;
}
.ie-fb-ticket-meta { font-size: 0.7rem; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ie-fb-unread-dot {
    width: 8px; height: 8px;
    background: #ef4444;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* Thread messages in the feedback panel */
.ie-fb-thread-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 8px;
    padding: 4px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Reply form in the feedback panel */
.ie-fb-reply-form { margin-top: 4px; }

/* New Inklet card variant — reuses .inklet-gallery-card for dimensions/hover.
   Overrides the skeleton gradient/animation on .inklet-gallery-thumb so a
   random hero background image can show through, darkened slightly, with a
   white Feather plus-circle centred on top. */
.inklet-gallery-card.inklet-gallery-new .inklet-gallery-thumb {
    background: none;
    animation: none;
    position: relative;
}
.inklet-gallery-card.inklet-gallery-new .inklet-gallery-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.inklet-gallery-card.inklet-gallery-new .inklet-gallery-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    pointer-events: none;
}
.inklet-gallery-card.inklet-gallery-new .inklet-gallery-plus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    color: #fff;
    stroke-width: 1.2;
    pointer-events: none;
    z-index: 1;
}

/* --- Save Split Button --- */
.ie-save-dropdown-btn {
    display: flex; align-items: stretch; border-radius: 6px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.3);
}
.ie-save-main {
    background: rgba(255,255,255,0.2); color: #fff; border: none;
    padding: 4px 14px; font-size: 0.85rem; cursor: pointer; font-family: 'Inter', sans-serif;
}
.ie-save-main:hover { background: rgba(255,255,255,0.3); }
.ie-save-caret {
    background: rgba(255,255,255,0.15); color: #fff; border: none; border-left: 1px solid rgba(255,255,255,0.3);
    padding: 4px 8px; font-size: 0.6rem; cursor: pointer;
}
.ie-save-caret:hover { background: rgba(255,255,255,0.3); }
.ie-save-dropdown-menu {
    position: absolute; top: 100%; right: 0; margin-top: 4px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15); min-width: 140px; z-index: 1000;
}
.ie-save-option {
    display: block; width: 100%; text-align: left; border: none; background: transparent;
    padding: 10px 14px; font-size: 0.85rem; color: var(--ink); cursor: pointer;
    font-family: 'Inter', sans-serif;
}
.ie-save-option:hover { background: var(--cream); }

/* --- Save Status --- */
.save-status-saving { color: var(--muted); animation: pulse-fade 1s infinite; }
.save-status-saved { color: var(--success); }
.save-status-failed { color: var(--danger); }
.save-status-dirty { color: var(--muted); }
@keyframes pulse-fade { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- Widget Editor Layout (inline mode) --- */
.widget-editor-layout {
    display: grid; grid-template-columns: 340px 1fr; gap: 25px;
    min-height: calc(100vh - 120px);
}
.widget-panel {
    overflow-y: auto; max-height: calc(100vh - 120px);
    background: var(--paper);
    padding: 0;
    position: relative;
    display: flex; flex-direction: column;
}
.panel-main-content { flex: 1; overflow-y: auto; }

/* Column tabs */
.col-tab-bar { border-bottom: 1px solid var(--border); }
.col-tab {
    padding: 8px 14px; border: none; background: transparent;
    font-size: 12px; font-weight: 500; font-family: 'Inter', sans-serif;
    color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
    text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.15s;
}
.col-tab:hover { color: var(--ink); }
.col-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.col-tab.dragging { opacity: 0.4; }
.col-tab.drag-over { border-bottom-color: var(--accent); }
.col-tab-add {
    padding: 6px 10px; border: 1px dashed var(--border); border-radius: 4px;
    background: transparent; font-size: 11px; font-family: 'Inter', sans-serif;
    color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.col-tab-add:hover { border-color: var(--accent); color: var(--accent); }
.col-tab-cog {
    padding: 6px 8px; border: none; background: transparent;
    font-size: 16px; color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.col-tab-cog:hover { color: var(--accent); }
.col-tab-cog.active { color: var(--accent); }

/* Bottom action bar */
.panel-action-bar {
    display: flex; gap: 8px; padding: 12px 20px;
    border-top: 1px solid var(--border); background: var(--paper);
    flex-shrink: 0;
}
.panel-action-btn {
    flex: 1; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--paper); color: var(--ink); font-size: 0.78rem; font-weight: 500;
    cursor: pointer; text-align: center; transition: all 0.15s ease;
    font-family: 'Inter', sans-serif;
}
.panel-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.panel-action-reset { color: var(--muted); font-weight: 400; }
.panel-action-reset:hover { color: var(--accent); }
#pc-col-delete-btn:hover { color: #dc2626; }
/* Fixed Book slot (not draggable, not deletable) */
.slot-item.slot-item-fixed {
    background: var(--sand);
}
.slot-grab.slot-grab-disabled {
    opacity: 0 !important;
    pointer-events: none;
    cursor: default;
}
.widget-output {
    overflow-y: auto; max-height: calc(100vh - 120px);
    padding: 0;
}

/* Slot edit button + text preview */
.slot-edit {
    border: none; background: transparent; cursor: pointer;
    color: var(--muted); font-size: 13px; padding: 2px 4px;
    flex-shrink: 0;
}
.slot-edit:hover { color: var(--accent); }
.slot-text-preview {
    flex: 1; font-size: 10px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin: 0 2px; min-width: 0;
}

/* Slot editor — overlays the full editing panel */
.slot-editor-inline {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--card-bg); z-index: 100;
    overflow-y: auto;
}
/* Per-slot alignment control */
.se-align-row { margin-bottom: 4px; }
.se-align-label {
    display: block; font-size: 12px; font-weight: 500; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px;
}
.se-align-icons { display: flex; gap: 4px; }
.se-align-btn {
    width: 32px; height: 28px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 4px; background: var(--paper);
    color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.se-align-btn:hover { border-color: var(--accent); color: var(--accent); }
.se-align-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.slot-editor-close-btn {
    border: 1px solid var(--border) !important; background: transparent !important;
    color: var(--ink) !important; font-size: 0.82rem !important; padding: 5px 16px !important;
    border-radius: 6px !important; cursor: pointer; transition: all 0.15s;
}
.slot-editor-close-btn:hover {
    background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important;
}
/* Inline typography section in slot editors */
.se-typo-section {
    margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
}
.se-typo-header {
    display: block;
    font-size: 12px; font-weight: 500; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 4px 0 8px;
}
.se-typo-body .field { margin-bottom: 10px; }
.se-typo-body .field-row { display: flex; gap: 10px; margin-bottom: 10px; }
.se-typo-body .field-row .field { flex: 1; margin-bottom: 0; }
.se-typo-body .toggle-row { display: flex; align-items: center; gap: 8px; }
.slot-editor-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
}
.slot-editor-header h3 { margin: 0; font-size: 1rem; }
.slot-editor-close {
    border: none; background: transparent; font-size: 1.3rem;
    cursor: pointer; color: var(--muted); padding: 0; line-height: 1;
}
.slot-editor-close:hover { color: var(--ink); }
.slot-editor-body {
    padding: 16px 20px;
}
/* Quill rich text editor overrides */
.slot-editor-inline .ql-toolbar {
    border-color: var(--border); border-radius: 6px 6px 0 0;
    background: var(--sand); padding: 6px 8px;
}
.slot-editor-inline .ql-container {
    border-color: var(--border); border-radius: 0 0 6px 6px;
    font-family: 'Inter', sans-serif; font-size: 13px;
}
.slot-editor-inline .ql-editor {
    min-height: 120px; max-height: 400px; overflow-y: auto;
}
.slot-editor-inline .ql-editor.ql-blank::before {
    font-style: normal; color: var(--muted);
}
.slot-editor-body .field { margin-bottom: 12px; }
/* Labels inherit from base .field label in widget-shared.css (12px, 500, uppercase) */
.slot-editor-body input[type="text"],
.slot-editor-body input[type="number"],
.slot-editor-body textarea,
.slot-editor-body select {
    width: 100%; padding: 8px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 13px;
    font-family: 'Inter', sans-serif; background: var(--paper);
    color: var(--ink); box-sizing: border-box;
}
.slot-editor-body textarea { resize: vertical; }
.slot-editor-footer {
    padding: 12px 20px 16px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end;
}
.se-section { }
.slot-editor-body .isbn-text-row { margin-bottom: 0; }
.slot-editor-body .isbn-text-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.slot-editor-body .isbn-text-header label {
    margin: 0;
}
.slot-editor-body .revert-btn {
    border: none; background: transparent; cursor: pointer;
    color: var(--muted); padding: 2px; width: 20px; height: 20px;
}
.slot-editor-body .revert-btn:hover { color: var(--accent); }
.slot-editor-body .toggle-row {
    display: flex; align-items: center; gap: 8px;
}
