@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* ---- Signalist token system ---- */
    --paper: #FAF8F4;
    --paper-raised: #FFFFFF;
    --ink: #14171F;
    --ink-soft: #565B66;
    --ink-faint: #8A8F99;
    --line: #E7E3D8;
    --line-strong: #D8D3C4;

    --signal: #0F6F5C;        /* deep broadcast teal — primary */
    --signal-bright: #17B890; /* live / success */
    --signal-soft: #E4F2EE;   /* tinted backgrounds */
    --amber: #E8763D;         /* warnings / scheduled */
    --amber-soft: #FBEAE0;
    --red: #C6432D;
    --red-soft: #F8E7E2;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(20, 23, 31, 0.06);
    --shadow-md: 0 6px 20px rgba(20, 23, 31, 0.08);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }

/* ---- Signal wordmark (the signature element) ---- */
.wordmark {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--ink);
}
.wordmark .dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--signal); flex: none; }
.wordmark .dot::before, .wordmark .dot::after {
    content: ''; position: absolute; border-radius: 50%; border: 1px solid var(--signal); opacity: 0;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    animation: pulse-ring 2.4s ease-out infinite;
}
.wordmark .dot::after { animation-delay: 1.2s; }
@keyframes pulse-ring {
    0%   { width: 10px; height: 10px; opacity: 0.55; }
    100% { width: 26px; height: 26px; opacity: 0; }
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-body); font-weight: 600; font-size: 14px;
    padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    cursor: pointer; transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--signal); color: #fff; }
.btn-primary:hover { background: #0C5D4D; }
.btn-secondary { background: var(--paper-raised); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-faint); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--signal-soft); color: var(--signal); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #f2d5cd; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- Forms ---- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="datetime-local"],
textarea, select {
    width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--ink);
    padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
    background: var(--paper-raised); transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft);
}
.field { margin-bottom: 18px; }
.field-hint { font-size: 12px; color: var(--ink-faint); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--red); margin-top: 6px; }

/* ---- Auth screens ---- */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, var(--signal-soft), transparent 45%),
        var(--paper);
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 400px; background: var(--paper-raised);
    border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    padding: 36px 32px;
}
.auth-card .wordmark { margin-bottom: 22px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--ink-soft); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-success { background: var(--signal-soft); color: var(--signal); }

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

.sidebar {
    width: 240px; flex: none; background: var(--paper-raised); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar .wordmark { padding: 0 8px 26px; }
.nav-group { margin-bottom: 22px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 0 10px; margin-bottom: 8px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--ink-soft); font-size: 14px; font-weight: 500; margin-bottom: 2px;
}
.nav-link:hover { background: var(--signal-soft); color: var(--signal); text-decoration: none; }
.nav-link.active { background: var(--signal); color: #fff; }
.nav-link svg { flex: none; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); }
.user-chip:hover { background: var(--paper); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--signal);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}
.user-chip .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-chip .email { font-size: 12px; color: var(--ink-faint); }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; padding: 18px 32px;
    border-bottom: 1px solid var(--line); background: var(--paper-raised);
}
.topbar h1 { font-size: 20px; margin: 0; }
.content { padding: 28px 32px 60px; max-width: 1080px; }

/* ---- Cards & grid ---- */
.card {
    background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 22px; box-shadow: var(--shadow-sm);
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; }
.stat-card .num { font-family: var(--font-display); font-size: 30px; font-weight: 600; }
.stat-card .label { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* ---- Platform badges ---- */
.platform-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--paper);
}
.platform-dot { width: 7px; height: 7px; border-radius: 50%; }
.pf-twitter .platform-dot   { background: #000; }
.pf-facebook .platform-dot  { background: #1877F2; }
.pf-instagram .platform-dot { background: #D6249F; }
.pf-linkedin .platform-dot  { background: #0A66C2; }
.pf-mastodon .platform-dot  { background: #6364FF; }

/* ---- Connect account cards ---- */
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.connect-card {
    border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; background: var(--paper-raised);
    display: flex; flex-direction: column; gap: 12px;
}
.connect-card .icon-row { display: flex; align-items: center; justify-content: space-between; }
.status-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.status-active { background: var(--signal-soft); color: var(--signal); }
.status-error { background: var(--red-soft); color: var(--red); }
.connected-accounts-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.connected-row {
    display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
    background: var(--paper); border-radius: var(--radius-sm); font-size: 13px;
}

/* ---- Composer ---- */
.composer-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
.platform-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.platform-check {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
    border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
    background: var(--paper-raised);
}
.platform-check.checked { background: var(--signal); border-color: var(--signal); color: #fff; }
.platform-check input { display: none; }
.char-count { font-size: 12px; color: var(--ink-faint); text-align: right; margin-top: 6px; }
.char-count.over { color: var(--red); font-weight: 700; }
.preview-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; margin-bottom: 12px; background: var(--paper); }
.preview-card .plabel { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.preview-card .ptext { font-size: 14px; white-space: pre-wrap; }
.media-drop {
    border: 1.5px dashed var(--line-strong); border-radius: var(--radius-md); padding: 22px; text-align: center;
    color: var(--ink-faint); font-size: 13px; cursor: pointer; margin-bottom: 16px;
}
.media-drop:hover { border-color: var(--signal); color: var(--signal); }
.media-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.media-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.schedule-row { display: flex; gap: 12px; align-items: flex-end; margin-top: 4px; }

/* ---- History table ---- */
.post-row { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.post-row:last-child { border-bottom: none; }
.post-row .content-preview { flex: 1; font-size: 14px; }
.post-row .meta { font-size: 12px; color: var(--ink-faint); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: capitalize; }
.status-published { background: var(--signal-soft); color: var(--signal); }
.status-scheduled { background: var(--amber-soft); color: var(--amber); }
.status-draft { background: var(--paper); color: var(--ink-faint); border: 1px solid var(--line-strong); }
.status-failed, .status-partial { background: var(--red-soft); color: var(--red); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-faint); }
.empty-state h3 { color: var(--ink); }

/* ---- Toast ---- */
#toast {
    position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff;
    padding: 12px 18px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-md);
    opacity: 0; transform: translateY(10px); transition: all .2s ease; pointer-events: none; z-index: 999;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ---- Responsive ---- */
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; overflow-x: auto; }
    .sidebar .wordmark { padding: 0 12px 0 0; }
    .nav-group { display: flex; gap: 4px; margin-bottom: 0; }
    .nav-label { display: none; }
    .sidebar-footer { margin-top: 0; margin-left: auto; border-top: none; padding-top: 0; }
    .content { padding: 20px 16px 40px; }
    .composer-layout { grid-template-columns: 1fr; }
}

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .wordmark .dot::before, .wordmark .dot::after { animation: none; }
}
