/* ==========================================================================
   HyndSyte My Dashboard
   ========================================================================== */

:root {
    --navy-950: #0b1220;
    --navy-900: #0f172a;
    --navy-800: #16223d;
    --navy-700: #1e293b;
    --border: #232f4b;
    --text-light: #e2e8f0;
    --text-muted: #94a3b8;
    --bg-app: #f4f6fb;
    --bg-card: #ffffff;
    --bg-page: #f8fafc;
    --text-dark: #0f172a;
    --text-body: #475569;

    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --purple: #8b5cf6;
    --green: #10b981;
    --teal: #06b6d4;
    --red: #ef4444;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.05);
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
textarea,
select {
    background: var(--bg-page) !important;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-app);
    color: var(--text-dark);
}

a { text-decoration: none; color: inherit; }

/* ---------------------------------------------------------------------- */
/* Login                                                                  */
/* ---------------------------------------------------------------------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
    padding: 24px;
    position: relative;
}

.login-stars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 0;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
}

.login-logo {
    height: 96px;
    margin-bottom: 20px;
    filter: brightness(0);
}

.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 8px 0 16px;
}

.cf-turnstile iframe {
    border-radius: var(--radius-sm);
}

.login-card h1 {
    font-size: 20px;
    margin: 0 0 6px;
    color: var(--text-dark);
}

.login-subtext {
    color: var(--text-body);
    font-size: 14px;
    margin: 0 0 24px;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: left;
}

.login-form {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 6px;
}

.login-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 10px;
}

.login-form input {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #d5dbe6;
    font-size: 14px;
    font-family: inherit;
}

.login-submit {
    margin-top: 20px;
    justify-content: center;
    width: 100%;
    border: none;
    cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Shell / Layout                                                        */
/* ---------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-logo { width: 150px; height: 150px; object-fit: contain; display: block; }
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 18px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59,130,246,0.22), rgba(59,130,246,0.05));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--blue);
}

.nav-dot {
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.nav-dot.inactive { background: var(--text-muted); }

.nav-submenu {
    display: flex;
    flex-direction: column;
    margin: 2px 0 6px 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.nav-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-submenu-item svg { flex-shrink: 0; width: 16px; height: 16px; }

.nav-submenu-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
}

.nav-submenu-item.active {
    background: var(--blue);
    color: #fff;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 35;
}

/* Main area ------------------------------------------------------------- */
.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 68px;
    background: var(--bg-card);
    border-bottom: 1px solid #e6e9f2;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title { font-size: 18px; font-weight: 700; margin: 0; flex: 1; }

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    cursor: pointer;
}
.menu-toggle span { display: block; height: 2px; width: 100%; background: var(--text-dark); border-radius: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #e6e9f2;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-body);
    cursor: pointer;
}
.icon-btn:hover { background: #f1f5f9; }

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

.app-footer {
    padding: 18px 28px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid #e6e9f2;
}

/* ---------------------------------------------------------------------- */
/* Stat cards                                                             */
/* ---------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-icon-blue   { background: rgba(59,130,246,0.12); color: var(--blue); }
.stat-icon-purple { background: rgba(139,92,246,0.12); color: var(--purple); }
.stat-icon-green  { background: rgba(16,185,129,0.12); color: var(--green); }
.stat-icon-teal   { background: rgba(6,182,212,0.12); color: var(--teal); }

.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text-dark); }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--text-muted); }

.stat-card-health { grid-column: span 2; }
.stat-value-health { color: var(--green); }
.stat-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
}

.btn-report {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--red);
    background: rgba(239,68,68,0.1);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.btn-report:hover { background: rgba(239,68,68,0.18); }

/* ---------------------------------------------------------------------- */
/* Services grid                                                          */
/* ---------------------------------------------------------------------- */
.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.section-heading p { margin: 0; color: var(--text-muted); font-size: 14px; }

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.service-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid transparent;
}

.service-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
    border-color: #e2e8f0;
}

.service-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.service-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(59,130,246,0.1);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-pill {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 999px;
}
.status-active { background: rgba(16,185,129,0.12); color: #047857; }
.status-inactive { background: rgba(148,163,184,0.18); color: #64748b; }

.service-name { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.service-desc { font-size: 13px; color: var(--text-body); margin: 0 0 16px; flex: 1; line-height: 1.5; }
.service-link { font-size: 13px; font-weight: 600; color: var(--blue); }

/* ---------------------------------------------------------------------- */
/* Service detail page                                                    */
/* ---------------------------------------------------------------------- */
.service-hero {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.service-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(59,130,246,0.1);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-hero-info { flex: 1; min-width: 220px; }
.service-hero-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.service-hero-title-row h2 { margin: 0; font-size: 22px; font-weight: 800; }
.service-hero-info p { margin: 0; color: var(--text-body); font-size: 14px; }

.btn-launch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn-launch:hover { background: var(--blue-dark); }
.btn-launch-muted { background: var(--text-muted); }
.btn-launch-muted:hover { background: #7c8aa0; }

.btn-launch-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.detail-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.detail-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-value { font-size: 19px; font-weight: 700; }

.empty-state {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px 24px;
    text-align: center;
    color: var(--text-body);
}
.empty-state svg { color: var(--text-muted); margin-bottom: 14px; }
.empty-state h3 { margin: 0 0 8px; font-size: 17px; color: var(--text-dark); }
.empty-state p { margin: 0; font-size: 14px; }

/* ---------------------------------------------------------------------- */
/* Settings page                                                          */
/* ---------------------------------------------------------------------- */
.settings-panel {
    max-width: 560px;
}

.settings-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--text-body); }
.form-row input {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #dbe2ee;
    font-size: 14px;
    font-family: inherit;
}
.form-row input:focus { outline: none; border-color: var(--blue); }
.form-row input:disabled { background: #f1f5f9; color: var(--text-muted); }

.settings-form .btn-launch { align-self: flex-start; }

.settings-message {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 0;
    text-align: left;
}
.settings-message-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}
.settings-message-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
}

.settings-password-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-password-section h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                             */
/* ---------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-area { margin-left: 0; }
    .menu-toggle { display: flex; }
}

@media (max-width: 560px) {
    .stats-grid, .services-grid, .detail-grid { grid-template-columns: 1fr; }
    .content { padding: 18px; }
    .topbar { padding: 0 16px; }
}

/* ---------------------------------------------------------------------- */
/* CRM — Tabs                                                            */
/* ---------------------------------------------------------------------- */
.crm-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    margin-bottom: 24px;
    width: fit-content;
}

.crm-tab {
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-body);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.crm-tab:hover { background: #f1f5f9; }
.crm-tab.active { background: var(--blue); color: #fff; }

.crm-panel[hidden] { display: none; }

.crm-quick-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------- */
/* CRM — Toolbar / inputs                                                */
/* ---------------------------------------------------------------------- */
.crm-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.crm-toolbar-hint { font-size: 13px; color: var(--text-muted); margin-right: auto; }

.crm-input, .crm-select {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #e0e5f0;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.crm-input { flex: 1; min-width: 220px; }

.crm-filter-group { display: flex; gap: 6px; margin-right: auto; flex-wrap: wrap; }

.crm-filter {
    border: 1px solid #e0e5f0;
    background: #fff;
    color: var(--text-body);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
}
.crm-filter.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------------------------------------------------------------------- */
/* CRM — Contacts table                                                   */
/* ---------------------------------------------------------------------- */
.crm-table-wrap {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.crm-table { width: 100%; border-collapse: collapse; }
.crm-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 14px 20px;
    border-bottom: 1px solid #eef1f7;
}
.crm-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid #eef1f7;
    vertical-align: middle;
}
.crm-table tr:last-child td { border-bottom: none; }
.crm-table tr:hover { background: #f8fafc; cursor: pointer; }

.crm-contact-name { font-weight: 700; color: var(--text-dark); }
.crm-contact-name small { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; }

.crm-tag {
    display: inline-block;
    background: rgba(59,130,246,0.1);
    color: var(--blue-dark);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    margin: 0 4px 4px 0;
}

.status-lead { background: rgba(59,130,246,0.12); color: var(--blue-dark); }
.status-prospect { background: rgba(139,92,246,0.12); color: var(--purple); }
.status-customer { background: rgba(16,185,129,0.12); color: #047857; }
.status-inactive { background: rgba(148,163,184,0.18); color: #64748b; }

.crm-row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.crm-icon-action {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
.crm-icon-action:hover { background: #eef1f7; color: var(--text-dark); }
.crm-icon-action.danger:hover { color: var(--red); background: rgba(239,68,68,0.1); }

.crm-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------------------------------------------------------------------- */
/* CRM — Kanban board                                                     */
/* ---------------------------------------------------------------------- */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.kanban-column {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 320px);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eef1f7;
    font-weight: 700;
    font-size: 14px;
}

.kanban-column-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; display: inline-block; }
.kanban-column-count {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 60px;
}

.kanban-cards.drag-over { background: rgba(59,130,246,0.06); border-radius: var(--radius-sm); }

.kanban-card {
    background: #fff;
    border: 1px solid #eef1f7;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.4; }

.kanban-card-title { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.kanban-card-value { font-size: 13px; color: var(--green); font-weight: 700; }
.kanban-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: flex; justify-content: space-between; }

/* ---------------------------------------------------------------------- */
/* CRM — Modals                                                           */
/* ---------------------------------------------------------------------- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 60;
}
.modal-backdrop.open { display: block; }

.modal-card {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 61;
}
.modal-card.open { display: block; }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--blue, #3b82f6);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    margin: 0 auto;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #eef1f7;
}
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 800; }

.modal-form { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-body { padding: 22px; }

.form-row { display: flex; gap: 14px; }
.form-field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12px; font-weight: 700; color: var(--text-body); text-transform: uppercase; letter-spacing: 0.03em; }
.form-field input, .form-field select, .form-field textarea {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #d5dbe6;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------------------------------------------------------------------- */
/* Purchase Modal                                                         */
/* ---------------------------------------------------------------------- */
.pm-toggle {
    display: flex;
    gap: 8px;
    background: #f3f4f6;
    border-radius: var(--radius-sm);
    padding: 4px;
    margin: 16px 0;
}

.pm-toggle-btn {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.pm-toggle-btn.active {
    background: var(--bg-card);
    color: var(--text-body);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.pm-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #dcfce7;
    color: #166534;
    border-radius: 999px;
}

.pm-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}

.pm-check-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue, #3b82f6);
    cursor: pointer;
}

.pm-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 18px 0 4px;
}

.pm-price-row #pm-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-body);
}

.pm-price-row #pm-price-period {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.pm-annual-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.pm-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 10px;
    min-height: 18px;
}

.pn-pricing-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 14px;
    margin: 12px 0;
}

.pn-pricing-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-body);
}

.pn-pricing-row.pn-pricing-total {
    font-weight: 700;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
    margin-top: 8px;
}

/* ---------------------------------------------------------------------- */
/* CRM — Contact slide-over + task list                                  */
/* ---------------------------------------------------------------------- */
.slide-over {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    max-width: 100%;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -8px 0 30px rgba(15,23,42,0.15);
    z-index: 61;
    transition: right 0.25s ease;
    display: flex;
    flex-direction: column;
}
.slide-over.open { right: 0; }

.slide-over-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid #eef1f7;
}
.slide-over-header h3 { margin: 0; font-size: 18px; font-weight: 800; }

/* Mock app preview card on inactive service pages */
.app-preview-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    max-width: 420px;
}

.app-preview-card h4 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
}

.app-preview-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.app-preview-btn {
    width: 100%;
    justify-content: center;
}

.app-preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.app-preview-stat {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.app-preview-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
}

.app-preview-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.ai-preview-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ai-preview-cards .app-preview-card {
    max-width: 420px;
    margin-bottom: 0;
    width: 100%;
}

@media (max-width: 1100px) {
    .ai-preview-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .ai-preview-cards {
        grid-template-columns: 1fr;
    }
}

.software-related {
    margin-top: 32px;
}

.software-related-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--text-dark);
}

.software-related-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.software-related-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    max-width: 420px;
}

.software-related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.software-related-card .app-preview-btn {
    pointer-events: none;
}

@media (max-width: 720px) {
    .software-related-cards {
        grid-template-columns: 1fr;
    }
}

.slide-over-body { padding: 22px; overflow-y: auto; flex: 1; }

#slideOverBackdrop { z-index: 55; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.task-item.done .task-item-title { text-decoration: line-through; color: var(--text-muted); }
.task-item-checkbox { width: 20px; height: 20px; flex-shrink: 0; cursor: pointer; }
.task-item-body { flex: 1; min-width: 0; }
.task-item-title { font-weight: 700; font-size: 14px; }
.task-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.task-priority { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; text-transform: uppercase; }
.task-priority-low { background: rgba(148,163,184,0.18); color: #64748b; }
.task-priority-medium { background: rgba(245,158,11,0.14); color: #b45309; }
.task-priority-high { background: rgba(239,68,68,0.12); color: var(--red); }
.task-overdue { color: var(--red) !important; font-weight: 700; }

.crm-activity-item { border-left: 2px solid #eef1f7; padding-left: 14px; margin-bottom: 14px; }
.crm-activity-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.03em; }
.crm-activity-body { font-size: 14px; }
.crm-detail-section { margin-bottom: 22px; }
.crm-detail-section h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 10px; }
.crm-detail-row { font-size: 14px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 10px; }
.crm-detail-row span:first-child { color: var(--text-muted); }

/* ---------------------------------------------------------------------- */
/* Phones — Overview + sub pages                                         */
/* ---------------------------------------------------------------------- */
.phone-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.phone-subnav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-body);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: background 0.15s, color 0.15s;
}

.phone-subnav-item:hover {
    background: var(--bg-hover);
}

.phone-subnav-item.active {
    background: var(--blue);
    color: #fff;
}

.phone-subnav-item svg {
    width: 18px;
    height: 18px;
}

.phone-section {
    margin-top: 24px;
}

.phone-section-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 14px;
}

.phone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.phone-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-decoration: none;
    color: var(--text-heading);
    transition: transform 0.15s, box-shadow 0.15s;
}

.phone-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.phone-card-icon {
    color: var(--blue);
    margin-bottom: 12px;
}

.phone-card h4 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
}

.phone-card p {
    margin: 0;
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.5;
}

.phone-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.phone-table-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.phone-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #eef1f7;
}

.phone-table-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.phone-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.phone-table th,
.phone-table td {
    padding: 14px 22px;
    text-align: left;
    border-bottom: 1px solid #eef1f7;
}

.phone-table th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.phone-table tr:last-child td {
    border-bottom: none;
}

.phone-number-cell {
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.phone-number-edit {
    color: var(--text-heading);
    text-decoration: none;
    display: inline-flex;
    flex-direction: column;
    line-height: 1.2;
}

.phone-number-edit:hover {
    color: var(--blue);
}

.phone-friendly-name {
    display: block;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
    margin-top: 0;
}

.phone-btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--red, #ef4444);
    background: transparent;
    color: var(--red, #ef4444);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.phone-btn-delete:hover {
    background: var(--red, #ef4444);
    color: #fff;
}

.phone-empty {
    padding: 48px 22px;
    text-align: center;
    color: var(--text-muted);
}

.phone-empty svg {
    margin-bottom: 14px;
    color: var(--text-muted);
}

.phone-empty p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.phone-form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.phone-form-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.phone-form-section h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
}

.phone-form-help {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.phone-form-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
}

.ai-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ai-subnav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-body);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.ai-subnav-item:hover {
    background: var(--bg-hover);
}

.ai-subnav-item.active {
    background: var(--blue);
    color: #fff;
}

.ai-subnav-item svg {
    width: 18px;
    height: 18px;
}

.ai-agents-container {
    margin-bottom: 32px;
}

.ai-agents-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
    margin-bottom: 20px;
}

.ai-agent-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.ai-agent-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: box-shadow .2s, border-color .2s, transform .2s;
    font: inherit;
    color: inherit;
}

.ai-agent-type-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.ai-agent-type-icon {
    color: var(--color-primary);
    margin-bottom: 14px;
}

.ai-agent-type-card h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ai-agent-type-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.4;
}

.ai-agent-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ai-agent-form .form-field {
    margin: 0;
}

.ai-agent-form .form-field label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
}

.ai-agent-form input[type="text"],
.ai-agent-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5dbe6;
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-page);
    color: var(--text-body);
}

.ai-agent-form textarea {
    resize: vertical;
}

.ai-agent-role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.ai-agent-role-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px solid #d5dbe6;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-page);
    transition: border-color .2s, background .2s;
}

.ai-agent-role-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-agent-role-card:has(input:checked) {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.ai-agent-role-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-heading);
}

.ai-agent-role-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
}

.ai-agent-integrations {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ai-agent-integration-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #d5dbe6;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-page);
    font-size: 14px;
    color: var(--text-body);
}

.ai-agent-integration-toggle input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.ai-agent-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 12px;
    width: 100%;
}

.ai-agent-form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.ai-agent-form-actions {
    display: flex;
    gap: 12px;
    padding-top: 6px;
}

.ai-agent-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.ai-agent-type-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    font: inherit;
    color: var(--text-body);
}

.ai-agent-type-select:hover {
    border-color: var(--blue);
}

.ai-agent-type-select.active {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    color: var(--blue);
}

.ai-agent-type-select svg {
    width: 32px;
    height: 32px;
}

.ai-agent-type-select span {
    font-weight: 600;
    font-size: 15px;
}

.ai-agent-type-select .ai-agent-type-desc {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: center;
    max-width: 220px;
}

.agent-plan-option:has(input:checked) {
    border-color: var(--blue);
    background: rgba(37, 99, 235, 0.05);
}

.ai-agent-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.ai-agent-tool-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px solid #d5dbe6;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-page);
    transition: border-color 0.15s, background 0.15s;
}

.ai-agent-tool-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-agent-tool-card:has(input:checked) {
    border-color: var(--blue);
    background: rgba(37, 99, 235, 0.05);
}

.ai-agent-tool-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-heading);
}

.ai-agent-tool-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
}

.ai-agent-card-actions {
    display: flex;
    gap: 8px;
}

.ai-kb-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-kb-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.ai-kb-item strong {
    color: var(--text-heading);
}

.ai-kb-source {
    color: var(--text-muted);
    font-size: 13px;
}

.ai-kb-source a {
    color: var(--blue);
    text-decoration: none;
}

.ai-kb-source a:hover {
    text-decoration: underline;
}

.phone-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.phone-section-header .phone-section-title {
    margin: 0;
}

.ai-agent-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.ai-agent-card-integrations {
    font-size: 12px;
    color: var(--text-muted);
}

.phone-number-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #d5dbe6;
    border-radius: var(--radius-sm);
    background: var(--bg-page);
    max-height: 180px;
    overflow-y: auto;
}

.phone-number-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-body);
}

.phone-number-checkbox input {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.phone-number-checkbox-label {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.2;
}

.phone-number-checkbox-label small {
    font-size: 11px;
    color: var(--text-muted);
}

.phone-extension-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr 36px;
    gap: 12px;
    align-items: flex-end;
    padding: 14px;
    background: var(--bg-page);
    border-radius: var(--radius);
    border: 1px solid #eef1f7;
    margin-bottom: 10px;
}

.phone-extension-row .form-field {
    margin: 0;
}

.phone-extension-remove {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--red, #ef4444);
    font-size: 22px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.phone-extension-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.ai-agent-logs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-agent-log-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
}

.ai-agent-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.ai-agent-log-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-agent-log-duration {
    color: var(--text-muted);
    font-size: 13px;
}

.ai-agent-log-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-agent-log-block h5 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-agent-log-block p {
    margin: 0;
    font-size: 14px;
    color: var(--text-body);
    line-height: 1.5;
}

.ai-agent-log-transcript {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-body);
    white-space: pre-wrap;
}

.ai-agent-log-audio {
    width: 100%;
    max-width: 500px;
}

@media (max-width: 860px) {
    .phone-extension-row {
        grid-template-columns: 1fr 1fr;
    }
    .phone-extension-remove {
        grid-column: span 2;
        width: 100%;
        height: 40px;
    }
}
