/* ============================================
   GLOBAL LAYOUT & TYPOGRAPHY
   ============================================ */

body.page {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    color: #222;
    background: #fafafa;
    margin: 20px;
    padding: 0;
}

.page-wrapper {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    color: #222;
    padding: 16px 24px 40px;
    background: #f7f7f9;
}

h1, h2, h3 {
    font-weight: 600;
    margin-top: 0;
}

a {
    color: #004c99;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   LEAD DETAIL PAGE BLOCKS
   ============================================ */

.lead-section {
    border: 1px solid #ccc;
    padding: 12px;
    margin-bottom: 16px;
    background: #fafafa;
}

.lead-section h2,
.lead-section h3 {
    margin-top: 0;
}

.field-label {
    font-weight: bold;
}

.lead-text-block {
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Card layout used on the standalone lead view */
.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.lead-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.lead-layout .card {
    flex: 1;
}

/* ============================================
   CAMPAIGN LEADS TABLE (LIST VIEW)
   ============================================ */

.table-leads {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    background: #fff;
}

.table-leads th,
.table-leads td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    vertical-align: top;
    font-size: 13px;
}

.table-leads th {
    background: #fafafa;
    font-weight: 600;
    text-align: left;
}

/* Wrapper so table body scrolls but header stays fixed */
.table-leads-wrapper {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

/* Sticky header */
.table-leads thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fafafa;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

/* zebra striping by batch groups */
.lead-row:nth-child(4n+1),
.lead-row:nth-child(4n+2) {
    background-color: #fff;
}

.lead-row:nth-child(4n+3),
.lead-row:nth-child(4n+4) {
    background-color: #fcfcff;
}

/* ============================================
   FIXED: OUTREACH META PANELS (Client + Internal)
   ============================================ */

/* Layout of the two cards */
.lead-meta-edit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Card container */
.lead-meta-card {
    flex: 1 1 320px;        /* reasonable default width */
    max-width: 380px;       /* prevents huge stretching */
    border: 1px solid #e0e0e0;
    padding: 0.75rem;
    border-radius: 6px;
    background: #fafafa;
    box-sizing: border-box;
}

/* Title inside card */
.lead-meta-card h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

/* Spacing in form rows */
.lead-meta-form .form-row {
    margin-bottom: 0.5rem;
}

/* Fix: keep all inputs compact and contained */
.lead-meta-form input[type="text"],
.lead-meta-form select,
.lead-meta-form textarea {
    width: 100%;
    max-width: 100%;
    font-size: 0.85rem;
    padding: 6px 8px;
    box-sizing: border-box;
}

/* Fix textarea height */
.lead-meta-form textarea {
    resize: vertical;
    min-height: 48px;
    max-height: 120px;
}

/* Buttons */
.lead-meta-form .btn-small {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
}

/* generic table fallback (other pages) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
}

table th,
table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
}

table th {
    background: #f0f0f0;
    font-weight: bold;
}

table td {
    vertical-align: top;
    word-break: break-word;
}

/* ============================================
   INLINE DETAIL EXPANDER (LIST VIEW)
   ============================================ */

.lead-detail-row td {
    background: #fdfdfd;
    padding: 0;
    border-top: none;
}

.lead-detail-panel {
    padding: 12px 16px 16px;
    border-top: 1px solid #e2e2e8;
}

.lead-detail-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.lead-detail-column {
    flex: 1 1 calc(50% - 16px);
    min-width: 300px;
    background: #ffffff;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #e5e5ee;
    box-sizing: border-box;
}

.lead-detail-column h3,
.lead-detail-messaging h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 15px;
}

.lead-detail-column h4 {
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 13px;
}

/* Make Notes for Team (and other paragraphs) wrap nicely inside the column */
.lead-detail-column p {
    white-space: normal;          /* ensure it can wrap */
    word-break: break-word;       /* break long words if needed */
    overflow-wrap: anywhere;      /* be aggressive about wrapping */
}

/* Messaging blocks inside expanded detail */

.lead-detail-messaging {
    margin-top: 12px;
}

.messaging-block {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fbfbff;
    border-radius: 6px;
    border: 1px solid #e1e1f2;
}

.messaging-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.messaging-text {
    margin: 0;
    padding-left: 0px;
}

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

/* Don’t wrap numeric / short-status columns */
.table-leads th:nth-child(1),
.table-leads td:nth-child(1), /* Brand */
.table-leads th:nth-child(8),
.table-leads td:nth-child(8), /* Warm */
.table-leads th:nth-child(9),
.table-leads td:nth-child(9), /* Fit */
.table-leads th:nth-child(10),
.table-leads td:nth-child(10)  /* Status */
{
    white-space: nowrap;
}

/* ============================================
   BUTTONS & CONTROLS
   ============================================ */

/* generic button */
button {
    padding: 8px 12px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    margin-top: 6px;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background: #004c99;
}

button:active {
    background: #003d7a;
}

/* small inline “View / Hide” link-style button */
.btn-link {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: #0057b8;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
}

.btn-link:hover {
    color: #f378e3;
}

/* “Copy” pill buttons in messaging blocks */
.btn-copy,
.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #0057b8;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    background: #0066cc;
    color: #ffffff;
    cursor: pointer;
    margin-left: 8px;
    line-height: 1.2;
}

.btn-copy:hover,
.copy-btn:hover {
    background: #004c99;
    border-color: #004c99;
    opacity: 1;
}

/* fallback full-page link label */
.detail-fallback-link {
    display: inline-block;
    margin-top: 2px;
    font-size: 11px;
    color: #777;
}

/* ================================
   DASHBOARD LAYOUT (legacy)
   ================================ */

.dashboard-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.dashboard-section-admin {
    background: #fff7e6;
    border-color: #f5d28b;
}

.section-hint {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 1rem;
}

/* ================================
   FLASH MESSAGES
   ================================ */

.flash {
    padding: 12px 15px;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.flash-success {
    background: #e6f7e6;
    border: 1px solid #7cc27c;
}

.flash-error {
    background: #ffecec;
    border: 1px solid #e88a8a;
}

/* ================================
   CARDS & GRID (legacy)
   ================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.card h3 {
    margin-top: 0;
}

.card-step-label {
    display: inline-block;
    background: #b410dd;
    color: #fff;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 50px;
    margin-bottom: 0.5rem;
}

/* ================================
   BUTTONS
   ================================ */

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 5px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
}

.btn-primary {
    background: #007bff;
}

.btn-secondary {
    background: #6c757d;
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.85;
}

/* ================================
   LOGOUT LINK
   ================================ */

.logout-link {
    margin-top: 2rem;
    text-align: right;
}

.logout-link a {
    color: #c00;
}

/* ============================================
   LOGIN LAYOUT (nice Innovation Advisor feel)
   ============================================ */

.login-body {
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    background: #f4f6fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    padding: 32px 28px 24px;
}

/* Logo & headings */
.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.login-logo {
    height: 56px;
    width: auto;
}

.login-title {
    font-size: 1.5rem;
    text-align: center;
    margin: 0 0 4px;
    color: #111827;
}

.login-subtitle {
    text-align: center;
    margin: 0 0 20px;
    font-size: 0.95rem;
    color: #6b7280;
}

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-label {
    font-size: 0.85rem;
    color: #374151;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-input {
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 10px 12px;
    font-size: 0.95rem;
}

.form-input:focus {
    outline: 2px solid #c54df5; 
    outline-offset: 1px;
    border-color: transparent;
}

/* Buttons */
.btn-primary {
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: #111827;
    color: #ffffff;
}

.btn-primary:hover {
    background: #020617;
}

.btn-full {
    width: 100%;
}

/* Flash */
.flash {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
}

/* Footer text */
.login-footer-text {
    margin-top: 18px;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
}

.login-footer-brand {
    font-weight: 600;
    color: #c54df5;
}

/* ================================
   CURRENT ORG DISPLAY
   ================================ */

.current-org {
    margin-bottom: 1rem;
}

.current-org.warning {
    color: #a00;
    font-weight: bold;
}

/* ============================================
   SPACING UTILITIES
   ============================================ */

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }

/* ============================================
   MT OUTREACH APP SHELL (SIDEBAR + HEADER)
   ============================================ */

body.app-body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f6fb;
    color: #111827;
}

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

/* Sidebar */

.app-sidebar {
    width: 240px;
    background: #020617; /* deep navy */
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-subtitle {
    font-size: 0.8rem;
    color: #9ca3af;
}

.sidebar-nav {
    flex: 1;
    font-size: 0.9rem;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 8px;
}

.sidebar-link {
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    color: #e5e7eb;
    text-decoration: none;
    margin-bottom: 4px;
}

.sidebar-link:hover {
    background: rgba(148, 163, 184, 0.18);
    text-decoration: none;
}

.sidebar-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #c54df5;
    color: #111827;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 6px;
}

.sidebar-footer {
    border-top: 1px solid #111827;
    padding-top: 12px;
    font-size: 0.8rem;
}

.sidebar-link-logout {
    color: #fecaca;
}

.sidebar-powered {
    margin-top: 6px;
    color: #9ca3af;
}

/* Main area */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.app-header-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 2px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Org pill */

.app-org-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    font-size: 0.8rem;
}

.app-org-name {
    font-weight: 500;
}

.app-org-change-link {
    font-size: 0.75rem;
    color: #2563eb;
}

/* User pill */

.app-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #0f172a;
    color: #e5e7eb;
}

.app-user-initials {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #c54df5;
    color: #111827;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-user-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.app-user-role {
    font-size: 0.7rem;
    color: #9ca3af;
}

/* Content & footer */

.app-content {
    padding: 24px;
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
}

.app-footer {
    padding: 10px 24px 16px;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Dashboard cards */

.dashboard-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.dashboard-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.dashboard-card {
    display: block;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
}

.dashboard-card-secondary {
    box-shadow: none;
    background: #f9fafb;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    border-color: #c54df5;
    text-decoration: none;
}

.dashboard-card h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
}

.dashboard-card p {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.dashboard-step-badge {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #c54df5;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.radio-row {
    display: flex;
    flex-direction: row;       /* ✅ force horizontal */
    align-items: flex-start;
    gap: 0.5rem;
}

.radio-row input[type="radio"] {
    margin-top: 3px;
    flex-shrink: 0;           /* keeps the dot snug on the left */
}

/* Org badge next to title */
.org-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.org-badge-logo {
    height: 48px;          /* nice size, not huge */
    width: auto;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
}

.org-badge-text {
    display: flex;
    flex-direction: column;
}

.org-badge-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.org-badge-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

/* Title row */
.page-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.page-title {
    margin: 0;
}

/* Radio rows – ensure input is on the left */
.radio-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.radio-row input[type="radio"] {
    margin-top: 3px;
}

/* Half-width inputs */
.form-input-half {
    max-width: 260px;
}

/* === Leads page: wider layout === */
.page-wrapper-wide {
    max-width: 1200px; /* wider than default shell */
}

/* Make this page use the full width of the viewport (minus sidebar) */
.page-wrapper-wide {
    max-width: 100%;
    padding-right: 2.5rem;
}

/* Wrapper: we don't want horizontal scroll here unless screen is truly tiny */
.page-wrapper-wide .table-leads-wrapper {
    overflow-x: visible;
}

/* Leads table: full-width and slightly more generous */
.table-leads-wide {
    width: 100%;
    border-collapse: collapse;
}

/* Prevent ugly word-breaks like "Prosp / ect" */
.table-leads-wide th,
.table-leads-wide td {
    white-space: nowrap;
}

/* But allow wrapping for long text columns */
.table-leads-wide th.col-signal,
.table-leads-wide td.col-signal,
.table-leads-wide th.col-notes,
.table-leads-wide td.col-notes {
    white-space: normal;
    vertical-align: top;
}

/* Make the Recent Signal / Notes columns a bit wider so they wrap gracefully */
.table-leads-wide th.col-signal,
.table-leads-wide td.col-signal {
    max-width: 280px;
}
.table-leads-wide th.col-notes,
.table-leads-wide td.col-notes {
    max-width: 260px;
}

/* Messaging: ensure heading and text stack vertically, left aligned */
.lead-detail-messaging,
.lead-detail-messaging .messaging-block,
.lead-detail-messaging .messaging-text,
.lead-detail-messaging .messaging-list {
    text-align: left;
}

.lead-detail-messaging .messaging-block {
    display: block;          /* kills any old flex-row layout */
    margin-bottom: 0.75rem;
}

.lead-detail-messaging .messaging-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.lead-detail-messaging .messaging-text {
    margin-top: 0.25rem;
}

/* Meta form fields keep the rounded look */
.lead-meta-card input[type="text"],
.lead-meta-card select,
.lead-meta-card textarea {
    width: 100%;
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    border: 1px solid #d0d7e2;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.lead-meta-card textarea {
    border-radius: 0.75rem;
    min-height: 80px;
    resize: vertical;
}

/* GLOBAL modern input styling */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea,
.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;

    background: #ffffff;
    border: 1px solid #d0d4da;
    border-radius: 8px; /* rounded corners */
    transition: 0.2s ease;
    box-sizing: border-box;
}

/* Hover */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
input[type="password"]:hover,
input[type="file"]:hover,
select:hover,
textarea:hover,
.form-input:hover {
    border-color: #b4b9c1;
}

/* Focus */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus,
.form-input:focus {
    outline: none;
    border-color: #005bff;
    box-shadow: 0 0 0 2px rgba(0, 91, 255, 0.15);
}

/* Make selects rounded and modern */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23555' height='20' width='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'><polygon points='0,0 20,0 10,10'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

/* File input tweak */
input[type="file"] {
    padding: 8px;
}

    .badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 0.75rem;
        line-height: 1.4;
        border: 1px solid #ddd;
        background: #f7f7f7;
        color: #444;
        white-space: nowrap;
    }
    .badge-default-org {
        border-color: #a855f7;
        background: #e7f0ff;
        color: #174aaf;
        font-weight: 500;
    }
    .badge-default-other {
        border-color: #aaa;
        background: #f0f0f0;
        color: #555;
    }
    .badge-muted {
        border-color: transparent;
        background: transparent;
        color: #999;
    }

    .badge-default-org {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    background: #eef4ff;
    color: #31439b;
    border: 1px solid #c5d0ff;
}

.badge-scope-global      { background: #eef; }
.badge-scope-orgtype     { background: #efe; }
.badge-scope-org         { background: #fee; }
.badge-default-for-org   { background: #ffd; font-weight: 600; }
.badge-status-active     { background: #e8ffe8; }
.badge-status-inactive   { background: #ffe8e8; }

.contact-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 10px;
}

.contact-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    margin-bottom: 6px;
}

.tier-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
}

.tier-card {
    border-radius: 12px;
    border: 1px solid #e1e4eb;
    padding: 1rem 1.25rem;
    background: #fff;
}

.tier-card-active {
    border-color: #a855f7;
    box-shadow: 0 0 0 1px rgba(59,130,246,0.18);
}

.tier-card-muted {
    opacity: 0.85;
    background: #f9fafb;
}

.tier-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}

.tier-title {
    font-weight: 600;
    font-size: .95rem;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.tier-subtitle {
    font-size: .8rem;
    color: #6b7280;
}

.tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .4rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #fff;
}

.tier-badge-1 { background: #2563eb; }
.tier-badge-2 { background: #10b981; }
.tier-badge-3 { background: #a855f7; }

.tier-pill {
    font-size: .75rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: #15803d;
    font-weight: 500;
}

.tier-pill-coming {
    background: #f3f4f6;
    color: #6b7280;
}

.tier-list {
    margin: 0 0 .75rem;
    padding-left: 1rem;
    font-size: .85rem;
}

.tier-list li {
    margin-bottom: .35rem;
}

.report-chart-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.report-chart-placeholder .chart-title {
    font-size: .8rem;
    margin-bottom: .25rem;
    color: #4b5563;
}

.chart-box {
    border-radius: .75rem;
    border: 1px dashed #d1d5db;
    min-height: 120px;
}

.chart-box-skeleton {
    background: repeating-linear-gradient(
        45deg,
        #f9fafb,
        #f9fafb 6px,
        #eef2ff 6px,
        #eef2ff 12px
    );
}

.sidebar-icon {
    margin-right: .4rem;
    display: inline-block;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.metric-tile {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #f7f7fb;
}

.metric-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.metric-sub {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 0.1rem;
}

.quadrant-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 0.75rem;
}

.quadrant-cell {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #f9fafb;
}

.quadrant-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.quadrant-count {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* --- Dashboard layout --- */
.page-subtitle {
    margin-top: 0.25rem;
    font-size: 0.95rem;
    color: #7c7f8e;
}

.date-range-pill {
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: rgba(62, 107, 255, 0.06);
    border: 1px solid rgba(62, 107, 255, 0.18);
    font-size: 0.8rem;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.date-range-pill span {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    color: #72768a;
}

/* Sections */
.dash-section {
    margin-top: 1.75rem;
}

.dash-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: #151826;
}

.dash-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-grid-top {
    margin-bottom: 0.5rem;
}

.stat-card {
    background: #ffffff;
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.stat-card.primary {
    background: #a855f7;
    color: #f9fafb;
    border-color: transparent;
}

.stat-card.accent {
    background: #1fbe97;
    color: #f9fafb;
}

.stat-card.soft {
    background: #f8fafc;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 0.25rem;
}

.stat-caption {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    opacity: 0.85;
}

/* Mini cards for campaigns */
.mini-card {
    background: #ffffff;
    border-radius: 0.8rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.mini-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.mini-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.mini-chip {
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.mini-card-body {
    font-size: 0.8rem;
}

.mini-metrics-row {
    display: flex;
    gap: 1.25rem;
}

.mini-metric {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mini-metric-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.mini-metric-value {
    font-weight: 600;
    color: #111827;
}

.mini-meta {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Status chips */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: #0f172a;
    color: #e5e7eb;
    font-size: 0.75rem;
}

.status-chip-label {
    opacity: 0.9;
}

.status-chip-count {
    font-weight: 600;
    background: rgba(248, 250, 252, 0.16);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}

/* Small helpers */
.link-subtle {
    font-size: 0.8rem;
    color: #4f46e5;
    text-decoration: none;
}

.link-subtle:hover {
    text-decoration: underline;
}

/* ============================================
   DB CLEANUP (Admin)
   ============================================ */

/* DB Cleanup grid layout */
.dbcleanup-grid{
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.dbcleanup-tile{
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 12px;
  cursor: pointer;
}

.dbcleanup-tile:hover{
  background: #f9fafb;
  border-color: #cbd5e1;
}

.dbcleanup-checkbox{
  width: 16px;
  height: 16px;
  margin: 0;
}

.dbcleanup-name{
  font-weight: 600;
  color: #111827;
  overflow-wrap: anywhere;
}

.dbcleanup-count{
  font-size: 0.85rem;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Optional: make admin cards slightly wider without inline styles */
.card.card-wide{
  max-width: 960px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .lead-layout {
        flex-direction: column;
    }

    .lead-detail-columns {
        flex-direction: column;
    }

    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .sidebar-nav {
        display: flex;
        gap: 8px;
    }

    .sidebar-section {
        margin-bottom: 0;
    }

    .app-main {
        flex: 1;
    }
}

@media (max-width: 600px) {
    body.page {
        margin: 10px;
    }

    table th,
    table td {
        padding: 6px;
        font-size: 14px;
    }

    button {
        width: 100%;
        padding: 10px;
        margin-top: 10px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .app-header-right {
        align-self: stretch;
        justify-content: space-between;
    }
}