/* Vyllara Newsletter Manager: the control-room design of the Vyllara workbench (dark navy, panels with a fine
   border, cyan for what is live and for the main action, green done, amber waiting on you, red wrong;
   Inter Tight, JetBrains Mono for times and ids). Same tokens as the workbench so the two apps look like one. */

:root {
  --bg: #0A1520; --panel: #0F1D2B; --panel-2: #132436; --line: #1D3146; --line-2: #284159;
  --text: #E4ECF3; --text-2: #B9C6D3; --muted: #8496A9; --dim: #5C7086;
  --cyan: #38B6E8; --cyan-soft: rgba(56,182,232,.12);
  --ok: #3DD6A0; --ok-soft: rgba(61,214,160,.12);
  --warn: #E8B04B; --warn-soft: rgba(232,176,75,.12);
  --bad: #EF6B6B; --bad-soft: rgba(239,107,107,.12);
  --violet: #8B9BB4;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Inter Tight", Inter, "Segoe UI", system-ui, sans-serif;
  --r-1: 6px; --r-2: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); color-scheme: dark; }
a { color: inherit; text-decoration: none; } a:hover { color: var(--cyan); }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; color: var(--text); margin: 0; }
h1 { font-size: 34px; margin-top: 4px; } h2 { font-size: 18px; margin-bottom: 12px; }
p { margin: 0 0 .75rem; }
::selection { background: rgba(56,182,232,.35); }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13px; } .center { text-align: center; } .r { text-align: right; }
.spacer { flex: 1; } .mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* shell + sidebar */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 222px; flex: none; background: #08111A; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.wordmark { display: block; font-family: "Newsreader", Georgia, serif; letter-spacing: .32em; font-size: 16px; color: var(--text); padding-left: 10px; margin-bottom: 22px; }
.wordmark:hover { color: var(--text); }
.wordmark small { display: block; font-family: var(--sans); letter-spacing: 0; font-size: 12px; color: var(--dim); margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 12px; color: var(--dim); padding: 14px 10px 4px; }
.nav a, .nav button { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r-1); color: var(--muted); font-size: 14.5px; background: transparent; border: 0; font: inherit; cursor: pointer; text-align: left; width: 100%; }
.nav a:hover, .nav button:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--cyan-soft); color: var(--cyan); }
.nav .pill { color: var(--cyan); font-weight: 600; font-size: 12.5px; } .nav .pill.plain { color: var(--dim); }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.sidebar-foot strong { display: block; color: var(--muted); font-weight: 500; word-break: break-all; }
.sidebar-foot button { background: none; border: 0; padding: 0; color: var(--dim); font: inherit; font-size: 12.5px; cursor: pointer; }
.sidebar-foot button:hover { color: var(--cyan); }

.content { flex: 1; min-width: 0; padding: 26px 32px 40px; max-width: 1320px; }

/* page head: eyebrow, title, clock */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .lede { color: var(--muted); margin: 4px 0 0; }
.eyebrow, .label { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; margin: 0; }
.label i { width: 14px; height: 2px; background: var(--cyan); display: inline-block; }
.label i.ok { background: var(--ok); } .label i.warn { background: var(--warn); } .label i.bad { background: var(--bad); }
.clock { text-align: right; font-family: var(--mono); font-size: 14px; color: var(--text); }
.clock small { display: block; color: var(--dim); font-family: var(--sans); font-size: 12px; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* panels, tiles */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2); padding: 18px 20px; margin-bottom: 14px; }
.card.danger { border-color: rgba(239,107,107,.5); }
.card.warn { border-color: rgba(232,176,75,.5); }
.card.quiet { background: transparent; border-style: dashed; }
.section-title { margin: 26px 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2); padding: 18px 20px; display: flex; flex-direction: column; color: var(--text); }
a.tile:hover { border-color: var(--line-2); color: var(--text); }
.tile .lbl { order: -1; } /* label on top, like the control room */
.tile .lbl { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.tile .lbl::before { content: ""; width: 14px; height: 2px; background: var(--cyan); display: inline-block; }
.tile.ok .lbl::before { background: var(--ok); } .tile.warn .lbl::before { background: var(--warn); } .tile.bad .lbl::before { background: var(--bad); }
.tile .num { font-weight: 700; font-size: 32px; line-height: 1.1; margin: 10px 0 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile .num small { font-size: 15px; font-weight: 500; color: var(--cyan); margin-left: 6px; }
.tile .sub { color: var(--muted); font-size: 13px; }

/* forms */
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label input, label select, label textarea { display: block; margin-top: 5px; width: 100%; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=date], input[type=file], select, textarea {
  font: inherit; font-size: 14.5px; color: var(--text); padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--bg); }
input::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(56,182,232,.35); border-color: var(--cyan); }
select option { background: var(--panel); }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; } .row > label { flex: 1; min-width: 160px; }
.row.wrap { align-items: center; gap: 6px 10px; margin-top: 10px; }
.narrow { max-width: 220px; } .xnarrow { max-width: 110px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-1); padding: 8px 12px 10px; margin: 0 0 12px; }
legend { color: var(--muted); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; padding: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 4px 0; font-size: 13px; color: var(--text-2); }
.chip input { margin: 0; width: auto; display: inline; accent-color: var(--cyan); }
input[type=checkbox] { accent-color: var(--cyan); }

button, .button { font: inherit; font-size: 14px; font-weight: 500; padding: 9px 14px; border-radius: var(--r-1); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; display: inline-block; line-height: 1.3; }
button:hover, .button:hover { border-color: var(--cyan); color: var(--text); }
button.primary, .button.primary { background: var(--cyan); border-color: var(--cyan); color: #04121C; font-weight: 600; }
button.primary:hover, .button.primary:hover { background: #5CC6EE; border-color: #5CC6EE; color: #04121C; }
button.small, .button.small, a.small { padding: 5px 10px; font-size: 13px; }
a.small { color: var(--muted); } a.small:hover { color: var(--cyan); }
button.danger { color: var(--bad); border-color: rgba(239,107,107,.5); background: transparent; } button.danger:hover { background: var(--bad-soft); }
button:disabled { opacity: .45; cursor: not-allowed; }
form.inline { display: inline-flex; gap: 6px; align-items: center; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(56,182,232,.04); }
.table td a:hover { color: var(--cyan); }
.table.compact th, .table.compact td { padding: 7px 8px; font-size: 13.5px; }
.table .chk { width: 2rem; }

/* statuses: a dot and a word */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.subscribed { color: var(--ok); } .status.unsubscribed { color: var(--muted); }
.status.bounced, .status.complained { color: var(--bad); }

.filters .row input[type=search] { flex: 2; min-width: 240px; }
.bulk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0 12px; font-size: 13.5px; }
.bulk-bar select, .bulk-bar input { padding: 6px 9px; font-size: 13.5px; }
.pager { display: flex; gap: 18px; justify-content: center; padding: 16px; font-size: 13.5px; color: var(--muted); }
.pager a { color: var(--text-2); } .pager a:hover { color: var(--cyan); }

.alert { padding: 10px 14px; border-radius: var(--r-1); margin: 0 0 14px; font-size: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(61,214,160,.35); }
.alert.warn { background: rgba(232,176,75,.12); color: var(--warn); border-color: rgba(232,176,75,.4); }
.alert.error { background: var(--bad-soft); color: var(--bad); border-color: rgba(239,107,107,.4); }

.checklist { list-style: none; padding: 0; margin: 0 0 14px; }
.checklist li { padding: 6px 0 6px 20px; position: relative; color: var(--text-2); font-size: 14px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.checklist li.ok::before { background: var(--ok); } .checklist li.todo { color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.kv .mono { color: var(--text-2); }

/* control-room pieces used on the dashboard */
.stage { display: grid; grid-template-columns: minmax(0, 1.3fr) auto; align-items: center; gap: 28px; padding: 10px 0 6px; }
.next { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.next:last-child { border-bottom: 0; }
.next .time { font-family: var(--mono); font-size: 12.5px; color: var(--cyan); white-space: nowrap; }
.next small { display: block; color: var(--dim); font-size: 11.5px; }
.ring { position: relative; width: 220px; height: 220px; margin: 0 auto; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring .r1 { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 6; }
.ring .r2 { fill: rgba(56,182,232,.05); stroke: var(--line); stroke-width: 10; stroke-dasharray: 1 5; }
.ring .arc { fill: none; stroke: var(--cyan); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 140 514; }
.ring .arc2 { fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 60 480; opacity: .55; }
.ring.warn .arc, .ring.warn .arc2 { stroke: var(--amber, #E8B04B); }
.spin { transform-origin: 120px 120px; animation: rotate 14s linear infinite; }
.spin.slow { animation-duration: 26s; animation-direction: reverse; }
@keyframes rotate { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.core { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 40px; }
.core .name { font-weight: 700; font-size: 22px; color: var(--cyan); }
.core .doing { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.3; }
.beat { margin-top: 8px; font-size: 12.5px; color: var(--ok); display: flex; align-items: center; gap: 6px; }
.beat.warn { color: var(--warn); }
.beat i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin-top: 16px; }
.bar span { display: block; height: 100%; }
.bar .ok, .legend i.ok { background: var(--ok); } .bar .cyan, .legend i.cyan { background: var(--cyan); }
.bar .hold, .legend i.hold { background: var(--violet); } .bar .bad, .legend i.bad { background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.legend b { color: var(--text); font-weight: 600; margin-right: 3px; }
.step { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; margin-top: 8px; }
.step .why { color: var(--muted); margin: 6px 0 0; max-width: 80ch; }
.step .button.primary { padding: 12px 18px; }

/* login + first password */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2); padding: 32px; width: 380px; max-width: 100%; }
.login-card .wordmark { padding-left: 0; margin-bottom: 18px; }
.login-card h1 { font-size: 22px; margin-bottom: 18px; } .login-card h1 span { display: block; font-size: 13.5px; color: var(--muted); font-weight: 400; margin-top: 6px; letter-spacing: 0; }
.login-card button { width: 100%; margin-top: 4px; }

@media (max-width: 980px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stage { grid-template-columns: 1fr; } .step { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { flex-direction: column; } .sidebar { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; } .nav .group { display: none; } .nav a { white-space: nowrap; width: auto; }
  .wordmark { margin-bottom: 10px; } .wordmark small { display: none; } .sidebar-foot { display: none; }
  .content { padding: 16px; } .grid-2 { grid-template-columns: 1fr; } .page-head { flex-direction: column; align-items: flex-start; } .clock { text-align: left; }
  h1 { font-size: 26px; }
}

/* editor: form left, preview right */
.editor { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 14px; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.45; white-space: pre; overflow: auto; tab-size: 2; min-height: 320px; }
.preview-card { position: sticky; top: 16px; }
#preview-frame { width: 100%; height: 720px; border: 1px solid var(--line); border-radius: var(--r-1); background: #fff; display: block; }
dialog.modal { width: min(1100px, 94vw); max-height: 92vh; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--r-2, 14px); background: var(--bg); color: var(--text); padding: 20px 22px; }
dialog.modal::backdrop { background: rgba(2, 8, 16, .72); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.htmx-indicator { display: none; margin-left: 8px; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.checkfield { display: inline-flex; align-items: center; justify-content: center; height: 40px; width: 52px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--bg); vertical-align: middle; }
.checkfield input { width: 18px; height: 18px; margin: 0; accent-color: var(--cyan); }
.stack > .card { margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-1); overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 6px 12px; font-size: 13px; background: transparent; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--panel-2); color: var(--text); }
.mobile #preview-frame { width: 375px; margin: 0 auto; border: 10px solid #141B26; border-radius: 34px; box-shadow: 0 0 0 1px var(--line-2), 0 18px 40px rgba(0,0,0,.45); }
code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }
input[type=datetime-local] { font: inherit; font-size: 14.5px; color: var(--text); padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--bg); }
input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(.7); }
input[type=radio] { accent-color: var(--cyan); }
.status.draft { color: var(--muted); } .status.scheduled { color: var(--cyan); } .status.sending { color: var(--cyan); }
.status.paused { color: var(--warn); } .status.sent { color: var(--ok); } .status.cancelled { color: var(--bad); }
.status.sending::before { animation: pulse 1.6s ease-in-out infinite; }
td.bad { color: var(--bad); }
@media (max-width: 980px) { .editor { grid-template-columns: 1fr; } .preview-card { position: static; } #preview-frame { height: 520px; } }

/* long ledes must not push the clock below the title */
.page-head > div:first-child { flex: 1 1 0; min-width: 0; }
.page-head .lede { max-width: 80ch; }
.head-right { flex: none; }
