/* ============================================================
   Super Optik - ortaq komponentlər + giriş / müştəri portalı körpüsü.
   Tokenlər: so-tokens.css. Yalnız <body class="so-ui"> daxilində işləyir
   (admin panel, billing-ui və s. toxunulmazdır). portal.css-dən SONRA yüklənir.
   Yalnız təqdimat: forma sahə adları, action, CSRF, captcha dəyişmir.
   ============================================================ */

/* ---- portal dəyişənlərini ortaq tokenlərə bağla (gecə rejimi avtomatik) ---- */
body.so-ui{
  --portal-bg:var(--bg); --portal-surface:var(--surface); --portal-surface-strong:var(--surface);
  --portal-surface-soft:var(--surface2); --portal-line:var(--border); --portal-line-strong:var(--border-str);
  --portal-text:var(--text); --portal-muted:var(--muted); --portal-primary:var(--brand);
  --portal-primary-dark:var(--brand-hover); --portal-accent:var(--accent);
  --portal-danger:var(--danger); --portal-success:var(--ok);
  --portal-shadow:var(--shadow); --portal-shadow-soft:var(--shadow);
  --mgs-focus-ring:0 0 0 3px var(--ring);
  --ui-color-canvas:var(--bg); --ui-color-surface:var(--surface); --ui-color-surface-muted:var(--surface2);
  --ui-color-text:var(--text); --ui-color-text-muted:var(--muted); --ui-color-border:var(--border);
  --ui-color-border-strong:var(--border-str); --ui-color-primary:var(--brand); --ui-color-primary-hover:var(--brand-hover);
  --ui-color-accent:var(--accent); --ui-color-success:var(--ok); --ui-color-warning:var(--warn);
  --ui-color-danger:var(--danger); --ui-color-info:var(--brand-ink); --ui-focus-ring:0 0 0 3px var(--ring);
  background:var(--bg); color:var(--text); font-family:var(--font); line-height:1.5;
}
body.so-ui.portal-auth-body{font-family:var(--font)}

/* ---- yüzeylər: gradient/parıltı yox, düz səth + sərhəd ---- */
body.so-ui :is(.portal-auth-copy,.portal-auth-card,.portal-topbar,.portal-topbar.is-scrolled,.portal-user-chip,.portal-hero,
  .portal-status-card,.portal-metric-card,.portal-workflow-guide,.portal-workflow-step,.portal-table-wrap,.portal-card,
  .billing-nav-group,.billing-nav-links,.mgs-command-hero,.mgs-stat-card,.mgs-chart-card,.mgs-data-card,.mgs-chart-tile,
  .mgs-timeline-item,.mgs-filter-panel,.mgs-customer-card,.mgs-empty-state,.mgs-profile-card,.mgs-kanban-column,
  .mgs-session-card,.mgs-ticket-card,.portal-muted-card,.mgs-insight-card,.mgs-action-tile,.mgs-channel-card,
  .mgs-compact-row,.mgs-page-header,.mgs-summary-card,.mgs-action-dropdown-menu,.customer-ticket-card){
  background:var(--surface); background-image:none; border:1px solid var(--border); box-shadow:var(--shadow);
  color:var(--text); backdrop-filter:none; -webkit-backdrop-filter:none;
}
body.so-ui :is(.portal-table th,.mgs-chip,.mgs-profile-kv div,.mgs-command-panel .portal-profile-list div,.mgs-ring-chart,
  .mgs-progress-track,.mgs-tab-nav a,.mgs-tab-shell a,.mgs-tab-shell button,.mgs-ticket-actions a,.portal-pagination a,
  .portal-pagination button,.mgs-wizard-steps span,.mgs-action-dropdown-menu a,.mgs-action-dropdown-menu button,.billing-nav-links a,
  .billing-nav-direct){
  background:var(--surface2); background-image:none; border-color:var(--border); color:var(--text);
}
body.so-ui .portal-table tr{background:transparent}
body.so-ui :is(.portal-card,.portal-status-card,.portal-metric-card):hover{transform:none;box-shadow:var(--shadow)}
body.so-ui :is(.portal-hero,.mgs-command-hero)::before,body.so-ui :is(.portal-hero,.mgs-command-hero)::after{display:none}
body.so-ui :is(h1,h2,h3,h4){color:var(--text);letter-spacing:-.015em;line-height:1.15;text-wrap:balance}
body.so-ui p{text-wrap:pretty}
body.so-ui :is(.portal-muted,.portal-kicker,small){color:var(--muted)}
body.so-ui .portal-kicker{color:var(--brand-ink);background:var(--brand-soft);border:0}
body.so-ui a{color:inherit}
body.so-ui .portal-auth-card a:not([class]),body.so-ui .portal-card a:not([class]){color:var(--brand-ink);text-decoration:underline;text-underline-offset:3px}

/* ---- düymələr: >=44px, açıq iyerarxiya, basılma geri bildirimi ---- */
body.so-ui :is(.portal-submit-btn,.portal-primary-btn,.portal-inline-form button,.portal-ghost-btn,.portal-role-btn,.portal-sso-btn,
  .portal-pagination a,.portal-pagination button,.mgs-tab-nav a,.mgs-ticket-actions a){
  min-height:var(--tap); display:inline-flex; align-items:center; justify-content:center; gap:var(--s-2);
  padding:10px 20px; border-radius:var(--r-sm); font-weight:600; font-size:.95rem; line-height:1.2; font-family:inherit;
  cursor:pointer; text-decoration:none; transform:none;
  transition:background-color var(--t-base) var(--ease),border-color var(--t-base) var(--ease),color var(--t-base) var(--ease),transform var(--t-fast) var(--ease);
}
body.so-ui :is(.portal-submit-btn,.portal-primary-btn,.portal-inline-form button){
  background:var(--brand); background-image:none; color:var(--on-brand); border:1px solid transparent; box-shadow:none;
}
body.so-ui :is(.portal-submit-btn,.portal-primary-btn,.portal-inline-form button):hover{background:var(--brand-hover);transform:none}
body.so-ui :is(.portal-ghost-btn,.portal-sso-btn,.portal-role-btn){
  background:transparent; color:var(--text); border:1px solid var(--border-str); box-shadow:none;
}
body.so-ui :is(.portal-ghost-btn,.portal-sso-btn,.portal-role-btn):hover{background:var(--surface2);transform:none}
body.so-ui .portal-role-btn.is-active{background:var(--brand);color:var(--on-brand);border-color:var(--brand);box-shadow:none}
body.so-ui :is(.portal-submit-btn,.portal-primary-btn,.portal-inline-form button,.portal-ghost-btn,.portal-role-btn,.portal-sso-btn):active{transform:scale(.98)}
body.so-ui :is(.portal-submit-btn,.portal-primary-btn,.portal-inline-form button)[disabled],
body.so-ui :is(.portal-submit-btn,.portal-primary-btn)[aria-busy="true"]{opacity:.6;cursor:progress}

/* ---- sahələr: görünən etiket, >=46px, aydın fokus və xəta ---- */
body.so-ui :is(.portal-form-row,.portal-inline-form) label{font-size:.875rem;font-weight:600;color:var(--muted)}
body.so-ui :is(.portal-form-row,.portal-card .portal-stacked-form,.portal-inline-inputs,.portal-local-challenge,.customer-ticket-mini)
  :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea){
  min-height:46px; padding:12px 14px; border:1px solid var(--border-str); border-radius:var(--r-sm);
  background:var(--surface); color:var(--text); font:inherit; font-size:1rem;
  transition:border-color var(--t-base) var(--ease),box-shadow var(--t-base) var(--ease);
}
body.so-ui :is(input,select,textarea)::placeholder{color:var(--faint);opacity:1}
body.so-ui :is(.portal-form-row,.portal-inline-inputs,.portal-card .portal-stacked-form,.portal-local-challenge) :is(input,select,textarea):focus{
  outline:0; border-color:var(--brand); box-shadow:0 0 0 3px var(--ring);
}
body.so-ui :is(input,select,textarea):user-invalid{border-color:var(--danger);box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 25%,transparent)}
body.so-ui :is(.portal-form-row input[type=date],.portal-form-row input[type=month]){color-scheme:inherit}
body.so-ui :is(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline:2px solid var(--brand-ink);outline-offset:2px;border-radius:6px}

/* ---- bildirişlər (rəngdən əlavə ikon + mətn artıq markup-dadır) ---- */
body.so-ui .portal-alert{border:1px solid transparent;border-radius:var(--r-sm)}
body.so-ui .portal-alert-success{background:var(--ok-soft);color:var(--ok);border-color:color-mix(in srgb,var(--ok) 35%,transparent)}
body.so-ui .portal-alert-error{background:var(--danger-soft);color:var(--danger);border-color:color-mix(in srgb,var(--danger) 35%,transparent)}

/* ---- cədvəl və statuslar ---- */
body.so-ui .portal-table{color:var(--text)}
body.so-ui .portal-table :is(th,td){border-color:var(--border)}
body.so-ui :is(.mgs-progress-fill,.mgs-bar-fill){background:var(--brand);background-image:none}
body.so-ui :is(.mgs-progress-fill.is-hot,.mgs-progress-fill.is-warm,.mgs-progress-fill.is-orange,.mgs-bar-fill.is-orange){background:var(--accent)}

/* ---- yüksək kontrast və şəffaflığı azalt ---- */
@media(prefers-contrast:more){
  body.so-ui :is(.portal-auth-card,.portal-card,.portal-status-card,.portal-metric-card,.mgs-data-card){border-color:var(--border-str);border-width:2px}
}
@media(prefers-reduced-transparency:reduce){
  body.so-ui .portal-topbar{backdrop-filter:none;-webkit-backdrop-filter:none;background:var(--surface)}
}

/* ---- giriş səhifəsi: tünd-yaşıl gradient paneli və dekorativ ləkələr əvəzinə düz səth ---- */
body.so-ui.portal-auth-body{background:var(--bg)}
body.so-ui .portal-auth-copy::after,body.so-ui .portal-auth-card::before{display:none}
body.so-ui .portal-auth-copy{background:var(--surface2);border-color:var(--border);color:var(--text)}
body.so-ui .portal-auth-copy p{color:var(--muted)}
body.so-ui .portal-auth-copy .portal-brand{color:var(--text)}
body.so-ui .portal-auth-copy .portal-brand img{background:transparent;padding:0}
body.so-ui .portal-auth-copy .portal-kicker{background:var(--brand-soft);color:var(--brand-ink)}
body.so-ui .portal-auth-copy .portal-benefits div{background:var(--surface);border:1px solid var(--border);color:var(--text)}
body.so-ui .portal-auth-copy .portal-benefits i{color:var(--brand-ink)}
body.so-ui .portal-auth-topbar,body.so-ui .portal-auth-topbar-brand,body.so-ui .portal-auth-topbar-site{color:var(--text)}
body.so-ui .portal-auth-topbar-brand b{color:var(--brand-ink)}
body.so-ui .portal-auth-topbar-site{min-height:var(--tap);border:1px solid var(--border-str);background:var(--surface)}
body.so-ui .portal-demo-box{background:var(--brand-soft);border-color:var(--border);color:var(--text)}
body.so-ui .portal-auth-card .portal-form-row input{min-height:52px;border-radius:var(--r-sm)}
body.so-ui .portal-auth-card .portal-submit-btn{width:100%;min-height:52px;font-family:inherit}
body.so-ui .portal-auth-card :is(.portal-form-row input,.portal-submit-btn,a):focus-visible,
body.so-ui .portal-auth-topbar a:focus-visible{outline:2px solid var(--brand-ink);outline-offset:2px}
body.so-ui :is(.portal-auth-topbar-brand,.portal-brand){min-height:var(--tap)}
body.so-ui .portal-demo-box{margin-bottom:var(--s-3)}

/* ---- müştəri portalı: keçid kartları, bilet sətirləri, nişanlar, flash ---- */
body.so-ui :is(.portal-link-card,.portal-ticket-item){background:var(--surface2);border:1px solid var(--border);color:var(--text);box-shadow:none}
body.so-ui :is(.portal-link-card,.portal-ticket-item,.portal-card,.portal-status-card,.portal-metric-card):hover{transform:none;box-shadow:none;border-color:var(--border-str)}
body.so-ui .portal-link-card{min-height:var(--tap)}
body.so-ui .portal-link-card::after{color:var(--brand-ink)}
body.so-ui .portal-link-card span,body.so-ui .portal-ticket-item p{color:var(--muted)}
body.so-ui .portal-pill{background:var(--brand-soft);color:var(--brand-ink)}
body.so-ui .portal-pill-success{background:var(--ok-soft);color:var(--ok)}
body.so-ui .portal-pill-danger{background:var(--danger-soft);color:var(--danger)}
body.so-ui .portal-flash{border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface2);color:var(--text)}
body.so-ui .portal-flash-success{background:var(--ok-soft);color:var(--ok)}
body.so-ui .portal-flash-error{background:var(--danger-soft);color:var(--danger)}
body.so-ui .portal-service-card::before{height:4px;background:var(--faint)}
body.so-ui .portal-service-online::before{background:var(--ok)}
body.so-ui .portal-service-offline::before{background:var(--danger)}
body.so-ui .portal-char-counter{color:var(--muted)}

/* Customer portal dashboard: compact, glanceable status without changing account actions. */
body.so-ui .customer-overview-grid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0 0 var(--s-5);
}
body.so-ui .customer-overview-card{
  position:relative;isolation:isolate;display:grid;gap:7px;min-width:0;min-height:156px;padding:18px;
  overflow:hidden;border:1px solid var(--border);border-radius:var(--r);background:var(--surface);box-shadow:var(--shadow);
}
body.so-ui .customer-overview-card::after{
  content:"";position:absolute;z-index:-1;right:-44px;bottom:-56px;width:148px;height:148px;border-radius:50%;opacity:.7;
  background:radial-gradient(circle,currentColor 0%,transparent 70%);
}
body.so-ui .customer-overview-card--service{color:var(--ok)}
body.so-ui .customer-overview-card--balance{color:var(--brand-ink)}
body.so-ui .customer-overview-card--time{color:var(--accent)}
body.so-ui .customer-overview-card--plan{color:#7364d7}
body.so-ui .customer-overview-card > :is(span,small){color:var(--muted)}
body.so-ui .customer-overview-card strong{min-width:0;color:var(--text);font-size:clamp(1.18rem,2.2vw,1.65rem);line-height:1.12;letter-spacing:-.035em;overflow-wrap:anywhere}
body.so-ui .customer-overview-card small{font-size:.78rem;line-height:1.35}
body.so-ui .customer-overview-icon{
  display:grid;place-items:center;width:36px;height:36px;border-radius:12px;background:color-mix(in srgb,currentColor 13%,transparent);color:currentColor;
}
body.so-ui .customer-live-pulse{
  display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:24px;align-items:center;margin:0 0 var(--s-5);padding:clamp(18px,3vw,30px);
  border:1px solid var(--border);border-radius:var(--r);background:linear-gradient(135deg,color-mix(in srgb,var(--brand-soft) 64%,var(--surface)),var(--surface));box-shadow:var(--shadow);
}
body.so-ui .customer-live-pulse-copy{min-width:0}
body.so-ui .customer-live-pulse-copy h2{margin:9px 0 8px;font-size:clamp(1.4rem,3vw,2rem)}
body.so-ui .customer-live-pulse-copy p{max-width:48ch;margin:0;color:var(--muted)}
body.so-ui .customer-live-pulse-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
body.so-ui .customer-pulse-stat{display:grid;gap:8px;min-width:0;padding:14px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface)}
body.so-ui .customer-pulse-stat span{color:var(--muted);font-size:.78rem;font-weight:650}
body.so-ui .customer-pulse-stat strong{min-width:0;color:var(--text);font-size:1.02rem;overflow-wrap:anywhere}
body.so-ui .customer-pulse-bar{display:block;height:6px;border-radius:999px;background:linear-gradient(90deg,var(--brand),#59c9cf 68%,transparent 68%);opacity:.82}
body.so-ui .customer-pulse-stat:nth-child(2) .customer-pulse-bar{background:linear-gradient(90deg,var(--accent),#f7c26a 52%,transparent 52%)}
body.so-ui .customer-pulse-stat:nth-child(3) .customer-pulse-bar{background:linear-gradient(90deg,var(--ok),#78d4a4 82%,transparent 82%)}
body.so-ui .portal-security-block{display:grid;gap:16px;margin-top:20px;padding:18px;border:1px solid var(--border);border-radius:var(--r);background:var(--surface2)}
body.so-ui .portal-security-block-head{display:flex;align-items:flex-start;gap:12px}
body.so-ui .portal-security-block-icon{display:grid;place-items:center;flex:none;width:40px;height:40px;border-radius:13px;background:var(--brand-soft);color:var(--brand-ink)}
body.so-ui .portal-security-block h3{margin:0;font-size:1rem}
body.so-ui .portal-security-block p{margin:4px 0 0;color:var(--muted);font-size:.86rem;line-height:1.45}
body.so-ui .portal-security-block .portal-inline-form{margin:0;padding:0;border:0;background:transparent}

@media (max-width: 900px){
  body.so-ui .customer-overview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.so-ui .customer-live-pulse{grid-template-columns:1fr}
}
@media (max-width: 560px){
  body.so-ui .customer-overview-grid{gap:10px}
  body.so-ui .customer-overview-card{min-height:144px;padding:15px}
  body.so-ui .customer-live-pulse{gap:18px;padding:18px}
  body.so-ui .customer-live-pulse-stats{grid-template-columns:1fr}
  body.so-ui .customer-pulse-stat{grid-template-columns:minmax(0,1fr) auto;align-items:center}
  body.so-ui .customer-pulse-bar{grid-column:1/-1}
  body.so-ui .portal-security-block{padding:15px}
}
@media (max-width: 360px){
  body.so-ui .customer-overview-grid{grid-template-columns:1fr}
}
/* Customer portal: compact navigation, real traffic chart and readable messages. */
body.so-ui .customer-section-nav { display:flex; gap:8px; overflow-x:auto; padding:4px 2px 10px; scrollbar-width:thin; }
body.so-ui .customer-section-nav a { flex:0 0 auto; display:inline-flex; align-items:center; gap:8px; min-height:42px; padding:0 14px; border:1px solid var(--sot-line, #d9e1ea); border-radius:999px; background:var(--sot-surface, #fff); color:var(--sot-text, #10233d); text-decoration:none; font-size:.88rem; font-weight:750; touch-action:manipulation; }
body.so-ui .customer-section-nav a:active { transform:scale(.98); }
@media (hover:hover) and (pointer:fine) { body.so-ui .customer-section-nav a:hover { border-color:#18aabd; background:#eefbfd; } }
body.so-ui .customer-traffic-card { overflow:hidden; }
body.so-ui .customer-traffic-tabs { display:flex; gap:6px; padding:4px; border-radius:12px; background:var(--sot-hover, #f2f6f8); }
body.so-ui .customer-traffic-tabs button { min-height:36px; padding:0 12px; border:0; border-radius:9px; background:transparent; color:var(--sot-muted, #60718a); font:700 .83rem inherit; touch-action:manipulation; }
body.so-ui .customer-traffic-tabs button[aria-pressed="true"] { background:var(--sot-surface, #fff); color:#087f8c; box-shadow:0 2px 8px rgba(15,48,73,.12); }
body.so-ui .customer-traffic-chart { min-height:250px; margin-top:14px; padding:14px 12px 8px; border:1px solid var(--sot-line, #d9e1ea); border-radius:18px; background:linear-gradient(145deg, color-mix(in srgb, var(--sot-surface, #fff) 94%, #e9fbff), var(--sot-surface, #fff)); }
body.so-ui .customer-traffic-chart svg { display:block; width:100%; height:auto; color:var(--sot-muted, #60718a); }
body.so-ui .customer-traffic-legend { display:flex; flex-wrap:wrap; gap:12px; align-items:center; padding:3px 8px 0; color:var(--sot-muted, #60718a); font-size:.78rem; font-weight:650; }
body.so-ui .customer-traffic-legend small { margin-left:auto; }
body.so-ui .traffic-dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px; }
body.so-ui .traffic-dot--download { background:#19b8d4; } body.so-ui .traffic-dot--upload { background:#a66cf4; }
body.so-ui .customer-traffic-loading { display:grid; min-height:212px; place-items:center; color:var(--sot-muted, #60718a); }
body.so-ui .customer-traffic-note { display:block; padding-top:10px; color:var(--sot-muted, #60718a); line-height:1.45; }
body.so-ui .portal-message-list { display:grid; gap:10px; }
body.so-ui .portal-message-item { padding:15px 16px; border:1px solid var(--sot-line, #d9e1ea); border-radius:16px; background:var(--sot-surface, #fff); }
body.so-ui .portal-message-meta { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; color:var(--sot-muted, #60718a); font-size:.8rem; font-weight:650; }
body.so-ui .portal-message-meta time { margin-left:auto; font-variant-numeric:tabular-nums; }
body.so-ui .portal-message-item p { max-width:76ch; margin:10px 0 0; color:var(--sot-text, #10233d); line-height:1.55; overflow-wrap:anywhere; }
body.so-ui .portal-empty-state { margin:0; padding:20px; border-radius:14px; background:var(--sot-hover, #f2f6f8); color:var(--sot-muted, #60718a); }
@media (max-width:600px) { body.so-ui .customer-traffic-card .portal-card-head { align-items:flex-start; } body.so-ui .customer-traffic-tabs { width:100%; } body.so-ui .customer-traffic-tabs button { flex:1; } body.so-ui .customer-traffic-chart { min-height:220px; padding:12px 5px 7px; } body.so-ui .portal-message-item { padding:14px; } body.so-ui .portal-message-meta time { width:100%; margin-left:0; } }
