/* ============================================================
 * shared/common.css — Helix Portal foundation styles
 * Extracted from portal.html (F12.x.0, 2026-05-14)
 *
 * Contains: CSS custom properties, base reset/typography,
 * top bar, portal switcher, layout primitives, sidebar, main.
 *
 * Loaded by: portal.html (root) and all sub-portals
 *   (/git/, /klient/, /dev/, /network/, /dashboard/).
 *
 * Per-view styles remain inline in each portal's index.html
 * <style> block. Do NOT add view-specific rules here.
 * ============================================================ */

  :root {
    --deep-navy: #0D1B2A;
    --steel-blue: #1A2E44;
    --steel-blue-2: #233a55;
    --electric: #00A8E8;
    --electric-soft: rgba(0, 168, 232, 0.12);
    --electric-glow: rgba(0, 168, 232, 0.35);
    --ai-cyan: #00D4D4;
    --frost: #F4F8FB;
    --muted: #6B7C93;
    --muted-soft: #8B9AB1;
    --white: #FFFFFF;
    --border-dark: rgba(255, 255, 255, 0.08);
    --green: #22d36b;
    --orange: #f59e0b;
    --red: #ef4444;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
  }
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

  /* ---------- SVG safety net (F13.x.fix, 2026-05-16) ----------
   * Inline <svg viewBox="..."> without explicit width/height defaults
   * to the SVG intrinsic size — often 300×150px in browsers — which
   * has repeatedly blown up icons across views (commits 416fd4e,
   * efcbdab and several follow-ups). This default keeps any unsized
   * SVG at text height; specific selectors (.btn svg, .nav-item svg,
   * .btn-icon svg, .coming-soon-icon svg, .manual-thumb svg, …)
   * still win on specificity, and inline style="width:..." still
   * wins over CSS, so sized icons are not affected. */
  svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
  }

  body {
    font-family: var(--font-sans);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--white);
    background: var(--deep-navy);
    min-height: 100vh;
    background-image:
      radial-gradient(ellipse 60% 40% at 80% 20%, rgba(0, 168, 232, 0.08), transparent 60%),
      radial-gradient(ellipse 50% 30% at 10% 90%, rgba(0, 212, 212, 0.05), transparent 60%);
    background-attachment: fixed;
  }
  a { color: inherit; text-decoration: none; }
  button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
  ::selection { background: var(--electric); color: var(--deep-navy); }

  /* ---------- TOP BAR ---------- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(13, 27, 42, 0.85);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-dark);
    padding: 14px 28px;
  }
  .topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
  .logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
    color: var(--white);
  }
  .logo-mark {
    /* white glass badge */
    width: 128px; height: 128px;
    border-radius: 18px;
    background:
      radial-gradient(circle at 30% 20%, rgba(255,255,255,1) 0%, rgba(248,250,252,0.96) 100%);
    position: relative;
    margin-top: -32px;
    margin-bottom: -64px;
    z-index: 5;
    box-shadow:
      0 0 32px -6px rgba(0, 168, 232, 0.45),
      0 14px 28px -8px rgba(0, 0, 0, 0.55),
      0 4px 10px -2px rgba(0, 0, 0, 0.35),
      inset 0 1px 0 rgba(255,255,255,0.8),
      inset 0 -1px 0 rgba(0,0,0,0.05);
    overflow: hidden;
    transform-style: preserve-3d;
    transform: perspective(800px) rotateX(0deg) rotateY(0deg);
    transition: box-shadow 320ms cubic-bezier(0.16, 0.84, 0.32, 1),
                transform 80ms linear;
  }
  /* Living gradient layer — masked by 2marsa SVG so letters glow */

  /* Static fallback — black logo via second mask layer for low-power. */

  /* Highlight gleam — small white glow top-left, suggests glass surface */

  /* Click ripple */

  /* Hover: brighter shadow + faster gradient flow */



  /* Lite-mode: kill animations + show static dark logo shape */





    50%  { background-position: 100% 100%; }
    100% { background-position:   0%   0%; }
  }

    100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
  }
  /* ensure the navbar doesn't clip the overhanging mark */
  .nav { overflow: visible; }
  .nav-inner { overflow: visible; }
  .logo .portal-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--electric);
    letter-spacing: 0.10em;
    text-transform: uppercase;
    margin-left: 6px;
    padding: 3px 8px;
    background: rgba(0, 168, 232, 0.10);
    border: 1px solid rgba(0, 168, 232, 0.25);
    border-radius: 100px;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .topbar-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(34, 211, 107, 0.10);
    border: 1px solid rgba(34, 211, 107, 0.30);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--green);
    letter-spacing: 0.04em;
  }
  .topbar-status .dot {
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
    animation: pulseGreen 2s ease-in-out infinite;
  }
  @keyframes pulseGreen {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }

  .user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dark);
    border-radius: 100px;
    font-size: 13px;
  }
  .user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--electric), var(--ai-cyan));
    display: grid; place-items: center;
    color: var(--deep-navy);
    font-weight: 700;
    font-size: 12px;
  }
  .user-name strong { font-weight: 600; }
  .user-name small { display: block; font-size: 10px; color: var(--muted); font-family: var(--font-mono); }

  .btn-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-dark);
    display: grid; place-items: center;
    transition: all 200ms ease;
    color: var(--muted-soft);
  }
  .btn-icon:hover {
    background: rgba(0, 168, 232, 0.10);
    border-color: var(--electric);
    color: var(--electric);
  }
  .btn-icon svg { width: 16px; height: 16px; }

  /* Topbar — breadcrumb / page title slot (restored F13.2) */
  .topbar-page-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted-soft);
    font-size: 13px;
    flex: 1;
    min-width: 0;
  }
  .topbar-page-sep {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 14px;
  }
  .topbar-page-name {
    color: var(--white);
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  @media (max-width: 900px) {
    .topbar-page-title { display: none; }
    .topbar-status { display: none; }
  }

  /* ---------- PORTAL SWITCHER (multi-portal nav under topbar) ---------- */
  .portal-switcher {
    background: rgba(13, 27, 42, 0.65);
    border-bottom: 1px solid var(--border-dark);
    padding: 0 28px;
  }
  .portal-switcher-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 44px;
  }
  .portal-switcher-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin-right: 12px;
    padding-right: 14px;
    border-right: 1px solid var(--border-dark);
    flex-shrink: 0;
  }
  .portal-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
    position: relative;
    white-space: nowrap;
  }
  .portal-switch-btn:hover:not([disabled]):not(.active) {
    background: rgba(0, 168, 232, 0.06);
    color: var(--white);
  }
  .portal-switch-btn.active {
    background: rgba(0, 212, 212, 0.10);
    border-color: rgba(0, 212, 212, 0.32);
    color: var(--white);
    box-shadow: 0 0 0 1px rgba(0, 212, 212, 0.12) inset,
                0 0 14px -5px rgba(0, 212, 212, 0.55);
  }
  .portal-switch-btn[disabled],
  .portal-switch-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
  }
  .portal-switch-btn[disabled]:hover,
  .portal-switch-btn[aria-disabled="true"]:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted-soft);
  }
  .portal-switch-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    transition: background-color 200ms ease, box-shadow 200ms ease;
  }
  .portal-switch-btn.active .portal-switch-dot {
    background: var(--ai-cyan);
    box-shadow: 0 0 8px var(--ai-cyan);
    animation: pulseGreen 2.4s ease-in-out infinite;
  }
  .portal-switch-name {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }
  .portal-switch-tag {
    font-size: 10px;
    color: var(--muted);
    text-transform: lowercase;
    letter-spacing: 0.05em;
    border-left: 1px solid var(--border-dark);
    padding-left: 9px;
    margin-left: 1px;
  }
  .portal-switch-btn.active .portal-switch-tag {
    color: var(--ai-cyan);
    border-left-color: rgba(0, 212, 212, 0.30);
  }
  .portal-switch-btn[aria-disabled="true"] .portal-switch-soon {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--orange);
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.28);
  }
  .portal-switcher-spacer { flex: 1; }
  .portal-switcher-hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.06em;
    opacity: 0.75;
  }

  @media (max-width: 860px) {
    .portal-switcher { padding: 0 16px; }
    .portal-switcher-label { display: none; }
    .portal-switch-btn { padding: 6px 10px; gap: 7px; }
    .portal-switch-tag { display: none; }
    .portal-switcher-hint { display: none; }
    .portal-switcher-inner { height: 40px; overflow-x: auto; gap: 2px; }
  }
  @media (max-width: 480px) {
    .portal-switch-btn[aria-disabled="true"] .portal-switch-soon { display: none; }
  }

  /* ---------- LAYOUT ---------- */
  .portal-layout {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 28px 56px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    align-items: start;
  }
  @media (max-width: 960px) {
    .portal-layout { grid-template-columns: 1fr; }
  }

  /* ---------- SIDEBAR ---------- */
  .sidebar {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 14px;
    position: sticky;
    top: 88px;
  }
  @media (max-width: 960px) {
    .sidebar { position: static; }
  }
  .sidebar-section {
    margin-bottom: 18px;
  }
  .sidebar-section:last-child { margin-bottom: 0; }
  .sidebar-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.10em;
    text-transform: uppercase;
    padding: 0 12px 8px;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted-soft);
    font-size: 14px;
    cursor: pointer;
    transition: all 200ms ease;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
  }
  .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
  .nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--white);
  }
  .nav-item.active {
    background: rgba(0, 168, 232, 0.12);
    color: var(--electric);
    box-shadow: inset 2px 0 0 var(--electric);
  }
  .nav-badge {
    margin-left: auto;
    padding: 2px 7px;
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--electric);
    color: var(--deep-navy);
    border-radius: 100px;
    font-weight: 700;
  }
  .nav-badge.warn { background: var(--orange); }
  .nav-badge.muted { background: rgba(255, 255, 255, 0.08); color: var(--muted-soft); }

  /* ---------- MAIN ---------- */
  .main {
    min-width: 0;
  }
  .view { display: none; animation: viewIn 360ms var(--ease); }
  .view.active { display: block; }
  @keyframes viewIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .view-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
  }
  .view-title {
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--white);
    margin-bottom: 4px;
  }
  .view-subtitle {
    font-size: 14px;
    color: var(--muted-soft);
  }


  /* ----- Shared button utility (F12.x.2 promotion) ----------------
   * Promoted from portal.html (was around line 4905). Used across
   * every sub-portal (form actions, dialogs, primary CTAs).
   * --------------------------------------------------------------- */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 200ms ease;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
  }
  .btn-primary {
    background: var(--electric);
    color: var(--deep-navy);
  }
  .btn-primary:hover {
    background: var(--ai-cyan);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px var(--electric-glow);
  }
  .btn-secondary {
    background: transparent;
    color: var(--white);
    border-color: var(--border-dark);
  }
  .btn svg,
  .btn-primary svg,
  .btn-secondary svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  .btn-secondary:hover {
    border-color: var(--electric);
    color: var(--electric);
  }

  /* ---------- SIDEBAR — F13.2 unified component additions ---------- */
  .sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 4px 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-dark);
  }
  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
  }
  .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    flex-shrink: 0;
  }
  .avatar--customer {
    background: linear-gradient(135deg, var(--electric), var(--ai-cyan));
    box-shadow: 0 0 12px rgba(0, 168, 232, 0.28);
  }
  .avatar--admin {
    background: linear-gradient(135deg, var(--orange), #f97316);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.28);
  }
  .sidebar-user-meta {
    min-width: 0;
    overflow: hidden;
  }
  .sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-user-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
    min-width: 0;
  }
  .sidebar-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .role-badge {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
  }
  .role-badge.customer {
    background: var(--electric-soft);
    color: var(--electric);
  }
  .role-badge.admin {
    background: rgba(245, 158, 11, 0.16);
    color: var(--orange);
  }
  .sidebar-switch {
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0, 168, 232, 0.08);
    border: 1px solid rgba(0, 168, 232, 0.22);
    color: var(--electric);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 180ms ease;
    flex-shrink: 0;
    align-self: center;
  }
  .sidebar-switch:hover {
    background: var(--electric-soft);
    border-color: var(--electric);
  }
  .sidebar-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 4px 10px;
  }
  .sidebar-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-dark);
  }
  .sidebar-divider-label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .sidebar-nav .nav-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sidebar-nav .nav-item .ti {
    font-size: 17px;
    line-height: 1;
    flex-shrink: 0;
  }
  .sidebar-error {
    padding: 12px;
    font-size: 12px;
    color: var(--red);
    background: rgba(239, 68, 68, 0.08);
    border-radius: 6px;
  }
