/*
  Copyright (c) 2026 Blue Astra Technologies LLP, India. All Rights Reserved.
  Proprietary software. Unauthorized copying or use by any means or technology
  (including AI tools) is strictly prohibited.
*/
/* =====================================================
   PROPOSALS › AI MODULES — Campaign Management, Lead Conversion,
   Communications Monitoring.

   Everything here is namespaced `pm-` (proposal modules) so it cannot collide
   with the existing proposal / proposal-task styles. Colours come from the
   theme variables where the app defines them, with literal fallbacks so the
   panels still read correctly if a theme has not been applied.
   ===================================================== */

:root {
    --pm-line: #e6e9ef;
    --pm-ink: #16233a;
    --pm-muted: #7b8794;
    --pm-accent: var(--theme-primary, #2d6cdf);
    --pm-soft: var(--theme-soft, #eef4ff);
    --pm-ok: #1f9d55;
    --pm-warn: #d9a406;
    --pm-risk: #c0392b;
}

/* -----------------------------------------------------
   Module tab bar and panels
   ----------------------------------------------------- */

.pro-modbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--pm-line);
}

.pro-modbar .pro-modtab i {
    margin-right: 6px;
}

.pro-modbar-hint {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--pm-muted);
}

/* A locked tab stays clickable — clicking it is how the user finds out what
   the plan buys, so it is dimmed rather than disabled. */
.pro-modtab-locked {
    opacity: 0.72;
}

.pro-modtab-lock {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 1px 6px;
    margin-left: 7px;
    border-radius: 8px;
    background: #f6c343;
    color: #4a3906;
    vertical-align: 1px;
    white-space: nowrap;
}

/* Only the selected module is in the document flow. */
.pro-module {
    display: none;
}

.pro-module.active {
    display: block;
}

/* -----------------------------------------------------
   Shared building blocks
   ----------------------------------------------------- */

.pm-muted {
    color: var(--pm-muted);
}

.pm-tiny {
    font-size: 0.78rem;
}

.pm-ok {
    color: var(--pm-ok);
}

.pm-warn {
    color: var(--pm-warn);
}

.pm-num {
    text-align: right;
    white-space: nowrap;
}

.pm-subhead {
    font-size: 0.95rem;
    margin: 20px 0 8px;
    color: var(--pm-ink);
    border-bottom: 1px solid var(--pm-line);
    padding-bottom: 6px;
}

.pm-card {
    border: 1px solid var(--pm-line);
    border-radius: 10px;
    padding: 18px;
    margin-top: 14px;
    background: #fff;
}

.pm-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.pm-card-head h4 {
    margin: 0 0 4px;
    color: var(--pm-ink);
    font-size: 1.05rem;
}

.pm-card-head p {
    margin: 0;
    font-size: 0.88rem;
}

.pm-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pm-badge {
    font-size: 0.7rem;
    padding: 2px 9px;
    border-radius: 10px;
    background: #f1f3f7;
    color: #55606e;
    white-space: nowrap;
}

.pm-badge-ai {
    background: var(--pm-soft);
    color: var(--pm-accent);
}

.pm-badge-ok,
.pm-badge-low {
    background: #e6f5ec;
    color: var(--pm-ok);
}

.pm-badge-warn,
.pm-badge-medium {
    background: #fdf4dc;
    color: #96700a;
}

.pm-badge-high {
    background: #fdecea;
    color: var(--pm-risk);
}

.pm-badge-draft {
    background: #f1f3f7;
    color: #55606e;
}

.pm-badge-approved {
    background: #e8f0fe;
    color: var(--pm-accent);
}

.pm-badge-live {
    background: #e6f5ec;
    color: var(--pm-ok);
}

.pm-badge-paused {
    background: #fdf4dc;
    color: #96700a;
}

.pm-badge-archived {
    background: #eceef2;
    color: #8a929c;
}

.pm-health-healthy { background: #e6f5ec; color: var(--pm-ok); }
.pm-health-watch { background: #fdf4dc; color: #96700a; }
.pm-health-at-risk { background: #fde8e0; color: #b3541e; }
.pm-health-critical { background: #fdecea; color: var(--pm-risk); }

.pm-chip {
    display: inline-block;
    font-size: 0.74rem;
    padding: 2px 9px;
    border-radius: 10px;
    background: #f1f3f7;
    color: #55606e;
    margin: 2px 4px 2px 0;
}

.pm-chip-positive { background: #e6f5ec; color: var(--pm-ok); }
.pm-chip-negative { background: #fdecea; color: var(--pm-risk); }
.pm-chip-mixed,
.pm-chip-neutral { background: #f1f3f7; color: #55606e; }
.pm-chip-email { background: var(--pm-soft); color: var(--pm-accent); }
.pm-chip-meeting { background: #e9f6f5; color: #12867b; }

.pm-chiprow {
    margin: 10px 0;
}

.pm-chiprow-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pm-ink);
    margin-bottom: 4px;
}

.pm-quote {
    background: var(--pm-soft);
    border-left: 3px solid var(--pm-accent);
    padding: 12px 14px;
    border-radius: 0 6px 6px 0;
    margin: 14px 0;
}

.pm-quote strong {
    display: block;
    font-size: 0.85rem;
    color: var(--pm-accent);
    margin-bottom: 4px;
}

.pm-quote p,
.pm-quote ul {
    margin: 0;
    font-size: 0.9rem;
}

.pm-quote ul {
    padding-left: 18px;
}

.pm-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pm-alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 0.9rem;
}

.pm-alert p {
    margin: 6px 0 0;
}

.pm-alert-error {
    background: #fdecea;
    border-left: 3px solid var(--pm-risk);
    color: #7d241a;
}

.pm-alert-warn {
    background: #fdf8e8;
    border-left: 3px solid var(--pm-warn);
    color: #6f5406;
}

/* Loading state */
.pm-busy {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px;
    color: var(--pm-muted);
    font-size: 0.9rem;
}

.pm-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--pm-line);
    border-top-color: var(--pm-accent);
    border-radius: 50%;
    display: inline-block;
    animation: pm-spin 0.7s linear infinite;
    flex: 0 0 auto;
}

.pm-spinner-sm {
    width: 12px;
    height: 12px;
    border-width: 2px;
    vertical-align: -1px;
}

@keyframes pm-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .pm-spinner { animation-duration: 2s; }
}

/* Forms */
.pm-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.pm-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm-field.pm-field-wide {
    grid-column: 1 / -1;
}

.pm-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pm-ink);
}

.pm-field input,
.pm-field select,
.pm-field textarea {
    padding: 9px 10px;
    border: 1px solid #dfe3ea;
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
    background: #fff;
    color: inherit;
}

.pm-field textarea {
    resize: vertical;
    min-height: 64px;
}

.pm-field small {
    font-size: 0.75rem;
    color: var(--pm-muted);
}

/* Tables */
.pm-tablewrap {
    overflow-x: auto;
}

.pm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    margin: 10px 0;
}

.pm-table-wide {
    min-width: 720px;
}

.pm-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--pm-muted);
    border-bottom: 1px solid var(--pm-line);
    padding: 6px 8px;
}

.pm-table td {
    padding: 8px;
    border-bottom: 1px solid #f2f4f7;
    vertical-align: top;
}

/* List rows reuse .activity-item; these are the extras. */
.pm-rowactions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.pm-rowactions select {
    padding: 4px 8px;
    border: 1px solid #dfe3ea;
    border-radius: 6px;
    font-size: 0.8rem;
    background: #fff;
    color: inherit;
}

/* -----------------------------------------------------
   Campaign Management
   ----------------------------------------------------- */

.pm-metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.pm-metric {
    flex: 1 1 90px;
    background: #f7f9fc;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.pm-metric span {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--pm-ink);
    line-height: 1.2;
}

.pm-metric label {
    font-size: 0.72rem;
    color: var(--pm-muted);
}

.pm-adgroup {
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 14px;
    margin: 12px 0;
}

.pm-adgroup-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.pm-adgroup-head h5 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--pm-ink);
}

.pm-match {
    font-size: 0.72rem;
    padding: 1px 7px;
    border-radius: 8px;
    white-space: nowrap;
}

.pm-match-broad { background: #f1f3f7; color: #55606e; }
.pm-match-phrase { background: var(--pm-soft); color: var(--pm-accent); }
.pm-match-exact { background: #e6f5ec; color: var(--pm-ok); }

.pm-ad {
    background: #f7f9fc;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.pm-ad-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pm-muted);
    margin-bottom: 6px;
}

.pm-ad-headlines {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Character counts sit next to each asset, because Google rejects anything
   over the limit and it is the first thing a marketer checks. */
.pm-pill {
    background: #fff;
    border: 1px solid #dfe3ea;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.83rem;
}

.pm-pill em,
.pm-ad-desc em {
    font-style: normal;
    font-size: 0.7rem;
    color: var(--pm-muted);
    margin-left: 4px;
}

.pm-ad-desc {
    margin: 8px 0 0;
    font-size: 0.86rem;
}

.pm-sitelinks {
    margin: 12px 0;
}

.pm-sitelink {
    border-left: 2px solid var(--pm-line);
    padding: 4px 0 4px 10px;
    margin-top: 6px;
    font-size: 0.86rem;
}

.pm-sitelink strong {
    color: var(--pm-accent);
    display: block;
}

.pm-sitelink span {
    color: var(--pm-muted);
}

/* -----------------------------------------------------
   Lead Conversion
   ----------------------------------------------------- */

.pm-leadpane {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .pm-leadpane {
        grid-template-columns: 1fr;
    }
}

.pm-leadlist {
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 6px;
}

.pm-leadrow {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #f2f4f7;
    padding: 10px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    border-radius: 6px;
}

.pm-leadrow:hover {
    background: #f7f9fc;
}

.pm-leadrow.selected {
    background: var(--pm-soft);
}

.pm-leadrow-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.76rem;
    color: var(--pm-muted);
    margin-top: 4px;
}

.pm-ownerbox {
    background: #f7f9fc;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 12px 0;
    font-size: 0.9rem;
}

.pm-ownerbox-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pm-muted);
    margin-bottom: 4px;
}

.pm-touchlist {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 8px;
}

.pm-touch {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 4px;
    border-bottom: 1px solid #f2f4f7;
    font-size: 0.85rem;
}

.pm-touch:last-child {
    border-bottom: none;
}

.pm-touch-when {
    color: var(--pm-muted);
    font-size: 0.76rem;
    white-space: nowrap;
    min-width: 78px;
}

.pm-touch-body {
    flex: 1;
    min-width: 0;
}

.pm-touch-body p {
    margin: 2px 0 0;
    font-size: 0.82rem;
}

/* Insight readout */
.pm-insight {
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 14px;
    margin-top: 14px;
}

.pm-insight-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.pm-likelihood {
    text-align: right;
    font-size: 0.78rem;
    color: var(--pm-muted);
    min-width: 160px;
}

.pm-likelihood label {
    display: block;
    margin-bottom: 3px;
}

.pm-bar {
    background: #eef1f6;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 3px;
}

.pm-bar-fill {
    height: 8px;
    border-radius: 6px;
}

.pm-bar-ok { background: var(--pm-ok); }
.pm-bar-warn { background: var(--pm-warn); }
.pm-bar-risk { background: var(--pm-risk); }

.pm-insight-block {
    margin-top: 10px;
}

.pm-insight-block strong {
    font-size: 0.85rem;
    color: var(--pm-ink);
}

.pm-insight-block ul {
    margin: 4px 0 0;
    padding-left: 18px;
    font-size: 0.87rem;
}

/* Brochure preview — laid out to read like the PDF it becomes. */
.pm-brochure {
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 20px 22px;
    background: #fcfdff;
}

.pm-hero {
    font-size: 1.05rem;
    font-style: italic;
    color: var(--pm-accent);
    margin: 0 0 16px;
    line-height: 1.5;
}

.pm-brochure-section {
    margin-bottom: 16px;
}

.pm-brochure-section h5 {
    margin: 0 0 5px;
    font-size: 0.98rem;
    color: var(--pm-ink);
}

.pm-brochure-section p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.pm-brochure-section ul {
    margin: 6px 0 0;
    padding-left: 20px;
    font-size: 0.88rem;
    line-height: 1.6;
}

.pm-cta {
    background: var(--pm-soft);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 16px 0 10px;
}

.pm-cta strong {
    display: block;
    color: var(--pm-accent);
    font-size: 0.85rem;
    margin-bottom: 3px;
}

.pm-cta p {
    margin: 0;
    font-size: 0.9rem;
}

.pm-deliverbox {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: #f7f9fc;
    border-radius: 8px;
    padding: 14px;
    margin-top: 16px;
}

.pm-deliverbox p {
    margin: 4px 0 0;
    max-width: 60ch;
}

.pm-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* -----------------------------------------------------
   Communications Monitoring
   ----------------------------------------------------- */

.pm-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.pm-tile {
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 12px 10px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    font: inherit;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.pm-tile:hover {
    border-color: var(--pm-accent);
}

.pm-tile.selected {
    border-color: var(--pm-accent);
    background: var(--pm-soft);
}

.pm-tile span {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--pm-ink);
}

.pm-tile label {
    font-size: 0.72rem;
    color: var(--pm-muted);
    cursor: pointer;
}

.pm-tile-warn span { color: var(--pm-warn); }
.pm-tile-risk span { color: var(--pm-risk); }

.pm-flag {
    display: inline-block;
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 8px;
    background: #f1f3f7;
    color: #55606e;
    margin: 1px 3px 1px 0;
    white-space: nowrap;
}

.pm-flag-awaiting-our-reply-overdue,
.pm-flag-gone-cold { background: #fdecea; color: var(--pm-risk); }

.pm-flag-going-quiet,
.pm-flag-follow-up-overdue,
.pm-flag-one-sided { background: #fdf4dc; color: #96700a; }

.pm-flag-awaiting-our-reply { background: var(--pm-soft); color: var(--pm-accent); }

.pm-finding {
    border-left: 3px solid var(--pm-line);
    padding: 10px 0 10px 12px;
    margin: 10px 0;
}

.pm-finding-high { border-left-color: var(--pm-risk); }
.pm-finding-medium { border-left-color: var(--pm-warn); }
.pm-finding-low { border-left-color: var(--pm-ok); }

.pm-finding-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.pm-finding p {
    margin: 5px 0 0;
    font-size: 0.89rem;
}

.pm-actionlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pm-action {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--pm-line);
    border-radius: 8px;
    padding: 10px 12px;
}

.pm-action-when {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
    background: #f1f3f7;
    color: #55606e;
    flex: 0 0 auto;
}

.pm-action-today .pm-action-when { background: #fdecea; color: var(--pm-risk); }
.pm-action-this-week .pm-action-when { background: #fdf4dc; color: #96700a; }

.pm-action-body p {
    margin: 3px 0 0;
    font-size: 0.89rem;
}
