/* Shared visual layer for the DirectFlow workspace. */
:root {
  --ink: #241b2e;
  --muted: #655b70;
  --line: #eae4ee;
  --paper: #fff;
  --canvas: #f8f7fa;
  --violet: #872ab1;
  --violet-soft: #f6ecfb;
  --violet-wash: linear-gradient(110deg, #f3e7fb, #fff0ec);
  --green: #257b58;
  --green-soft: #e9f6ef;
  --shadow: 0 3px 12px #33203e0a;
  --rail-width: 228px;
  --strip-height: 34px;
  --header-height: 62px;
  --chrome-height: calc(var(--strip-height) + var(--header-height));
}

body { background: var(--canvas); color: var(--ink); font-family: "DM Sans", system-ui, sans-serif; }
:is(h1, h2, h3, .brand-mark, .metric-value) { font-family: Manrope, "DM Sans", system-ui, sans-serif; }
:is(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.notice-bar, .topbar { position: fixed; inset-inline: 0; z-index: 5; }
.notice-bar {
  top: 0;
  height: var(--strip-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.notice-mark { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; }
.topbar {
  top: var(--strip-height);
  height: var(--header-height);
  justify-content: flex-start;
  gap: 18px;
  padding: 0 24px;
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 calc(var(--rail-width) - 24px);
  color: var(--violet);
  font: 800 22px Manrope, sans-serif;
  letter-spacing: -.85px;
}
.brand-mark, .mobile-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, #8026b0, #ad3179 75%, #b95257);
  box-shadow: 0 3px 9px #872ab12b;
  font-size: 24px;
}
.crumb { color: var(--muted); font-size: 12px; }
.top-actions { margin-left: auto; gap: 12px; }
.avatar { background: var(--violet-soft); color: var(--violet); }
.avatar-top { width: 36px; height: 36px; }
.connection-pill { color: #735518; background: #fff8e7; border-color: #f1e4c2; font-size: 11px; }
.connection-pill.is-connected { color: #1d6c4c; background: var(--green-soft); border-color: #d7eadd; }

.sidebar {
  inset-block-start: var(--chrome-height);
  width: var(--rail-width);
  padding: 16px 12px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar > .brand { display: none; }
.nav-label {
  padding: 9px 10px 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
}
.nav-label:not(:first-of-type) { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 15px; }
.nav-item { min-height: 39px; flex-shrink: 0; gap: 9px; padding: 8px 10px; color: #51475e; font-size: 13px; }
.nav-item .ico { color: #71627e; flex: 0 0 19px; }
.nav-item:hover, .nav-item.active, .mobile-nav button.active { background: var(--violet-wash); color: var(--violet); }
.nav-item.active .ico { color: var(--violet); }
.nav-count { color: var(--violet); background: var(--violet-soft); }
.sidebar-bottom { padding-top: 16px; }
.plan-card { background: linear-gradient(145deg, #faf2fe, #fff8f6); border-color: #efe4f3; }
.plan-card strong { font-size: 12px; }
.plan-card small, .profile-mini small { color: var(--muted); }
.plan-card :is(button, .plan-spark) { color: var(--violet); }

.main { margin-left: var(--rail-width); padding-top: var(--chrome-height); min-width: 0; }
.content { padding: 27px 28px 82px; max-width: 1540px; }
.heading-row { align-items: center; gap: 16px; margin-bottom: 21px; }
.heading-row > div, .account-summary > div { min-width: 0; }
.heading-row h1 { font: 800 clamp(24px, 2.35vw, 34px)/1.15 Manrope, "DM Sans", system-ui, sans-serif; letter-spacing: -.035em; margin: 5px 0 7px; }
.eyebrow { color: var(--violet); font-size: 10px; letter-spacing: .13em; }
.subtle { color: var(--muted); font-size: 14px; line-height: 1.5; }
.card { border-radius: 15px; box-shadow: var(--shadow); }
.btn { min-height: 38px; border-radius: 9px; padding: 9px 14px; font-size: 12px; line-height: 1.35; }
.btn-primary {
  background: linear-gradient(110deg, #852cb2, #a33183);
  color: white;
  box-shadow: 0 3px 9px #852cb127;
}
.btn-primary:hover { background: linear-gradient(110deg, #74229e, #91266f); }
.btn-soft { background: var(--violet-soft); color: var(--violet); }
.btn-soft:hover { background: #f1e2f7; }
.btn-dark { background: #322239; }
.text-button { color: var(--violet); font-size: 12px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
button:disabled { cursor: not-allowed; }

.account-overview {
  position: relative;
  overflow: hidden;
  min-height: 116px;
  padding: 20px;
  border-color: #e9daef;
  background: radial-gradient(ellipse at right top, #f7e8fc, transparent 70%), var(--paper);
}
.account-summary, .account-summary-actions { flex-wrap: wrap; }
.account-avatar, .account-icon, .ig-mark {
  background: var(--violet-wash);
  color: var(--violet);
  font-size: 0;
  flex: none;
  display: grid;
  place-items: center;
}
.account-avatar { width: 56px; height: 56px; border: 1px solid #ead8f1; border-radius: 16px; }
:is(.account-avatar, .account-icon, .ig-mark)::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='3' width='18' height='18' rx='5'/%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Ccircle cx='17.5' cy='6.8' r='.9' fill='black' stroke='none'/%3E%3C/svg%3E") center / contain no-repeat;
}
.account-summary h2 { font: 800 20px/1.3 Manrope, "DM Sans", system-ui, sans-serif; overflow-wrap: anywhere; }
.account-summary p { color: var(--muted); font-size: 12px; line-height: 1.45; }
.account-status, .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 20px;
  background: #f5f1f7;
  color: #64586f;
  font-size: 11px;
  font-weight: 700;
}
.account-status.online, .account-connected .account-status, .status-active, .status-on { background: var(--green-soft); color: #1d6c4c; }
.status-draft { background: #fff6df; color: #7a561a; }
.status-paused { color: #665a6e; }
.status i, .account-status i { flex: none; }

.section-line h2, .panel h2, .media-panel h2, .settings-panel h2, .settings-title h2 {
  font: 800 17px/1.25 Manrope, sans-serif;
  letter-spacing: -.025em;
}
.section-line p, .panel-note, .footnote, .metric-foot, .neutral, .settings-panel p,
.settings-disclaimer, .account-copy small, .empty-inbox, .empty-state p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 118px; padding: 14px 16px; }
.metric-top { gap: 8px; color: var(--muted); font-size: 12px; }
.metric-icon { flex: none; width: 32px; height: 32px; }
.metric:nth-child(4n+1) .metric-icon { color: var(--violet); background: var(--violet-soft); }
.metric:nth-child(4n+3) .metric-icon { color: #9b4b36; background: #fceee8; }
.metric:nth-child(4n+4) .metric-icon { color: #435ca3; background: #edf0ff; }
.metric-value { color: var(--ink); font: 800 28px/1.2 Manrope, "DM Sans", system-ui, sans-serif; }
.automation-tile { min-height: 83px; }
.automation-tile:hover, .media-card:hover { border-color: #c99ed9; box-shadow: 0 4px 12px #872ab114; }
.automation-tile b, .rule-name b, .full-rule-name b, .account-copy b { font-size: 13px; }
.automation-tile small, .rule-name small, .rule-sent small, .rule-trigger small, .full-rule-name small { color: var(--muted); font-size: 11px; }
.tile-lilac { color: var(--violet); background: var(--violet-soft); }
.row-more { color: var(--violet); font-size: 12px; }

.filter-row { gap: 12px; }
.tabs { padding: 4px; background: #f0ecf3; border-radius: 10px; }
.tab { min-height: 34px; font-size: 12px; color: var(--muted); }
.tab.selected { background: white; color: var(--violet); box-shadow: 0 1px 4px #35253f15; }
.search, .search-wrap input { min-height: 38px; background: white; border-color: var(--line); font-size: 13px; }
.rules-head { color: var(--muted); background: #fdfbfe; font-size: 11px; }
.rule-actions button { color: var(--violet); font-size: 11px; }
.trigger-tag { background: var(--violet-soft); color: #6e318b; }
.full-rule-name > span:last-child { min-width: 0; }
.media-panel { padding: 18px; }
.media-gallery { gap: 12px; max-height: 420px; }
.media-card { border-radius: 12px; border-color: var(--line); color: var(--ink); }
.media-image { background: #f3edf7; }
.media-image > b { background: #2e183dde; }
.media-card > strong { color: var(--ink); min-height: 36px; font-size: 12px; }
.media-card > small { color: var(--violet); font-size: 11px; font-weight: 700; }

.settings-content { max-width: 1050px; }
.settings-panel { padding: 20px; }
.account-box { border-color: #eadbf0; background: #fcf8fe; }
.account-connected { background: #f7fcf9; border-color: #deeee3; }
.meta-note { border: 1px solid #eee3f3; background: #fcf7ff; }
.meta-note > span { color: var(--violet); }
.meta-note p, .requirements ul, .requirements b, .workspace-facts small { color: var(--muted); font-size: 12px; }
.settings-disclaimer a { color: var(--violet); }
.execution-row b { font-size: 13px; }
.execution-row small { color: var(--muted); font-size: 11px; }
.execution-status { font-size: 11px; font-weight: 700; }
.modal { border-radius: 17px; }
.modal h2 { font: 800 23px/1.25 Manrope, "DM Sans", system-ui, sans-serif; }
.modal > p, .field-help, .modal-foot, .variant-heading p { color: var(--muted); }
.modal label :is(input, select, textarea), .variation-field textarea { font-size: 14px; border-color: #e8dfee; }
.variant-section { background: #fdfaff; border-color: #ede2f3; }
.variant-heading h3 { color: var(--ink); font-size: 14px; }
.variant-heading p { font-size: 12px; }
.variation-field textarea:focus { outline-color: var(--violet); }
.chat-messages .bubble { font-size: 13px; }
.chat-messages .reply-bubble { background: var(--violet-soft); color: #553464; }
body #directflow-cloud-auth {
  background: white;
  color: var(--violet);
  border: 1px solid #e9d9f1;
  box-shadow: 0 3px 12px #33203e14;
}
body #directflow-auth-modal button.primary { background: var(--violet); }

@media (max-width: 1120px) {
  :root { --rail-width: 205px; }
  .content { padding-inline: 20px; }
  .metric-grid, .automation-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules-head, .full-rule { grid-template-columns: minmax(135px, 1.5fr) minmax(115px, 1fr) 45px 78px 115px; }
}

@media (max-width: 880px) {
  :root { --header-height: 55px; --strip-height: 29px; --mobile-nav-height: 52px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; gap: 8px; }
  .mobile-brand { flex-basis: auto; font-size: 20px; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; font-size: 21px; }
  .crumb { display: none; }
  .content { padding: 18px 14px 82px; }
  .mobile-nav, .app-shell:not(:has(.mobile-nav)) .sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    height: var(--mobile-nav-height);
    padding: 6px 12px;
    overflow: auto hidden;
    scrollbar-width: thin;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: white;
    z-index: 4;
  }
  .mobile-nav { position: sticky; top: var(--chrome-height); }
  .app-shell:not(:has(.mobile-nav)) .sidebar { inset: var(--chrome-height) 0 auto; width: auto; }
  .app-shell:not(:has(.mobile-nav)) .main { padding-top: calc(var(--chrome-height) + var(--mobile-nav-height)); }
  .app-shell:not(:has(.mobile-nav)) .sidebar > :is(.nav-label, .sidebar-bottom) { display: none; }
  .mobile-nav button, .sidebar .nav-item { flex: 0 0 auto; width: auto; min-height: 36px; white-space: nowrap; font-size: 12px; }
  .account-summary-actions { margin-left: 0; }
}

@media (max-width: 760px) {
  .rules-head { display: none; }
  .full-rule { grid-template-columns: minmax(0, 1fr) auto; }
  .full-rule[data-active] > .status { grid-column: 2; grid-row: 1; }
  .full-rule[data-active] > .more-button { grid-column: 2; grid-row: 2; }
  .connection-pill { font-size: 11px; padding: 5px 8px; }
  .account-overview { padding: 14px; }
  .account-summary { flex-wrap: nowrap; }
  .heading-row { align-items: flex-start; flex-wrap: wrap; }
  .heading-row > .btn { font-size: 12px; }
  .media-panel { padding: 14px; }
  .metric-value { font-size: 24px; }
  .settings-panel .btn { margin: 6px 6px 6px 0 !important; }
}

@media (max-width: 460px) {
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    height: auto;
  }
  .mobile-nav button { min-width: 0; padding-inline: 4px; }
}

@media (max-width: 420px) {
  .notice-bar { font-size: 11px; }
  .connection-pill { font-size: 0; gap: 0; }
  .top-actions { gap: 8px; }
  .metric { padding: 12px; }
  .metric-icon { width: 27px; height: 27px; }
  .automation-tile { padding: 10px; }
  .automation-tile > i { display: none; }
  .account-summary-actions { gap: 8px; }
  .modal label :is(input, select, textarea), .variation-field textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell *, .modal-backdrop * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Private workspace */
.df-icon { display: inline-block; flex: none; vertical-align: middle; }
.nav-item .ico { display: grid; place-items: center; }
.notice-mark, .plan-spark, .ig-glyph { display: inline-flex; align-items: center; justify-content: center; }
.plan-card button { display: inline-flex; align-items: center; gap: 5px; }
.account-avatar:has(.df-icon)::before { content: none; }
.account-avatar:has(.df-icon) { color: #873c90; }
.workspace-logout { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); display: grid; place-items: center; }
.workspace-logout:hover { color: var(--violet); background: var(--violet-wash); }
.btn:has(.df-icon) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
.global-comment-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 18px; margin: 0 0 20px; border-color: #eae0f3; background: linear-gradient(110deg,#fbf7ff,#fff 70%); }
.global-comment-card h2 { margin: 0 0 5px; font-size: 16px; }
.global-comment-card p { margin: 0; line-height: 1.55; font-size: 13px; color: var(--muted); }
.global-comment-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.private-entrance { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 18% 20%,#efe4ff,transparent 55%), radial-gradient(ellipse at 82% 81%,#fce5ee,transparent 53%), #faf9fd; }
.private-card { width: min(100%,460px); background: #fff; border: 1px solid #eadff1; border-radius: 22px; box-shadow: 0 22px 64px #5938691a; padding: clamp(24px,7vw,40px); }
.private-brand { display: flex; align-items: center; gap: 10px; font: 800 23px Manrope,sans-serif; letter-spacing: -.04em; color: var(--ink); margin-bottom: 24px; }
.private-kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--violet); font-size: 11px; font-weight: 800; letter-spacing: .09em; }
.private-card h1 { font-size: clamp(25px,5vw,34px); margin: 8px 0; }
.private-card p { color: var(--muted); line-height: 1.6; margin: 0 0 20px; }
.private-card .btn { width: 100%; }
.private-card footer { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 15px; }
.private-card footer a { font-size: 12px; color: var(--muted); }
#directflow-cloud-auth[hidden] { display: none; }
@media (max-width: 620px) {
  .global-comment-card { grid-template-columns: auto minmax(0,1fr); padding: 14px; gap: 10px 12px; }
  .global-comment-card > :last-child { grid-column: 2; justify-self: start; }
}

.media-entry .media-card { width: 100%; }
.media-permalink { display: block; width: fit-content; margin: 6px 4px 0; color: var(--violet); font-size: 11px; font-weight: 700; }
