/* ============ SEO Master — prototype styles ============ */
:root {
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-soft: #f4f3ef;
  --sidebar: #fbfbf9;
  --border: #e7e5df;
  --border-strong: #d6d4cc;
  --text: #1b1b18;
  --text-2: #6c6b64;
  --text-muted: #9a988f;
  --accent: #2f6fed;
  --accent-bg: #e9f0fd;
  --accent-text: #1a4fb0;
  --green: #1f7a55;
  --green-bg: #e3f4ec;
  --amber: #9a6a00;
  --amber-bg: #fbefd8;
  --red: #c23b34;
  --red-bg: #fbe9e7;
  --purple: #6a4bc0;
  --purple-bg: #ece8fb;
  --radius: 9px;
  --radius-lg: 13px;
  --shadow: 0 1px 2px rgba(20,20,18,.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
button {
  font-family: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); padding: 7px 13px; border-radius: var(--radius);
  display: inline-flex; align-items: center; gap: 6px; transition: background .12s;
}
button:hover { background: var(--surface-soft); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #2a63d4; }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-soft); }
.icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 15px; height: 15px; }
.icon.favorited { fill: currentColor; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px; flex: none; background: var(--sidebar);
  border-right: 1px solid var(--border); padding: 16px 12px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center; flex: none;
}
.brand .name { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 14px 8px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--radius);
  color: var(--text-2); font-size: 13.5px; font-weight: 500; margin-bottom: 1px; cursor: pointer;
}
.nav-item:hover { background: var(--surface-soft); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-text); }
.nav-item .icon { width: 18px; height: 18px; }
.sidebar .spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 9px; padding: 9px 8px; border-top: 1px solid var(--border); margin-top: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--purple-bg); color: var(--purple); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
  height: 56px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 14px; padding: 0 26px; position: sticky; top: 0; z-index: 5;
}
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 11px; width: 290px; color: var(--text-muted); font-size: 13px; }
.search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 13px; flex: 1; color: var(--text); }
.topbar .spacer { flex: 1; }
.iconbtn { width: 34px; height: 34px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-2); cursor: pointer; }
.iconbtn:hover { background: var(--surface-soft); }

.content { padding: 24px 26px 48px; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; }
.page-head .sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.row-actions { display: flex; gap: 8px; }

/* ---------- Cards / KPI ---------- */
.grid { display: grid; gap: 14px; }
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 15px 16px; box-shadow: var(--shadow);
}
.kpi .label { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 25px; font-weight: 600; margin-top: 7px; letter-spacing: -.02em; }
.kpi .delta { font-size: 12px; margin-top: 5px; font-weight: 500; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--text-2); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 17px 19px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; }
.card-head .hint { font-size: 12px; color: var(--text-muted); }

/* ---------- Badges ---------- */
.badge { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--accent-bg); color: var(--accent-text); }
.badge.gray { background: var(--surface-soft); color: var(--text-2); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
tbody td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Project list rows ---------- */
.proj-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.proj-row:last-child { border-bottom: none; }
.proj-row:hover { background: var(--surface-soft); }
.proj-ident { display: flex; align-items: center; gap: 12px; }
.proj-fav { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.proj-name { font-weight: 600; font-size: 14px; }
.proj-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 9px 12px; font-size: 13.5px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kcol { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.kcol-head .count { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 0 7px; font-size: 11px; color: var(--text-muted); }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 11px; margin-bottom: 8px; box-shadow: var(--shadow); }
.kcard:last-child { margin-bottom: 0; }
.kcard .title { font-size: 13px; font-weight: 500; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.kcard .tags { display: flex; gap: 5px; }
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; font-size: 10px; display:flex; align-items:center; justify-content:center; font-weight:600; }

/* ---------- Misc ---------- */
.progress { height: 7px; background: var(--surface-soft); border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.score-ring { font-variant-numeric: tabular-nums; }
.split { display: grid; gap: 16px; }
.list-line { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-line:last-child { border-bottom: none; }
.muted { color: var(--text-muted); }
.strike { text-decoration: line-through; color: var(--text-muted); }
.pill-tab { font-size: 12px; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border); cursor: pointer; color: var(--text-2); }
.pill-tab.active { background: var(--text); color: #fff; border-color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: var(--radius); padding: 7px; background: var(--surface); }
.cal-cell .date { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.cal-ev { font-size: 11px; padding: 3px 6px; border-radius: 6px; margin-bottom: 4px; font-weight: 500; line-height: 1.3; }
.empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 28px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-2); }
.integration { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.integration:last-child { border-bottom: none; }
.int-ident { display: flex; align-items: center; gap: 12px; }
.int-logo { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 4px 0 12px; }

/* ---------- Health ring ---------- */
.hring { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; position: relative; }
.hring::before { content: ''; position: absolute; inset: 4px; background: var(--surface); border-radius: 50%; }
.hring span { position: relative; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hring.sm { width: 34px; height: 34px; }
.hring.sm span { font-size: 11px; }

/* ---------- Nav badge / sections ---------- */
.nbadge { margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.alert:last-child { border-bottom: none; }
.sev { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.sev.high { background: var(--red); } .sev.med { background: var(--amber); } .sev.low { background: var(--text-muted); }
.alert .cause { background: var(--surface-soft); border-radius: 8px; padding: 9px 11px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); display: flex; gap: 7px; }
.alert .cause b { color: var(--text); font-weight: 600; }

/* ---------- Filter bar / tags ---------- */
.filterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.tagchip { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--surface-soft); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.tagrow { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- Segmented bar ---------- */
.seg { display: flex; height: 11px; border-radius: 6px; overflow: hidden; background: var(--surface-soft); }
.seg > span { display: block; height: 100%; }

/* ---------- Share of voice ---------- */
.sov { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.sov .name { width: 165px; font-size: 13px; }
.sov .bar { flex: 1; height: 9px; background: var(--surface-soft); border-radius: 6px; overflow: hidden; }
.sov .bar > span { display: block; height: 100%; border-radius: 6px; }
.sov .pct { width: 40px; text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Approval cards ---------- */
.appr { border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; margin-bottom: 12px; }
.appr .preview { background: var(--surface-soft); border-radius: 8px; padding: 11px 13px; font-size: 13px; margin: 11px 0; color: var(--text-2); font-style: italic; line-height: 1.5; }
.conf { font-size: 11.5px; font-weight: 600; }
.appr-actions { display: flex; gap: 8px; }

/* ---------- Chat (ask portfolio) ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 200px; }
.bubble { max-width: 82%; padding: 11px 14px; border-radius: 13px; font-size: 13.5px; line-height: 1.55; }
.bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--surface-soft); border-bottom-left-radius: 4px; }
.bubble.ai b { font-weight: 600; }
.chat-input { display: flex; gap: 8px; margin-top: 16px; }
.chat-input input { flex: 1; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 9px 12px; font-family: inherit; font-size: 13.5px; outline: none; }
.suggest { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.suggest .pill-tab { background: var(--surface); }

/* ---------- Stat strip ---------- */
.stripe { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.stripe > div { padding: 14px 16px; border-right: 1px solid var(--border); }
.stripe > div:last-child { border-right: none; }
.stripe .v { font-size: 21px; font-weight: 600; }
.stripe .l { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Screaming Frog crawl analysis ---------- */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 11px; padding: 20px; text-align: center; color: var(--text-2); background: var(--surface-soft); }
.dropzone .icon { width: 24px; height: 24px; color: var(--text-muted); }
.dropzone .big { font-weight: 500; color: var(--text); margin-top: 6px; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-bg); }
.sfrow { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.sfrow:last-child { border-bottom: none; }
.sfrow .meta { flex: 1; min-width: 0; }
.sfrow .acts { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sf-prop { background: var(--accent-bg); border-radius: 8px; padding: 10px 12px; margin-top: 9px; font-size: 12.5px; color: var(--accent-text); }
.sf-prop b { font-weight: 600; }
.btn-xs { font-size: 12px; padding: 5px 10px; }
.sf-issue { padding: 13px 0; border-bottom: 1px solid var(--border); }
.sf-issue:last-child { border-bottom: none; }
.sf-issue-head { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.sf-issue-head .meta { flex: 1; min-width: 0; }
.sf-issue-head .acts { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sf-caret { display: inline-block; color: var(--text-muted); transition: transform .15s; margin-top: 3px; flex-shrink: 0; transform: rotate(-90deg); }
.sf-caret.open { transform: rotate(0deg); }
.sf-url-toggle { text-decoration: underline; cursor: pointer; }
.sf-url-list { margin: 10px 0 0 22px; padding-top: 10px; border-top: 1px solid var(--border); }
.sf-url-tally { font-size: 11.5px; margin-bottom: 8px; }
.sf-url-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.sf-url-row:last-child { border-bottom: none; }
.sf-url-row .u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.sf-url-row .acts { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* ---------- v3: modals, forms, switcher, drag, roles ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,20,18,.45); display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px; z-index: 60; overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 540px; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; max-height: 64vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.iconclose { cursor: pointer; color: var(--text-muted); display: flex; }
.iconclose:hover { color: var(--text); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 9px 11px; font-family: inherit; font-size: 13.5px; outline: none; background: var(--surface); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.field .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.checkrow { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.checkrow:last-child { border-bottom: none; }
.checkrow input { width: auto; }
.switcher { margin: 0 4px 8px; }
.switcher select { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 9px; font-family: inherit; font-size: 13px; background: var(--surface); color: var(--text); cursor: pointer; outline: none; }
.switcher select:hover { border-color: var(--border-strong); }
.kcard { cursor: grab; }
.kcard:active { cursor: grabbing; }
.kcol.dragover { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-bg); }

/* ---------- v5: smooth drag-drop + editable column titles ---------- */
.kcards { min-height: 26px; }
.kcard { transition: box-shadow .15s ease, transform .12s ease, opacity .12s ease; }
.kcard.dragging { opacity: .4; }
.kcard-empty { font-size: 12px; padding: 12px 2px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; color: var(--text-muted); }
.kcol-title { flex: 1; min-width: 0; border: none; background: transparent; font-family: inherit; font-weight: 600; font-size: 12.5px; color: var(--text-2); padding: 2px 5px; margin-left: -5px; border-radius: 6px; outline: none; cursor: text; }
.kcol-title:hover { background: var(--surface); }
.kcol-title:focus { background: var(--surface); color: var(--text); box-shadow: 0 0 0 2px var(--accent-bg); }

/* ---------- v4: dark mode theme ---------- */
[data-theme="dark"] {
  --page: #191917;
  --surface: #222220;
  --surface-soft: #2b2b27;
  --sidebar: #1d1d1b;
  --border: #34332e;
  --border-strong: #46453d;
  --text: #ededea;
  --text-2: #b2b1a7;
  --text-muted: #84837a;
  --accent: #5b8def;
  --accent-bg: #1f2c44;
  --accent-text: #a9c6f7;
  --green: #5fce99; --green-bg: #16301f;
  --amber: #e3a73f; --amber-bg: #372c14;
  --red: #ec7a72; --red-bg: #3a1f1d;
  --purple: #b09cf8; --purple-bg: #272042;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ---------- v4: task card detail (checklist, attachments, labels) ---------- */
.minilabels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 7px; }
.minilabels .badge { font-size: 10px; padding: 1px 7px; }
.label-pill { cursor: pointer; }
.chk-item { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 13.5px; }
.chk-item input { width: auto; }
.chk-item.done span { text-decoration: line-through; color: var(--text-muted); }
.attach { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }

@media (max-width: 1080px) { .kpi-grid { grid-template-columns: repeat(2,1fr);} .kanban{grid-template-columns:repeat(2,1fr);} .stripe{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 720px) { .sidebar{display:none;} .kpi-grid,.kanban,.stripe{grid-template-columns:1fr;} }
