/* ============================================
   AST CRM — styled to match app.anthonystorres.com
   Same variables, fonts, and admin-panel patterns as web-app/admin/admin.css,
   self-contained since this lives on its own subdomain.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Noto+Sans:wght@400;600&display=swap');

:root {
    --primary:        #50748a;
    --primary-dark:   #3d5a6b;
    --primary-light:  #6a90a8;
    --accent:         #507f70;
    --text:           #222;
    --text-muted:     #666;
    --bg-card:        #ffffff;
    --bg-alt:         #f7f5f3;
    --border:         #ddd;
    --tag-bg:         #e8f0f4;
    --tag-text:       #50748a;
    --btn-bg:         #50748a;
    --btn-text:       #ffffff;
    --btn-hover:      #3d5a6b;
    --danger:         #c0392b;
    --danger-bg:      #fdecea;
    --success:        #276738;
    --success-bg:     #eaf6ed;
    --shadow:         0 2px 12px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Noto Sans', sans-serif;
    font-size: 16px;
    color: var(--text);
    background: #f0f2f5;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', serif;
    font-weight: normal;
    color: var(--text);
    margin-top: 0;
}
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.3rem;  line-height: 1.3; }
h3 { font-size: 1.1rem;  line-height: 1.3; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 6px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--btn-hover); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); padding: 0.5rem 1.15rem; }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a53125; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text-muted); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 0.95rem;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-error { color: var(--danger); font-size: 0.85rem; margin: -0.5rem 0 1rem; }

/* ── Login ── */
#LoginWrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 2.5rem; max-width: 360px; width: 100%; text-align: center; }
.login-card .logo img { height: 48px; margin-bottom: 1rem; }

/* ── Admin shell ── */
#AdminShell { display: flex; min-height: 100vh; }
#AdminNav {
    width: 220px;
    min-height: 100vh;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem 0;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
}
#AdminNav .admin-logo { padding: 0 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 1rem; }
#AdminNav .admin-logo img { height: 32px; filter: brightness(0) invert(1); }
#AdminNav .admin-logo span { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.4rem; }
#AdminNav a { display: block; padding: 0.7rem 1.25rem; color: rgba(255,255,255,0.75); text-decoration: none; font-size: 0.9rem; transition: background 0.15s, color 0.15s; }
#AdminNav a:hover, #AdminNav a.active { background: rgba(255,255,255,0.1); color: #fff; }
#AdminNav a .nav-icon { margin-right: 0.5rem; }

#AdminContent { margin-left: 220px; flex: 1; padding: 2rem; max-width: 1100px; }
/* Kanban-style pages benefit from using a wide monitor's actual width
   instead of being capped like reading-width pages (tables/forms). */
#AdminContent.full-width { max-width: none; }

.admin-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 0.75rem; }
.admin-page-header h1 { margin: 0; }

/* ── Cards ── */
.admin-card { background: #fff; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,0.08); padding: 1.5rem; margin-bottom: 1.5rem; }
.admin-card h2 { margin-bottom: 1.25rem; border-bottom: 1px solid #eee; padding-bottom: 0.75rem; }

/* ── Stats row ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { background: #fff; border-radius: 10px; padding: 1.25rem 1.5rem; box-shadow: 0 1px 6px rgba(0,0,0,0.08); text-align: center; }
.stat-card .stat-number { font-size: 1.9rem; font-weight: 600; color: var(--primary); font-family: 'Noto Sans', sans-serif; }
.stat-card .stat-label { font-size: 0.8rem; color: #888; margin-top: 0.25rem; }

/* ── Tables ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th { text-align: left; padding: 0.6rem 0.85rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #888; border-bottom: 2px solid #eee; font-weight: 600; }
.admin-table td { padding: 0.75rem 0.85rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }

/* ── Tags / pills ── */
.tag-pill { display: inline-block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.18rem 0.5rem; border-radius: 20px; background: var(--tag-bg); color: var(--tag-text); margin: 0.1rem; }
.stage-pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.65rem; border-radius: 20px; background: var(--tag-bg); color: var(--tag-text); white-space: nowrap; }
.overdue-badge { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.18rem 0.5rem; border-radius: 20px; background: var(--danger-bg); color: var(--danger); }
.due-soon-badge { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.18rem 0.5rem; border-radius: 20px; background: #fff6e0; color: #a67c00; }

/* ── Timeline (contact detail) ── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 0.9rem; padding: 0.85rem 0; border-bottom: 1px solid #f0f0f0; }
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 1.1rem; flex-shrink: 0; width: 1.6rem; text-align: center; }
.timeline-body { flex: 1; }
.timeline-meta { font-size: 0.75rem; color: #999; margin-bottom: 0.15rem; }
.timeline-note { white-space: pre-wrap; font-size: 0.9rem; } /* preserves line breaks — fixes Monica's flattened notes */

/* ── Flash messages ── */
.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: 0.9rem; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #b2dfbc; }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6c6; }

/* ── Pipeline board ──
   Columns are capped to a fixed height with their own internal vertical
   scroll for cards, so the board's horizontal scrollbar stays visible right
   under the headers — it was previously only reachable by scrolling all the
   way down past whichever column had the most cards. */
.pipeline-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    max-height: calc(100vh - 220px);
    min-height: 300px;
}
.pipeline-col {
    flex: 0 0 240px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}
.pipeline-col h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: #888; padding: 0.9rem 1rem 0.6rem; margin: 0; border-bottom: 1px solid #eee; flex-shrink: 0; }
.pipeline-col .count { color: var(--primary); }
.pipeline-col-body { overflow-y: auto; flex: 1; }
.pipeline-card { margin: 0.6rem; padding: 0.65rem 0.75rem; background: var(--bg-alt); border-radius: 8px; font-size: 0.85rem; }
.pipeline-card a { color: var(--text); font-weight: 600; }

/* ── Pipeline quick-move (Next/Back with a dated log entry) ── */
.pipeline-move-form { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.35rem; }
.pipeline-date-input { flex: 1; min-width: 0; padding: 0.3rem 0.35rem; border: 1px solid var(--border); border-radius: 5px; font-size: 0.72rem; font-family: 'Noto Sans', sans-serif; }
.pipeline-move-buttons { display: flex; gap: 0.25rem; flex-shrink: 0; }
.pipeline-move-buttons .btn-sm { padding: 0.3rem 0.55rem; font-size: 0.85rem; line-height: 1; }
.pipeline-move-buttons .btn-sm:disabled { opacity: 0.3; cursor: not-allowed; }
.pipeline-move-buttons .btn-sm:disabled:hover { background: var(--btn-bg); }
.pipeline-move-buttons .btn-outline:disabled:hover { background: transparent; color: var(--primary); }

/* ── Responsive ── */
@media (max-width: 768px) {
    #AdminNav { display: none; }
    #AdminContent { margin-left: 0; padding: 1rem; }
    .form-row { flex-direction: column; gap: 0; }
}
