:root {
    color-scheme: light;
    --ink: #15202b;
    --muted: #617080;
    --line: #dce3ea;
    --paper: #fff;
    --soft: #f4f7fa;
    --brand: #155eef;
    --danger: #b42318;
    --ok: #067647;
}
body.client-kargo { --brand: #c45816; --soft: #fff7ed; }
body.client-share { --brand: #7c3aed; --soft: #f5f3ff; }
body.client-ip { --brand: #027a48; --soft: #ecfdf3; }
body.client-cloud { --brand: #475467; --soft: #f2f4f7; }
body.client-keizaal { --brand: #9a6700; --soft: #fffaeb; }
body.client-mucahit { --brand: #3448a1; --soft: #eef4ff; }
body.client-saglik { --brand: #b42318; --soft: #fff1f0; }
body.client-tasks { --brand: #0e7490; --soft: #ecfeff; }
* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(145deg,#eef4ff,#f8fafc 48%,#edf7f3); color: var(--ink); font: 15px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; min-height: 100vh; }
.topbar { height: 68px; padding: 0 max(20px,calc((100vw - 1080px)/2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); }
a { color: var(--brand); text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand); color: white; font-weight: 800; }
.topbar nav { display: flex; gap: 18px; }
.page { width: min(1080px,calc(100% - 32px)); margin: 42px auto 80px; }
.auth-card,.card { width: min(520px,100%); margin: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: 0 18px 50px rgba(26,44,70,.1); }
.card.wide { width: 100%; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 24px 0 12px; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 15px; margin-top: 22px; }
label { display: grid; gap: 6px; font-weight: 650; }
input,select { width: 100%; border: 1px solid #bcc7d3; border-radius: 10px; padding: 11px 12px; font: inherit; background: white; }
input[type=checkbox] { width: auto; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.button,button { display: inline-flex; justify-content: center; border: 0; border-radius: 10px; padding: 11px 16px; background: var(--brand); color: white; font: inherit; font-weight: 750; cursor: pointer; }
.button.secondary { background: #e8eef6; color: var(--ink); }
.button.danger { background: var(--danger); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.notice { padding: 12px 14px; border-radius: 10px; margin: 14px 0; background: #edf4ff; color: #1849a9; }
.notice.error { background: #fef3f2; color: var(--danger); }
.notice.success { background: #ecfdf3; color: var(--ok); }
table { width: 100%; border-collapse: collapse; margin-top: 18px; }
th,td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #eaf0f7; font-size: 12px; }
.badge.ok { background: #dcfae6; color: var(--ok); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.membership { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); margin: 12px 0; }
.membership-head { display: flex; justify-content: space-between; gap: 10px; }
.app-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 12px; margin-top: 22px; }
.app-link { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); color: var(--ink); }
.eyebrow { margin: 0 0 10px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 20px; color: var(--muted); font-size: 13px; }
.portal-shell { width: 100%; }
.portal-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 26px; padding: 8px 4px 0; }
.portal-hero h1 { margin-bottom: 10px; font-size: clamp(32px,5vw,52px); letter-spacing: -.04em; }
.portal-hero p:not(.eyebrow) { max-width: 650px; margin: 0; color: var(--muted); font-size: 17px; }
.portal-count { flex: 0 0 auto; min-width: 150px; padding: 17px 20px; border: 1px solid rgba(21,94,239,.18); border-radius: 18px; background: rgba(255,255,255,.72); box-shadow: 0 12px 32px rgba(26,44,70,.06); }
.portal-count strong,.portal-count span { display: block; }
.portal-count strong { font-size: 30px; line-height: 1; }
.portal-count span { margin-top: 6px; color: var(--muted); font-size: 13px; }
.portal-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.portal-card { --app-accent: #155eef; --app-tint: #eef4ff; display: flex; min-height: 276px; flex-direction: column; gap: 20px; padding: 22px; overflow: hidden; border: 1px solid color-mix(in srgb,var(--app-accent) 20%,#dce3ea); border-radius: 22px; background: linear-gradient(145deg,#fff 22%,var(--app-tint)); color: var(--ink); box-shadow: 0 14px 34px rgba(26,44,70,.07); transition: transform .18s ease,box-shadow .18s ease,border-color .18s ease; }
.portal-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb,var(--app-accent) 52%,#dce3ea); box-shadow: 0 20px 46px rgba(26,44,70,.12); }
.portal-card:focus-visible { outline: 3px solid color-mix(in srgb,var(--app-accent) 42%,white); outline-offset: 3px; }
.portal-card-top,.portal-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--app-accent); color: #fff; font-size: 14px; font-weight: 850; letter-spacing: .03em; box-shadow: 0 9px 20px color-mix(in srgb,var(--app-accent) 28%,transparent); }
.portal-arrow { color: var(--app-accent); font-size: 23px; transition: transform .18s ease; }
.portal-card:hover .portal-arrow { transform: translate(2px,-2px); }
.portal-card-copy { flex: 1; }
.portal-domain { color: var(--app-accent); font-size: 11px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.portal-card h2 { margin: 6px 0 8px; font-size: 23px; letter-spacing: -.025em; }
.portal-card-copy p { margin: 0; color: var(--muted); font-size: 14px; }
.portal-card-meta { padding-top: 15px; border-top: 1px solid color-mix(in srgb,var(--app-accent) 16%,#dce3ea); }
.portal-card-meta strong { color: var(--app-accent); font-size: 13px; }
.portal-role { max-width: 55%; overflow: hidden; padding: 5px 9px; border-radius: 999px; background: color-mix(in srgb,var(--app-accent) 11%,white); color: var(--app-accent); font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.portal-app-kargo { --app-accent: #c45816; --app-tint: #fff7ed; }
.portal-app-tasks { --app-accent: #0e7490; --app-tint: #ecfeff; }
.portal-app-saglik { --app-accent: #b42318; --app-tint: #fff1f0; }
.portal-app-share { --app-accent: #7c3aed; --app-tint: #f5f3ff; }
.portal-app-cloud { --app-accent: #475467; --app-tint: #f2f4f7; }
.portal-app-ip { --app-accent: #027a48; --app-tint: #ecfdf3; }
.portal-app-keizaal { --app-accent: #9a6700; --app-tint: #fffaeb; }
.portal-app-mucahit { --app-accent: #3448a1; --app-tint: #eef4ff; }
.portal-admin-link { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; margin-top: 18px; padding: 18px 20px; border: 1px dashed #9db2d0; border-radius: 18px; background: rgba(255,255,255,.66); color: var(--ink); }
.portal-admin-link:hover { border-style: solid; border-color: var(--brand); background: #fff; }
.portal-admin-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #e8eef6; color: var(--brand); font-weight: 850; }
.portal-admin-link strong,.portal-admin-link small { display: block; }
.portal-admin-link small { margin-top: 2px; color: var(--muted); }
.portal-admin-link b { color: var(--brand); font-size: 22px; }
.portal-empty { padding: 45px 24px; border: 1px dashed #b7c4d4; border-radius: 22px; background: rgba(255,255,255,.64); text-align: center; }
.portal-empty > span { display: block; color: var(--brand); font-size: 38px; }
.portal-empty h2 { margin: 5px 0; }
.portal-empty p { margin: 0; color: var(--muted); }
.global-logout-page { display: grid; place-items: center; padding: 24px; }
.global-logout-card { width: min(520px,100%); padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: 0 22px 60px rgba(26,44,70,.13); text-align: center; }
.global-logout-card > p:not(.eyebrow) { margin: 0 auto; color: var(--muted); }
.global-logout-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 20px; border-radius: 18px; background: #dcfae6; color: var(--ok); font-size: 28px; font-weight: 900; }
.global-logout-progress { height: 7px; margin: 25px 0 19px; overflow: hidden; border-radius: 999px; background: #e7edf4; }
.global-logout-progress span { display: block; width: 38%; height: 100%; border-radius: inherit; background: var(--brand); animation: global-logout-progress 1.15s ease-in-out infinite alternate; }
.global-logout-card > a { font-size: 13px; font-weight: 750; }
.global-logout-pings { position: fixed; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@keyframes global-logout-progress { from { transform: translateX(-15%); } to { transform: translateX(180%); } }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 25px; }
@media(max-width:680px) {
    .topbar { height: auto; min-height: 64px; padding: 12px 16px; align-items: flex-start; }
    .topbar nav { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
    .page { margin-top: 24px; }
    .auth-card,.card { padding: 22px; border-radius: 16px; }
    .auth-links { align-items: flex-start; flex-direction: column; }
    .portal-hero { align-items: stretch; flex-direction: column; }
    .portal-count { min-width: 0; }
    .portal-grid { grid-template-columns: 1fr; }
    .portal-card { min-height: 245px; }
    .portal-admin-link { align-items: start; grid-template-columns: auto 1fr; }
    .portal-admin-link b { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    table { display: block; overflow-x: auto; }
}
@media(min-width:681px) and (max-width:960px) {
    .portal-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
