/* CFO Access Insights — custom overrides beyond Tailwind */

/* ── Login Page ── */
.login-page {
    background: linear-gradient(135deg, #081B33 0%, #0A2342 30%, #0B3B82 70%, #237A8C 100%);
    position: relative;
    overflow: hidden;
}
.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(44, 143, 163, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(11, 59, 130, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(83, 181, 196, 0.1) 0%, transparent 50%);
    pointer-events: none;
}
.login-card {
    animation: login-fade-in 0.5s ease-out;
}
@keyframes login-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-input {
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input:focus {
    border-color: #2C8FA3;
    box-shadow: 0 0 0 3px rgba(44, 143, 163, 0.15);
}
.login-button {
    background: linear-gradient(135deg, #0B3B82 0%, #2C8FA3 100%);
    box-shadow: 0 2px 8px rgba(11, 59, 130, 0.3);
}
.login-button:hover {
    background: linear-gradient(135deg, #0A3070 0%, #237A8C 100%);
    box-shadow: 0 4px 12px rgba(11, 59, 130, 0.4);
    transform: translateY(-1px);
}
.login-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(11, 59, 130, 0.3);
}

/* Smooth sidebar transitions */
.sidebar-link {
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Pulse animation for running operations */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.pulse-dot {
    animation: pulse-dot 1.5s ease-in-out infinite;
}

/* Table row hover */
.table-row-hover:hover {
    background-color: rgba(11, 59, 130, 0.05);
}

/* Toast notification slide-in */
@keyframes slide-in-right {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast-enter {
    animation: slide-in-right 0.3s ease-out;
}

/* ── Email Newsletter Preview ── */
.email-preview-wrapper {
    background: #e8eaed;
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-height: 36rem;
    overflow-y: auto;
}

/* Email client chrome (To/Subject bar) */
.email-chrome {
    background: #fff;
    border-radius: 0.5rem 0.5rem 0 0;
    border: 1px solid #d1d5db;
    border-bottom: none;
    max-width: 640px;
    margin: 0 auto;
}
.email-chrome-dots {
    display: flex;
    gap: 6px;
    padding: 10px 14px 6px;
    border-bottom: 1px solid #e5e7eb;
}
.email-chrome-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
}
.email-chrome-dots span:nth-child(1) { background: #ef4444; }
.email-chrome-dots span:nth-child(2) { background: #eab308; }
.email-chrome-dots span:nth-child(3) { background: #22c55e; }
.email-chrome-bar {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.email-chrome-label {
    color: #94a3b8;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.email-chrome-value {
    color: #334155;
}

/* Newsletter container */
.email-newsletter {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-width: 640px;
    margin: 0 auto;
    overflow: hidden;
}
.email-chrome + .email-newsletter {
    border-top: none;
}
.email-preview-wrapper > .email-newsletter:first-child {
    border-radius: 0.5rem;
    border-top: 1px solid #d1d5db;
}

/* Newsletter header */
.email-header {
    background: linear-gradient(135deg, #0A2342 0%, #0B3B82 100%);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.email-header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}
.email-header-logo svg {
    opacity: 0.9;
}
.email-header-date {
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
}

/* Newsletter body — markdown rendered content */
.email-body {
    padding: 1.75rem;
    color: #1e293b;
    font-size: 0.9375rem;
    line-height: 1.7;
}
.email-body h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
}
.email-body h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin: 2rem 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #d0e8f0;
    line-height: 1.4;
}
.email-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin: 1.5rem 0 0.375rem 0;
}
.email-body p {
    margin: 0 0 1rem 0;
}
.email-body ul, .email-body ol {
    margin: 0 0 1rem 0;
    padding-left: 1.25rem;
}
.email-body li {
    margin-bottom: 0.375rem;
}
.email-body a {
    color: #0B3B82;
    text-decoration: underline;
    text-decoration-color: rgba(11,59,130,0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s;
}
.email-body a:hover {
    text-decoration-color: #0B3B82;
}
.email-body strong {
    font-weight: 600;
    color: #0f172a;
}
.email-body blockquote {
    border-left: 3px solid #2C8FA3;
    background: #e8f4f8;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 0 0.375rem 0.375rem 0;
    color: #0A2342;
    font-size: 0.875rem;
}
.email-body blockquote p:last-child {
    margin-bottom: 0;
}
.email-body hr {
    border: none;
    height: 1px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}
.email-body code {
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    color: #475569;
}
/* ── Editorial Decision Brief styling (mirrors src/utils/email_renderer.py) ── */

.email-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #334155;
    line-height: 1.7;
    font-size: 15px;
}
.email-body p {
    margin: 0 0 14px 0;
    font-size: 15px;
    color: #334155;
    line-height: 1.7;
}
.email-body a {
    color: #0B3B82;
    text-decoration: underline;
}
.email-body strong {
    font-weight: 600;
    color: #0f172a;
}
.email-body ul {
    margin: 0 0 16px 0;
    padding-left: 20px;
}
.email-body li {
    margin-bottom: 6px;
    color: #334155;
    line-height: 1.7;
}

/* 32px x 2px navy section rule above every section heading */
.nl-section-rule {
    width: 32px;
    height: 2px;
    background: #0B3B82;
    margin: 32px 0 8px;
}

/* Topic section serif headline */
.email-body h2.nl-topic-headline,
.email-body h2 {
    font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    font-size: 22px;
    font-weight: 500;
    color: #0f172a;
    line-height: 1.3;
    margin: 0 0 16px 0;
    padding: 0;
    border: none;
}

/* Navy left-border "Why this matters" callout (no fill) */
.nl-callout {
    margin: 18px 0;
    padding: 0 0 0 16px;
    border-left: 2px solid #0B3B82;
}
.nl-callout-label {
    margin: 0 0 6px;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #0B3B82;
    font-weight: 700;
}
.nl-callout-text {
    margin: 0;
    font-size: 14.5px;
    color: #475569;
    line-height: 1.6;
}

/* Restrained slate source pills */
.nl-source-row {
    margin: 18px 0 32px;
    font-size: 11px;
    line-height: 1.6;
}
.nl-source-label {
    color: #94a3b8;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 10px;
    margin-right: 4px;
}
.nl-source-pill {
    display: inline-block;
    padding: 3px 9px;
    border: 1px solid #e2e8f0;
    color: #475569;
    text-decoration: none !important;
    font-size: 11.5px;
    margin: 2px 4px 2px 0;
}
.nl-source-pill:hover {
    border-color: #cbd5e1;
    color: #0f172a;
}

/* Advisor-voice action section (eyebrow + serif italic intro + numbered table) */
.nl-action-eyebrow {
    margin: 0 0 12px;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}
.nl-action-intro {
    margin: 0 0 20px;
    font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    font-size: 19px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.45;
    color: #0f172a;
}
.nl-action-table {
    border-collapse: collapse;
    margin: 0 0 32px;
    width: 100%;
}
.nl-action-numeral {
    padding: 8px 0;
    font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    font-size: 18px;
    color: #cbd5e1;
    font-weight: 400;
    width: 40px;
    vertical-align: top;
}
.nl-action-item-cell {
    padding: 8px 0;
    font-size: 14.5px;
    line-height: 1.6;
    color: #334155;
}

/* Looking Ahead (section rule + dark uppercase eyebrow + dark hairline + plain body) */
.nl-outlook-eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #0f172a;
    font-weight: 700;
}
.nl-outlook-rule {
    border-top: 1px solid #0f172a;
    margin: 0 0 16px;
    height: 1px;
}

/* Newsletter footer */
.email-footer {
    padding: 1.25rem 1.75rem 1.5rem;
    text-align: center;
    font-size: 0.6875rem;
    color: #94a3b8;
    line-height: 1.6;
}
.email-footer-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #cbd5e1, transparent);
    margin-bottom: 1rem;
}
.email-footer p {
    margin: 0 0 0.25rem 0;
}
.email-footer-links {
    margin-top: 0.5rem;
}
.email-footer-links a {
    color: #2C8FA3;
    text-decoration: none;
}
.email-footer-links a:hover {
    text-decoration: underline;
}
.email-footer-links span {
    margin: 0 0.375rem;
    color: #cbd5e1;
}

/* Preview wrapper scrollbar */
.email-preview-wrapper::-webkit-scrollbar {
    width: 6px;
}
.email-preview-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.email-preview-wrapper::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 3px;
}

/* Scrollbar styling for sidebar */
.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 2px;
}

/* ============================================================
   Admin UI component layer
   Shared vocabulary for the admin surface. Plain CSS (the
   Tailwind Play CDN does not process @apply in external files),
   built on the existing brand/teal hexes. Templates use these
   classes instead of repeating the same utility soup.
   ============================================================ */

:root {
    --brand-600: #0B3B82;
    --brand-700: #0A3070;
    --brand-800: #0A2342;
    --teal-500:  #2C8FA3;
    --ink:       #0f172a;  /* slate-900 */
    --ink-soft:  #334155;  /* slate-700 */
    --muted:     #64748b;  /* slate-500 */
    --faint:     #94a3b8;  /* slate-400 */
    --line:      #e6eaf1;  /* panel border, a touch cooler than slate-200 */
    --line-soft: #eef1f6;  /* inner dividers */
    --radius:    0.75rem;
    --radius-sm: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.05), 0 6px 16px rgba(15, 23, 42, 0.05);
    --ring:      0 0 0 3px rgba(11, 59, 130, 0.14);
}

/* Crisp Inter rendering + subtle optical tracking on the app shell */
.font-sans { letter-spacing: -0.006em; }
.tabular { font-variant-numeric: tabular-nums; }

/* ── Panels: the one surface treatment ── */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.panel-raised { box-shadow: var(--shadow-md); }
.panel-title { font-size: 0.875rem; font-weight: 600; color: var(--ink-soft); letter-spacing: -0.006em; }
.panel-sub   { font-size: 0.75rem; color: var(--faint); }

/* Page section heading row (title + optional action) */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }

/* Eyebrow — deliberate, used sparingly. NOT on every section. */
.eyebrow { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }

/* ── Stat / KPI ── */
.stat-label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 1.75rem; line-height: 1.1; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value.v-emerald { color: #059669; }
.stat-value.v-brand   { color: var(--brand-600); }
.stat-value.v-teal    { color: var(--teal-500); }
.stat-value.v-red     { color: #dc2626; }
.stat-sub   { font-size: 0.75rem; color: var(--faint); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    font-size: 0.875rem; font-weight: 500; line-height: 1.25rem;
    padding: 0.5rem 0.875rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-secondary { background: #fff; color: var(--ink-soft); border-color: #d4dae3; }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; border-color: #c2cad6; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; color: var(--ink-soft); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.8125rem; gap: 0.375rem; }
.btn-lg { padding: 0.625rem 1.125rem; font-size: 0.9375rem; }

/* ── Form controls ── */
.field-label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 0.375rem; }
.input, .select, .textarea {
    width: 100%; font-size: 0.875rem; color: var(--ink-soft);
    background: #fff; border: 1px solid #d4dae3; border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: #9aa6b6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--teal-500); box-shadow: var(--ring); }

/* ── Badges / pills ── */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.6875rem; font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 9999px; border: 1px solid transparent; line-height: 1.3; }
.badge-brand   { background: #e8f4f8; color: #0B3B82; border-color: #cfe6ef; }
.badge-emerald { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.badge-amber   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-red     { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-slate   { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* ── Data tables ── */
.data-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.data-table thead th { text-align: left; font-size: 0.75rem; font-weight: 500; color: var(--muted); padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tbody td { padding: 0.625rem 0.5rem; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: #f8fafc; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Soft brand focus ring helper for non-.input elements */
.focus-ring:focus-visible { outline: none; box-shadow: var(--ring); }
