/* MarketingOS operator console.
   Desktop-first and dense (spec §26): an operator scanning twenty scheduled
   posts needs rows, not cards. Dark by default because this console is usually
   open all day next to a terminal. */

:root {
  --bg: #0b1522;
  --surface: #11202f;
  --surface-2: #16293b;
  --line: #23394f;
  --text: #e8eef5;
  --muted: #8aa0b8;
  --primary: #4c8dff;
  --accent: #00b894;
  --warn: #e8a33d;
  --bad: #e5484d;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #eef3f9;
    --line: #d5e0ec;
    --text: #10202f;
    --muted: #5d738c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body.centered { display: grid; place-items: center; min-height: 100vh; }

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

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; padding: 0 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.workspace { padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); }
.workspace-name { font-weight: 600; font-size: 13px; }
.workspace-meta { color: var(--muted); font-size: 11px; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 13px;
}
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--surface-2); color: var(--primary); font-weight: 600; }
.sidebar nav a em { font-style: normal; background: var(--primary); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.user { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); }
.user-name { font-weight: 600; font-size: 13px; }
.user-meta { color: var(--muted); font-size: 11px; margin-bottom: 6px; }

/* ---------- main ---------- */
main { padding: 22px 26px 60px; max-width: 1500px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.switcher { display: flex; gap: 6px; margin-bottom: 14px; }

.notice {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px; margin-bottom: 14px; font-size: 13px;
}
.notice.simulated { border-color: var(--warn); color: var(--warn); }
.error { color: var(--bad); }
.empty { color: var(--muted); padding: 14px 0; font-size: 13px; }

/* ---------- cards & tiles ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card > header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.card h2 { margin: 0; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile-value { font-size: 25px; font-weight: 650; letter-spacing: -0.03em; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile.ok .tile-value { color: var(--accent); }
.tile.warn .tile-value { color: var(--warn); }
.tile.bad .tile-value { color: var(--bad); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td .inline { display: inline; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2);
  white-space: nowrap;
}
.badge.ok { color: var(--accent); border-color: var(--accent); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.bad { color: var(--bad); border-color: var(--bad); }
.badge.sim { color: var(--warn); border-color: var(--warn); }

/* ---------- inline search ---------- */
form.inline-search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
form.inline-search input[type="search"] { flex: 1; }
form.inline-search button { white-space: nowrap; }
mark { background: var(--warn); color: var(--surface); border-radius: 3px; padding: 0 2px; }

/* ---------- meter ---------- */
/* A full bar is the healthy state: these show remaining quota, not consumption. */
.meter {
  display: inline-block; vertical-align: middle; width: 90px; height: 6px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  overflow: hidden;
}
.meter-fill { display: block; height: 100%; background: var(--muted); }
.meter-fill.ok { background: var(--accent); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.bad { background: var(--bad); }
.meter-label { margin-left: 8px; font-size: 11px; color: var(--muted); }

/* ---------- forms ---------- */
form.stack { display: flex; flex-direction: column; gap: 10px; }
form.inline { display: inline-block; margin: 0 2px 0 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; width: 100%;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
small { color: var(--muted); font-size: 11px; }

button {
  background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }

.login { width: min(380px, 92vw); }
.login h1 { font-size: 19px; margin: 6px 0 10px; }

/* ---------- calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 96px; }
.day h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.day .slot { font-size: 12px; padding: 5px 6px; border-radius: 6px; background: var(--surface-2); margin-bottom: 5px; }
.day .slot .t { color: var(--muted); font-size: 11px; }

/* A movable slot says so before it is touched: a drag affordance nobody can see
   is a feature nobody finds. Slots that have already published stay inert. */
.day .slot.movable { cursor: grab; border: 1px dashed transparent; }
.day .slot.movable:hover { border-color: var(--line); }
.day .slot.dragging { opacity: 0.45; cursor: grabbing; }
.day.over { outline: 2px solid var(--primary); outline-offset: -2px; }

/* The no-script move control. Compact because it sits in a table cell next to
   two buttons. */
form.move { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }
form.move input[type="datetime-local"] { width: auto; font-size: 11px; padding: 4px 6px; }

@media (prefers-reduced-motion: reduce) {
  .day .slot.dragging { opacity: 1; }
}

/* ---------- misc ---------- */
.preview { max-width: 260px; border-radius: 8px; border: 1px solid var(--line); }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.dim { color: var(--muted); }
.variant { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.variant h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.variant p { margin: 0 0 6px; white-space: pre-wrap; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
}

/* --- Grouped navigation ---------------------------------------------------
   The menu was one flat list of sixteen links with the technical screens mixed
   into the daily ones. Grouping restores the shape of the journey; the
   secondary block keeps the advanced screens reachable without letting them
   compete for the first click. */
.nav-group { margin-bottom: 14px; }
.nav-group-title {
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted, #7c8494);
  padding: 0 12px 4px;
  font-weight: 600;
}
.nav-group.secondary { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line, #232936); opacity: .72; }
.nav-group.secondary a { font-size: 12px; padding-top: 5px; padding-bottom: 5px; }
.nav-group.secondary:hover { opacity: 1; }

/* --- "Requer sua atenção" and the onboarding checklist -------------------- */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--line, #232936);
}
.todo li:last-child { border-bottom: 0; }
.todo .todo-mark { flex: none; width: 20px; text-align: center; font-size: 14px; }
.todo .todo-mark.done { color: #2fbf71; }
.todo .todo-mark.todo { color: var(--muted, #7c8494); }
.todo .todo-text { flex: 1; }
.todo .todo-text small { display: block; color: var(--muted, #7c8494); margin-top: 2px; }
.todo .todo-action { flex: none; }
.todo li.is-done .todo-text { color: var(--muted, #7c8494); }

/* --- Empty states with a way out ----------------------------------------- */
.empty-state { padding: 26px 4px; text-align: center; }
.empty-state p { color: var(--muted, #7c8494); margin: 0 0 14px; line-height: 1.55; }
.empty-state .actions { display: flex; gap: 10px; justify-content: center; }

/* --- Per-network connection rows ----------------------------------------- */
.channel-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 2px; border-bottom: 1px solid var(--line, #232936);
}
.channel-row:last-child { border-bottom: 0; }
.channel-row .channel-name { flex: 1; font-weight: 500; }
.channel-row .channel-name small { display: block; font-weight: 400; color: var(--muted, #7c8494); margin-top: 2px; }
.channel-row .actions { display: flex; gap: 8px; }

/* A one-line explanation under each page title. */
.page-hint { color: var(--muted, #7c8494); margin: -6px 0 18px; max-width: 70ch; line-height: 1.55; }

/* Checkbox rows in the manual-creation form. */
.inline-check { display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 8px 0; font-weight: 400; }
.inline-check input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--line, #232936); border-radius: 8px; padding: 12px 14px 6px; margin: 0 0 14px; }
fieldset legend { padding: 0 6px; font-size: 12px; color: var(--muted, #7c8494); }
/* Links styled as buttons, so an anchor and a submit look the same in a row. */
a.button {
  display: inline-block; padding: 7px 13px; border-radius: 7px; font-size: 13px;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
}

/* --- Language switcher ------------------------------------------------- */
/* The topbar carries the two controls that are true of every screen: which
   workspace you are in, and which language you are reading. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.topbar .switcher { margin-bottom: 0; }

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.lang-switcher .lang-option { display: inline; margin: 0; }
.lang-switcher .lang-sep { color: var(--border, #d7dbe3); font-size: 12px; }
.lang-switcher button.lang {
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
  cursor: pointer;
  border-radius: 4px;
}
.lang-switcher button.lang:hover { color: var(--text, #172b4d); background: var(--surface-2, #f1f3f7); }
.lang-switcher button.lang.is-current { color: var(--text, #172b4d); text-decoration: underline; }

/* The login screen has no shell, so the switcher is stacked under the card. */
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* --- Brand identity ---------------------------------------------------- */
.brand-mark { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-mark img { max-width: 34px; max-height: 34px; object-fit: contain; }
.brand-mark-empty {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface-2, #f1f3f7); color: var(--muted, #6b7280);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); display: inline-block; }

.logo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.logo-slot h4 { margin: 0 0 8px; font-size: 13px; }
.logo-preview {
  border: 1px solid var(--border, #d7dbe3); border-radius: 8px; padding: 14px;
  display: flex; align-items: center; justify-content: center; min-height: 84px; background: #fff;
}
/* The dark-background logo is unreadable on white — which is the entire reason
   that slot exists, so the preview has to show it on the surface it is for. */
.logo-preview.on-dark { background: #0e1b2b; }
.logo-preview img { max-width: 100%; max-height: 60px; object-fit: contain; }
.logo-empty {
  border: 1px dashed var(--border, #d7dbe3); border-radius: 8px; padding: 24px;
  text-align: center; color: var(--muted, #6b7280); font-size: 12px; min-height: 84px;
  display: flex; align-items: center; justify-content: center;
}
.logo-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; }
.logo-slot form.stack { margin-top: 8px; gap: 6px; }
.logo-slot input[type="file"] { font-size: 12px; }

.color-field { display: block; margin-bottom: 10px; }
.color-field > span { display: block; font-size: 12px; color: var(--muted, #6b7280); margin-bottom: 4px; }
.color-controls { display: flex; align-items: center; gap: 8px; }
.color-controls input[type="color"] { width: 38px; height: 32px; padding: 0; border: 1px solid var(--border, #d7dbe3); border-radius: 6px; background: none; cursor: pointer; }
.color-controls input[type="text"] { flex: 1; max-width: 140px; }

.reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.reference { border: 1px solid var(--border, #d7dbe3); border-radius: 8px; overflow: hidden; }
.reference img { width: 100%; height: 110px; object-fit: cover; display: block; }
.reference form { margin: 0; padding: 6px; }

.brand-preview { border: 1px solid var(--border, #d7dbe3); border-radius: 10px; padding: 26px; }
.brand-preview h3 { margin: 14px 0 8px; }
.brand-preview p { margin: 0 0 16px; }
.preview-logo { max-height: 44px; max-width: 200px; object-fit: contain; }
.preview-wordmark { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.preview-button { display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.notice.warn { border-left: 3px solid #d97706; }

/* --- Social and integrations ------------------------------------------- */
.network-offer .channel-name { font-weight: 600; }
.how-to { margin-top: 6px; font-weight: 400; }
.how-to summary { cursor: pointer; font-size: 12px; color: var(--muted, #6b7280); }
.how-to ol { margin: 8px 0 0 18px; font-size: 12px; color: var(--muted, #6b7280); }
.how-to li { margin-bottom: 3px; }

.integration { padding: 14px 0; border-bottom: 1px solid var(--border, #d7dbe3); }
.integration:last-child { border-bottom: none; }
.integration-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.integration ul.mono { margin: 6px 0 10px 18px; font-size: 12px; }
.integration input[readonly] { background: var(--surface-2, #f1f3f7); }
