/* MatrixCloud customer portal */

:root {
    --mc-blue: #0b6bff;
    --mc-blue-dark: #0052cc;
    --mc-blue-soft: #e8f0ff;
    --mc-navy: #0b1426;
    --mc-navy-2: #131f36;
    --mc-navy-text: #a9b6cc;
    --mc-ink: #0f172a;
    --mc-ink-2: #475569;
    --mc-ink-3: #64748b;
    --mc-line: #e2e8f0;
    --mc-bg: #f5f7fb;
    --mc-card: #ffffff;
    --mc-green: #0f9d58;
    --mc-green-soft: #e6f6ee;
    --mc-amber: #b45309;
    --mc-amber-soft: #fef3e2;
    --mc-red: #c5221f;
    --mc-red-soft: #fdecea;
    --mc-radius: 10px;
    --mc-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --mc-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--mc-font);
    font-size: 15px;
    color: var(--mc-ink);
    background: var(--mc-bg);
    -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 1.6rem; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 .75rem; }

/* ---------- App shell ---------- */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
    background: var(--mc-navy);
    color: var(--mc-navy-text);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand svg { flex: none; }

.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7a93; padding: 14px 10px 6px; }

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--mc-navy-text); font-weight: 500;
}
.nav-link:hover { background: var(--mc-navy-2); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--mc-blue); color: #fff; }
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-link.disabled { opacity: .45; cursor: default; pointer-events: none; }
.soon { margin-left: auto; font-size: .66rem; font-weight: 600; padding: 2px 6px; border-radius: 999px; background: var(--mc-navy-2); color: #8796ae; }

.sidebar-footer { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--mc-navy-2); font-size: .8rem; color: #6b7a93; }

.topbar {
    height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: 14px;
    padding: 0 32px; background: var(--mc-card); border-bottom: 1px solid var(--mc-line);
}
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--mc-ink-2); font-size: .9rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--mc-blue-soft); color: var(--mc-blue-dark); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }

.content { padding: 28px 32px 48px; max-width: 1180px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; color: var(--mc-ink-3); }
.crumbs { font-size: .85rem; color: var(--mc-ink-3); margin-bottom: 8px; }

/* ---------- Building blocks ---------- */

.card { background: var(--mc-card); border: 1px solid var(--mc-line); border-radius: var(--mc-radius); box-shadow: var(--mc-shadow); padding: 20px 22px; }
.card + .card { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card + .card { margin-top: 0; }
.grid-2 + .card, .card + .grid-2 { margin-top: 18px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
    font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--mc-blue); color: #fff; }
.btn-primary:hover { background: var(--mc-blue-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--mc-ink-2); border-color: var(--mc-line); }
.btn-ghost:hover { background: var(--mc-bg); text-decoration: none; }
.btn-block { width: 100%; padding: 11px 16px; }
.btn-link { background: none; border: 0; color: var(--mc-ink-3); padding: 6px 4px; font-weight: 500; }
.btn-link:hover { color: var(--mc-ink); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .86rem; font-weight: 600; color: var(--mc-ink-2); }
.input {
    font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--mc-ink);
}
.input:focus { outline: none; border-color: var(--mc-blue); box-shadow: 0 0 0 3px rgba(11, 107, 255, .15); }
.hint { font-size: .8rem; color: var(--mc-ink-3); }
.validation-message { color: var(--mc-red); font-size: .82rem; }
.inline-form { display: flex; gap: 10px; align-items: flex-start; }
.inline-form .field { flex: 1; margin: 0; }

.alert { border-radius: 8px; padding: 11px 14px; font-size: .9rem; margin-bottom: 16px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-error { background: var(--mc-red-soft); color: var(--mc-red); }
.alert-info { background: var(--mc-blue-soft); color: var(--mc-blue-dark); }
.alert-success { background: var(--mc-green-soft); color: var(--mc-green); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--mc-green-soft); color: var(--mc-green); }
.badge-amber { background: var(--mc-amber-soft); color: var(--mc-amber); }
.badge-red { background: var(--mc-red-soft); color: var(--mc-red); }
.badge-grey { background: #eef2f7; color: var(--mc-ink-3); }
.role { font-size: .78rem; font-weight: 600; color: var(--mc-ink-3); background: #eef2f7; padding: 3px 9px; border-radius: 6px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mc-ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--mc-line); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--mc-line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.name-cell a { font-weight: 600; color: var(--mc-ink); }
.muted { color: var(--mc-ink-3); font-size: .86rem; }

.dl { display: grid; grid-template-columns: 170px 1fr; row-gap: 12px; margin: 0; }
.dl dt { color: var(--mc-ink-3); font-size: .88rem; }
.dl dd { margin: 0; font-weight: 500; }

.empty { text-align: center; padding: 42px 20px; color: var(--mc-ink-3); }
.empty svg { width: 46px; height: 46px; color: #9aa9c0; margin-bottom: 10px; }
.empty h2 { color: var(--mc-ink); }

/* ---------- Instances ---------- */

.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 7px; }
.btn-danger-ghost { background: transparent; color: var(--mc-red); border-color: #f3c7c5; }
.btn-danger-ghost:hover { background: var(--mc-red-soft); text-decoration: none; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.spec { color: var(--mc-ink-2); font-size: .88rem; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .86rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--mc-line); margin-bottom: 20px; }
.tab { padding: 9px 14px; color: var(--mc-ink-3); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--mc-ink); text-decoration: none; }
.tab.active { color: var(--mc-blue); border-bottom-color: var(--mc-blue); }

.select { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--mc-ink); }
.select:focus { outline: none; border-color: var(--mc-blue); box-shadow: 0 0 0 3px rgba(11, 107, 255, .15); }
.section-title { font-size: .95rem; font-weight: 650; margin: 0 0 4px; }
.section-hint { color: var(--mc-ink-3); font-size: .86rem; margin: 0 0 14px; }
.create-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.summary { position: sticky; top: 20px; }
.summary .price { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; }
.summary .per { color: var(--mc-ink-3); font-size: .85rem; }
.summary hr { border: 0; border-top: 1px solid var(--mc-line); margin: 16px 0; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.plan-card { position: relative; display: block; border: 1.5px solid var(--mc-line); border-radius: 10px; padding: 14px 16px; cursor: pointer; background: #fff; }
.plan-card:hover { border-color: #a9c6ff; }
.plan-card input { position: absolute; opacity: 0; pointer-events: none; }
.plan-card:has(input:checked) { border-color: var(--mc-blue); box-shadow: 0 0 0 3px rgba(11, 107, 255, .12); }
.plan-card .plan-price { font-size: 1.15rem; font-weight: 700; }
.plan-card .plan-price small { font-size: .78rem; font-weight: 500; color: var(--mc-ink-3); }
.plan-card .plan-name { font-weight: 600; margin-bottom: 8px; }
.plan-card ul { list-style: none; padding: 0; margin: 10px 0 0; color: var(--mc-ink-2); font-size: .86rem; line-height: 1.7; }

@media (max-width: 1000px) {
    .create-grid { grid-template-columns: 1fr; }
    .summary { position: static; }
}

/* ---------- Billing ---------- */

.balance { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.balance.negative { color: var(--mc-red); }
.amount-in { color: var(--mc-green); }
.amount-out { color: var(--mc-ink); }

/* ---------- Sign-in / sign-up ---------- */

.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero {
    background: radial-gradient(1200px 600px at -10% -10%, #1d3b8f 0%, transparent 55%), linear-gradient(160deg, #0b1426 0%, #0d1d3d 100%);
    color: #dbe5f5; padding: 48px 56px; display: flex; flex-direction: column;
}
.auth-hero .brand { padding: 0; font-size: 1.3rem; }
.auth-hero h2 { font-size: 2rem; line-height: 1.2; color: #fff; margin: auto 0 14px; max-width: 460px; letter-spacing: -.02em; }
.auth-hero p { max-width: 440px; color: #aebbd2; line-height: 1.6; margin: 0; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 auto; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #c9d5ea; }
.auth-points li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(11, 107, 255, .25); color: #8fb7ff; font-size: .75rem; font-weight: 700; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--mc-card); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .sub { color: var(--mc-ink-3); margin: 0 0 24px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--mc-ink-3); font-size: .9rem; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .auth { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 20px; }
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    background: #fff7d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
