/* app.css — Pulse · Admin & Brand · Light Design */
:root {
    --bg:          #F4F6FB;
    --card:        #FFFFFF;
    --card-soft:   #F9FAFB;
    --text:        #111827;
    --muted:       #6B7280;
    --accent:      #7C3AED;
    --accent-dim:  #EDE9FE;
    --accent-strong: #5B21B6;
    --danger:      #EF4444;
    --success:     #10B981;
    --border:      rgba(0,0,0,0.08);
    --border-solid: #E5E7EB;
    --shadow:      0 1px 4px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.08);
    --font:        "Manrope", "Helvetica Neue", "Segoe UI", sans-serif;
    --timeline-height: 720px;
}

* { box-sizing: border-box; }

body {
    margin: 0; min-height: 100vh;
    background: var(--bg); color: var(--text);
    font-family: var(--font); font-size: 15px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

#app { max-width: 1200px; margin: 0 auto; padding: 32px 20px 80px; }

.page { display: flex; flex-direction: column; gap: 24px; }

.hero {
    background: linear-gradient(135deg, var(--accent-dim), #F0F9FF);
    border: 1px solid var(--border-solid);
    border-radius: 18px; padding: 20px 24px;
    display: flex; flex-direction: column; gap: 10px;
    box-shadow: var(--shadow);
}
.hero.row { flex-direction: row; justify-content: space-between; align-items: center; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 12px; color: var(--muted); margin: 0; font-weight: 700; }
.lead { margin: 0; color: var(--muted); font-size: 14px; }

h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; font-weight: 900; }
h2 { margin: 0; font-size: 17px; font-weight: 700; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.two.tight label { margin-bottom: 0; }

.card {
    background: var(--card); border: 1px solid var(--border-solid);
    border-radius: 16px; padding: 20px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 12px;
}
.card.soft { background: var(--card-soft); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

.pill {
    padding: 5px 11px; border-radius: 999px;
    background: var(--accent-dim); color: var(--accent);
    font-size: 12px; font-weight: 700; border: 1px solid rgba(124,58,237,0.15);
    display: inline-flex; align-items: center;
}

.btn {
    border: 1px solid var(--border-solid);
    background: var(--card);
    color: var(--text); padding: 9px 16px;
    border-radius: 10px; cursor: pointer;
    transition: all 0.15s ease; font-weight: 700;
    letter-spacing: 0.01em; font-family: var(--font); font-size: 14px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.25); }
.btn.secondary { background: var(--accent-dim); border-color: rgba(124,58,237,0.2); color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--card-soft); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.form input, .form select, .form textarea {
    padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--border-solid);
    background: var(--card-soft); color: var(--text); font-size: 14px; font-family: var(--font);
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.form select { cursor: pointer; }

.hint { margin: 0; color: var(--muted); font-size: 13px; }
.feedback { color: var(--accent); font-size: 14px; min-height: 18px; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.list li { padding-left: 12px; border-left: 3px solid var(--accent-dim); font-size: 14px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: 12px;
    background: var(--card-soft); border: 1px solid var(--border-solid);
}
.cluster { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.log-item { padding: 8px 12px; border-radius: 8px; background: var(--card-soft); border: 1px solid var(--border-solid); font-size: 13px; }
.log-item strong { color: var(--accent); }

/* ── Calendar ────────────────────────────────────────── */
.calendar-grid { margin-top: 10px; }
.calendar-week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 12px; }
@media (min-width: 1100px) { .calendar-week { grid-template-columns: repeat(7, minmax(140px, 1fr)); } }

.week-day {
    background: var(--card-soft); border: 1px solid var(--border-solid);
    border-radius: 14px; padding: 10px;
    display: flex; flex-direction: column; gap: 8px; min-height: 220px;
}
.week-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.weekday-label { font-weight: 800; color: var(--text); font-size: 13px; }
.day-number { font-size: 12px; color: var(--muted); }
.pill.compact { padding: 3px 7px; font-size: 11px; }

.week-body {
    position: relative; border: 1px dashed var(--border-solid);
    border-radius: 12px; background: rgba(0,0,0,0.02);
    height: var(--timeline-height); overflow: hidden;
}
.week-body.dropping { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,58,237,0.2); }

.hour-line {
    position: absolute; left: 8px; right: 8px;
    border-top: 1px dashed rgba(0,0,0,0.07);
    font-size: 10px; color: var(--muted); padding-top: 2px; pointer-events: none;
}
.hour-line span { background: var(--card-soft); padding: 0 4px; border-radius: 4px; }

.calendar-item {
    padding: 10px; border-radius: 10px; margin-bottom: 8px;
    background: var(--card); border: 1px solid var(--border-solid);
    cursor: grab; transition: transform 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.calendar-item.compact { position: absolute; left: 8px; margin: 0; padding: 8px; font-size: 12px; min-height: 62px; width: calc(100% - 16px); }
.calendar-item.dragging { opacity: 0.6; }
.calendar-item:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.calendar-item.sent { border-color: var(--success); background: #F0FDF4; }
.calendar-item.failed { border-color: var(--danger); background: #FEF2F2; }
.calendar-item.queued { border-color: var(--accent); background: var(--accent-dim); }

.calendar-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; font-size: 12px; }
.legend { padding: 4px 10px; border-radius: 8px; font-size: 12px; border: 1px solid var(--border-solid); background: var(--card-soft); color: var(--muted); }
.legend.best { background: var(--accent-dim); border-color: rgba(124,58,237,0.2); color: var(--accent); }
.legend.queued { background: #FEF3C7; border-color: #F59E0B; color: #92400E; }
.legend.sent { background: #D1FAE5; border-color: var(--success); color: #065F46; }
.legend.failed { background: #FEE2E2; border-color: var(--danger); color: #991B1B; }
.best-slot { background: linear-gradient(135deg, var(--accent-dim), #F0F9FF); }

.item-top { display: flex; align-items: center; gap: 6px; justify-content: space-between; flex-wrap: wrap; }
.item-title { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time-chip { font-weight: 700; font-size: 12px; background: var(--card-soft); border-radius: 6px; padding: 3px 6px; border: 1px solid var(--border-solid); }
.platform-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.status-pill { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 7px; border-radius: 6px; border: 1px solid; font-weight: 700; }
.status-pill.sent { color: #065F46; border-color: var(--success); background: #D1FAE5; }
.status-pill.failed { color: #991B1B; border-color: var(--danger); background: #FEE2E2; }
.status-pill.queued { color: var(--accent); border-color: rgba(124,58,237,0.3); background: var(--accent-dim); }

.best-indicator { color: var(--accent); font-size: 12px; }

.icon-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.icon-btn {
    border: 1px solid var(--border-solid); background: var(--card-soft);
    color: var(--muted); padding: 5px 7px; border-radius: 8px; cursor: pointer; font-size: 12px;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.item-text { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* ── Modal ───────────────────────────────────────────── */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content {
    position: relative; background: var(--card);
    border: 1px solid var(--border-solid); border-radius: 18px;
    padding: 24px; min-width: 320px; max-width: 640px; width: 90%;
    z-index: 1000; box-shadow: var(--shadow-lg);
}
.modal-content .close { position: absolute; top: 12px; right: 12px; }
.modal-body img { max-width: 100%; border-radius: 10px; margin-top: 10px; }
.modal-body textarea, .modal-body input {
    width: 100%; padding: 10px 14px;
    background: var(--card-soft); border: 1px solid var(--border-solid);
    border-radius: 10px; color: var(--text); font-family: var(--font);
}

/* ── Auth / Login ────────────────────────────────────── */
.auth { max-width: 900px; margin: 0 auto; }
.auth .hero { text-align: center; align-items: center; }
.auth .grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.auth .card { padding: 28px; }
.big-input input { font-size: 16px; padding: 14px; }

/* ── Plans table (brand config) ──────────────────────── */
[data-config-table] { width: 100%; border-collapse: collapse; font-size: 14px; }
[data-config-table] th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; border-bottom: 2px solid var(--border-solid); }
[data-config-table] td { padding: 10px 12px; border-bottom: 1px solid var(--border-solid); vertical-align: middle; }
[data-config-table] tr:hover td { background: var(--card-soft); }

/* ── Pillish inputs ──────────────────────────────────── */
.pillish {
    padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
    border: 1px solid var(--border-solid); background: var(--card-soft);
    color: var(--text); font-family: var(--font);
}

@media (max-width: 640px) {
    #app { padding: 16px 12px 60px; }
    .hero.row { flex-direction: column; align-items: flex-start; }
    .auth .grid.two { grid-template-columns: 1fr; }
    /* Auth/login: reduce top padding and card inner padding on small screens */
    .page.auth { padding-top: 32px !important; padding-bottom: 32px !important; }
    .card { padding: 20px !important; }
    /* Inputs: 16px prevents iOS auto-zoom */
    input, textarea, select { font-size: 16px !important; }
}
