/* ═══════════════════════════════════════════════════════════════════════════
   PublisherHub · Design System
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
    /* Core palette */
    --bg:          #f0f4f8;
    --surface:     #ffffff;
    --surface-alt: #f8fafc;
    --card:        #ffffff;
    --text:        #0f172a;
    --text-sec:    #64748b;
    --muted:       #64748b;
    --border:      #e2e8f0;
    --border-sub:  #f1f5f9;

    /* Brand */
    --brand:       #2563eb;
    --brand-dark:  #1d4ed8;
    --brand-light: #eff6ff;

    /* Sidebar */
    --sidebar-bg:     #0f172a;
    --sidebar-active: #2563eb;
    --sidebar-hover:  #1e293b;
    --sidebar-text:   #94a3b8;
    --sidebar-text-active: #ffffff;

    /* Status */
    --success:        #10b981;
    --success-bg:     #ecfdf5;
    --success-text:   #065f46;
    --success-border: #6ee7b7;

    --warning:        #f59e0b;
    --warning-bg:     #fffbeb;
    --warning-text:   #92400e;
    --warning-border: #fde68a;

    --error:          #ef4444;
    --error-bg:       #fef2f2;
    --error-text:     #991b1b;
    --error-border:   #fca5a5;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 4px 16px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
    --shadow-lg: 0 8px 32px rgba(15,23,42,.10), 0 3px 10px rgba(15,23,42,.05);

    /* Radii */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-full: 999px;

    /* Motion */
    --ease:     cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.16s;

    /* Sidebar dimensions */
    --sidebar-w: 240px;
    --topbar-h:  64px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body:not(.no-js) {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
a:hover { color: var(--brand-dark); text-decoration: underline; }

code {
    background: #edf2f8;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.875em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ─── Admin Shell Layout ──────────────────────────────────────────────────── */

.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 200;
    scrollbar-width: none;
}
.admin-sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: var(--topbar-h);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    text-decoration: none;
}
.sidebar-logo-icon {
    width: 30px;
    height: 30px;
    background: var(--brand);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.04em;
    overflow: hidden;
}
.sidebar-logo-icon.has-image {
    background: #fff;
    padding: 3px;
}
.sidebar-logo-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sidebar-logo-text {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 10px 8px 4px 20px;
    margin-top: 8px;
}
.sidebar-section-label:first-child { margin-top: 0; }

.sidebar-link {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    min-height: 42px;
    padding: 9px 12px;
    margin: 0 8px;
    width: calc(100% - 16px);
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
    position: relative;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}
.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}
.sidebar-link.active:hover { background: var(--brand-dark); }

.sidebar-icon {
    width: 18px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-label {
    display: block;
    text-align: left;
    line-height: 1.25;
}
.sidebar-link.active .sidebar-icon,
.sidebar-link:hover .sidebar-icon { opacity: 1; }

.sidebar-badge {
    justify-self: end;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    line-height: 1.4;
}
.sidebar-link.active .sidebar-badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}
.sidebar-user:hover {
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}
.sidebar-avatar {
    width: 30px;
    height: 30px;
    background: var(--brand);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    display: block;
}

/* ─── Admin Main Content Area ─────────────────────────────────────────────── */

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── Topbar ──────────────────────────────────────────────────────────────── */

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    gap: 16px;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

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

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
.topbar-breadcrumb a {
    color: var(--text-sec);
    font-weight: 500;
}
.topbar-breadcrumb .sep { color: var(--muted); }
.topbar-breadcrumb .current {
    color: var(--text);
    font-weight: 600;
}

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

/* ─── Content wrapper ─────────────────────────────────────────────────────── */

.admin-content {
    flex: 1;
    padding: 28px;
}

/* Legacy container compatibility (for non-admin pages) */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─── Public Header (archive/blog) ────────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    gap: 20px;
}

.brand {
    font-weight: 800;
    font-size: 17px;
    color: var(--text);
    letter-spacing: -0.02em;
    transition: color var(--duration) var(--ease);
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand::before {
    content: 'PH';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 6px;
    letter-spacing: -0.04em;
}
.brand:hover { color: var(--brand); text-decoration: none; }

nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
nav a {
    color: var(--text-sec);
    font-weight: 500;
    font-size: 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
nav a:hover {
    background: var(--brand-light);
    color: var(--brand);
    text-decoration: none;
}
nav a.active,
nav a[aria-current="page"] {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}
nav a.active:hover,
nav a[aria-current="page"]:hover { background: var(--brand-dark); color: #fff; }
nav a.nav-signout { color: var(--muted); font-weight: 500; }
nav a.nav-signout:hover { background: var(--error-bg); color: var(--error-text); }

main.container { padding-top: 32px; padding-bottom: 56px; }

/* ─── Page header blocks ──────────────────────────────────────────────────── */

.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.page-header p {
    margin: 0;
    color: var(--text-sec);
    font-size: 14px;
}

/* White-labelled Results header: optional client logo sits flush to
   the left of the heading, brand colour comes in as a CSS custom
   property from settings.brand_color. Renders as a clean letterhead
   when printed. */
.report-header {
    display: flex;
    align-items: center;
    gap: 16px;
}
.report-logo {
    max-height: 48px;
    width: auto;
    flex: 0 0 auto;
}
@media print {
    .report-header { border-bottom: 2px solid var(--brand-color, #1a6bc4); padding-bottom: 12px; }
    .sidebar, .actions, .topbar { display: none !important; }
}

/* ─── Panel ───────────────────────────────────────────────────────────────── */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.hero {
    padding: 36px 28px;
    background: linear-gradient(135deg, #f0f6ff 0%, #ffffff 60%);
    border-color: #d0dff0;
}

.hero h1, .panel h1 {
    margin-top: 0;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-weight: 800;
}
.panel h2 {
    margin-top: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

/* ─── Stat cards ──────────────────────────────────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--stat-accent, var(--brand));
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.stat-card-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 4px 0 0;
}
.stat-card-sub {
    font-size: 12px;
    color: var(--text-sec);
    margin: 2px 0 0;
}

/* Accent variants */
.stat-accent-blue   { --stat-accent: var(--brand); }
.stat-accent-green  { --stat-accent: var(--success); }
.stat-accent-yellow { --stat-accent: var(--warning); }
.stat-accent-red    { --stat-accent: var(--error); }
.stat-accent-slate  { --stat-accent: #64748b; }

/* ─── Card surface ────────────────────────────────────────────────────────── */

.card-surface {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.card-body { padding: 22px; }

/* ─── Eyebrow / Labels ────────────────────────────────────────────────────── */

.eyebrow, .post-label {
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
    margin: 0 0 8px;
}

.muted { color: var(--text-sec); }
.lead { color: var(--text-sec); font-size: 17px; line-height: 1.6; }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */

.alert {
    padding: 14px 16px 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    border-left-width: 3px;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.55;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
    border-left-color: var(--success);
}
.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
    border-left-color: var(--error);
}
.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
    border-left-color: var(--warning);
}
.alert-info {
    background: var(--brand-light);
    color: #1e40af;
    border-color: #bfdbfe;
    border-left-color: var(--brand);
}

/* ─── Forms ───────────────────────────────────────────────────────────────── */

.form { display: grid; gap: 20px; }

/* Required-field marker. Visible to sighted users; hidden from AT (the
   underlying input already carries `required`, which screen readers
   announce — a literal "asterisk" would be redundant). */
.req { color: var(--error-text); margin-left: 2px; font-weight: 700; }

/* Visible invalid state. The native :invalid pseudo fires before the
   user has typed; we paint only when the server has set aria-invalid
   so the cue arrives at the right moment. */
input[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: var(--error-border);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-grid { gap: 14px; }
.full { grid-column: 1 / -1; }

label {
    display: grid;
    gap: 6px;
    align-content: start;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text);
}

input, textarea, select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }

.field-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 2px 0 0;
}

label.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 10px;
}
label.checkbox-row input[type="checkbox"] { grid-row: span 2; width: auto; }
label.checkbox-row small { grid-column: 2; color: var(--muted); }

.edit-post-form textarea[name="blog_content"],
.edit-post-form textarea[name="faq_content"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.6;
}


.field-label {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.field-block { display: grid; gap: 8px; }
.field-block > label { display: block; font-weight: 600; }

/* ─── URL slug row ────────────────────────────────────────────────────────── */

.archive-slug-field { max-width: 100%; }

.url-slug-row {
    display: grid;
    grid-template-columns: minmax(0, 58%) minmax(110px, 1fr) auto;
    align-items: stretch;
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.url-slug-row:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.url-slug-prefix, .url-slug-suffix {
    display: inline-flex;
    align-items: center;
    background: var(--surface-alt);
    color: var(--text-sec);
    padding: 0 11px;
    font-weight: 500;
    font-size: 13.5px;
}
.url-slug-prefix {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: thin;
}
.url-slug-prefix::-webkit-scrollbar { height: 3px; }
.url-slug-prefix::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }

.url-slug-row input {
    border: none;
    border-radius: 0;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    background: var(--surface);
}
.url-slug-row input:focus { outline: none; border-color: transparent; box-shadow: none; }

.archive-url-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

button, .button-secondary, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-sm);
    min-height: 40px;
    padding: 9px 18px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                transform 0.1s var(--ease),
                color var(--duration) var(--ease);
}
button {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 1px 3px rgba(37,99,235,.25);
}
button:hover {
    background: var(--brand-dark);
    box-shadow: 0 3px 10px rgba(37,99,235,.30);
    transform: translateY(-1px);
    color: #fff;
}
button:active { transform: translateY(0); box-shadow: none; }

.button-secondary {
    color: var(--brand);
    background: var(--brand-light);
    border: 1px solid rgba(37,99,235,.15);
}
.button-secondary:hover {
    background: #dbeafe;
    color: var(--brand-dark);
    text-decoration: none;
    transform: translateY(-1px);
}
.button-secondary:active { transform: translateY(0); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-ghost {
    color: var(--text-sec);
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border-sub); color: var(--text); text-decoration: none; transform: translateY(-1px); }
.btn-danger {
    color: var(--error-text) !important;
    background: var(--error-bg) !important;
    border: 1px solid var(--error-border) !important;
}
.btn-danger:hover { background: #fee2e2 !important; }

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

/* ─── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

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

.workflow-table th,
.workflow-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-sub);
    vertical-align: middle;
    font-size: 14px;
}
.workflow-table tbody tr:last-child td { border-bottom: none; }
.workflow-table tbody tr:nth-child(even) { background: var(--surface-alt); }

.workflow-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-sec);
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}

.workflow-table tbody tr {
    transition: background var(--duration) var(--ease);
}
.workflow-table tbody tr:hover { background: var(--brand-light); }

/* ─── Post cards / Grids ──────────────────────────────────────────────────── */

.post-grid, .status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.post-card, .status-card, .result-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--surface);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                transform var(--duration) var(--ease);
    box-shadow: var(--shadow-sm);
}
.post-card:hover {
    border-color: #bfdbfe;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.status-card strong, .status-card span { display: block; }
.status-card span { color: var(--text-sec); margin-top: 6px; overflow-wrap: anywhere; font-size: 13px; }
.status-card strong { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }

.post-card h3 { margin-top: 0; margin-bottom: 8px; font-size: 16px; line-height: 1.35; font-weight: 700; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--brand); text-decoration: none; }
.post-card p { font-size: 13px; color: var(--text-sec); line-height: 1.55; margin: 0 0 12px; }

.read-more { color: var(--brand); font-weight: 600; font-size: 13px; }
.edit-link {
    color: var(--muted);
    font-weight: 600;
    font-size: 12.5px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.edit-link:hover { background: var(--surface-alt); color: var(--brand); text-decoration: none; }

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-sub);
}

.muted-panel { background: var(--surface-alt); border-color: var(--border); }

/* Original Tours settings */
.ot-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.ot-header h1 { margin-bottom: 6px; }

.ot-eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.ot-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.ot-list-panel {
    position: sticky;
    top: 84px;
}

.ot-tour-list {
    display: grid;
    gap: 8px;
}

.ot-tour-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.ot-tour-item:hover {
    border-color: #bfdbfe;
    background: var(--brand-light);
    text-decoration: none;
}

.ot-tour-item.is-active {
    border-color: var(--brand);
    background: var(--brand-light);
}

.ot-tour-item strong,
.ot-tour-item small {
    display: block;
    min-width: 0;
}

.ot-tour-item strong {
    font-size: 13.5px;
    line-height: 1.35;
}

.ot-tour-item small {
    margin-top: 4px;
    color: var(--muted);
}

.ot-tour-index {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--surface-alt);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.ot-detail { min-width: 0; }

.ot-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ot-info-grid > div {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.ot-info-grid strong,
.ot-info-grid span {
    display: block;
}

.ot-info-grid > div > strong {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ot-info-grid span { overflow-wrap: anywhere; }

.ot-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.compact-list {
    margin: 0;
    padding-left: 18px;
}

.compact-list li + li { margin-top: 4px; }

.ot-note-list {
    margin-top: 12px;
    color: var(--muted);
}

.ot-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ot-photo {
    position: relative;
    display: block;
    min-height: 142px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-alt);
}

.ot-photo:hover { border-color: #bfdbfe; }

.ot-photo img {
    display: block;
    width: 100%;
    height: 142px;
    object-fit: cover;
}

.ot-photo span {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.74);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ot-json {
    max-height: 460px;
    overflow: auto;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #0f172a;
    color: #dbeafe;
    font-size: 12px;
    line-height: 1.55;
}

/* ─── Cluster tabs ────────────────────────────────────────────────────────── */

.cluster-tablist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 16px;
}

.cluster-tab-button {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.cluster-tab-button:hover { border-color: #93c5fd; background: #dbeafe; color: var(--brand-dark); }
.cluster-tab-button.is-active { border-color: var(--brand); background: var(--brand-light); font-weight: 600; color: var(--brand-dark); }

.cluster-tab-icons { color: var(--muted); display: inline-flex; gap: 5px; }

/* ─── QA pills ────────────────────────────────────────────────────────────── */

.qa-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid transparent;
    line-height: 1.4;
}
.qa-pill-success, .qa-pill-pass {
    color: var(--success-text);
    background: var(--success-bg);
    border-color: var(--success-border);
}
.qa-pill-warning {
    color: var(--warning-text);
    background: var(--warning-bg);
    border-color: var(--warning-border);
}
.qa-pill-danger, .qa-pill-fail {
    color: var(--error-text);
    background: var(--error-bg);
    border-color: var(--error-border);
}
.qa-pill-muted {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.qa-pill-info {
    color: #1e40af;
    background: var(--brand-light);
    border-color: #bfdbfe;
}

/* ─── Post meta badges ────────────────────────────────────────────────────── */

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 14px;
}
.post-meta span {
    background: var(--surface-alt);
    color: var(--text-sec);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── GitHub Import ───────────────────────────────────────────────────────── */

.ghimport-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.badge-ok       { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge-error    { background: var(--error-bg);   color: var(--error-text);   border: 1px solid var(--error-border); }
.badge-warning  { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge-neutral  { background: var(--surface-alt); color: var(--text-sec);   border: 1px solid var(--border); }
.badge-disabled { background: #f4f4f5; color: #71717a; border: 1px solid #e4e4e7; }

.ghimport-conn-list { display: grid; gap: 14px; }

.ghimport-conn-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--surface);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    box-shadow: var(--shadow-sm);
}
.ghimport-conn-card:hover { border-color: #bfdbfe; box-shadow: var(--shadow-md); }
.ghimport-conn-card.conn-disabled { opacity: 0.6; background: var(--surface-alt); }

.ghimport-conn-header { margin-bottom: 14px; }
.ghimport-conn-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ghimport-conn-title h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }

.ghimport-conn-meta {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px 16px;
    margin: 0 0 16px;
    font-size: 13.5px;
}
.ghimport-conn-meta dt {
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 2px;
}
.ghimport-conn-meta dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.ghimport-conn-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--border-sub);
}
.ghimport-conn-actions button,
.ghimport-conn-actions .button-secondary { font-size: 12.5px; padding: 7px 13px; }

.ghimport-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.ghimport-result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }

.ghimport-result-item {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 0 12px;
    align-items: baseline;
    font-size: 13px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}
.ghimport-result-item.ghimport-status-created   { background: var(--success-bg); }
.ghimport-result-item.ghimport-status-updated   { background: var(--brand-light); }
.ghimport-result-item.ghimport-status-error     { background: var(--error-bg); }
.ghimport-result-item.ghimport-status-unchanged { background: var(--surface-alt); }
.ghimport-result-item.ghimport-status-skipped   { background: #fafafa; }

.ghimport-result-status {
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    white-space: nowrap;
}
.ghimport-status-created  .ghimport-result-status { color: var(--success-text); }
.ghimport-status-updated  .ghimport-result-status { color: var(--brand); }
.ghimport-status-error    .ghimport-result-status { color: var(--error-text); }

.ghimport-result-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: var(--text);
    overflow-wrap: anywhere;
    grid-column: 2;
}
.ghimport-result-msg { grid-column: 2; color: var(--muted); font-size: 12px; }

.ghimport-item-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ghimport-item-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 9px;
    font-size: 12.5px;
}
.ghimport-type-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 5px;
    border-radius: var(--radius-full);
}
.type-dir  { background: #dbeafe; color: #1e40af; }
.type-file { background: #dcfce7; color: #166534; }

/* ─── Cluster asset list ──────────────────────────────────────────────────── */

.cluster-asset-list { list-style: none; margin: 0 0 16px; padding: 0; }
.cluster-asset-list li {
    padding: 9px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}
.cluster-asset-list li .qa-pill { margin-right: 6px; vertical-align: middle; }

/* ─── Auth panel ──────────────────────────────────────────────────────────── */

.auth-panel {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 40px;
}

/* Login page full-screen layout */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.login-logo-icon {
    width: 38px;
    height: 38px;
    background: var(--brand);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.04em;
}
.login-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.login-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.login-sub {
    font-size: 13.5px;
    color: var(--text-sec);
    margin: 0 0 24px;
}

/* ─── Blog content ────────────────────────────────────────────────────────── */

.blog-post, .blog-faq { max-width: 780px; }

.content-body h1:first-child,
.content-body h2:first-child,
.content-body h3:first-child { margin-top: 0; }

.content-body h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 800; }
.content-body h2 { font-size: 22px; margin-top: 32px; font-weight: 700; letter-spacing: -0.01em; }
.content-body h3 { font-size: 18px; margin-top: 24px; font-weight: 700; }
.content-body p { margin: 0 0 16px; }
.content-body ul { margin: 0 0 18px 22px; padding: 0; }
.content-body li { margin-bottom: 8px; }
.content-body a { font-weight: 600; }

.content-body a.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 10px 12px 0;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}
.content-body a.cta-button:hover { background: var(--brand-dark); color: #fff; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 16px;
    background: var(--surface);
}
.site-footer p { margin: 0; color: var(--muted); font-size: 12.5px; }

.admin-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.admin-footer p { margin: 0; font-size: 12px; color: var(--muted); }

/* ─── Focus ring ──────────────────────────────────────────────────────────── */

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ─── Skip link ───────────────────────────────────────────────────────────── */

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    position: fixed;
    left: 12px;
    top: 12px;
    width: auto;
    height: auto;
    padding: 10px 14px;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius-sm);
    z-index: 9999;
    box-shadow: var(--shadow-md);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

/* ─── Hamburger toggle (hidden on desktop) ────────────────────────────────── */

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    color: var(--text-sec);
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.sidebar-toggle:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-toggle svg { display: block; }

/* Overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

@media (max-width: 900px) {
    :root { --sidebar-w: 0px; }

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

    .admin-sidebar {
        transform: translateX(-240px);
        transition: transform 0.22s var(--ease);
        width: 240px;
        z-index: 300;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-topbar { padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); gap: 10px; }
    .topbar-inner { flex: 1; min-width: 0; }
    .topbar-breadcrumb { min-width: 0; overflow: hidden; white-space: nowrap; }
    .topbar-breadcrumb a,
    .topbar-breadcrumb .current { overflow: hidden; text-overflow: ellipsis; }
    .topbar-breadcrumb .current { min-width: 0; }
    .admin-content { padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ot-layout { grid-template-columns: 1fr; }
    .ot-list-panel { position: static; }
    .ot-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Hide the "View Blog" shortcut on mobile to save space */
    .topbar-blog-link { display: none; }
}

@media (max-width: 760px) {
    .container { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
    .panel { padding: 18px; border-radius: var(--radius-md); margin-bottom: 16px; }
    .hero { padding: 24px 18px; }
    .hero h1, .panel h1 { font-size: 22px; }
    .content-body h1 { font-size: 22px; }
    .content-body h2 { font-size: 18px; }

    .header-inner { min-height: 56px; }
    .site-header .header-inner { align-items: stretch; padding-top: 10px; padding-bottom: 10px; }
    .site-header nav { gap: 6px; }
    .site-header nav a { flex: 1 1 auto; justify-content: center; }

    .grid-form,
    .post-grid,
    .status-grid { grid-template-columns: 1fr; }
    .ot-info-grid { grid-template-columns: 1fr; }
    .ot-header { display: grid; }
    .ot-photo-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-card-value { font-size: clamp(24px, 8vw, 30px); }

    .header-inner,
    .actions,
    .archive-url-actions { align-items: stretch; flex-direction: column; }

    .card-actions { flex-direction: row; }

    .url-slug-row { grid-template-columns: minmax(0, 54%) minmax(80px, 1fr) auto; }
    .url-slug-prefix { font-size: 13px; padding: 0 8px; }
    .url-slug-row input { min-height: 44px; padding-left: 10px; padding-right: 10px; }
    .url-slug-suffix { min-height: 44px; padding: 0 10px; }

    /* Full-width on mobile only for action-bar buttons. Compact .btn-sm
       buttons (in tables, breadcrumb-style chips, image cards) stay
       inline so they don't stack into a wall of slabs. */
    button:not(.btn-sm):not(.sidebar-toggle):not(.alert-close), .button-secondary:not(.btn-sm), .btn-ghost:not(.btn-sm), .edit-link, .read-more { width: 100%; justify-content: center; }
    button:hover, .button-secondary:hover { transform: none; }

    .auth-panel { margin-top: 12px; }
    .post-card:hover { transform: none; }
    .login-card { padding: 28px 24px; }

    .ghimport-conn-meta { grid-template-columns: 1fr; }
    .ghimport-conn-meta dt { padding-top: 8px; }
    .ghimport-summary-grid { grid-template-columns: 1fr 1fr; }
    .ghimport-result-item { grid-template-columns: 68px minmax(0, 1fr); }
    .ghimport-conn-actions { flex-direction: column; }
    .ghimport-conn-actions button,
    .ghimport-conn-actions .button-secondary { width: 100%; justify-content: center; }
}

/* Sticky first column for wide horizontally-scrolling tables. Apply by
   adding class="workflow-table table-sticky-first" so the tour/package
   name stays visible while the operator scrolls right. */
.workflow-table.table-sticky-first th:first-child,
.workflow-table.table-sticky-first td:first-child {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
    box-shadow: 1px 0 0 var(--border-sub);
}
.workflow-table.table-sticky-first thead th:first-child { background: var(--surface-alt); }
.workflow-table.table-sticky-first tbody tr:nth-child(even) td:first-child { background: var(--surface-alt); }
.workflow-table.table-sticky-first tbody tr:hover td:first-child { background: var(--brand-light); }

/* When JavaScript is disabled, the mobile sidebar toggle is inert.
   Force the sidebar visible (and hide the dead toggle) so the admin
   nav still works. Note: noscript styles must be inline / late-loaded
   to take effect; the rule below relies on a wrapper <body class="no-js">
   stripped by JS. The class is added in render and removed inline. */
body.no-js .admin-sidebar { transform: none !important; }
body.no-js .sidebar-toggle { display: none !important; }
body.no-js .admin-main { margin-left: 240px; }
@media (max-width: 900px) {
    body.no-js .admin-main { margin-left: 240px; }
}

/* Banner close button (success/error alerts). Auto-scrolled into view
   by JS so operators don't miss the response after submitting a long
   form. Visually unobtrusive — fades into the alert background. */
.alert { position: relative; }
.alert-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.6;
    box-shadow: none;
}
.alert-close:hover { opacity: 1; background: rgba(0,0,0,0.05); }


@media (max-width: 640px) {
    .page-header { margin-bottom: 16px; }
    .page-header h1 { font-size: 22px; line-height: 1.2; }
    .page-header p { font-size: 13.5px; }

    .card-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px;
    }

    .table-wrap {
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }
    .table-wrap .workflow-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }
    .table-wrap .workflow-table thead { display: none; }
    .table-wrap .workflow-table,
    .table-wrap .workflow-table tbody,
    .table-wrap .workflow-table tr,
    .table-wrap .workflow-table td { display: block; width: 100%; }
    .table-wrap .workflow-table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--surface);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }
    .workflow-table tbody tr:nth-child(even),
    .workflow-table tbody tr:hover { background: var(--surface); }
    .table-wrap .workflow-table td {
        display: grid;
        grid-template-columns: minmax(8rem, 38%) minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border-sub);
        overflow-wrap: anywhere;
    }
    .table-wrap .workflow-table td:last-child { border-bottom: none; }
    .table-wrap .workflow-table td::before {
        content: attr(data-label);
        color: var(--text-sec);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.06em;
        line-height: 1.45;
        text-transform: uppercase;
    }
    .table-wrap .workflow-table td[data-label=""]::before { display: none; }
    .workflow-table.table-sticky-first th:first-child,
    .workflow-table.table-sticky-first td:first-child {
        position: static;
        box-shadow: none;
        background: transparent;
    }
}

@media (max-width: 430px) {
    .admin-topbar { min-height: 56px; height: auto; padding-top: 8px; padding-bottom: 8px; }
    .topbar-breadcrumb .sep,
    .topbar-breadcrumb a { display: none; }
    .topbar-breadcrumb .current { font-size: 15px; font-weight: 700; }
    .stat-grid { grid-template-columns: 1fr; }
    .login-shell { padding: 16px; }
    .login-card { padding: 24px 18px; }
    .table-wrap .workflow-table td { grid-template-columns: 1fr; gap: 4px; }
    .table-wrap .workflow-table td::before { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ─── Utility classes — UX overhaul polish ────────────────────────────────────
   Replaces recurring inline style="..." declarations across the admin
   surfaces (image cards / grids, inline form wrappers, cluster header
   layout, empty states). Naming: BEM-ish — `block`, `block--variant`,
   `block__element`. Keep this section narrow; only add classes that
   genuinely repeat. ──────────────────────────────────────────────────── */

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.image-grid--sm {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.image-card {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}
.image-card__thumb {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #f3f4f6;
}
.image-card__thumb--sm { height: 120px; }
.image-card__caption {
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
}
.image-card__caption .src { word-break: break-all; }

.form-inline { display: contents; }

.cluster-panel {
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.cluster-panel__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
}
.cluster-panel__header h3 { margin: 0; }
.cluster-panel__meta { text-align: right; }

.qa-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.stack-sm { margin-top: 0.5rem; }
.stack-xs { margin-top: 0.25rem; }

/* Drive sync result card — JS-rendered compact variant of .image-card
   used inside the per-folder sync output panel on tour.php. */
.drive-image-card {
    text-decoration: none;
    color: inherit;
}
.drive-image-card:hover { text-decoration: none; }
.drive-image-card__caption {
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.3;
    word-break: break-all;
}
.drive-image-card__badge {
    color: var(--text-sec);
    font-size: 11px;
    padding: 0 8px 6px;
}
.drive-image-card__badge--missing { color: #b45309; }

.empty-state {
    color: var(--text-sec);
    margin: 0;
}
.empty-state--panel {
    padding: 18px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* Keep long Original Tours menus usable while the detail pane scrolls. */
.ot-list-panel {
    max-height: calc(100vh - 104px);
    overflow: hidden;
}

.ot-tour-list {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 4px;
    overscroll-behavior: contain;
}

.brand-dashboard-header,
.brand-gallery-header {
    display: flex;
    align-items: center;
    gap: 18px;
}
.brand-dashboard-header h1,
.brand-gallery-header h1 {
    margin-bottom: 6px;
}
.brand-dashboard-logo,
.brand-gallery-logo {
    display: block;
    width: min(260px, 42vw);
    max-height: 86px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.brand-gallery-logo {
    width: min(220px, 38vw);
    max-height: 74px;
}
@media (max-width: 720px) {
    .brand-dashboard-header,
    .brand-gallery-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .brand-dashboard-logo,
    .brand-gallery-logo {
        width: 100%;
        max-width: 280px;
    }
}
