/* Tutti Influencer CRM — chips_secretaria visual language
   (graph-paper grid, ink navy #0D1B2A, sticker cards with hard offset
   shadows, Georgia serif headings with italic green accent, green CTA).
   Reference: landing-tutti HeroChipsSecretaria.tsx + ReferralsAdmin.tsx */

:root {
    --ink: #0D1B2A;
    --green: #2ECC71;
    --green-dark: #1E7C46;
    --purple: #6e12ff;
    --bg-grid-line: #e2e8f0;
    --card: #ffffff;
    --text: #2D3748;
    --muted: #718096;
    --border-soft: #CBD5E0;
    --danger: #e53e3e;
    --gold: #F4B400;
    --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: white;
    background-image:
        linear-gradient(to right, var(--bg-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--bg-grid-line) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: -1px -1px;
    color: var(--text);
    min-height: 100vh;
    position: relative;
}

/* radial mask over the grid, like the hero */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 80% 70% at 50% 30%, transparent 55%, white 100%);
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

.hidden { display: none !important; }

@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0.05); }
}

/* --- Topbar --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-bottom: 1.5px solid var(--ink);
    padding: 0.7rem 1.4rem;
}
.topbar h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0;
    cursor: pointer;
}
.topbar h1 em { font-style: italic; font-weight: 600; color: var(--green-dark); }

/* eyebrow pill (pulsing dot) */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 9px;
    background: white;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    box-shadow: 2px 2px 0 var(--ink);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.02em;
}
.eyebrow .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulseDot 2s ease-in-out infinite;
}

.container { max-width: 1240px; margin: 1.6rem auto; padding: 0 1rem; }

/* --- Command-center layout (table + always-on chat) --- */
.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 1.4rem;
    align-items: start;
}
.home-main { min-width: 0; }
.chat-panel {
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    padding: 1rem 1.1rem;
}
.chat-panel-head { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.chat-panel-hint { font-size: 0.78rem; color: var(--muted); }
.chat-panel #gchat-messages {
    flex: 1;
    height: auto;
    min-height: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0.4rem 0;
    background: transparent;
}
.chat-panel .chat-form { margin-top: 0.8rem; }

@media (max-width: 900px) {
    .home-grid { grid-template-columns: 1fr; }
    .chat-panel {
        position: static;
        height: auto;
        order: -1;
        padding: 1rem;
    }
    .chat-panel #gchat-messages { height: 40vh; }
}

/* --- Sticker card base --- */
.sticker, .list-table, .timeline-item, .chat-messages, .report,
.modal-card, .login-card, .details-grid {
    background: var(--card);
    border: 1.5px solid var(--ink);
    border-radius: 14px;
    box-shadow: 3px 3px 0 var(--ink);
}

/* --- Headings --- */
h2, h3 {
    font-family: var(--serif);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* --- Buttons & inputs --- */
.btn {
    border: 1.5px solid var(--ink);
    border-radius: 10px;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    background: white;
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--green); color: var(--ink); }
.btn-primary:disabled {
    opacity: 0.5; cursor: default;
    transform: none; box-shadow: 2px 2px 0 var(--ink);
}
.btn-danger { background: white; color: var(--danger); border-color: var(--danger); box-shadow: 2px 2px 0 var(--danger); }
.btn-danger:hover { box-shadow: 3px 3px 0 var(--danger); }
.btn-link {
    background: transparent; color: var(--ink); text-decoration: underline;
    border: none; box-shadow: none; font-weight: 600;
}
.btn-link:hover, .btn-link:active { transform: none; box-shadow: none; }
.btn-block { width: 100%; margin-top: 0.6rem; }

input, select, textarea {
    font: inherit;
    padding: 0.5rem 0.7rem;
    border: 1.5px solid var(--border-soft);
    border-radius: 10px;
    background: white;
    color: var(--text);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ink);
}

/* --- Login --- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { padding: 2.2rem 2rem; width: 360px; text-align: center; }
.login-card .eyebrow { margin-bottom: 1.1rem; }
.login-card h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 2rem;
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 0.3rem;
}
.login-card h1 .underlined { position: relative; display: inline-block; white-space: nowrap; }
.login-card h1 .underlined svg {
    position: absolute; left: -4px; right: -4px; bottom: -6px;
    width: calc(100% + 8px); height: 12px;
}
.subtitle { color: var(--muted); margin: 0 0 1.2rem; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.85rem; text-align: left; }
.message { padding: 0.6rem; border-radius: 10px; margin: 0.6rem 0; font-size: 0.9rem; border: 1.5px solid transparent; }
.message.error { background: #fed7d7; color: #822727; border-color: #822727; }
.message.success { background: #c6f6d5; color: #22543d; border-color: var(--green-dark); }
.message.info { background: #F7F9FC; color: var(--ink); border-color: var(--border-soft); }
.loading { color: var(--muted); margin: 0.5rem 0; }

/* --- List --- */
.toolbar { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; }
.toolbar input[type="search"] { flex: 1; }
.toolbar select { width: auto; }
.toolbar .btn { white-space: nowrap; }

.list-table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.list-table th, .list-table td { padding: 0.7rem 0.85rem; text-align: left; font-size: 0.9rem; }
.list-table thead { background: #F7F9FC; }
.list-table thead th {
    color: var(--muted); font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1.5px solid var(--ink);
}
.list-table tbody tr { cursor: pointer; }
.list-table tbody tr + tr td { border-top: 1px solid var(--bg-grid-line); }
.list-table tbody tr:hover { background: #F7F9FC; }
.list-table td strong { color: var(--ink); }

.empty { color: var(--muted); text-align: center; padding: 2rem; }

/* --- Status chips (white pill + colored dot, like the orbit chips) --- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.2rem 0.7rem 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    background: white;
    border: 1px solid var(--border-soft);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px -8px rgba(15, 23, 42, 0.18);
    white-space: nowrap;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #A0AEC0; flex: none; }
.pill-prospecto::before { background: #A0AEC0; }
.pill-contactado::before { background: #3182CE; }
.pill-negociando::before { background: var(--gold); }
.pill-acordado::before { background: var(--green); }
.pill-publicado::before { background: var(--green-dark); }
.pill-descartado::before { background: var(--danger); }

.verdict {
    font-weight: 700; font-size: 0.78rem; padding: 0.18rem 0.55rem;
    border-radius: 8px; border: 1.5px solid;
}
.verdict-go { background: #c6f6d5; color: #22543d; border-color: var(--green-dark); }
.verdict-no_go, .verdict-no-go { background: #fed7d7; color: #822727; border-color: #822727; }
.verdict-maybe { background: #fff8e5; color: #744210; border-color: var(--gold); }

/* --- Profile --- */
.profile-header { display: flex; align-items: center; gap: 1rem; margin: 0.8rem 0 1.1rem; }
.profile-header h2 { margin: 0; font-size: 1.7rem; }
.status-select {
    width: auto; font-weight: 700; color: var(--ink);
    border: 1.5px solid var(--ink); border-radius: 999px;
    box-shadow: 2px 2px 0 var(--ink); padding: 0.35rem 0.8rem;
    background: white;
}

.tabs { display: flex; gap: 0.3rem; border-bottom: 1.5px solid var(--ink); margin-bottom: 1.2rem; }
.tab {
    border: none; background: transparent; padding: 0.6rem 1rem;
    cursor: pointer; font-size: 0.95rem; font-weight: 600; color: var(--muted);
    border-bottom: 3px solid transparent; margin-bottom: -1.5px;
}
.tab.active { color: var(--ink); border-bottom-color: var(--purple); }

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.8rem;
    padding: 1.1rem;
}
.details-grid label {
    font-size: 0.72rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em;
    display: flex; flex-direction: column; gap: 0.3rem;
}
.form-actions { display: flex; gap: 0.7rem; align-items: center; margin-top: 1.1rem; }
.inline-msg { color: var(--green-dark); font-weight: 600; font-size: 0.9rem; }

/* --- Interactions --- */
.interaction-form { display: flex; gap: 0.5rem; margin-bottom: 1.1rem; }
.interaction-form select { width: auto; }
.interaction-form input { flex: 1; }
.timeline { display: flex; flex-direction: column; gap: 0.7rem; }
.timeline-item { padding: 0.75rem 0.95rem; box-shadow: 2px 2px 0 var(--ink); }
.timeline-meta { font-size: 0.76rem; font-weight: 600; color: var(--muted); margin-bottom: 0.3rem; }

/* --- Chat --- */
.chat-messages {
    padding: 1rem;
    height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.chat-msg {
    max-width: 82%;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    font-size: 0.93rem;
    line-height: 1.45;
}
.chat-msg p { margin: 0.3rem 0; }
.chat-msg ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.chat-user {
    align-self: flex-end;
    background: var(--ink);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-assistant {
    align-self: flex-start;
    background: white;
    border: 1px solid var(--border-soft);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px -8px rgba(15, 23, 42, 0.18);
    border-bottom-left-radius: 4px;
}
.chat-error, .chat-msg.chat-error {
    align-self: center;
    background: #fed7d7; color: #822727;
    border: 1.5px solid #822727;
    font-size: 0.85rem;
}
.chat-typing {
    align-self: flex-start; color: var(--muted); font-style: italic;
    background: transparent; display: inline-flex; align-items: center; gap: 8px;
}
.chat-typing::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); animation: pulseDot 2s ease-in-out infinite;
}
.chat-form { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.chat-form textarea { flex: 1; resize: none; }

/* --- Research --- */
.research-toolbar { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1.1rem; }
.report { padding: 1.4rem; line-height: 1.6; }
.report h3, .report h4, .report h5 { font-family: var(--serif); color: var(--ink); margin: 1.1rem 0 0.4rem; }
.report a { color: var(--purple); }
.report-badges { display: flex; gap: 0.6rem; margin-bottom: 0.9rem; }
.report code { background: #F7F9FC; border: 1px solid var(--bg-grid-line); padding: 0.1rem 0.3rem; border-radius: 4px; }

/* --- Modal --- */
.modal {
    position: fixed; inset: 0;
    background: rgba(13, 27, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
}
.modal-card { padding: 1.6rem; width: 390px; box-shadow: 5px 5px 0 var(--ink); }
.modal-card form { display: flex; flex-direction: column; gap: 0.55rem; }
.modal-card h3 { margin: 0 0 0.6rem; font-size: 1.35rem; }

@media (max-width: 640px) {
    .toolbar { flex-wrap: wrap; }
    .list-table th:nth-child(n+7), .list-table td:nth-child(n+7) { display: none; }
    .chat-msg { max-width: 95%; }
    .topbar .eyebrow { display: none; }
}
