/* =========================================================
   IdeaPulse — Editorial console
   Palette:  warm cream, deep navy, coral accent, amber highlights
   Fonts:    Manrope (body), Fraunces (display), JetBrains Mono (data)
   ========================================================= */

:root {
    --bg: #fbf7f1;
    --surface: #ffffff;
    --surface-alt: #f4eee3;
    --ink: #1a1f2e;
    --ink-soft: #2d3548;
    --muted: #6b7280;
    --muted-2: #9ba3b3;
    --accent: #e85d42;
    --accent-hover: #d24a30;
    --accent-soft: #fde5df;
    --amber: #f0b429;
    --amber-soft: #fdf1cf;
    --border: #e5dfd3;
    --border-strong: #cfc7b3;
    --success: #2f855a;
    --success-soft: #d9f2e4;
    --danger: #c53030;
    --danger-soft: #fcdada;
    --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
    box-sizing: border-box;
}
html,
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body {
    margin: 0;
    min-height: 100vh;
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
::selection {
    background: var(--amber);
    color: var(--ink);
}

/* -------------------- Auth screen -------------------- */
.ip-auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: linear-gradient(180deg, var(--bg) 0%, #f6efe0 100%);
}
.ip-auth-card {
    padding: clamp(2rem, 5vw, 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 540px;
    margin-left: auto;
    width: 100%;
}
.ip-auth-aside {
    background: var(--ink);
    color: #f4eee3;
    padding: clamp(2rem, 5vw, 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.ip-auth-aside::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 93, 66, 0.25), transparent 70%);
    pointer-events: none;
}
.ip-auth-aside::after {
    content: "";
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(240, 180, 41, 0.18), transparent 70%);
    pointer-events: none;
}
.ip-aside-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}
.ip-aside-headline {
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
}
.ip-aside-copy {
    color: #d8cfbc;
    max-width: 460px;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}
.ip-aside-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 1;
}
.ip-aside-list li {
    padding: 0.5rem 0;
    color: #ebe4d1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.ip-aside-list i {
    color: var(--amber);
    font-size: 1.15rem;
}

.ip-auth-brand,
.ip-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 2rem;
}
.ip-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--ink);
    color: var(--amber);
    font-size: 1.4rem;
    border-radius: 12px;
    font-family: var(--font-display);
    flex-shrink: 0;
}
.ip-brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--ink);
    line-height: 1;
}
.ip-brand-tag {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 4px;
}
.ip-display {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2.2rem;
    line-height: 1.15;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}
.ip-subtle {
    color: var(--muted);
    margin-bottom: 1.5rem;
}
.ip-alert {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(197, 48, 48, 0.2);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.ip-alert.success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(47, 133, 90, 0.2);
}
.ip-auth-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
@media (max-width: 900px) {
    .ip-auth-shell {
        grid-template-columns: 1fr;
    }
    .ip-auth-aside {
        display: none;
    }
    .ip-auth-card {
        max-width: 100%;
    }
}

/* -------------------- Form controls -------------------- */
.form-control,
.form-select {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--ink);
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    font-family: var(--font-body);
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(26, 31, 46, 0.08);
    color: var(--ink);
}
.form-control-lg {
    font-size: 1rem;
    padding: 0.85rem 1rem;
}
.form-label {
    font-weight: 600;
    color: var(--ink-soft);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}
.form-check-input:checked {
    background-color: var(--ink);
    border-color: var(--ink);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(26, 31, 46, 0.08);
    border-color: var(--ink-soft);
}

/* -------------------- Buttons -------------------- */
.ip-btn-primary {
    background: var(--ink);
    color: #fff;
    border: 1.5px solid var(--ink);
    font-weight: 600;
    padding: 0.65rem 1.2rem;
    border-radius: 10px;
    transition:
        transform 0.1s,
        background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.ip-btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}
.ip-btn-primary:disabled {
    opacity: 0.55;
    transform: none;
}
.ip-btn-accent {
    background: var(--accent);
    color: #fff;
    border: 1.5px solid var(--accent);
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition:
        transform 0.1s,
        background 0.15s;
}
.ip-btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}
.ip-btn-outline {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--border-strong);
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: border-color 0.15s;
}
.ip-btn-outline:hover {
    border-color: var(--ink);
    color: var(--ink);
}
.ip-btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ip-btn-ghost:hover {
    color: var(--ink);
    background: rgba(0, 0, 0, 0.04);
}
.ip-btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid transparent;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ip-btn-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}
.ip-btn-success {
    background: var(--success);
    color: #fff;
    border: 1.5px solid var(--success);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ip-btn-success:hover {
    background: #266b48;
    color: #fff;
}

/* -------------------- App shell -------------------- */
.ip-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.ip-sidebar {
    background: var(--ink);
    color: #f4eee3;
    padding: 1.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.ip-sidebar .ip-mark {
    background: rgba(255, 255, 255, 0.08);
}
.ip-sidebar-brand > div {
    flex: 1;
    min-width: 0;
}
.ip-sidebar .ip-brand-name {
    color: #fff;
    font-size: 1.05rem;
    line-height: 1.15;
    white-space: nowrap;
}
.ip-sidebar .ip-brand-tag {
    color: #a29d8f;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ip-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.ip-nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    color: #c4bda9;
    font-weight: 500;
    font-size: 0.94rem;
    transition:
        background 0.15s,
        color 0.15s;
    text-decoration: none;
}
.ip-nav-link i {
    font-size: 1.05rem;
    opacity: 0.9;
}
.ip-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}
.ip-nav-link.active {
    background: var(--accent);
    color: #fff;
}
.ip-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
}
.ip-sidebar-footer .ip-btn-ghost {
    color: #a29d8f;
    justify-content: flex-start;
}
.ip-sidebar-footer .ip-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.ip-main {
    padding: 2rem clamp(1.5rem, 3vw, 3rem);
    max-width: 1400px;
    width: 100%;
}
@media (max-width: 900px) {
    .ip-shell {
        grid-template-columns: 1fr;
    }
    .ip-sidebar {
        position: relative;
        height: auto;
    }
    .ip-main {
        padding: 1.25rem;
    }
}

/* -------------------- Page headers -------------------- */
.ip-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.ip-page-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1.15;
}
.ip-page-subtitle {
    color: var(--muted);
    margin-top: 4px;
    font-size: 0.95rem;
}
.ip-page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* -------------------- Cards & panels -------------------- */
.ip-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    transition: border-color 0.15s;
}
.ip-card-hoverable:hover {
    border-color: var(--border-strong);
}
.ip-metric {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.ip-metric-label {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 600;
}
.ip-metric-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2rem;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.01em;
}
.ip-metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 1rem;
}
.ip-metric-icon.accent {
    background: var(--accent-soft);
    color: var(--accent);
}
.ip-metric-icon.amber {
    background: var(--amber-soft);
    color: #b8871d;
}
.ip-metric-icon.success {
    background: var(--success-soft);
    color: var(--success);
}
.ip-metric-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.ip-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.ip-section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
    margin-bottom: 1rem;
    letter-spacing: -0.005em;
}

/* -------------------- Draft cards -------------------- */
.ip-draft-list {
    display: grid;
    gap: 1rem;
}
.ip-draft-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
    cursor: pointer;
}
.ip-draft-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 6px 18px rgba(26, 31, 46, 0.06);
}
.ip-draft-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.ip-draft-headline {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--ink);
    line-height: 1.25;
    margin-bottom: 0.5rem;
    letter-spacing: -0.005em;
}
.ip-draft-oneliner {
    color: var(--ink-soft);
    font-size: 0.94rem;
    margin-bottom: 0.75rem;
    font-style: italic;
}

/* -------------------- Badges -------------------- */
.ip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--surface-alt);
    color: var(--ink-soft);
    text-transform: capitalize;
    border: 1px solid var(--border);
}
.ip-badge.pending {
    background: var(--amber-soft);
    color: #8a610f;
    border-color: rgba(240, 180, 41, 0.35);
}
.ip-badge.approved {
    background: #dceffd;
    color: #1d4b7a;
    border-color: rgba(29, 75, 122, 0.2);
}
.ip-badge.published {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(47, 133, 90, 0.25);
}
.ip-badge.rejected {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(197, 48, 48, 0.2);
}
.ip-badge.success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(47, 133, 90, 0.25);
}
.ip-badge.failed {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(197, 48, 48, 0.2);
}
.ip-badge.category {
    background: var(--surface-alt);
    color: var(--muted);
    text-transform: none;
}
.ip-badge.solid {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

/* -------------------- Tables -------------------- */
.ip-table {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}
.ip-table thead th {
    background: var(--surface-alt);
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}
.ip-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 0.92rem;
}
.ip-table tbody tr:last-child td {
    border-bottom: none;
}
.ip-table tbody tr:hover {
    background: #fbf7ee;
}
.ip-table .mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--muted);
}

/* -------------------- Toasts -------------------- */
.ip-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.ip-toast {
    background: var(--ink);
    color: #fff;
    padding: 0.8rem 1.1rem;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
    min-width: 260px;
    max-width: 380px;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: ip-toast-in 0.2s ease-out;
    font-size: 0.9rem;
}
.ip-toast.success {
    background: var(--success);
}
.ip-toast.error {
    background: var(--danger);
}
.ip-toast.warning {
    background: #b8871d;
}
@keyframes ip-toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------------- Modal overrides -------------------- */
.modal-content {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}
.modal-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.005em;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0.5rem;
}

/* -------------------- Loading / empty -------------------- */
.ip-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--muted);
    gap: 0.5rem;
}
.ip-empty {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--muted);
}
.ip-empty i {
    font-size: 2rem;
    color: var(--border-strong);
    margin-bottom: 0.5rem;
    display: block;
}

/* -------------------- Draft editor -------------------- */
.ip-section-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.85rem;
}
.ip-section-block-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.4rem;
    display: block;
}
textarea.form-control {
    min-height: 90px;
    font-family: var(--font-body);
    line-height: 1.55;
}
.ip-editor-sidepanel {
    background: var(--surface-alt);
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.ip-editor-sidepanel h6 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.ip-source-link {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    word-break: break-all;
}
.ip-source-link:hover {
    color: var(--accent);
}
.ip-thumb {
    width: 100%;
    border-radius: 10px;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--surface-alt);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

/* -------------------- Settings tabs -------------------- */
.ip-tab-nav {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}
.ip-tab-nav button {
    background: transparent;
    border: 0;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: background 0.15s;
}
.ip-tab-nav button.active {
    background: var(--ink);
    color: #fff;
}
.ip-tab-nav button:hover:not(.active) {
    background: var(--surface-alt);
    color: var(--ink);
}
.ip-help {
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.ip-list-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 800px) {
    .ip-list-two-col {
        grid-template-columns: 1fr;
    }
}

/* -------------------- Publications timeline row -------------------- */
.ip-pub-channel {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--ink);
    text-transform: capitalize;
}
.ip-pub-channel i {
    color: var(--muted);
}

/* -------------------- Chip -------------------- */
.ip-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    background: var(--surface-alt);
    color: var(--muted);
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    border: 1px solid var(--border);
}
.ip-chip.on {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(47, 133, 90, 0.25);
}
.ip-chip.off {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(197, 48, 48, 0.2);
}

/* -------------------- Overview activity list -------------------- */
.ip-activity-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.ip-activity-item:last-child {
    border-bottom: none;
}
.ip-activity-item .title {
    color: var(--ink);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ip-activity-item .time {
    color: var(--muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

/* Utility */
.text-mono {
    font-family: var(--font-mono);
}
.gap-05 {
    gap: 0.5rem;
}
.cursor-pointer {
    cursor: pointer;
}
.min-w-0 {
    min-width: 0;
}
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
