:root {
  color-scheme: light;
  --navy: #011e41;
  --navy-2: #092c54;
  --red: #eb0045;
  --cyan: #12a9c6;
  --green: #16845b;
  --amber: #c67b14;
  --paper: #f3f6f9;
  --white: #fff;
  --ink: #122238;
  --muted: #69798c;
  --line: #dce3ea;
  --shadow: 0 16px 42px rgba(1, 30, 65, 0.1);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, Montserrat, Arial, Helvetica, sans-serif;
  font-size: 17px;
  letter-spacing: 0;
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

a { color: inherit; }

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow.light { color: #8be1ed; }

/* Login */
.login-page {
  display: grid;
  min-height: 100vh;
  padding: clamp(16px, 3vw, 50px);
  background: #e8edf3;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(460px, 0.8fr);
  width: min(1560px, 100%);
  min-height: min(880px, calc(100vh - clamp(32px, 6vw, 100px)));
  margin: auto;
  overflow: hidden;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(1, 30, 65, 0.18);
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 680px;
  padding: clamp(42px, 6vw, 92px);
  overflow: hidden;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    var(--navy);
  background-size: 44px 44px;
}

.login-brand::after {
  content: "";
  position: absolute;
  right: -180px;
  bottom: -240px;
  width: 620px;
  height: 620px;
  border: 130px solid var(--red);
  border-radius: 50%;
  opacity: 0.92;
}

.login-logo {
  position: relative;
  z-index: 1;
  width: min(380px, 65%);
  padding: 20px 24px;
  background: var(--white);
}

.login-brand-copy { position: relative; z-index: 1; max-width: 750px; }

.login-brand h1 {
  margin: 0;
  font-size: clamp(46px, 5vw, 82px);
  line-height: 0.98;
  font-weight: 800;
}

.login-brand-copy > p:last-child {
  max-width: 620px;
  margin: 28px 0 0;
  color: #c6d4e4;
  font-size: clamp(19px, 1.5vw, 25px);
  line-height: 1.5;
}

.login-version { position: relative; z-index: 1; color: #94a9c0; font-weight: 700; }

.login-form-panel { display: grid; place-items: center; padding: clamp(38px, 6vw, 90px); }

.login-form { display: grid; gap: 28px; width: min(470px, 100%); }

.login-form h2 { margin: 0; color: var(--navy); font-size: clamp(38px, 3vw, 54px); line-height: 1.05; }

.login-form label { display: grid; gap: 10px; color: var(--navy); font-weight: 700; }

.login-form input {
  width: 100%;
  height: 64px;
  padding: 0 18px;
  color: var(--ink);
  background: #f7f9fb;
  border: 2px solid var(--line);
  border-radius: 5px;
  outline: 0;
}

.login-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(18, 169, 198, 0.14); }

.password-field { position: relative; display: block; }

.password-field input { padding-right: 112px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 14px;
  padding: 8px;
  color: var(--navy);
  background: transparent;
  border: 0;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 800;
}

.primary-button {
  min-height: 66px;
  padding: 16px 24px;
  color: var(--white);
  background: var(--red);
  border: 0;
  border-radius: 5px;
  font-size: 19px;
  font-weight: 800;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover { background: #c9003b; }
.primary-button:active { transform: translateY(1px); }

.security-note { margin: -8px 0 0; color: var(--muted); font-size: 14px; text-align: center; }

.form-error { padding: 14px 16px; color: #8e0d30; background: #fff0f4; border-left: 4px solid var(--red); font-weight: 700; }

/* Application shell */
.app-shell { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: var(--white);
  background: var(--navy);
  box-shadow: 12px 0 38px rgba(1, 30, 65, 0.12);
}

.brand {
  display: block;
  padding: 40px 34px 32px;
  color: #aebed0;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand img { width: 224px; padding: 13px 14px; background: var(--white); }
.brand span { display: block; margin-top: 14px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.side-nav { flex: 1; padding: 26px 18px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 14px 16px;
  color: #dbe6f2;
  text-decoration: none;
  border-left: 4px solid transparent;
  border-radius: 4px;
}

.nav-item.active { color: var(--white); background: rgba(255,255,255,.1); border-left-color: var(--red); }
.nav-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #fff; background: var(--red); border-radius: 4px; font-size: 26px; }
.nav-item strong, .nav-item small { display: block; }
.nav-item strong { font-size: 18px; }
.nav-item small { margin-top: 3px; color: #91a7bf; font-size: 13px; }

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.user-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-block strong, .user-block small { display: block; }
.user-block small { margin-top: 3px; color: #91a7bf; font-size: 12px; }
.avatar { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; background: var(--cyan); border-radius: 50%; font-size: 20px; font-weight: 800; }
.logout-button { width: 42px; height: 42px; color: #c6d4e4; background: rgba(255,255,255,.08); border: 0; border-radius: 4px; font-size: 22px; }
.logout-button:hover { color: white; background: var(--red); }

.workspace { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 130px;
  padding: 25px clamp(28px, 4vw, 70px);
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.breadcrumb { margin: 0 0 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.topbar h1 { margin: 0; color: var(--navy); font-size: clamp(34px, 3vw, 48px); line-height: 1; }
.updated { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.updated small, .updated strong { display: block; }
.updated small { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.updated strong { font-size: 15px; }
.live-dot { width: 12px; height: 12px; background: var(--green); border: 3px solid #d7f2e7; border-radius: 50%; box-sizing: content-box; }
.menu-button { display: none; }

.content { padding: clamp(28px, 4vw, 64px) clamp(24px, 4vw, 70px) 80px; }

.summary-strip {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  margin-bottom: 34px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.summary-strip > div { display: flex; align-items: center; gap: 18px; min-height: 116px; padding: 24px 30px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip strong { color: var(--navy); font-size: clamp(34px, 3vw, 52px); line-height: 1; }
.summary-strip span { color: var(--muted); font-size: 14px; line-height: 1.35; }
.summary-strip .summary-primary { color: var(--white); background: var(--navy); }
.summary-strip .summary-primary strong { color: var(--white); }
.summary-strip .summary-primary span { color: #b7c7d8; }

.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.search-box { position: relative; display: block; width: min(500px, 100%); }
.search-box > span { position: absolute; top: 50%; left: 18px; color: var(--navy); transform: translateY(-52%); font-size: 28px; }
.search-box input { width: 100%; height: 58px; padding: 0 18px 0 52px; background: var(--white); border: 2px solid var(--line); border-radius: 4px; outline: 0; }
.search-box input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(18,169,198,.12); }

.filters { display: flex; gap: 6px; padding: 5px; overflow-x: auto; background: #e7ecf1; border-radius: 5px; }
.filter-button { min-height: 48px; padding: 9px 15px; white-space: nowrap; color: #526174; background: transparent; border: 0; border-radius: 3px; font-size: 13px; font-weight: 800; }
.filter-button span { display: inline-grid; place-items: center; min-width: 25px; height: 25px; margin-left: 5px; padding: 0 6px; background: rgba(1,30,65,.08); border-radius: 3px; }
.filter-button.active { color: var(--white); background: var(--navy); box-shadow: 0 5px 12px rgba(1,30,65,.2); }
.filter-button.active span { background: rgba(255,255,255,.16); }

.catalog-meta { display: flex; justify-content: space-between; margin: 24px 0 16px; color: var(--muted); font-size: 13px; }
.catalog-meta p { margin: 0; }
.catalog-meta strong { color: var(--navy); }

.competitor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }

.competitor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 510px;
  padding: 26px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(1,30,65,.07);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.competitor-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(1,30,65,.13); }
.competitor-card[data-threat="critical"] { border-top-color: var(--red); }
.competitor-card[data-threat="high"] { border-top-color: #f25d32; }
.competitor-card[data-threat="medium"] { border-top-color: var(--amber); }

.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rank { color: var(--navy); font-size: 15px; font-weight: 900; }
.confidence { padding: 7px 9px; color: #536375; background: #edf1f5; border-radius: 3px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.confidence-a { color: #096346; background: #ddf4eb; }
.confidence-b { color: #80540d; background: #fff0cd; }

.card-identity { display: grid; grid-template-columns: 76px minmax(0,1fr); align-items: center; gap: 16px; min-height: 116px; margin-top: 18px; }
.company-mark { display: grid; place-items: center; width: 76px; height: 76px; color: var(--navy); background: #e8eef4; border: 1px solid #cfdae5; border-radius: 5px; font-size: 24px; font-weight: 900; }
.mark-critical { color: #a1002f; background: #fff0f4; border-color: #f7c1d1; }
.mark-high { color: #aa3719; background: #fff0eb; border-color: #f4c9bd; }
.mark-medium { color: #84580f; background: #fff4d9; border-color: #ead49e; }
.company-mark.large { width: 92px; height: 92px; flex: 0 0 92px; color: var(--navy); background: var(--white); border: 0; font-size: 29px; }
.brand-name { margin: 0 0 6px; color: var(--red); font-size: 14px; font-weight: 900; }
.card-identity h2 { margin: 0; color: var(--navy); font-size: 21px; line-height: 1.18; overflow-wrap: anywhere; }
.segment { min-height: 44px; margin: 4px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.45; }

.threat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.threat-row > span { color: var(--muted); }
.threat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; text-transform: uppercase; }
.threat::before { content: ""; width: 8px; height: 8px; background: currentColor; border-radius: 50%; }
.threat-critical { color: var(--red); }
.threat-high { color: #d64b28; }
.threat-medium { color: #a66b0c; }
.threat-low { color: var(--green); }

.card-facts { display: grid; gap: 13px; margin: 18px 0; }
.card-facts div { min-width: 0; }
.card-facts dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.card-facts dd { display: -webkit-box; margin: 0; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.details-button { display: flex; align-items: center; justify-content: space-between; min-height: 52px; margin-top: auto; padding: 12px 15px; color: var(--navy); background: #f0f4f8; border: 0; border-radius: 3px; font-size: 14px; font-weight: 900; }
.details-button span { color: var(--red); font-size: 22px; }
.details-button:hover { color: var(--white); background: var(--navy); }
.search-content { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.empty-state { display: grid; place-items: center; min-height: 280px; color: var(--muted); background: var(--white); border: 1px dashed #bfcbd7; }
.empty-state strong { color: var(--navy); font-size: 26px; }

/* Detail dialog */
.dialog-open { overflow: hidden; }
.details-dialog { width: min(1220px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; background: var(--white); border: 0; border-radius: 7px; box-shadow: 0 35px 100px rgba(0,0,0,.35); }
.details-dialog::backdrop { background: rgba(1,18,39,.72); backdrop-filter: blur(5px); }
.dialog-frame { max-height: calc(100vh - 32px); overflow-y: auto; }
.detail-header { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; min-height: 176px; padding: 38px 42px; color: var(--white); background: var(--navy); }
.detail-title { display: flex; align-items: center; gap: 22px; }
.detail-overline { margin: 0 0 7px !important; color: #7fd4e3 !important; font-size: 13px; font-weight: 900; text-transform: uppercase; }
.detail-title h2 { margin: 0; color: var(--white); font-size: clamp(28px, 3vw, 42px); line-height: 1.05; }
.detail-title p:last-child { margin: 10px 0 0; color: #b6c5d6; font-size: 14px; }
.dialog-close { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; color: var(--white); background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 4px; font-size: 34px; line-height: 1; }
.dialog-close:hover { background: var(--red); }

.detail-status { display: grid; grid-template-columns: repeat(3, 1fr) auto; align-items: stretch; border-bottom: 1px solid var(--line); }
.detail-status > div { display: grid; gap: 5px; align-content: center; min-height: 92px; padding: 18px 25px; border-right: 1px solid var(--line); }
.detail-status span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.detail-status strong { color: var(--navy); font-size: 15px; }
.detail-status a { display: grid; place-items: center; min-width: 170px; padding: 16px; color: var(--white); background: var(--red); text-decoration: none; font-size: 14px; font-weight: 900; }

.recommendation { margin: 32px 42px 0; padding: 24px 28px; color: var(--white); background: var(--navy-2); border-left: 7px solid var(--red); }
.recommendation span { color: #86d9e7; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.recommendation p { margin: 10px 0 0; font-size: 18px; font-weight: 700; line-height: 1.55; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 28px 42px 48px; }
.detail-section { padding: 26px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 4px; }
.detail-section.wide { grid-column: 1 / -1; }
.detail-section h3 { margin: 0 0 18px; color: var(--navy); font-size: 19px; }
.detail-section p { margin: 0; color: #42536a; font-size: 15px; line-height: 1.6; }
.detail-section ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.detail-section li { position: relative; padding-left: 23px; color: #42536a; font-size: 15px; line-height: 1.5; }
.detail-section li::before { content: "+"; position: absolute; left: 0; color: var(--green); font-weight: 900; }
.detail-section.negative li::before { content: "−"; color: var(--red); }
.detail-section.positive { border-top: 4px solid var(--green); }
.detail-section.negative { border-top: 4px solid var(--red); }

.data-list { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 30px; margin: 0; }
.data-list dt, .metric-list dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.data-list dd, .metric-list dd { margin: 0; color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.45; }
.metric-list { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 0 18px; }
.metric-list dd { color: var(--navy); font-size: 19px; }
.source-line { padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted) !important; font-size: 12px !important; }
.price-note { margin-top: 18px; padding: 16px; color: #68470d; background: #fff2d7; border-left: 4px solid var(--amber); font-size: 14px; line-height: 1.5; }
.price-note span { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.evidence { background: #eef3f7; }
.evidence p + p { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.sidebar-scrim { display: none; }

@media (max-width: 1450px) {
  .competitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; width: min(330px, 88vw); transform: translateX(-105%); transition: transform 180ms ease; }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 15; background: rgba(1,18,39,.6); }
  .menu-open .sidebar-scrim { display: block; }
  .menu-button { display: grid; place-items: center; width: 52px; height: 52px; margin-right: 18px; color: var(--navy); background: #edf2f6; border: 0; border-radius: 4px; font-size: 24px; }
  .topbar { justify-content: flex-start; }
  .updated { margin-left: auto; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip > div { border-bottom: 1px solid var(--line); }
  .summary-strip > div:nth-child(2) { border-right: 0; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .login-page { padding: 0; }
  .login-shell { grid-template-columns: 1fr; min-height: 100vh; border-radius: 0; }
  .login-brand { min-height: 290px; padding: 32px 26px; }
  .login-logo { width: 210px; padding: 12px; }
  .login-brand-copy { margin-top: 45px; }
  .login-brand h1 { font-size: 38px; }
  .login-brand-copy > p:last-child, .login-version { display: none; }
  .login-brand::after { right: -100px; bottom: -150px; width: 350px; height: 350px; border-width: 70px; }
  .login-form-panel { padding: 42px 26px; }
  .login-form { gap: 22px; }
  .login-form h2 { font-size: 36px; }
  .topbar { min-height: 104px; padding: 18px; }
  .topbar h1 { font-size: 32px; }
  .breadcrumb { display: none; }
  .updated { display: none; }
  .content { padding: 20px 16px 50px; }
  .summary-strip { grid-template-columns: 1fr 1fr; margin-bottom: 22px; }
  .summary-strip > div { min-height: 94px; padding: 18px; gap: 10px; }
  .summary-strip strong { font-size: 32px; }
  .summary-strip span { font-size: 11px; }
  .filters { margin: 0 -16px; padding: 5px 16px; border-radius: 0; }
  .catalog-meta p:last-child { display: none; }
  .competitor-grid { grid-template-columns: 1fr; gap: 16px; }
  .competitor-card { min-height: 490px; padding: 22px; }
  .details-dialog { width: 100vw; max-width: none; max-height: 100vh; margin: 0; border-radius: 0; }
  .dialog-frame { max-height: 100vh; }
  .detail-header { min-height: 150px; padding: 24px 20px; }
  .company-mark.large { display: none; }
  .detail-title h2 { font-size: 28px; }
  .dialog-close { width: 46px; height: 46px; flex-basis: 46px; }
  .detail-status { grid-template-columns: 1fr 1fr; }
  .detail-status > div { min-height: 78px; padding: 14px 18px; }
  .detail-status > div:nth-child(2) { border-right: 0; }
  .detail-status a { grid-column: 1 / -1; min-height: 58px; }
  .recommendation { margin: 20px 16px 0; padding: 20px; }
  .recommendation p { font-size: 16px; }
  .detail-grid { grid-template-columns: 1fr; padding: 18px 16px 35px; }
  .detail-section.wide { grid-column: auto; }
  .data-list, .metric-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
