:root {
    --navy: #102a43;
    --navy-2: #163a5f;
    --blue: #1769e0;
    --blue-soft: #eaf2ff;
    --ink: #172b4d;
    --muted: #60758a;
    --line: #dce5ed;
    --surface: #ffffff;
    --canvas: #f4f7fa;
    --success: #16794b;
    --warning: #9a5b00;
    --danger: #b42318;
    --radius: 14px;
    --shadow: 0 8px 28px rgba(16, 42, 67, .08);
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a { color: var(--blue); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(23, 105, 224, .35); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; color: white; background: var(--navy); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; color: #dbeafe; background: linear-gradient(180deg, #0c2742 0%, #102a43 100%); display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; color: white; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font-weight: 800; background: linear-gradient(135deg, #3b82f6, #14b8a6); box-shadow: 0 7px 20px rgba(20, 184, 166, .25); }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: #9fb7cd; font-size: 11px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { padding: 11px 13px; color: #c9d8e6; text-decoration: none; border-radius: 9px; font-size: 14px; font-weight: 600; }
.sidebar nav a:hover { color: white; background: rgba(255,255,255,.07); }
.sidebar nav a.active { color: white; background: rgba(59,130,246,.25); box-shadow: inset 3px 0 #60a5fa; }
.nav-section { margin: 22px 13px 5px; color: #7f9bb5; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-foot { margin-top: auto; padding: 15px 12px 0; border-top: 1px solid rgba(255,255,255,.1); color: #9fb7cd; font-size: 11px; line-height: 1.5; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #f59e0b; }
.page { min-width: 0; }
.topbar { min-height: 82px; display: flex; align-items: center; gap: 14px; padding: 15px 30px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 2px 0 0; font-size: 21px; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-copy { display: grid; justify-items: end; gap: 3px; font-size: 13px; }
.role-badge { padding: 3px 8px; color: #14532d; background: #dcfce7; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.content { width: min(1420px, 100%); margin: 0 auto; padding: 30px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h2 { margin: 5px 0 7px; font-size: clamp(24px, 3vw, 32px); }
.page-heading p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.55; }
.panel, .connection-card, .status-card, .empty-state, .safe-notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 20px; }
.panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel h3, .connection-card h3, .empty-state h3 { margin: 0; }
.panel header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 22px; }
.status-card { padding: 18px; }
.status-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.status-card strong { display: block; margin-top: 8px; font-size: 22px; }
.status-card small { display: block; margin-top: 8px; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.metric-list { display: grid; gap: 12px; margin: 0; }
.metric-list div { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.metric-list div:last-child { padding-bottom: 0; border-bottom: 0; }
.metric-list dt { color: var(--muted); }
.metric-list dd { margin: 0; font-weight: 800; }
.safe-notice { margin-bottom: 22px; padding: 16px 18px; color: #164e63; background: #ecfeff; border-color: #a5f3fc; line-height: 1.55; }
.safe-notice strong { display: block; }
.connection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.connection-card { padding: 20px; }
.connection-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.connection-card h3 { margin-top: 10px; font-size: 18px; }
.connection-card p { margin: 5px 0 0; color: var(--muted); }
.bank-chip { display: inline-flex; padding: 4px 8px; color: #1e40af; background: var(--blue-soft); border-radius: 6px; font-size: 10px; font-weight: 800; }
.status { display: inline-flex; align-items: center; padding: 5px 9px; color: #35516c; background: #edf2f7; border: 1px solid #d5e0e9; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.status-approved, .status-active, .status-current { color: var(--success); background: #ecfdf3; border-color: #a7f3d0; }
.status-failed, .status-revoked, .status-error, .status-security_review_required { color: var(--danger); background: #fff1f0; border-color: #fecaca; }
.status-expired, .status-reauth_required, .status-awaiting_user, .status-candidate { color: var(--warning); background: #fffbeb; border-color: #fde68a; }
.compact-status { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin: 18px 0; }
.compact-status div { padding: 10px; background: var(--canvas); border-radius: 8px; }
.compact-status dt { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.compact-status dd { margin: 4px 0 0; font-size: 12px; font-weight: 700; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.detail-list { display: grid; gap: 10px; margin: 0; }
.detail-list div { display: flex; justify-content: space-between; gap: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { padding-bottom: 0; border-bottom: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; text-align: right; font-weight: 700; }
.actions-panel, .instruction-panel { margin-top: 16px; }
.action-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 750; }
.field input, .field select { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: white; border: 1px solid #bac9d6; border-radius: 8px; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,224,.13); outline: none; }
.field small { color: var(--muted); font-size: 11px; }
.field-error { color: var(--danger); font-size: 12px; }
.button { min-height: 41px; display: inline-flex; align-items: center; justify-content: center; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .12s, filter .12s, background .12s; }
.button:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { color: white; background: var(--blue); }
.button-secondary { color: var(--navy); background: white; border-color: #b9c9d7; }
.button-danger { color: var(--danger); background: #fff7f6; border-color: #f4b5af; }
.button-ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.button-small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.is-loading { cursor: wait; }
.flash { margin-bottom: 20px; padding: 14px 16px; border: 1px solid; border-radius: 10px; line-height: 1.5; }
.flash ul { margin-bottom: 0; }
.flash-success { color: #14532d; background: #ecfdf3; border-color: #a7f3d0; }
.flash-error { color: #7f1d1d; background: #fff1f0; border-color: #fecaca; }
.flash-warning { color: #713f12; background: #fffbeb; border-color: #fde68a; }
.flash-info { color: #164e63; background: #ecfeff; border-color: #a5f3fc; }
.empty-state { padding: 55px 24px; text-align: center; }
.empty-state p { max-width: 520px; margin: 10px auto 20px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px; color: var(--blue); background: var(--blue-soft); border-radius: 50%; font-size: 26px; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 13px; }
.mobile-menu { display: none; }
.icon-button { width: 40px; height: 40px; padding: 10px; border: 1px solid var(--line); background: white; border-radius: 8px; }
.icon-button span { display: block; height: 2px; margin: 4px 0; background: var(--ink); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(8, 24, 40, .48); }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dbeafe, transparent 38%), var(--canvas); }
.login-shell { width: min(960px, 100%); display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 70px rgba(16,42,67,.16); }
.login-brand { padding: clamp(35px, 7vw, 70px); color: white; background: linear-gradient(145deg, #102a43, #164e63); }
.login-brand .brand-mark { margin-bottom: 30px; }
.login-brand h1 { max-width: 330px; margin: 0 0 14px; font-size: clamp(30px, 4vw, 44px); }
.login-brand p { color: #c9dbe8; line-height: 1.65; }
.login-form-wrap { padding: clamp(30px, 6vw, 65px); }
.login-form-wrap h2 { margin: 7px 0 9px; font-size: 29px; }
.login-form-wrap > p { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 18px; }
.password-control { position: relative; }
.password-control input { padding-right: 94px; }
.password-toggle { position: absolute; right: 7px; top: 7px; min-height: 29px; padding: 4px 8px; color: var(--blue); background: transparent; border: 0; border-radius: 5px; font-size: 11px; font-weight: 800; cursor: pointer; }
.login-form .button { width: 100%; min-height: 46px; }
.login-foot { margin-top: 25px; color: var(--muted); font-size: 11px; text-align: center; }
@media (max-width: 1050px) {
    .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .shell { display: block; }
    .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(300px, 86vw); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
    .sidebar.is-open { transform: translateX(0); }
    .mobile-menu { display: block; }
    .content { padding: 22px 18px; }
    .topbar { padding: 13px 18px; }
    .user-copy { display: none; }
    .connection-grid, .detail-grid { grid-template-columns: 1fr; }
    .action-form { grid-template-columns: 1fr; align-items: stretch; }
}
@media (max-width: 620px) {
    .login-body { padding: 0; }
    .login-shell { min-height: 100vh; display: block; border: 0; border-radius: 0; }
    .login-brand { padding: 28px 25px; }
    .login-brand h1 { font-size: 26px; }
    .login-brand p { margin-bottom: 0; }
    .login-form-wrap { padding: 35px 25px; }
    .status-grid { grid-template-columns: 1fr; }
    .page-heading { display: grid; }
    .topbar h1 { font-size: 17px; }
    .connection-card-head { display: grid; }
    .compact-status { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
