/* ============================================================
   ACBIZ AI — Design Tokens
   Ink base + brass/cyan accents. Space Grotesk display,
   IBM Plex Sans body, IBM Plex Mono for data/ticker.
   ============================================================ */
:root {
    --ink:          #0E1B1B;
    --ink-soft:     #16302E;
    --ink-line:     #274543;
    --paper:        #EEF0EC;
    --paper-card:   #FFFFFF;
    --text-on-ink:  #F4F6F2;
    --text-muted:   #9FB0AC;
    --text-dark:    #10201E;
    --text-dark-muted: #5B6E6A;
    --brass:        #C9A227;
    --brass-soft:   #E4C766;
    --cyan:         #5FD9C9;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body:    'IBM Plex Sans', sans-serif;
    --font-mono:    'IBM Plex Mono', monospace;

    --radius: 10px;
    --container-w: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--text-dark);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.12;
    margin: 0;
}

a { color: inherit; }

.container {
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 26px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brass); color: var(--ink); }
.btn-primary:hover { background: var(--brass-soft); }
.btn-outline { background: transparent; color: var(--text-on-ink); border-color: rgba(244,246,242,0.35); }
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-outline-dark { background: transparent; color: var(--text-dark); border-color: var(--ink-line); }
.btn-outline-dark:hover { border-color: var(--brass); color: var(--brass); }
.btn-sm { padding: 9px 18px; font-size: 0.85rem; }
.btn-block { display: flex; width: 100%; }
.btn-group { display: flex; gap: 14px; flex-wrap: wrap; }

/* ── Header ──────────────────────────────────────────────── */
.site-header {
    background: var(--ink);
    padding: 18px 0;
}
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    background: var(--brass);
    color: var(--ink);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.8rem;
}
.brand-name { color: var(--text-on-ink); font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-name-accent { color: var(--brass); }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { color: var(--text-muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; }
.site-nav a:hover { color: var(--text-on-ink); }
.nav-signin:hover { color: var(--cyan) !important; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
    background: var(--ink);
    padding: 88px 0 64px;
}
.hero-inner { max-width: 720px; }
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 18px;
}
.eyebrow-dark { color: var(--brass); }
.hero h1 {
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    color: var(--text-on-ink);
    letter-spacing: -0.02em;
}
.hero-sub {
    color: var(--text-muted);
    font-size: 1.08rem;
    max-width: 560px;
    margin: 22px 0 34px;
}

/* ── Ops Ticker (signature element) ─────────────────────────
   A monospace readout of tasks the assistant is handling —
   the hero's thesis made literal, not just a decorative strip. */
.ops-ticker {
    margin-top: 48px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--ink-line);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.02);
    padding: 14px 18px;
    overflow: hidden;
}
.ops-ticker-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--brass);
    border: 1px solid var(--brass);
    border-radius: 4px;
    padding: 2px 7px;
    flex-shrink: 0;
    position: relative;
}
.ops-ticker-label::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--brass);
    margin-right: 6px;
    animation: pulse 1.6s infinite ease-in-out;
}
.ops-ticker-track {
    display: flex;
    gap: 40px;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    animation: ticker 26s linear infinite;
}
@keyframes ticker {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) {
    .ops-ticker-track { animation: none; }
    .ops-ticker-label::before { animation: none; }
}

/* ── Features ────────────────────────────────────────────── */
.features { padding: 84px 0; }
.features h2, .pricing h2 {
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    color: var(--text-dark);
    margin: 10px 0 44px;
    max-width: 560px;
}
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.feature-card {
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    border-top: 3px solid var(--ink-line);
    border-radius: var(--radius);
    padding: 26px 24px;
    transition: border-color 0.15s ease;
}
.feature-card:hover { border-top-color: var(--brass); }
.feature-card h3 { font-size: 1.08rem; margin-bottom: 10px; }
.feature-card p { color: var(--text-dark-muted); font-size: 0.94rem; margin: 0; }

/* ── Pricing ─────────────────────────────────────────────── */
.pricing { padding: 20px 0 96px; }
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    align-items: stretch;
}
.plan-card {
    position: relative;
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    border-radius: var(--radius);
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
}
.plan-card-featured {
    border-color: var(--brass);
    box-shadow: 0 0 0 1px var(--brass);
}
.plan-badge {
    position: absolute;
    top: -12px; left: 22px;
    background: var(--brass);
    color: var(--ink);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 4px 10px;
    border-radius: 20px;
}
.plan-name { font-size: 1.1rem; }
.plan-tagline { color: var(--text-dark-muted); font-size: 0.87rem; margin: 8px 0 20px; min-height: 34px; }
.plan-price { font-family: var(--font-mono); margin-bottom: 22px; }
.plan-price-currency { font-size: 1.1rem; vertical-align: top; }
.plan-price-value { font-size: 2.1rem; font-weight: 500; }
.plan-price-period { color: var(--text-dark-muted); font-size: 0.85rem; }
.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 26px;
    flex-grow: 1;
}
.plan-features li {
    font-size: 0.88rem;
    color: var(--text-dark-muted);
    padding: 7px 0;
    border-top: 1px solid #EEF0EC;
}
.plan-features li:first-child { border-top: none; }
.plan-features li::before { content: '+ '; color: var(--brass); font-weight: 600; }
.pricing-empty { color: var(--text-dark-muted); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer { background: var(--ink); padding: 40px 0; }
.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.footer-brand p { color: var(--text-muted); font-size: 0.82rem; margin: 4px 0 0; }
.footer-copy { color: var(--text-muted); font-size: 0.82rem; margin: 0; }

/* ── Admin ───────────────────────────────────────────────── */
.admin-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brass-soft);
    border: 1px solid var(--ink-line);
    border-radius: 4px;
    padding: 2px 8px;
    margin: -4px 0 18px;
}
.app-main.admin-main { overflow-y: auto; padding: 32px 36px; display: block; }
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.admin-header h2 { font-size: 1.4rem; color: var(--text-dark); }
.admin-back-link { color: var(--text-dark-muted); text-decoration: none; font-size: 0.88rem; }
.admin-back-link:hover { color: var(--brass); }
.admin-empty { color: var(--text-dark-muted); }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    border-radius: var(--radius);
    overflow: hidden;
}
.admin-table th, .admin-table td {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.88rem;
    border-bottom: 1px solid #EEF0EC;
}
.admin-table th {
    background: #F5F6F2;
    color: var(--text-dark-muted);
    font-weight: 600;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table-mono { font-family: var(--font-mono); color: var(--text-dark-muted); }
.admin-table-muted { color: var(--text-dark-muted); }
.admin-table-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.admin-table-actions a { color: var(--brass); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.admin-inline-form { display: inline; margin: 0; }
.admin-link-danger {
    background: none; border: none; padding: 0; cursor: pointer;
    color: #C0392B; font-weight: 600; font-size: 0.85rem; font-family: inherit;
}

.status-pill {
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.status-pill-active { background: #E4F3E9; color: #1E7B4D; }
.status-pill-inactive { background: #F1F1EC; color: #7A7A72; }

.admin-form {
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    border-radius: var(--radius);
    padding: 28px;
    max-width: 640px;
}
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.admin-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #D7DAD3;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    background: #FBFBF9;
    color: var(--text-dark);
    resize: vertical;
}
.admin-form textarea:focus { outline: none; border-color: var(--brass); background: #fff; }
.admin-checkbox-group { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.admin-checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-dark); font-weight: 500; }
.admin-checkbox input { width: 16px; height: 16px; }

@media (max-width: 720px) {
    .admin-main { padding: 20px; }
    .admin-form-grid { grid-template-columns: 1fr; }
    .admin-table { display: block; overflow-x: auto; }
}
.auth-body {
    background: var(--ink);
    min-height: 100vh;
}
.auth-page {
    max-width: 420px;
    margin: 0 auto;
    padding: 64px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.auth-brand { margin-bottom: 36px; }
.auth-card {
    background: var(--paper-card);
    border-radius: var(--radius);
    padding: 36px 32px;
    width: 100%;
}
.auth-card h1 { font-size: 1.5rem; color: var(--text-dark); }
.auth-sub { color: var(--text-dark-muted); font-size: 0.92rem; margin: 8px 0 28px; }
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #D7DAD3;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: #FBFBF9;
    color: var(--text-dark);
    transition: border-color 0.15s ease;
}
.form-group input:focus {
    outline: none;
    border-color: var(--brass);
    background: #fff;
}
.btn-full { width: 100%; margin-top: 6px; }
.auth-footer {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-dark-muted);
    margin: 22px 0 0;
}
.auth-footer a { color: var(--brass); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ── Flash messages ──────────────────────────────────────── */
.flash { max-width: var(--container-w); margin: 0 auto; padding: 0 24px; }
body.auth-body .flash { max-width: 420px; padding: 0 24px; margin-top: 0; }

/* ── Dashboard (placeholder) ─────────────────────────────── */
.dash-shell { padding: 64px 0; min-height: 60vh; }
.dash-shell h2 { font-size: 1.8rem; margin: 10px 0 6px; color: var(--text-dark); }
.dash-sub { color: var(--text-dark-muted); margin: 0 0 32px; }
.dash-placeholder {
    background: var(--paper-card);
    border: 1px dashed #D7DAD3;
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.dash-placeholder p { color: var(--text-dark-muted); margin: 0; }

/* ── AI Chat: app shell ──────────────────────────────────── */
.app-body { margin: 0; height: 100vh; overflow: hidden; }
.app-shell { display: flex; height: 100vh; }

.app-sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--ink);
    color: var(--text-on-ink);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
}
.app-brand { margin-bottom: 20px; }
.new-chat-form { margin-bottom: 18px; }

.conversation-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.conversation-item {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conversation-item:hover { background: rgba(255,255,255,0.05); color: var(--text-on-ink); }
.conversation-item-active { background: rgba(201,162,39,0.14); color: var(--brass-soft); }

.app-sidebar-footer {
    border-top: 1px solid var(--ink-line);
    padding-top: 14px;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.app-sidebar-link { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; }
.app-sidebar-link:hover { color: var(--cyan); }

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    overflow: hidden;
}

/* ── Chat: empty state ───────────────────────────────────── */
.chat-empty {
    margin: auto;
    text-align: center;
    max-width: 380px;
}
.chat-empty h2 { color: var(--text-dark); margin-bottom: 10px; }
.chat-empty p { color: var(--text-dark-muted); margin-bottom: 24px; }

/* ── Chat: header ────────────────────────────────────────── */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid #E1E4DE;
    flex-shrink: 0;
}
.chat-header h2 { font-size: 1.05rem; color: var(--text-dark); }
.chat-delete-link { color: var(--text-dark-muted); font-size: 0.82rem; text-decoration: none; }
.chat-delete-link:hover { color: #C0392B; }

/* ── Chat: thread ────────────────────────────────────────── */
.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-assistant { justify-content: flex-start; }
.msg-bubble {
    max-width: 640px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.94rem;
    line-height: 1.55;
    white-space: pre-wrap;
}
.msg-user .msg-bubble {
    background: var(--ink);
    color: var(--text-on-ink);
    border-bottom-right-radius: 4px;
}
.msg-assistant .msg-bubble {
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}
.msg-pending .msg-bubble { color: var(--text-dark-muted); font-style: italic; }
.msg-error .msg-bubble { background: #FBEAEA; border-color: #F0C4C4; color: #922B21; }

/* ── Chat: composer ──────────────────────────────────────── */
.composer {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 28px 22px;
    border-top: 1px solid #E1E4DE;
    flex-shrink: 0;
}
.composer textarea {
    flex: 1;
    resize: none;
    max-height: 200px;
    padding: 12px 14px;
    border: 1px solid #D7DAD3;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: #FBFBF9;
    color: var(--text-dark);
    line-height: 1.4;
}
.composer textarea:focus { outline: none; border-color: var(--brass); background: #fff; }
.composer .btn { flex-shrink: 0; }

@media (max-width: 720px) {
    .app-sidebar { width: 210px; }
    .chat-thread, .composer, .chat-header { padding-left: 16px; padding-right: 16px; }
    .msg-bubble { max-width: 85%; }
}
@media (max-width: 960px) {
    .pricing-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .site-nav { gap: 16px; }
    .site-nav a:not(.btn):not(.nav-signin) { display: none; }
    .pricing-grid { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: 1fr; }
    .hero { padding: 56px 0 44px; }
    .ops-ticker-track { animation-duration: 18s; }
}

/* Visible keyboard focus */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

/* ── Knowledge Base ──────────────────────────────────────── */
.knowledge-page { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.knowledge-body { flex: 1; overflow-y: auto; padding: 28px; }
.upload-form { display: flex; gap: 16px; align-items: stretch; margin-bottom: 28px; }
.upload-dropzone {
    flex: 1;
    border: 1.5px dashed #D7DAD3;
    border-radius: var(--radius);
    background: var(--paper-card);
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease;
    position: relative;
}
.upload-dropzone:hover { border-color: var(--brass); }
.upload-dropzone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-dropzone-label { font-weight: 600; color: var(--text-dark); font-size: 0.94rem; }
.upload-dropzone-hint { color: var(--text-dark-muted); font-size: 0.8rem; margin-top: 6px; }
.upload-form .btn { flex-shrink: 0; align-self: center; }
.knowledge-empty { color: var(--text-dark-muted); }
.knowledge-table { margin-top: 4px; }
.status-pill-failed { background: #FBEAEA; color: #922B21; }

.knowledge-preview { padding: 28px; overflow-y: auto; }
.knowledge-preview-note {
    color: var(--text-dark-muted);
    font-size: 0.85rem;
    background: #F5F6F2;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}
.knowledge-preview-text {
    white-space: pre-wrap;
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    border-radius: var(--radius);
    padding: 22px;
}

@media (max-width: 720px) {
    .upload-form { flex-direction: column; }
}

/* ── AI Automation: Tasks & Calendar ─────────────────────── */
.automation-hint { color: var(--text-dark-muted); font-size: 0.82rem; margin: 4px 0 0; }
.automation-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}
.automation-col h3 { font-size: 1rem; color: var(--text-dark); margin-bottom: 14px; }
.automation-form {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.automation-form input[type="text"] {
    flex: 1;
    min-width: 140px;
    padding: 9px 12px;
    border: 1px solid #D7DAD3;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #FBFBF9;
}
.automation-form input[type="date"], .automation-form input[type="time"] {
    padding: 9px 10px;
    border: 1px solid #D7DAD3;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #FBFBF9;
}
.automation-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.automation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--paper-card);
    border: 1px solid #E1E4DE;
    border-radius: 8px;
    padding: 10px 12px;
}
.automation-item-title { flex: 1; font-size: 0.9rem; color: var(--text-dark); }
.automation-item-due { font-size: 0.78rem; color: var(--text-dark-muted); font-family: var(--font-mono); }
.automation-check {
    background: none; border: 1px solid #D7DAD3; border-radius: 50%;
    width: 22px; height: 22px; cursor: pointer; color: var(--text-dark-muted);
    display: flex; align-items: center; justify-content: center; font-size: 0.75rem; padding: 0;
}
.automation-check:hover { border-color: #1E7B4D; color: #1E7B4D; }

@media (max-width: 800px) {
    .automation-columns { grid-template-columns: 1fr; }
}
