/* ==========================================================================
   Marketing — social posting (Instagram + Facebook + LinkedIn)
   Four tabs on one shell: Post Queue, Posting Plans, Accounts, Hashtags.
   A post is a product photo + an AI caption + the hashtags of its product type,
   sent to one or more connected accounts. The Repeat Limit keeps the same
   product off the same account more often than the plan allows.
   ========================================================================== */

/* ---- Column widths (share of the table, fixed layout) -------------------- */
.mk-table { table-layout: fixed; width: 100%; }
.mk-table th.col-post      { width: 38%; }
.mk-table th.col-plan      { width: 18%; }
.mk-table th.col-accounts  { width: 16%; }
.mk-table th.col-when      { width: 14%; }
.mk-table th.col-status    { width: 14%; }

.mk-table th.col-pname     { width: 22%; }
.mk-table th.col-products  { width: 20%; }
.mk-table th.col-freq      { width: 18%; }
.mk-table th.col-repeat    { width: 13%; }
.mk-table th.col-approval  { width: 13%; }

.mk-table th.col-account   { width: 34%; }
.mk-table th.col-network   { width: 14%; }
.mk-table th.col-posts     { width: 14%; }
.mk-table th.col-by        { width: 22%; }

.mk-table th.col-set       { width: 19%; }
.mk-table th.col-ig        { width: 33%; }
.mk-table th.col-fb        { width: 24%; }
.mk-table th.col-li        { width: 24%; }

/* The status column is last and banks right (feedback: last column right-aligned). */
.mk-table th:last-child,
.mk-table td:last-child { text-align: right; }

.mk-table tbody tr[data-open] { cursor: pointer; }
.mk-table tbody tr[data-open]:hover { background: var(--color-surface-alt); }

/* ---- Post cell: slab still + product + caption opening ------------------- */
.mk-post { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mk-post__img {
  width: 44px; height: 44px; flex: none;
  border-radius: 5px; border: 1px solid var(--color-border);
  background-size: cover; background-position: center;
}
.mk-post .cell-stack .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Network marks (Lucide ships no brand glyphs) ------------------------- */
.mk-net { display: inline-flex; align-items: center; gap: 6px; }
.mk-net svg { width: 16px; height: 16px; flex: none; }
.mk-net--ig svg { color: #C13584; }
.mk-net--fb svg { color: #1877F2; }
.mk-net--li svg { color: #0A66C2; }
.mk-nets { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mk-nets .sub { margin-left: 2px; }

/* ---- Hashtag words -------------------------------------------------------- */
.mk-tags { color: var(--color-primary-700); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.mk-tags .subtle { color: var(--color-text-subtle); }

/* ---- Setting rows: [label] [value] two across, nothing pushed right ------- */
.mk-settings {
  display: grid; grid-template-columns: repeat(3, max-content); gap: 10px 36px;
  align-items: center; margin-bottom: 14px;
}
.mk-setting { display: grid; grid-template-columns: max-content max-content; gap: 10px; align-items: center; font-size: 13px; }
.mk-setting .input { width: 64px; }
.mk-help { font-size: 12px; color: var(--color-text-subtle); margin: 0 0 12px; }
.mk-help a { color: var(--color-primary-700); text-decoration: none; font-weight: 500; }
.toolbar .mk-help { margin: 0; }
.mk-help--after { margin: 10px 0 0; }
.mk-lists { margin-top: 16px; }
.mk-lists .btn { margin-top: 6px; align-self: flex-start; }
.mk-section > .search { max-width: none; margin-bottom: 8px; }
.mk-section > .mk-sentence + .field,
.mk-section > .field + .field-grid { margin-top: 14px; }

/* ---- Slide-over form sections -------------------------------------------- */
.mk-section + .mk-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--color-border); }
.mk-section[hidden] + .mk-section { margin-top: 0; padding-top: 0; border-top: 0; }
.mk-section > h3 { margin: 0 0 4px; font-size: 14px; }
.mk-section > .mk-help { margin-bottom: 12px; }

/* A sentence with controls in it: "at most [1] time(s) per [6 Months]". */
.mk-sentence { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.mk-sentence .input { width: 64px; }
.mk-sentence .select { width: auto; }
.mk-sentence input[type="time"].input { width: 110px; }
.mk-sentence input[type="date"].input { width: 150px; }

/* Multi-pick chips (days, product types, accounts). Unchosen by default. */
.mk-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer;
  color: var(--color-text-muted);
  background: var(--color-control); border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
}
.mk-pick:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.mk-pick[aria-pressed="true"] {
  background: var(--color-primary-50); border-color: var(--color-primary);
  color: var(--color-primary-700); font-weight: 600;
}
.mk-pick svg { width: 14px; height: 14px; }

.mk-switches { display: grid; grid-template-columns: repeat(2, max-content); gap: 10px 32px; margin-top: 12px; }
.mk-switches .switch-field { color: var(--color-text); font-weight: 400; }

/* Two-sided binary toggle, unboxed: the active side is dark + bold. */
.mk-bi { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; }
.mk-bi__side { color: var(--color-text-muted); cursor: pointer; }
.mk-bi__side.is-active { color: var(--color-text); font-weight: 600; }

/* Pinned / excluded product lists — a nested box takes the control ground. */
.mk-list {
  margin-top: 8px; border: 1px solid var(--color-control-border);
  background: var(--color-control); border-radius: var(--radius);
}
.mk-list__row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13px;
}
.mk-list__row + .mk-list__row { border-top: 1px solid var(--color-control-border); }
.mk-list__row .mk-post__img { width: 32px; height: 32px; }
.mk-list__row .cell-stack { flex: 1; }
.mk-list__empty { padding: 10px; font-size: 12px; color: var(--color-text-subtle); }
.mk-list__row.is-blocked { color: var(--color-text-subtle); }
.mk-list__row.is-blocked .mk-post__img { opacity: .5; }
.mk-list__row[data-pick] { cursor: pointer; }
.mk-list__row[data-pick]:not(.is-blocked):hover { background: var(--color-primary-50); }
.mk-list__row[aria-pressed="true"] { background: var(--color-primary-50); }
.mk-list--scroll { max-height: 238px; overflow-y: auto; }

/* Post From — one source per plan: Materials, a Collection, or Specific Products. */
.mk-from { align-self: flex-start; }
.mk-from-panel, .mk-from-common { margin-top: 14px; }
.mk-from-panel > .field + .field { margin-top: 14px; }
.mk-from-panel > .search { max-width: none; }
.mk-from-common .mk-switches { margin-top: 12px; }
.mk-optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--color-text-subtle); }
.mk-list__row > svg { width: 16px; height: 16px; color: var(--color-primary-700); }

/* Up Next — the plan's posting order; chosen products sit on top. */
.mk-next__n { width: 18px; flex: none; text-align: right; font-size: 12px; font-weight: 600; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.mk-next.is-chosen .mk-next__n { color: var(--color-primary-700); }
.mk-next__how { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.mk-next__how svg, .mk-next .badge svg { width: 12px; height: 12px; }
.mk-next .badge { display: inline-flex; align-items: center; gap: 4px; }
.mk-next-add { margin-top: 6px; }
#plan-next-picker { margin-top: 6px; }

.mk-match { margin-top: 10px; font-size: 12px; color: var(--color-text-muted); }
.mk-match strong { color: var(--color-text); font-size: 13px; }

/* ---- Post preview: photo left, caption editor right ---------------------- */
.mk-compose { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.mk-preview {
  border: 1px solid var(--color-control-border); border-radius: var(--radius);
  background: var(--color-control); overflow: hidden;
}
.mk-preview__head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; font-weight: 600; }
.mk-preview__head .mk-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--color-primary-50); border: 1px solid var(--color-border); }
.mk-preview__img { aspect-ratio: 1 / 1; background-size: cover; background-position: center; background-color: var(--color-surface-alt); }
.mk-preview__empty {
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--color-text-subtle); text-align: center; padding: 16px;
}
.mk-caption { min-height: 150px; resize: vertical; }
.mk-ai { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mk-ai .subtle { font-size: 12px; }

/* Repeat-limit notice under a product. */
.mk-guard { margin-top: 10px; font-size: 12px; color: var(--color-text-muted); }
.mk-guard strong { color: var(--color-text); }
.mk-guard.is-blocked strong { color: var(--color-danger-ink); }

/* ---- Connect-account tiles ------------------------------------------------ */
.mk-connect { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mk-connect__tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px; text-align: left; font: inherit; cursor: pointer;
  background: var(--color-control); border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
}
.mk-connect__tile:hover { border-color: var(--color-border-strong); }
.mk-connect__tile[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-50); }
.mk-connect__tile .mk-net svg { width: 20px; height: 20px; }
.mk-connect__tile strong { font-size: 14px; }
.mk-connect__tile span.subtle { font-size: 12px; }

/* ==========================================================================
   Overview — the landing view: big numbers, the last post and the next three,
   and one lively card per connected account. Manage opens the tabs above.
   ========================================================================== */
.mk-home { display: flex; flex-direction: column; gap: var(--page-gap); }

/* The numbers are the house KPI cards; three of them open the queue on their filter. */
button.kpi { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }

.mk-block__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.mk-block__head h2 { margin: 0; font-size: 16px; }
.mk-more {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; font: inherit; font-size: 13px;
  font-weight: 600; color: var(--color-primary-700); background: none; border: 0; cursor: pointer;
}
.mk-more:hover { color: var(--color-primary); }
.mk-more svg { width: 14px; height: 14px; }

/* The reel: the post that just went out, then the next three. */
.mk-reel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mk-shot {
  display: flex; flex-direction: column; cursor: pointer; overflow: hidden;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 7px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.mk-shot:hover, .mk-shot:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mk-shot__img {
  position: relative; aspect-ratio: 4 / 3;
  background-size: cover; background-position: center; background-color: var(--color-surface-alt);
}
.mk-shot__img::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(0 0 0 / .45) 0%, rgb(0 0 0 / 0) 38%, rgb(0 0 0 / 0) 62%, rgb(0 0 0 / .35) 100%);
}
.mk-shot__tag {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  padding: 4px 9px; border-radius: 5px; font-size: 12px; font-weight: 700;
  color: var(--color-text); background: rgb(255 255 255 / .92);
}
.mk-shot.is-live .mk-shot__tag { color: #fff; background: #2C4C72; }
.mk-shot__nets { position: absolute; right: 10px; bottom: 10px; z-index: 1; display: flex; gap: 6px; }
.mk-shot__body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; font-size: 13px; }
.mk-shot__body strong { font-size: 14px; }
.mk-shot__body .sub { font-size: 12px; color: var(--color-text-muted); }
.mk-shot__st { margin-top: 4px; }
.mk-shot.is-live { border-color: #587FA9; }

/* Brand bubbles — the network logo in its own colours, big enough to read at a glance. */
.mk-bubble {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .25);
}
.mk-bubble svg { width: 19px; height: 19px; }
.mk-bubble--ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.mk-bubble--fb { background: #1877F2; }
.mk-bubble--li { background: #0A66C2; }

/* A reading: the network mark, then plain words — "212 likes · 18 comments". */
.mk-read { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }
.mk-read b { color: var(--color-text); font-weight: 700; }

/* Account cards — the brand is the card. */
.mk-accts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mk-acct {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer; text-align: left; font: inherit;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 7px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.mk-acct:hover, .mk-acct:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mk-acct__band {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 112px; padding: 18px; color: #fff; overflow: hidden;
}
.mk-acct--ig .mk-acct__band { background: linear-gradient(45deg, #F58529 0%, #DD2A7B 45%, #8134AF 75%, #515BD4 100%); }
.mk-acct--fb .mk-acct__band { background: linear-gradient(135deg, #1877F2 0%, #0B5FCC 100%); }
.mk-acct--li .mk-acct__band { background: linear-gradient(135deg, #0A66C2 0%, #004182 100%); }
.mk-acct__logo { display: inline-flex; flex: none; }
.mk-acct__logo svg { width: 56px; height: 56px; }
.mk-acct--ig .mk-acct__logo svg { stroke-width: 1.8; }
/* The oversized watermark bleeding off the band's corner. */
.mk-acct__wm { position: absolute; right: -26px; bottom: -40px; opacity: .16; pointer-events: none; }
.mk-acct__wm svg { width: 170px; height: 170px; }
.mk-acct__who { position: relative; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mk-acct__who strong { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-acct__who > span:last-child { font-size: 13px; color: rgb(255 255 255 / .85); }
.mk-acct__net { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgb(255 255 255 / .8); }
.mk-acct__body { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; flex: 1; }
.mk-acct__stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--color-text-muted); }
.mk-acct__stats b { font-size: 20px; font-weight: 700; color: var(--color-text); }
.mk-acct__last {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--color-control); border: 1px solid var(--color-control-border); border-radius: 5px;
}
.mk-acct__last .main { font-size: 13px; }
.mk-acct__last .mk-read { margin-top: 2px; }
.mk-acct__last.is-empty { font-size: 12px; color: var(--color-text-subtle); }
.mk-acct__foot { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 12px; }
.mk-acct__foot .sub { color: var(--color-text-subtle); }

/* Connect tile — sits in the row like a card still to be filled. */
.mk-acct--add {
  align-items: center; justify-content: center; gap: 6px; min-height: 240px;
  color: var(--color-text-muted); background: var(--color-control);
  border: 1px dashed var(--color-control-border); box-shadow: none;
}
.mk-acct--add strong { font-size: 14px; color: var(--color-text); }
.mk-acct--add .sub { font-size: 12px; }
.mk-acct__plus {
  width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #1877F2 100%);
}
.mk-acct__plus svg { width: 22px; height: 22px; }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .mk-reel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .mk-compose { grid-template-columns: 1fr; }
  .mk-preview { max-width: 260px; }
  .mk-settings, .mk-switches, .mk-connect { grid-template-columns: 1fr; }
  .mk-table { min-width: 680px; }
}
@media (max-width: 480px) {
  .mk-reel { grid-template-columns: 1fr; }
}
