:root {
  --ui-v3-sidebar: 248px;
  --ui-v3-topbar: 72px;
  --ui-v3-ink: #101820;
  --ui-v3-ink-soft: #24343e;
  --ui-v3-cyan: #009aaa;
  --ui-v3-green: #168a62;
  --ui-v3-amber: #c98412;
  --ui-v3-canvas: #f3f6f7;
  --ui-v3-line: #d7e0e4;
  --ui-v3-muted: #687983;
}

body.ui-v3-shell {
  color: var(--ui-v3-ink);
  background-color: var(--ui-v3-canvas) !important;
  background-image:
    linear-gradient(rgba(16, 24, 32, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 32, .035) 1px, transparent 1px) !important;
  background-size: 32px 32px !important;
}

body.ui-v3-shell .app {
  grid-template-columns: var(--ui-v3-sidebar) minmax(0, 1fr);
}

body.ui-v3-shell .sidebar {
  z-index: 110;
  gap: 16px;
  padding: 18px 14px;
  background: #101b23;
  box-shadow: inset -1px 0 0 #2b3a43;
}

body.ui-v3-shell .brand {
  padding: 5px 8px 16px;
  border-color: #30414b;
}

body.ui-v3-shell .brand::before {
  width: 36px;
  height: 3px;
  border-radius: 0;
  background: var(--ui-v3-cyan);
}

body.ui-v3-shell .brand h1 { font-size: 18px; }
body.ui-v3-shell .brand div { color: #8fa4af; font-size: 11px; }
body.ui-v3-shell .ui-v3-original-nav { display: none !important; }

.ui-primary-sidebar {
  display: grid;
  gap: 6px;
}

.ui-primary-module {
  position: relative;
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #b9c7ce;
  background: transparent;
  text-align: left;
  box-shadow: none;
}

.ui-primary-module > span {
  grid-row: 1 / 3;
  align-self: center;
  color: #59717c;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ui-primary-module strong {
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.ui-primary-module small {
  margin-top: 2px;
  color: #6f858f;
  font-size: 10px;
  line-height: 1.3;
}

.ui-primary-module:hover {
  color: #ffffff;
  background: #172832;
  border-color: #2b4552;
  box-shadow: none;
  transform: none;
}

.ui-primary-module.is-active {
  color: #ffffff;
  background: #1a2e38;
  border-color: #315260;
  box-shadow: inset 3px 0 0 var(--ui-v3-cyan);
}

.ui-primary-module.is-active > span { color: #6fd2db; }
.ui-primary-module.is-active small { color: #9db0b9; }

#uiTopShellV3 {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: var(--ui-v3-sidebar);
  height: var(--ui-v3-topbar);
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) max-content;
  align-items: stretch;
  color: #ffffff;
  background: #101820;
  border-bottom: 1px solid #2a3942;
  box-shadow: 0 8px 22px rgba(16, 24, 32, .13);
}

.ui-module-context {
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 0 18px;
  border-right: 1px solid #2a3942;
}

.ui-module-context span {
  color: #6f8793;
  font-size: 9px;
}

.ui-module-context strong {
  font-size: 14px;
  white-space: nowrap;
}

.ui-secondary-nav {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #40515b transparent;
}

.ui-secondary-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: 112px;
  height: var(--ui-v3-topbar);
  padding: 0 14px;
  border: 0;
  border-right: 1px solid #25343d;
  border-radius: 0;
  color: #a7b7bf;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: none;
}

.ui-secondary-tab span {
  display: block;
  margin-bottom: 4px;
  color: #607680;
  font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ui-secondary-tab:hover {
  color: #ffffff;
  background: #172731;
  box-shadow: none;
  transform: none;
}

.ui-secondary-tab.is-active {
  color: #ffffff;
  background: #1a2c36;
}

.ui-secondary-tab.is-active span { color: #6fd2db; }
.ui-secondary-tab.is-active::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  background: var(--ui-v3-cyan);
}

.ui-shell-meta {
  min-width: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: #aabac2;
  border-left: 1px solid #2a3942;
  font-size: 11px;
  white-space: nowrap;
}

.ui-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ui-v3-green);
  box-shadow: 0 0 0 4px rgba(22, 138, 98, .16);
}

body.ui-v3-shell .main {
  min-width: 0;
  padding: calc(var(--ui-v3-topbar) + 24px) 24px 24px;
}

body.ui-v3-shell .main-header,
body.ui-v3-shell .card,
body.ui-v3-shell .panel,
body.ui-v3-shell .section-card,
body.ui-v3-shell .metric-card {
  border-color: var(--ui-v3-line) !important;
  border-radius: 6px !important;
  box-shadow: 0 5px 16px rgba(35, 55, 66, .07) !important;
}

body.ui-v3-shell button,
body.ui-v3-shell input,
body.ui-v3-shell select,
body.ui-v3-shell textarea { border-radius: 5px; }

/* Automation center */
#automationView.ui-automation-workflow.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#automationView .ui-auto-order-1 { order: 1; }
#automationView .ui-auto-order-2 { order: 2; }
#automationView .ui-auto-order-3 { order: 3; }
#automationView .ui-auto-order-4 { order: 4; }
#automationView .ui-auto-order-5 { order: 5; }
#automationView .ui-auto-order-6 { order: 6; }
#automationView .ui-auto-order-7 { order: 7; }
#automationView .ui-auto-order-8 { order: 8; }
#automationView .ui-auto-order-9 { order: 9; }
#automationView .ui-auto-order-10 { order: 10; }
#automationView .ui-auto-order-11 { order: 11; }

.automation-process-nav {
  position: sticky;
  top: calc(var(--ui-v3-topbar) + 8px);
  z-index: 40;
  min-height: 54px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--ui-v3-line);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(24, 41, 50, .09);
}

.automation-process-nav button {
  min-width: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--ui-v3-line);
  border-radius: 0;
  color: #3d4e58;
  background: #ffffff;
  font-weight: 700;
  box-shadow: none;
}

.automation-process-nav button:last-child { border-right: 0; }
.automation-process-nav button:hover { color: var(--ui-v3-cyan); background: #f4fafb; transform: none; box-shadow: none; }
.automation-process-nav button span { color: var(--ui-v3-cyan); font: 800 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }

.ui-automation-stage {
  position: relative;
  scroll-margin-top: calc(var(--ui-v3-topbar) + 78px);
  padding-top: 48px !important;
}

.ui-automation-stage::before {
  content: attr(data-stage-label);
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #30434d;
  background: #edf4f6;
  border-bottom: 1px solid var(--ui-v3-line);
  font-size: 12px;
  font-weight: 800;
}

#automationView:not(.active) .ui-automation-stage::before {
  content: none;
}

#automationView .automation-hero {
  border-left: 4px solid var(--ui-v3-cyan) !important;
  background: #ffffff !important;
}

#automationView .automation-hero h3 { max-width: 760px; }
#automationView .automation-hero p { max-width: 900px; color: var(--ui-v3-muted); }
#automationView .automation-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#automationTrendList.trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.opportunity-track-field { gap: 8px; }

.opportunity-track-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.opportunity-track-options .check-row {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ui-v3-line);
  border-radius: 6px;
  background: #f8fafb;
}

.opportunity-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.opportunity-card {
  min-height: 370px;
  border-top: 3px solid #1593a5;
  background: #fff;
}

.opportunity-card[data-opportunity="exhibition"] { border-top-color: #a56a16; }
.opportunity-card[data-opportunity="university"] { border-top-color: #2f6fb3; }
.opportunity-card[data-opportunity="travel"] { border-top-color: #168263; }

.opportunity-badges,
.opportunity-keywords {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.opportunity-type,
.opportunity-evidence,
.opportunity-keywords span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--ui-v3-line);
  border-radius: 4px;
  color: #47606c;
  background: #f2f6f7;
  font-size: 10px;
  font-weight: 800;
}

.opportunity-type { color: #075b68; border-color: #9bcbd2; background: #ebf8fa; }
.opportunity-evidence { color: #7a5413; border-color: #e3c78f; background: #fff9eb; }
.opportunity-keywords strong { margin-right: 2px; color: var(--ui-v3-muted); font-size: 11px; }
.opportunity-summary { min-height: 48px; }

.opportunity-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.opportunity-facts div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #dce6ea;
  border-radius: 5px;
  background: #f8fafb;
}

.opportunity-facts dt {
  margin-bottom: 4px;
  color: #6b7d86;
  font-size: 10px;
  font-weight: 800;
}

.opportunity-facts dd {
  margin: 0;
  color: #243c46;
  font-size: 12px;
  line-height: 1.45;
}

.trend-score small {
  display: block;
  font-size: 8px;
  font-weight: 700;
}

.radar-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.radar-evidence-filter {
  display: inline-flex;
  padding: 3px;
  background: #eef3f5;
  border: 1px solid var(--ui-v3-line);
  border-radius: 6px;
}

.radar-evidence-filter button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  color: #5c6e78;
  background: transparent;
  box-shadow: none;
  font-size: 11px;
}

.radar-evidence-filter button:hover,
.radar-evidence-filter button.active {
  color: #ffffff;
  background: var(--ui-v3-ink-soft);
  transform: none;
  box-shadow: none;
}

.format-evidence {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--ui-v3-line);
  border-radius: 4px;
  color: #536670;
  background: #f4f7f8;
  font-size: 10px;
  font-weight: 800;
}

.format-evidence.verified { color: #126b4e; border-color: #9fd1bf; background: #edf8f4; }
.format-evidence.candidate { color: #8a5a08; border-color: #e5c889; background: #fff8e8; }
.format-score-label { color: var(--ui-v3-muted); font-size: 10px; }

.platform-watch-labels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.academic-calendar-section {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid #cfd9dd;
  border-radius: 6px;
  background: #f7f9fa;
}

.academic-calendar-heading,
.academic-region-head,
.academic-window-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.academic-calendar-heading {
  margin-bottom: 12px;
}

.academic-calendar-kicker {
  display: block;
  margin-bottom: 2px;
  color: #4b626d;
  font-size: 10px;
  font-weight: 800;
}

.academic-calendar-heading h4 {
  margin: 0;
  color: #17252d;
  font-size: 15px;
}

.academic-calendar-note {
  color: #697b84;
  font-size: 11px;
}

.university-calendar-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.academic-region-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d4dee2;
  border-top: 3px solid #178273;
  border-radius: 6px;
  background: #ffffff;
}

.academic-region-card[data-region="north_america"] { border-top-color: #2e66b1; }
.academic-region-card[data-region="australia"] { border-top-color: #b47716; }

.academic-region-head {
  align-items: flex-start;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8eb;
}

.academic-region-head > div {
  min-width: 0;
}

.academic-region-label {
  display: block;
  margin-bottom: 4px;
  color: #14262f;
  font-size: 15px;
  font-weight: 900;
}

.academic-region-head strong {
  display: block;
  color: #667983;
  font-size: 10px;
  line-height: 1.45;
}

.academic-source-state,
.opportunity-region {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #cad7dc;
  border-radius: 4px;
  color: #526872;
  background: #f3f6f7;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.academic-source-state.official {
  color: #126b4e;
  border-color: #9fd1bf;
  background: #edf8f4;
}

.opportunity-region {
  color: #205c91;
  border-color: #b6cee4;
  background: #eef5fb;
}

.academic-window-list {
  display: grid;
  gap: 8px;
  padding-top: 10px;
}

.academic-window-row {
  align-items: flex-start;
  min-height: 50px;
}

.academic-window-row > div:first-child {
  min-width: 0;
}

.academic-window-row strong,
.academic-window-row span {
  display: block;
}

.academic-window-row > div:first-child strong {
  color: #21343d;
  font-size: 12px;
}

.academic-window-row > div:first-child span {
  margin-top: 3px;
  color: #71828a;
  font-size: 10px;
  line-height: 1.35;
}

.academic-reminder {
  flex: 0 0 112px;
  padding: 6px 7px;
  border-left: 3px solid #7a8b93;
  background: #f3f6f7;
}

.academic-reminder strong {
  color: #324852;
  font-size: 10px;
}

.academic-reminder span {
  margin-top: 2px;
  color: #6b7b83;
  font-size: 9px;
  line-height: 1.35;
}

.academic-reminder.active { border-left-color: #178273; background: #edf8f4; }
.academic-reminder.focus { border-left-color: #2e66b1; background: #eef5fb; }
.academic-reminder.urgent { border-left-color: #b54b35; background: #fff2ef; }
.academic-reminder.future { border-left-color: #b47716; background: #fff8ea; }

.academic-exact-row {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #a9d6c6;
  border-radius: 4px;
  background: #eff9f5;
}

.academic-exact-row span,
.academic-exact-row strong,
.academic-exact-row p {
  display: block;
}

.academic-exact-row span { color: #33715e; font-size: 9px; font-weight: 800; }
.academic-exact-row strong { margin-top: 2px; color: #183d31; font-size: 11px; }
.academic-exact-row p { margin: 4px 0 0; color: #527267; font-size: 10px; line-height: 1.4; }

.academic-region-foot {
  margin: 10px 0 0;
  color: #7a6a42;
  font-size: 9px;
  line-height: 1.4;
}

.outbound-flow-radar {
  border-top: 3px solid #0c7e8d !important;
}

.outbound-flow-title-actions,
.outbound-flow-status,
.outbound-flow-status-main,
.outbound-flow-block-title,
.outbound-flow-row > div:first-child {
  display: flex;
  align-items: center;
}

.outbound-flow-title-actions { gap: 12px; }
.outbound-flow-title-actions > span { color: var(--ui-v3-muted); font-size: 11px; }

.outbound-flow-status {
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #c9d9de;
  border-left: 3px solid #0c7e8d;
  background: #f4f9fa;
}

.outbound-flow-status-main { gap: 9px; min-width: 0; }
.outbound-flow-status-main strong { font-size: 12px; }
.outbound-flow-status > span { color: var(--ui-v3-muted); font-size: 10px; white-space: nowrap; }

.outbound-flow-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.outbound-flow-metrics article {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d7e0e4;
  border-top: 2px solid #2c6e9b;
  background: #fff;
}

.outbound-flow-metrics article:nth-child(2) { border-top-color: #168a62; }
.outbound-flow-metrics article:nth-child(3) { border-top-color: #c98412; }
.outbound-flow-metrics article:nth-child(4) { border-top-color: #865b98; }
.outbound-flow-metrics span,
.outbound-flow-metrics small { display: block; color: var(--ui-v3-muted); font-size: 10px; }
.outbound-flow-metrics strong { display: block; margin: 5px 0 3px; color: #10212b; font-size: 24px; line-height: 1; }

.outbound-flow-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.outbound-flow-block {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d7e0e4;
  background: #fbfcfc;
}

.outbound-flow-block-title { justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid #e1e7e9; }
.outbound-flow-block-title h4 { margin: 0; font-size: 13px; }
.outbound-flow-block-title span { color: var(--ui-v3-muted); font-size: 9px; }
.outbound-region-list,
.outbound-airport-list { display: grid; gap: 7px; margin-top: 9px; }

.outbound-flow-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) minmax(80px, 1fr) 64px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.outbound-flow-row > div:first-child { justify-content: space-between; gap: 8px; min-width: 0; }
.outbound-flow-row strong { min-width: 0; overflow: hidden; color: #22343e; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.outbound-flow-row strong em { margin-right: 7px; color: #76909c; font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; font-style: normal; }
.outbound-flow-row span { flex: none; color: var(--ui-v3-muted); font-size: 9px; }
.outbound-flow-row b { color: #183441; font-size: 11px; text-align: right; }

.outbound-flow-bar { height: 5px; overflow: hidden; background: #e3eaed; }
.outbound-flow-bar i { display: block; height: 100%; background: #0c7e8d; }
.region-north-america .outbound-flow-bar i { background: #2e66b1; }
.region-australia .outbound-flow-bar i { background: #bd7811; }
.region-asia .outbound-flow-bar i { background: #168a62; }
.region-middle-east .outbound-flow-bar i { background: #865b98; }
.region-africa .outbound-flow-bar i { background: #a8583e; }
.region-south-america .outbound-flow-bar i { background: #567b48; }
.airport-row .outbound-flow-bar i { background: #2c6e9b; }

.outbound-route-table { margin-top: 12px; }
.outbound-route-table table { min-width: 680px; }
.outbound-route-table th,
.outbound-route-table td { padding-top: 8px; padding-bottom: 8px; }
.outbound-flow-disclaimer {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 3px solid #c98412;
  color: #6b5a35;
  background: #fff9ed;
  font-size: 10px;
}

@media (min-width: 901px) and (max-width: 1080px) {
  :root { --ui-v3-sidebar: 230px; }
  #uiTopShellV3 { grid-template-columns: 132px minmax(0, 1fr); }
  .ui-shell-meta { display: none; }
  .ui-secondary-tab { min-width: 102px; padding: 0 10px; }
}

@media (max-width: 900px) {
  body.ui-v3-shell .app { grid-template-columns: minmax(0, 1fr); }
  body.ui-v3-shell .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }
  .ui-primary-sidebar {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .ui-primary-module {
    flex: 0 0 150px;
    min-height: 56px;
  }
  #uiTopShellV3 {
    position: sticky;
    grid-column: 1;
    top: 0;
    right: auto;
    left: auto;
    width: 100%;
    height: 64px;
    grid-template-columns: 124px minmax(0, 1fr);
  }
  .ui-module-context { padding: 0 12px; }
  .ui-secondary-tab { height: 64px; min-width: 98px; padding: 0 10px; font-size: 12px; }
  .ui-shell-meta { display: none; }
  body.ui-v3-shell .main { padding: 16px; }
  .automation-process-nav { top: 70px; display: flex; overflow-x: auto; }
  .automation-process-nav button { flex: 0 0 134px; }
  #automationView .automation-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body.ui-v3-shell .side-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ui-primary-module { flex-basis: 138px; }
  #uiTopShellV3 { grid-template-columns: 112px minmax(0, 1fr); }
  .ui-module-context strong { font-size: 12px; }
  #automationView .automation-stats { grid-template-columns: minmax(0, 1fr); }
  .automation-process-nav button { flex-basis: 122px; font-size: 11px; }
  .radar-title-actions { align-items: stretch; justify-content: flex-start; }
  .radar-evidence-filter { width: 100%; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-primary-module,
  .ui-secondary-tab,
  .automation-process-nav button { transition: none; }
}
