/* =====================================================================
   Magnus Carrier Registry — design system
   No framework, no build step. One stylesheet, served straight from S3.
   ===================================================================== */

:root {
    /* Brand */
    --navy-900: #071324;
    --navy-800: #0b1c33;
    --navy-700: #12294a;
    --navy-600: #1b3a63;
    --brand-green: #386a52;      /* from the Magnus mark */

    --blue-600: #1d4ed8;
    --blue-500: #2563eb;
    --blue-400: #3b82f6;
    --blue-50:  #eff6ff;

    /* Neutrals — text never lighter than #595959 */
    --ink-900: #101828;
    --ink-700: #344054;
    --ink-600: #475467;
    --ink-500: #595959;
    --line:    #e4e7ec;
    --line-2:  #f2f4f7;
    --surface: #ffffff;
    --canvas:  #f6f8fb;

    /* Status */
    --ok-600:   #067647;
    --ok-50:    #ecfdf3;
    --warn-700: #b54708;
    --warn-50:  #fffaeb;
    --err-700:  #b42318;
    --err-50:   #fef3f2;
    --info-700: #175cd3;
    --info-50:  #eff8ff;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
    --shadow-md: 0 4px 8px -2px rgba(16,24,40,.1), 0 2px 4px -2px rgba(16,24,40,.06);
    --shadow-lg: 0 12px 16px -4px rgba(16,24,40,.08), 0 4px 6px -2px rgba(16,24,40,.03);

    --fs-base: 15px;      /* 15px base, 13px floor */
    --sidebar-w: 232px;
    --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--canvas);
    color: var(--ink-900);
    font: var(--fs-base)/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select { font: inherit; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- Login */

.login {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}
@media (max-width: 860px) {
    .login { grid-template-columns: 1fr; }
    .login__brand { display: none; }
}

.login__brand {
    position: relative;
    overflow: hidden;
    padding: 56px 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(1100px 700px at 78% 18%, rgba(59,130,246,.30), transparent 62%),
        radial-gradient(760px 520px at 12% 88%, rgba(56,106,82,.34), transparent 66%),        linear-gradient(160deg, var(--navy-900), var(--navy-700));
}

/* Faint lat/long grid, evoking the globe in the reference design. */
.login__grid {
    position: absolute;
    inset: -20% -10% -10%;
    background-image:
        repeating-linear-gradient(90deg, rgba(255,255,255,.055) 0 1px, transparent 1px 68px),
        repeating-linear-gradient(0deg,  rgba(255,255,255,.045) 0 1px, transparent 1px 68px);
    mask-image: radial-gradient(58% 52% at 62% 32%, #000 0%, transparent 78%);
    pointer-events: none;
}
.login__glow {
    position: absolute;
    width: 620px; height: 620px;
    right: -170px; top: -140px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 38%, rgba(96,165,250,.36), rgba(29,78,216,.14) 46%, transparent 68%);
    filter: blur(2px);
    pointer-events: none;
}

.login__mastheadWrap { position: relative; z-index: 1; }

/* Wordmark, then the mark BELOW it. */
.wordmark { display: inline-flex; flex-direction: column; gap: 14px; }
.wordmark__magnus {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: .18em;
    line-height: 1;
}
.wordmark__sub {
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: .34em;
    color: rgba(255,255,255,.82);
    line-height: 1;
}
.wordmark__rule {
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,.42), rgba(255,255,255,0));
    margin: 2px 0 0;
}
.wordmark__mark {
    width: 46px;
    height: auto;
    color: #fff;              /* the mark's lower facet uses currentColor */
    margin-top: 2px;
}

.login__pitch { position: relative; z-index: 1; max-width: 34ch; }
.login__pitch h1 {
    font-size: 30px;
    line-height: 1.22;
    font-weight: 600;
    margin: 0 0 16px;
}
.login__pitch p {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.65;
    color: rgba(255,255,255,.78);
}

.login__panel {
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}
.login__form { width: 100%; max-width: 356px; }
.login__form h2 { font-size: 23px; margin: 0 0 6px; font-weight: 650; }
.login__form .muted { color: var(--ink-600); font-size: 14px; margin: 0 0 26px; }

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--ink-700);
    margin-bottom: 6px;
}
.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink-900);
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.field input:focus {
    outline: none;
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(59,130,246,.16);
}
.field--pw { position: relative; }
.field--pw input { padding-right: 42px; }
.field__reveal {
    position: absolute;
    right: 6px; bottom: 5px;
    border: 0; background: none;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--ink-500);
    border-radius: 6px;
}
.field__reveal:hover { background: var(--line-2); }

.row-between { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-700); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14.5px;
    font-weight: 550;
    cursor: pointer;
    transition: background .12s, border-color .12s, box-shadow .12s;
    white-space: nowrap;
}
.btn--primary { background: var(--blue-600); color: #fff; }
.btn--primary:hover { background: #1a44c2; }
.btn--primary:disabled { background: #9db4ea; cursor: not-allowed; }
.btn--block { width: 100%; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink-700); }
.btn--ghost:hover { background: var(--line-2); }
.btn--sm { padding: 6px 11px; font-size: 13.5px; }

.divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--ink-500); font-size: 13px;
    margin: 20px 0;
}
.divider::before, .divider::after {
    content: ""; flex: 1; height: 1px; background: var(--line);
}

.secure-note {
    margin-top: 28px;
    padding: 12px 14px;
    background: var(--line-2);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--ink-600);
    display: flex; gap: 10px;
}
.secure-note strong { display: block; color: var(--ink-700); font-size: 13.5px; margin-bottom: 2px; }

.alert {
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert--err { background: var(--err-50); border-color: #fecdca; color: var(--err-700); }

/* ---------------------------------------------------------------- Shell */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    background: var(--navy-800);
    color: rgba(255,255,255,.72);
    display: flex;
    flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
}
.sidebar__brand svg { width: 22px; color: #fff; }
.sidebar__brandText { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar__brandText b { font-size: 14px; letter-spacing: .13em; font-weight: 700; }
.sidebar__brandText span { font-size: 9.5px; letter-spacing: .2em; color: rgba(255,255,255,.62); }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav__item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 11px;
    border-radius: 7px;
    color: rgba(255,255,255,.74);
    font-size: 14px;
    cursor: pointer;
    border: 0; background: none;
    text-align: left;
    width: 100%;
}
.nav__item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav__item.is-active { background: var(--blue-600); color: #fff; font-weight: 550; }
.nav__item[disabled] { opacity: .42; cursor: not-allowed; }
.nav__item[disabled]:hover { background: none; color: rgba(255,255,255,.74); }
.nav__tag {
    margin-left: auto;
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
}
.nav__sep { margin: 10px 12px 6px; font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: rgba(255,255,255,.42); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 16px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 20;
}
.search {
    flex: 1; max-width: 620px;
    position: relative;
}
.search input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--canvas);
}
.search input:focus { outline: none; border-color: var(--blue-400); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.14); }
.search__icon { position: absolute; left: 11px; top: 9px; color: var(--ink-500); }

.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--blue-600); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 650;
}
.userchip { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 7px; }
.userchip:hover { background: var(--line-2); }
.userchip__role { font-size: 12px; color: var(--ink-600); }

.content { padding: 24px; flex: 1; }
.page__head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page__head h1 { font-size: 22px; margin: 0 0 3px; font-weight: 650; }
.page__head p { margin: 0; color: var(--ink-600); font-size: 14px; }
.page__actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------------------------------------------------------- Cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card__head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px;
}
.card__head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card__body { padding: 16px; }

.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid--3 { grid-template-columns: repeat(1,minmax(0,1fr)); } }
@media (max-width: 760px)  { .grid--4, .grid--2 { grid-template-columns: 1fr; } }

.stat { padding: 16px; }
.stat__label { font-size: 13px; color: var(--ink-600); margin-bottom: 6px; }
.stat__value { font-size: 26px; font-weight: 650; letter-spacing: -.01em; line-height: 1.1; }
.stat__foot { margin-top: 7px; font-size: 12.5px; color: var(--ink-600); display: flex; align-items: center; gap: 6px; }

.delta { font-weight: 600; }
.delta--up { color: var(--ok-600); }
.delta--down { color: var(--err-700); }

/* --------------------------------------------------------------- Badges */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 550;
    border: 1px solid;
    white-space: nowrap;
}
.badge--ok    { background: var(--ok-50);   color: var(--ok-600);   border-color: #abefc6; }
.badge--warn  { background: var(--warn-50); color: var(--warn-700); border-color: #fedf89; }
.badge--err   { background: var(--err-50);  color: var(--err-700);  border-color: #fecdca; }
.badge--info  { background: var(--info-50); color: var(--info-700); border-color: #b2ddff; }
.badge--muted { background: var(--line-2);  color: var(--ink-600);  border-color: var(--line); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------------- Tables */

.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-600);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 14px;
    background: var(--canvas);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky; top: 0;
}
table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line-2);
    color: var(--ink-700);
    white-space: nowrap;
}
table.data tr:hover td { background: #fafbfd; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.linkish { color: var(--blue-600); cursor: pointer; }
.linkish:hover { text-decoration: underline; }

.empty { padding: 42px 16px; text-align: center; color: var(--ink-600); }
.empty h4 { margin: 0 0 6px; font-size: 15px; color: var(--ink-700); }

/* --------------------------------------------------------------- Filters */

.filters { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
@media (max-width: 1100px) { .filters { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px)  { .filters { grid-template-columns: 1fr; } }
.filters label { display: block; font-size: 12.5px; font-weight: 550; color: var(--ink-700); margin-bottom: 5px; }
.filters input, .filters select {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(59,130,246,.14); }

/* --------------------------------------------------------------- Charts */

.chartbox { height: 190px; position: relative; }
.spark { width: 100%; height: 100%; display: block; }

.legend { display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.legend__row { display: flex; align-items: center; gap: 8px; color: var(--ink-700); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend__val { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-600); }

.health { display: flex; flex-wrap: wrap; gap: 10px; }
.health__chip {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 12px;
    min-width: 132px;
    background: #fff;
}
.health__name { font-size: 12.5px; color: var(--ink-600); margin-bottom: 5px; }

/* --------------------------------------------------------------- Detail */

.detail__head { display: flex; align-items: flex-start; gap: 14px; }
.detail__logo {
    width: 46px; height: 46px; border-radius: 9px;
    background: var(--navy-700); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 650; flex: none;
}
.detail__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail__title h1 { margin: 0; font-size: 21px; font-weight: 650; }
.detail__meta { color: var(--ink-600); font-size: 13.5px; margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; }

.attrstrip {
    display: grid; grid-template-columns: repeat(6, minmax(0,1fr));
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: #fff; overflow: hidden;
}
@media (max-width: 1100px) { .attrstrip { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 620px)  { .attrstrip { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.attrstrip__cell { padding: 11px 14px; border-right: 1px solid var(--line-2); }
.attrstrip__cell:last-child { border-right: 0; }
.attrstrip__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-600); margin-bottom: 4px; }
.attrstrip__value { font-size: 14px; color: var(--ink-900); font-weight: 500; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 20px 0 16px; overflow-x: auto; }
.tab {
    padding: 9px 14px;
    border: 0; background: none;
    font-size: 14px; color: var(--ink-600);
    cursor: pointer; white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--ink-900); }
.tab.is-active { color: var(--blue-600); border-bottom-color: var(--blue-600); font-weight: 550; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl__item { position: relative; padding-bottom: 18px; }
.tl__dot {
    position: absolute; left: -21px; top: 4px;
    width: 10px; height: 10px; border-radius: 50%;
    background: #fff; border: 2px solid var(--blue-500);
}
.tl__date { font-size: 12px; color: var(--ink-600); font-variant-numeric: tabular-nums; }
.tl__body { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-top: 5px; background: #fff; }
.tl__title { font-size: 13.5px; font-weight: 550; color: var(--ink-900); }
.tl__sub { font-size: 12.5px; color: var(--ink-600); margin-top: 3px; }

/* -------------------------------------------------------------- Utility */

.muted { color: var(--ink-600); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.inline { display: flex; align-items: center; gap: 8px; }
.spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid var(--line); border-top-color: var(--blue-600);
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed; right: 20px; bottom: 20px; z-index: 100;
    background: var(--ink-900); color: #fff;
    padding: 11px 15px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); font-size: 13.5px;
}
