/* Content library, keyword workbench and administrator views. */
.data-platforms { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 0 23px; margin-bottom: 23px; border-bottom: 1px solid var(--border); }
.platform-tab { background: #fff; color: var(--muted); border: 1px solid transparent; border-radius: 7px; min-height: 36px; padding: 7px 13px; font-size: 12px; font-weight: 500; transition: color var(--motion), background var(--motion); }
.platform-tab:hover { background: var(--surface-muted); color: var(--text); }
.platform-tab[aria-pressed="true"] { background: var(--primary-soft); border-color: #e1d8f4; color: var(--primary); font-weight: 600; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 0 0 24px; }
.filter-bar > div { flex: 1 1 160px; min-width: 0; }
.filter-bar > div:first-child { flex-grow: 1.5; }
.filter-bar label { font-size: 12px; font-weight: 500; margin-bottom: 8px; }
.filter-bar input, .filter-bar select { min-height: 42px; font-size: 13px; }
.data-toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding: 21px 0 18px; }
#data-summary { font-size: 13px; font-weight: 550; margin: 0; }
.export-actions { display: flex; align-items: center; gap: 10px; }
.export-actions label { margin: 0; font-weight: 400; color: var(--muted); font-size: 12px; }
.export-actions select { width: auto; font-size: 12px; min-height: 38px; }
.table-scroll { overflow-x: auto; width: 100%; border: 1px solid var(--border); border-radius: 9px; scrollbar-width: thin; scrollbar-color: #d3cedf transparent; }
.table-scroll:focus-visible { outline-offset: 3px; }
.data-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; line-height: 1.6; }
.data-table th { background: #f8f8fa; font-size: 12px; color: #777381; font-weight: 550; white-space: nowrap; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.data-table th { position: sticky; top: 0; z-index: 1; }
.data-panel[data-view="data"] .table-scroll, .task-table-scroll { max-height: 580px; }
.data-table td { padding: 19px 16px; border-bottom: 1px solid #eeedf2; vertical-align: top; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--motion); }
.data-table tbody tr:hover { background: #fbfafd; }
.data-table td strong { font-weight: 550; }
.data-table td:first-child { min-width: 128px; }
.data-table .content-cell { min-width: 230px; max-width: 480px; }
.content-cell > strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #302a3c; }
.cell-secondary, .cell-preview { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.cell-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.7; }
.time-cell { min-width: 110px; font-size: 12px; color: #686371; font-variant-numeric: tabular-nums; }
.data-table td:last-child > .button { background: transparent; color: var(--primary); border-color: #e3dcf2; }
.data-table .table-empty { height: 210px; padding: 50px 25px; vertical-align: middle; text-align: center; color: var(--muted); font-size: 13px; }
.table-empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 9px; }
.table-empty p { margin-bottom: 0; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.pagination > div { display: flex; gap: 7px; }
.pagination .button { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.export-note { font-size: 12px; margin-top: 20px; }

/* Batch editor and existing keyword inventory. */
.keywords-workspace { display: grid; grid-template-columns: minmax(310px,.85fr) minmax(0,1.4fr); gap: 22px; align-items: start; }
.batch-panel { margin: 0; padding: 24px; }
.batch-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.batch-fieldset legend { font-size: 12px; font-weight: 550; padding: 0; margin-bottom: 12px; }
.batch-platforms { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.batch-platforms label { display: flex; align-items: center; gap: 8px; min-height: 43px; border: 1px solid var(--border); border-radius: 7px; padding: 9px 10px; font-size: 12px; font-weight: 400; margin: 0; cursor: pointer; transition: border-color var(--motion), background var(--motion); }
.batch-platforms label:hover { border-color: #c5b9df; background: #fcfaff; }
.batch-platforms label:has(input:checked) { border-color: #c4b4e9; background: var(--primary-soft); color: #56418b; }
.batch-platforms input { width: 15px; min-height: 15px; height: 15px; }
.batch-select-actions, .batch-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 12px 0 24px; }
.batch-select-actions .button { border: 0; padding: 3px 0; color: var(--primary); margin-right: 10px; background: transparent; font-size: 12px; }
#batch-keyword-form > label { font-size: 12px; }
#batch-keywords { background: #fcfcfd; font-size: 13px; }
#batch-keyword-form > .helper { margin-top: 8px; font-size: 12px; }
#batch-preview { padding: 12px; border-radius: 7px; background: #f5f3f9; color: #675a7f; line-height: 1.8; }
.batch-submit { margin: 18px 0 0; }
.batch-submit > .button { flex: 1; }
#batch-result, #account-result { margin-top: 12px; color: var(--success); }
.keyword-layout { overflow: hidden; }
.platform-panel { padding: 24px 24px 20px; border-bottom: 1px solid var(--border); }
.platform-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.platform-item { display: flex; align-items: center; justify-content: space-between; gap: 7px; text-align: left; padding: 10px; min-height: 42px; background: var(--surface-muted); border: 1px solid transparent; border-radius: 7px; color: var(--muted); transition: background var(--motion), border-color var(--motion); }
.platform-item strong { font-weight: 500; font-size: 12px; }
.platform-meta { display: none; }
.platform-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.platform-item:hover { background: #efedf4; }
.platform-item.active { background: var(--primary-soft); border-color: #d8cbed; color: var(--primary); }
.keyword-panel { padding: 24px; }
.keyword-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
.keyword-header h2 { font-size: 22px; }
.count-badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 6px 10px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 6px; color: var(--muted); white-space: nowrap; }
.keyword-form { display: flex; align-items: flex-end; gap: 10px; }
.keyword-form .input-group { min-width: 0; flex: 1; }
.keyword-form label { font-size: 12px; }
.form-actions { display: flex; gap: 7px; }
.keyword-selection { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; margin: 15px 0 5px; border-block: 1px solid var(--border); }
.keyword-selection label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 400; margin: 0 auto 0 0; min-height: 36px; }
.keyword-selection .button { font-size: 12px; padding-inline: 8px; }
.keyword-list { display: grid; }
.keyword-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid #eeedf2; }
.keyword-row:last-child { border-bottom: 0; }
.keyword-text { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 13px; margin: 0; min-height: 38px; overflow-wrap: anywhere; min-width: 0; }
.row-actions { display: flex; gap: 5px; }
.row-actions .button { border-color: transparent; background: transparent; padding-inline: 9px; }
.keyword-list > .empty-state { margin-top: 15px; padding-block: 44px; }

/* Execution summary and accounts. */
.task-summary { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border: 1px solid var(--border); border-radius: 10px; background: #faf9fc; margin: 0 0 20px; overflow: hidden; }
.task-summary > div { min-width: 0; padding: 17px 16px; border-right: 1px solid var(--border); }
.task-summary > div { padding-inline: 12px; }
.task-summary > div:last-child { border: 0; }
.task-summary span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; white-space: nowrap; }
.task-summary strong { font-size: 26px; line-height: 1.2; font-weight: 550; font-variant-numeric: tabular-nums; }
.task-summary > div:first-child { background: #f0ecf8; }
.task-summary > div:first-child strong { color: var(--primary); }
#admin-batch-note { font-size: 12px; margin-bottom: 18px; }
.run-status { display: inline-flex; align-items: center; gap: 5px; border-radius: 5px; font-size: 12px; padding: 4px 8px; color: #696575; background: #f0eef4; white-space: nowrap; }
.run-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.run-status.success { color: var(--success); background: #eaf5ee; }
.run-status.failed { color: var(--danger); background: var(--danger-soft); }
.run-status.running { color: var(--primary); background: var(--primary-soft); }
.account-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 18px; align-items: start; padding: 20px; background: #faf9fc; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 22px; }
.account-form label { font-size: 12px; }
.account-form > button { margin-top: 27px; }
.account-form .helper { font-size: 12px; margin-top: 8px; }
#account-rows td { padding-block: 16px; }

dialog { border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: min(800px,calc(100vw - 40px)); max-height: 85dvh; color: var(--text); background: var(--surface); box-shadow: 0 24px 100px rgb(21 16 35 / 18%); }
dialog::backdrop { background: rgb(25 21 34 / 55%); }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 24px; }
.detail-heading h2 { margin: 0; font-size: 20px; }
.detail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.9; padding: 14px 0 24px; }
dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 12px; }
dialog details { margin-top: 24px; }
dialog summary { min-height: 44px; font-size: 13px; }
dialog h3, dialog .helper { overflow-wrap: anywhere; }

@media (min-width: 1600px) { .keywords-workspace { grid-template-columns: 420px minmax(0,1fr); } }
@media (max-width: 1200px) {
  .keywords-workspace { grid-template-columns: minmax(0,1fr); }
  .batch-platforms { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .platform-list { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .task-summary { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .task-summary > div { border-bottom: 1px solid var(--border); }
  .task-summary > div:nth-child(4) { border-right: 0; }
  .task-summary > div:nth-child(n+5) { border-bottom: 0; }
}
@media (max-width: 600px) {
  .data-platforms { gap: 6px; padding-bottom: 18px; margin-bottom: 18px; }
  .platform-tab { min-height: 44px; padding: 7px 10px; font-size: 12px; border-color: var(--border); }
  .filter-bar { gap: 10px; padding-bottom: 18px; }
  .filter-bar > div { flex: 1 1 120px; }
  .filter-bar > div:first-child { flex-basis: 100%; }
  .filter-bar input, .filter-bar select { font-size: 16px; min-height: 46px; }
  .filter-bar > .button { flex: 1; }
  .data-toolbar { padding-top: 18px; gap: 16px; }
  .export-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .export-actions label { width: 100%; }
  .export-actions select { flex: 1; min-width: 0; font-size: 14px; min-height: 44px; }
  .export-actions .button { padding-inline: 11px; }
  .data-table th, .data-table td { padding-inline: 12px; }
  .pagination .button { min-height: 44px; font-size: 12px; }
  .batch-panel, .platform-panel, .keyword-panel { padding: 20px 16px; }
  .batch-platforms { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .batch-platforms label { min-height: 46px; font-size: 12px; }
  #batch-keywords { font-size: 16px; }
  .platform-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .platform-item { min-height: 50px; padding: 8px; flex-wrap: wrap; gap: 4px; }
  .platform-item strong { font-size: 12px; }
  .keyword-form { flex-wrap: wrap; }
  .keyword-form .input-group { flex-basis: 100%; }
  .form-actions { width: 100%; justify-content: flex-end; }
  .keyword-selection label { width: 100%; min-height: 44px; }
  .keyword-selection .button { flex: 1; font-size: 12px; }
  .keyword-text { font-size: 12px; }
  .keyword-row { gap: 6px; }
  .row-actions { gap: 2px; }
  .row-actions .button { min-width: 44px; padding-inline: 7px; font-size: 12px; }
  .task-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .task-summary > div { padding: 15px; border-bottom: 1px solid var(--border); }
  .task-summary > div:nth-child(n+5) { border-bottom: 1px solid var(--border); }
  .task-summary > div:nth-child(even) { border-right: 0; }
  .task-summary > div:last-child { border-bottom: 0; }
  .task-summary strong { font-size: 24px; }
  .account-form { grid-template-columns: minmax(0,1fr); padding: 16px; gap: 18px; }
  .account-form > button { margin-top: 0; }
  #account-rows td { min-width: 100px; }
  dialog { padding: 20px; width: calc(100vw - 24px); border-radius: 12px; }
}
