:root {
  --navy: #071b3d;
  --blue: #1667e8;
  --blue-soft: #eaf3ff;
  --line: #dce5f1;
  --muted: #65738a;
  --surface: #ffffff;
  --background: #f4f7fb;
  --green: #159b68;
  --amber: #d88a00;
  --red: #d84b4b;
}

html { font-size: 16px; min-height: 100%; }
body { min-height: 100vh; display: flex; flex-direction: column; background: var(--background); color: var(--navy); }
body > .app-shell { width: 100%; flex: 1 0 auto; }
.app-shell { max-width: 1500px; padding-left: 32px; padding-right: 32px; }
.navbar { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); padding: 18px 0; }
.navbar-brand { display: flex; gap: 14px; align-items: center; font-weight: 750; color: var(--navy); }
.navbar-brand small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.brand-logo { width: 190px; height: 48px; object-fit: contain; object-position: left center; }
.cockpit-label { padding-left: 14px; border-left: 1px solid var(--line); line-height: 1.15; }
.nav-link { color: var(--muted); font-weight: 650; margin-left: 12px; }
.nav-link:hover { color: var(--blue); }
main { padding-top: 44px; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 28px; }
.page-heading h1 { font-size: clamp(2rem, 3vw, 3.2rem); margin: 0 0 8px; letter-spacing: -.04em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--blue) !important; text-transform: uppercase; letter-spacing: .11em; font-weight: 750; font-size: .77rem; margin-bottom: 8px !important; }
.overall { min-width: 280px; display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--line); padding: 16px 20px; border-radius: 16px; box-shadow: 0 8px 24px rgba(9,32,69,.05); }
.overall strong, .overall small { display: block; }
.overall small { color: var(--muted); margin-top: 2px; }
.status-dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(101,115,138,.1); }
.overall-healthy .status-dot, .status-healthy .status-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(21,155,104,.12); }
.overall-degraded .status-dot, .status-degraded .status-dot { background: var(--amber); box-shadow: 0 0 0 5px rgba(216,138,0,.12); }
.overall-critical .status-dot, .status-critical .status-dot, .status-offline .status-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(216,75,75,.12); }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.product-card, .section-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 34px rgba(9,32,69,.05); }
.product-card { padding: 24px; border-top: 4px solid var(--green); }
.product-card.status-degraded { border-top-color: var(--amber); }
.product-card.status-critical, .product-card.status-offline { border-top-color: var(--red); }
.product-card header { display: flex; justify-content: space-between; gap: 12px; }
.product-card h2 { font-size: 1.35rem; margin: 0; }
.product-card > p { color: var(--muted); min-height: 48px; margin: 22px 0; }
.status-pill { white-space: nowrap; height: fit-content; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; font-size: .78rem; font-weight: 700; }
.status-pill .status-dot { width: 7px; height: 7px; box-shadow: none; }
.product-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.product-card dl div { min-width: 0; }
.product-card dt { color: var(--muted); font-size: .75rem; font-weight: 600; }
.product-card dd { margin: 3px 0 0; font-weight: 700; }
.card-link, .section-heading > a { color: var(--blue); font-weight: 700; text-decoration: none; }
.card-link { display: inline-block; margin-top: 10px; }
.section-card { padding: 28px; margin-bottom: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.section-heading h2, .empty-state h2 { font-size: 1.45rem; }
.section-card > p, .empty-state p { color: var(--muted); }
.empty-state { text-align: center; padding: 64px 24px; }
.empty-icon { display: grid; place-items: center; margin: 0 auto 18px; width: 52px; height: 52px; border-radius: 16px; background: var(--blue-soft); color: var(--blue); font-size: 1.5rem; }
.contract-summary { min-width: 170px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-align: right; }
.contract-summary strong { display: block; color: var(--blue); font-size: 1.65rem; line-height: 1; }
.contract-summary span { display: block; color: var(--muted); margin-top: 5px; font-size: .82rem; }
.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.source-card { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 14px; padding: 16px; }
.source-card > div { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.source-card span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.source-card p { color: var(--muted); margin: 10px 0 0; font-size: .9rem; }
.source-card.source-ready { border-left-color: var(--green); }
.source-card.source-error { border-left-color: var(--red); }
.source-card.source-pending { border-left-color: var(--amber); }
.compact-empty { padding-top: 38px; padding-bottom: 38px; }
.contract-heading p { color: var(--muted); margin: 0; }
.list-search { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbff; }
.list-search label { flex: 1 1 560px; margin: 0; color: var(--ink); font-weight: 700; }
.list-search input { display: block; width: 100%; margin-top: 7px; padding: 12px 14px; border: 1px solid #b8c8dc; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 400; }
.list-search input:focus { border-color: var(--blue); outline: 3px solid rgba(30, 107, 230, .16); }
.list-search p { flex: 0 0 auto; margin: 0 0 11px; color: var(--muted); white-space: nowrap; }
.search-empty { margin-top: 16px; padding: 24px; border: 1px dashed #b8c8dc; border-radius: 14px; text-align: center; }
.search-empty strong, .search-empty span { display: block; }
.search-empty span { margin-top: 5px; color: var(--muted); }
.contract-card[hidden], .device-card[hidden], .search-empty[hidden] { display: none !important; }
.contract-list { display: grid; gap: 16px; margin-top: 20px; }
.contract-card { border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.contract-card header { display: flex; justify-content: space-between; gap: 18px; }
.contract-card h3 { margin: 3px 0; font-size: 1.3rem; }
.contract-card header p { margin: 0; color: var(--muted); }
.contract-product { color: var(--blue); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 750; }
.contract-status { height: fit-content; border-radius: 999px; padding: 7px 11px; font-size: .78rem; font-weight: 750; }
.contract-active { color: #08794f; background: #e8f8f1; }
.contract-warning { color: #8b5900; background: #fff4dc; }
.contract-error { color: #a92f2f; background: #fff0f0; }
.contract-card dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 20px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.contract-card dt { color: var(--muted); font-size: .75rem; }
.contract-card dd { margin: 4px 0 0; font-weight: 700; }
.contract-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: -4px 0 18px; color: var(--muted); }
.contract-contact strong { color: var(--ink); }
.contract-contact a { color: var(--blue); font-weight: 700; text-decoration: none; }
.contract-card footer { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .78rem; }
.monitoring-source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.device-list { display: grid; gap: 16px; margin-top: 20px; }
.device-card { border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: 16px; padding: 20px; }
.device-card.device-online { border-left-color: var(--green); }
.device-card.device-warning, .device-card.device-pending { border-left-color: var(--amber); }
.device-card.device-error, .device-card.device-offline { border-left-color: var(--red); }
.device-card header { display: flex; justify-content: space-between; gap: 18px; }
.device-card h3 { margin: 3px 0; font-size: 1.3rem; }
.device-card header p { margin: 0; color: var(--muted); }
.device-status { height: fit-content; border-radius: 999px; padding: 7px 11px; font-size: .78rem; font-weight: 750; background: var(--blue-soft); }
.device-card dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.device-card dt { color: var(--muted); font-size: .75rem; }
.device-card dd { margin: 4px 0 0; font-weight: 700; }
.device-error-detail { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff0f0; color: #a92f2f; font-size: .88rem; }
.footer { flex: 0 0 auto; margin-top: 42px; padding: 28px 0; border-top: 1px solid var(--line); }
.login-wrap { max-width: 520px; margin: 28px auto 80px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 34px; box-shadow: 0 16px 44px rgba(9,32,69,.08); }
.login-card h1 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -.03em; }
.login-card > p { color: var(--muted); margin-bottom: 26px; }
.login-card .form-floating { margin-bottom: 16px; }
.login-card .form-check { margin: 18px 0 22px; }
.login-card .remember-checkbox { width: 1.15rem; height: 1.15rem; border: 1px solid #9eacc0; cursor: pointer; }
.login-card .form-check-label { padding-left: 4px; cursor: pointer; }
.login-card .remember-checkbox:checked { background-color: var(--blue); border-color: var(--blue); }
.login-card .btn-primary { background: var(--blue); border-color: var(--blue); font-weight: 700; padding: 12px 18px; }
.login-card .validation-summary-errors { color: var(--red); background: #fff2f2; border: 1px solid #ffd2d2; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.login-card .validation-summary-errors ul { margin: 0; padding-left: 18px; }

@media (max-width: 1100px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .app-shell { padding-left: 18px; padding-right: 18px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .overall { min-width: 0; }
  .product-grid { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; }
  .brand-logo { width: 150px; }
  .cockpit-label { display: none; }
  .source-grid, .contract-card dl, .device-card dl { grid-template-columns: 1fr; }
  .contract-card footer { flex-direction: column; }
  .list-search { align-items: stretch; flex-direction: column; }
  .list-search label { flex-basis: auto; }
  .list-search p { margin: 0; }
}
.notification-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .45rem 1rem;
  margin-top: 1rem;
  padding: .8rem 1rem;
  border-radius: .8rem;
  background: #eef6ff;
  color: #10264a;
}

.notification-contact span:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
}

.missing-contact {
  margin: 1rem 0 0;
  color: #9a5d00;
  font-weight: 700;
}
