/*
 * KG Channel Intelligence OS V10.1 — Premium UI
 * Presentation-only refinement layered after V10.
 * No application behavior, data contract, network call or permission is changed.
 */

:root {
  --kgp-radius-sm: 9px;
  --kgp-radius-md: 13px;
  --kgp-radius-lg: 18px;
  --kgp-focus: 0 0 0 3px rgba(91, 140, 255, 0.22);
}

html[data-kg-theme="dark"] {
  --kgp-bg: #07101d;
  --kgp-bg-elevated: #0a1524;
  --kgp-surface: #0f1c2e;
  --kgp-surface-raised: #132238;
  --kgp-surface-soft: #17283f;
  --kgp-line: #263b59;
  --kgp-line-strong: #365272;
  --kgp-text: #eef5ff;
  --kgp-text-soft: #c8d6e8;
  --kgp-muted: #94a9c2;
  --kgp-faint: #7086a1;
  --kgp-accent: #5b8cff;
  --kgp-accent-2: #8b6cff;
  --kgp-success: #42d3a0;
  --kgp-warning: #f4c65d;
  --kgp-danger: #ff8095;
  --kgp-shadow:
    0 1px 0 rgba(255, 255, 255, 0.025), 0 18px 48px rgba(0, 0, 0, 0.22);
}

html[data-kg-theme="light"] {
  --kgp-bg: #f3f6fb;
  --kgp-bg-elevated: #f8faff;
  --kgp-surface: #ffffff;
  --kgp-surface-raised: #f7f9fd;
  --kgp-surface-soft: #eef3fb;
  --kgp-line: #dce4ef;
  --kgp-line-strong: #c7d3e2;
  --kgp-text: #172033;
  --kgp-text-soft: #35445a;
  --kgp-muted: #66768c;
  --kgp-faint: #8391a4;
  --kgp-accent: #376fe8;
  --kgp-accent-2: #7559e8;
  --kgp-success: #168a67;
  --kgp-warning: #a96a08;
  --kgp-danger: #c03b50;
  --kgp-shadow:
    0 1px 2px rgba(20, 38, 63, 0.04), 0 14px 38px rgba(31, 51, 79, 0.08);
}

/* Clearer application proportions and typography */
.shell {
  grid-template-columns: 272px minmax(0, 1fr);
}

.mainContent {
  max-width: 1660px;
  padding: 28px 34px 72px;
  font-size: 14px;
  line-height: 1.5;
}

.mainContent :where(h1, h2, h3, h4) {
  text-wrap: balance;
}

.pageHeader {
  margin-bottom: 22px;
}

.pageHeader h1 {
  font-size: clamp(28px, 2vw, 36px);
  line-height: 1.12;
}

.sectionTitle {
  margin: 26px 0 13px;
}

.card {
  border-radius: var(--kgp-radius-lg);
}

html[data-kg-theme="dark"] body {
  background:
    radial-gradient(
      circle at 74% -14%,
      rgba(91, 140, 255, 0.13),
      transparent 34%
    ),
    radial-gradient(
      circle at 48% -18%,
      rgba(139, 108, 255, 0.08),
      transparent 30%
    ),
    var(--kgp-bg);
}

html[data-kg-theme="dark"] .mainContent {
  color: var(--kgp-text);
}

html[data-kg-theme="dark"] .mainContent :where(p, li, dd) {
  color: var(--kgp-text-soft);
}

html[data-kg-theme="dark"] .mainContent :where(small, .muted) {
  color: var(--kgp-muted);
}

/* Refined left navigation */
html[data-kg-theme="dark"] .sidebar {
  padding: 22px 16px 18px;
  background:
    radial-gradient(
      circle at 10% 0%,
      rgba(91, 140, 255, 0.13),
      transparent 28%
    ),
    linear-gradient(180deg, #07111f 0%, #081321 58%, #070e19 100%);
  border-right: 1px solid rgba(94, 126, 169, 0.2);
  box-shadow: 18px 0 48px rgba(0, 0, 0, 0.18);
}

.brand {
  padding: 2px 5px 18px;
}

.brandMark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.brand b {
  font-size: 13px;
}

.brand span {
  font-size: 10px;
  line-height: 1.35;
}

.sidebar nav {
  gap: 5px;
  margin-top: 18px;
}

.sidebar nav a,
.sidebarNavButton,
.channelNavToggle {
  min-height: 42px;
  border-radius: 10px;
  font-size: 13px;
}

html[data-kg-theme="dark"] .sidebar nav a.active,
html[data-kg-theme="dark"] .sidebarNavButton.active {
  border: 1px solid rgba(103, 145, 255, 0.25);
  background: linear-gradient(
    90deg,
    rgba(91, 140, 255, 0.24),
    rgba(139, 108, 255, 0.1)
  );
  box-shadow:
    inset 3px 0 #5b8cff,
    0 8px 24px rgba(0, 0, 0, 0.12);
}

html[data-kg-theme="dark"] .channelNavTree {
  margin-left: 14px;
  padding-left: 10px;
}

html[data-kg-theme="dark"] .channelToolLinks a,
html[data-kg-theme="dark"] .allChannelsLink {
  min-height: 34px;
  color: #9fb1c8;
  font-size: 12px;
}

/* Premium controls */
html[data-kg-theme="dark"] :where(input, select, textarea) {
  min-height: 40px;
  color: var(--kgp-text) !important;
  background: #101e31 !important;
  border: 1px solid var(--kgp-line-strong) !important;
  border-radius: var(--kgp-radius-sm);
}

html[data-kg-theme="dark"]
  :where(input, select, textarea):hover:not(:disabled) {
  border-color: #47698f !important;
}

html[data-kg-theme="dark"] :where(input, select, textarea):focus {
  border-color: var(--kgp-accent) !important;
  box-shadow: var(--kgp-focus) !important;
}

html[data-kg-theme="dark"] :where(input, select, textarea):disabled {
  color: #8495aa !important;
  background: #101a2a !important;
  border-color: #28394f !important;
  opacity: 0.78;
}

html[data-kg-theme="dark"] :where(button, .button) {
  min-height: 40px;
  border-radius: var(--kgp-radius-sm);
  letter-spacing: 0;
}

html[data-kg-theme="dark"]
  :where(button, .button):not(
    .secondary,
    .sidebarNavButton,
    .channelNavToggle,
    .v10ThemeToggle,
    .accountPasswordLink
  ) {
  background: linear-gradient(135deg, #315fc7, #6848d6);
  border: 1px solid rgba(151, 176, 255, 0.28);
  box-shadow: 0 8px 22px rgba(63, 104, 213, 0.2);
}

html[data-kg-theme="dark"] :where(button, .button).secondary {
  color: #d5e0ee !important;
  background: #16253a !important;
  border: 1px solid #304964 !important;
}

html[data-kg-theme="dark"]
  :where(button, .button).secondary:hover:not(:disabled) {
  color: #ffffff !important;
  background: #1b2f49 !important;
  border-color: #49698d !important;
}

/* Consistent premium surfaces missed by the first V10 theme layer */
html[data-kg-theme="dark"]
  .mainContent
  :where(
    .v912IdeaScheduler,
    .v912ProductionSchedule,
    .v912ScheduleGroup,
    .v983SeoPack,
    .v982KeywordList,
    .v983SeoScopeNote
  ) {
  color: var(--kgp-text);
}

/* Idea scheduler — exact repair for the screen reported by the Owner */
html[data-kg-theme="dark"] .v912IdeaScheduler {
  position: relative;
  overflow: hidden;
  margin: 20px 0 10px;
  padding: 22px;
  border: 1px solid var(--kgp-line) !important;
  border-radius: var(--kgp-radius-lg);
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(91, 140, 255, 0.11),
      transparent 28%
    ),
    linear-gradient(180deg, #101d30 0%, #0d1929 100%) !important;
  box-shadow: var(--kgp-shadow);
}

html[data-kg-theme="dark"] .v912IdeaScheduler::before {
  position: absolute;
  top: 0;
  right: 24px;
  left: 24px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(117, 156, 255, 0.72),
    rgba(139, 108, 255, 0.48),
    transparent
  );
  content: "";
}

.v912IdeaSchedulerHead {
  align-items: flex-start;
  gap: 22px;
}

.v912IdeaSchedulerHead > div:first-child {
  gap: 3px;
}

html[data-kg-theme="dark"] .v912IdeaSchedulerHead small {
  color: #7ea8ff !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[data-kg-theme="dark"] .v912IdeaSchedulerHead b {
  color: #f4f8ff !important;
  font-size: 18px;
  line-height: 1.35;
}

html[data-kg-theme="dark"] .v912IdeaSchedulerHead p {
  max-width: 900px;
  margin-top: 3px;
  color: #9fb2c9 !important;
  font-size: 13px;
  line-height: 1.55;
}

html[data-kg-theme="dark"] .v912IdeaSchedulerHead .buttonRow {
  flex: 0 0 auto;
  gap: 8px;
}

html[data-kg-theme="dark"] .v912IdeaSchedulerHead .button {
  min-height: 38px;
  padding: 8px 13px;
  white-space: nowrap;
}

html[data-kg-theme="dark"] .v912BatchControls {
  grid-template-columns: minmax(190px, 0.75fr) minmax(300px, 1.45fr) auto;
  gap: 12px;
  margin: 18px 0 14px;
  padding: 14px;
  border: 1px solid #263b58;
  border-radius: 14px;
  background: rgba(8, 18, 31, 0.64);
}

html[data-kg-theme="dark"] .v912BatchControls label {
  gap: 7px;
}

html[data-kg-theme="dark"] .v912BatchControls label > span {
  color: #a9bad0 !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

html[data-kg-theme="dark"] .v912BatchControls :where(input, select) {
  min-height: 42px;
  padding: 9px 12px;
}

html[data-kg-theme="dark"] .v912BatchControls > button {
  min-width: 164px;
  min-height: 42px;
}

html[data-kg-theme="dark"] .v912Warning {
  margin: 10px 0;
  padding: 11px 13px;
  color: #f7d575 !important;
  background: rgba(244, 198, 93, 0.09) !important;
  border: 1px solid rgba(244, 198, 93, 0.3) !important;
  border-radius: 11px;
  font-size: 13px;
}

html[data-kg-theme="dark"] .v912IdeaTableWrap {
  overflow: auto;
  margin-top: 14px;
  border: 1px solid #2b405e !important;
  border-radius: 14px;
  background: #0b1626 !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.02);
}

html[data-kg-theme="dark"] .v912IdeaTable {
  color: var(--kgp-text);
}

html[data-kg-theme="dark"] .v912IdeaTable th {
  top: 0;
  height: 43px;
  padding: 10px 12px;
  color: #9fb2cb !important;
  background: #0b1727 !important;
  border-bottom: 1px solid #314765 !important;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

html[data-kg-theme="dark"] .v912IdeaTable td {
  padding: 10px 12px;
  color: #d9e5f3 !important;
  background: #0f1c2e !important;
  border-bottom: 1px solid #263a55 !important;
  vertical-align: middle;
}

html[data-kg-theme="dark"] .v912IdeaTable tbody tr:nth-child(even) td {
  background: #111f32 !important;
}

html[data-kg-theme="dark"] .v912IdeaTable tbody tr:hover td {
  background: #172b44 !important;
}

html[data-kg-theme="dark"] .v912IdeaTable tbody tr.isSelected td {
  background: rgba(67, 108, 190, 0.22) !important;
  border-bottom-color: rgba(105, 149, 231, 0.34) !important;
}

html[data-kg-theme="dark"] .v912IdeaTable tbody tr.isSelected td:first-child {
  box-shadow: inset 3px 0 #5b8cff;
}

html[data-kg-theme="dark"] .v912IdeaTable td b {
  color: #eff5ff !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.42;
}

html[data-kg-theme="dark"] .v912IdeaTable td small {
  margin-top: 4px;
  color: #8fa6c0 !important;
  font-size: 11px;
}

html[data-kg-theme="dark"] .v912IdeaTable td:nth-child(3) {
  color: #8cb1ff !important;
  font-variant-numeric: tabular-nums;
}

html[data-kg-theme="dark"] .v912IdeaTable :where(input, select) {
  min-height: 38px;
  padding: 7px 10px;
  background: #13243a !important;
  border-color: #385471 !important;
  font-size: 12px;
}

html[data-kg-theme="dark"] .v912IdeaTable input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--kgp-accent);
}

html[data-kg-theme="dark"] .v912IdeaFooter {
  gap: 14px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #263b58;
  border-radius: 13px;
  background: rgba(8, 18, 31, 0.68);
}

html[data-kg-theme="dark"] .v912IdeaFooter > span {
  color: #9fb1c8;
  font-size: 12px;
  font-weight: 700;
}

html[data-kg-theme="dark"] .v912IdeaFooter .button {
  min-width: 190px;
}

html[data-kg-theme="dark"] .v912InlineMessage {
  color: #a9edd3 !important;
  background: rgba(66, 211, 160, 0.09) !important;
  border: 1px solid rgba(66, 211, 160, 0.26) !important;
}

html[data-kg-theme="dark"] .v983SeoScopeNote {
  display: block;
  margin: 12px 2px 0;
  color: #869bb6 !important;
  line-height: 1.55;
}

/* SEO branch directly below the idea scheduler */
html[data-kg-theme="dark"] .v983SeoPack {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--kgp-line) !important;
  border-radius: 16px;
  background: linear-gradient(180deg, #101d2f, #0d1929) !important;
  box-shadow: var(--kgp-shadow);
}

html[data-kg-theme="dark"] .v983SeoPackHead {
  gap: 16px;
}

html[data-kg-theme="dark"] .v983SeoPackHead small {
  color: #7ea8ff !important;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

html[data-kg-theme="dark"] .v983SeoPackHead b {
  color: #eef5ff !important;
  font-size: 15px;
}

html[data-kg-theme="dark"] .v983SeoPreview > div,
html[data-kg-theme="dark"] .v983SeoDetails {
  color: var(--kgp-text);
  background: #132238 !important;
  border-color: #2a405e !important;
}

/* Make light mode equally coherent when the Owner switches themes */
html[data-kg-theme="light"] body {
  color: var(--kgp-text);
  background:
    radial-gradient(
      circle at 82% -10%,
      rgba(55, 111, 232, 0.08),
      transparent 30%
    ),
    var(--kgp-bg);
}

html[data-kg-theme="light"] .mainContent {
  color: var(--kgp-text);
}

html[data-kg-theme="light"] .card,
html[data-kg-theme="light"] .dataTable,
html[data-kg-theme="light"] .v912IdeaScheduler,
html[data-kg-theme="light"] .v983SeoPack {
  background: var(--kgp-surface) !important;
  border-color: var(--kgp-line) !important;
  box-shadow: var(--kgp-shadow);
}

html[data-kg-theme="light"] .v912IdeaScheduler {
  padding: 22px;
  border-radius: var(--kgp-radius-lg);
}

html[data-kg-theme="light"] .v912IdeaSchedulerHead small,
html[data-kg-theme="light"] .v983SeoPackHead small {
  color: var(--kgp-accent) !important;
}

html[data-kg-theme="light"] .v912IdeaSchedulerHead b,
html[data-kg-theme="light"] .v912IdeaTable td b,
html[data-kg-theme="light"] .v983SeoPackHead b {
  color: var(--kgp-text) !important;
}

html[data-kg-theme="light"] .v912IdeaSchedulerHead p,
html[data-kg-theme="light"] .v912IdeaTable td small,
html[data-kg-theme="light"] .v983SeoScopeNote {
  color: var(--kgp-muted) !important;
}

html[data-kg-theme="light"] .v912BatchControls,
html[data-kg-theme="light"] .v912IdeaFooter {
  padding: 14px;
  border: 1px solid var(--kgp-line);
  border-radius: 14px;
  background: var(--kgp-surface-raised);
}

html[data-kg-theme="light"] .v912IdeaTableWrap {
  border-color: var(--kgp-line) !important;
  border-radius: 14px;
  background: #fff !important;
}

html[data-kg-theme="light"] .v912IdeaTable th {
  color: #63738a;
  background: #f2f5fa !important;
  border-color: #d9e2ee !important;
}

html[data-kg-theme="light"] .v912IdeaTable td {
  color: var(--kgp-text-soft);
  background: #fff !important;
  border-color: #e2e8f1 !important;
}

html[data-kg-theme="light"] .v912IdeaTable tbody tr:nth-child(even) td {
  background: #f8fafd !important;
}

html[data-kg-theme="light"] .v912IdeaTable tbody tr:hover td {
  background: #eef4ff !important;
}

html[data-kg-theme="light"] .v912IdeaTable tbody tr.isSelected td {
  background: #eaf1ff !important;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .mainContent {
    padding: 24px 24px 64px;
  }

  html[data-kg-theme="dark"] .v912BatchControls {
    grid-template-columns: 1fr 1fr;
  }

  html[data-kg-theme="dark"] .v912BatchControls > button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .mainContent {
    padding: 20px 14px 56px;
  }

  html[data-kg-theme="dark"] .v912IdeaScheduler,
  html[data-kg-theme="light"] .v912IdeaScheduler {
    padding: 15px;
    border-radius: 15px;
  }

  .v912IdeaSchedulerHead,
  .v912IdeaFooter {
    align-items: stretch;
  }

  html[data-kg-theme="dark"] .v912IdeaSchedulerHead .buttonRow {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  html[data-kg-theme="dark"] .v912BatchControls {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  html[data-kg-theme="dark"] .v912BatchControls > button {
    grid-column: auto;
    width: 100%;
  }

  html[data-kg-theme="dark"] .v912IdeaFooter .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v912IdeaTable tbody tr,
  .v912IdeaScheduler,
  .v983SeoPack {
    transition: none !important;
  }
}
