
    /* CSS Custom Properties zgodne ze Style Guide i App Shell */



    @media (prefers-reduced-motion: reduce) {
      * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
      }
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      background-color: var(--bg);
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 15px;
      line-height: 1.6;
      transition: background-color 0.25s ease, color 0.25s ease;
      padding: 32px 20px 80px;
    }

    .container {
      max-width: 1280px;
      margin: 0 auto;
    }

    header.spec-header {
      margin-bottom: 40px;
      padding-bottom: 24px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 20px;
      flex-wrap: wrap;
    }

    .badge-label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 6px;
      display: inline-block;
    }

    h1.spec-title {
      font-family: var(--font-serif);
      font-size: clamp(28px, 3.2vw, 38px);
      font-weight: 500;
      letter-spacing: -0.01em;
      line-height: 1.2;
      margin-bottom: 8px;
    }

    p.spec-subtitle {
      color: var(--text-muted);
      max-width: 760px;
      font-size: 15px;
      line-height: 1.6;
    }

    /* Controls bar */
    .controls-group {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface);
      border: 1px solid var(--border);
      padding: 6px 12px;
      border-radius: var(--radius-card);
    }

    .theme-toggle-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: var(--surface-raised);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px 14px;
      border-radius: var(--radius-control);
      font-family: var(--font-sans);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      min-height: 44px;
      transition: all 0.2s ease;
    }
    .theme-toggle-btn:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    /* Section Styles */
    section {
      margin-bottom: 56px;
    }

    .section-heading {
      margin-bottom: 24px;
    }

    .section-title {
      font-family: var(--font-serif);
      font-size: 24px;
      font-weight: 500;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .section-desc {
      color: var(--text-muted);
      font-size: 14px;
    }

    /* Grid for Mobile Mockups */
    .mockups-grid-390 {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(390px, 390px));
      gap: 32px;
      justify-content: center;
      margin-top: 24px;
    }

    @media (max-width: 440px) {
      .mockups-grid-390 {
        grid-template-columns: 1fr;
      }
    }

    /* Phone Shell Chrome (390px frame) */
    .phone-device {
      width: 100%;
      max-width: 390px;
      min-height: 760px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 36px;
      box-shadow: 0 16px 40px -12px rgba(0,0,0,0.12);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      position: relative;
    }

    .phone-notch-bar {
      height: 38px;
      padding: 0 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-subtle);
      border-bottom: 1px solid transparent;
      user-select: none;
    }

    .phone-top-bar {
      min-height: 52px;
      padding: 8px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border);
      background: var(--bg);
    }

    .phone-back-action {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      font-weight: 600;
      color: var(--accent);
      text-decoration: none;
      min-width: 44px;
      min-height: 44px;
      background: transparent;
      border: none;
      cursor: pointer;
    }

    .phone-lang-switch {
      display: flex;
      background: var(--surface-raised);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 2px;
      gap: 2px;
      font-size: 11px;
      font-weight: 600;
    }

    .phone-lang-switch span {
      padding: 4px 8px;
      border-radius: 4px;
      color: var(--text-muted);
    }

    .phone-lang-switch span.active {
      background: var(--surface);
      color: var(--text);
      box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    }

    .phone-content {
      padding: 24px 20px 32px;
      flex: 1;
      display: flex;
      flex-direction: column;
    }

    .phone-home-indicator {
      width: 134px;
      height: 4px;
      background: var(--border);
      border-radius: 2px;
      margin: 12px auto 8px;
    }

    /* Brand Header inside flow */
    .brand-mark {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 24px;
    }

    .brand-logo-sq {
      width: 38px;
      height: 38px;
      background: var(--accent);
      color: #FFFFFF;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-serif);
      font-size: 20px;
      font-weight: 600;
    }

    .brand-names {
      display: flex;
      flex-direction: column;
    }

    .brand-names .name-main {
      font-family: var(--font-serif);
      font-size: 18px;
      font-weight: 600;
      line-height: 1.1;
      color: var(--text);
    }

    .brand-names .name-sub {
      font-size: 11px;
      letter-spacing: 0.04em;
      color: var(--text-muted);
      text-transform: uppercase;
    }

    .form-heading-title {
      font-family: var(--font-serif);
      font-size: 24px;
      font-weight: 500;
      line-height: 1.25;
      margin-bottom: 6px;
      color: var(--text);
    }

    .form-heading-sub {
      font-size: 13.5px;
      color: var(--text-muted);
      line-height: 1.5;
      margin-bottom: 24px;
    }

    /* Form Elements */
    .form-group {
      margin-bottom: 18px;
      position: relative;
    }

    .input-wrapper {
      position: relative;
      display: flex;
      align-items: center;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-control);
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .input-wrapper:focus-within {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--focus-ring);
    }

    .input-wrapper.error {
      border-color: var(--danger);
      background-color: var(--danger-bg);
    }

    .input-wrapper.error:focus-within {
      box-shadow: 0 0 0 3px rgba(254, 63, 33, 0.25);
    }

    .input-wrapper.validating {
      border-color: var(--orange);
    }

    .input-wrapper.disabled {
      background: var(--surface-raised);
      opacity: 0.7;
      pointer-events: none;
    }

    .input-field {
      width: 100%;
      height: 52px;
      padding: 18px 14px 4px 14px;
      background: transparent;
      border: none;
      outline: none;
      font-family: var(--font-sans);
      font-size: 15px;
      color: var(--text);
    }

    .input-label {
      position: absolute;
      left: 14px;
      top: 15px;
      font-size: 14px;
      color: var(--text-muted);
      pointer-events: none;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      transform-origin: left top;
    }

    /* Floating label behaviour */
    .input-wrapper.has-value .input-label,
    .input-field:focus ~ .input-label {
      transform: translateY(-8px) scale(0.78);
      color: var(--text-subtle);
      font-weight: 500;
    }

    .input-field:focus ~ .input-label {
      color: var(--accent);
    }

    .input-wrapper.error .input-label {
      color: var(--danger);
    }

    /* Password toggle button (A11y min 44x44) */
    .toggle-visibility-btn {
      min-width: 44px;
      min-height: 44px;
      background: transparent;
      border: none;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      padding: 10px;
      margin-right: 4px;
      border-radius: 6px;
    }
    .toggle-visibility-btn:focus-visible {
      outline: 2px solid var(--accent);
    }

    /* Inline Field Error */
    .field-error-msg {
      display: flex;
      align-items: flex-start;
      gap: 6px;
      color: var(--danger);
      font-size: 12.5px;
      line-height: 1.4;
      margin-top: 6px;
      font-weight: 500;
    }

    .field-error-msg svg {
      flex-shrink: 0;
      margin-top: 2px;
    }

    /* Field Helper Text */
    .field-hint-msg {
      font-size: 12px;
      color: var(--text-subtle);
      margin-top: 5px;
      line-height: 1.4;
    }

    /* Checkbox terms */
    .checkbox-group {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      margin: 18px 0 24px;
      cursor: pointer;
    }

    .custom-checkbox {
      width: 22px;
      height: 22px;
      min-width: 22px;
      border: 1.5px solid var(--border);
      border-radius: 4px;
      background: var(--surface);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 2px;
      transition: all 0.15s ease;
    }

    .checkbox-group:hover .custom-checkbox {
      border-color: var(--accent);
    }

    .custom-checkbox.checked {
      background: var(--accent);
      border-color: var(--accent);
      color: #FFF;
    }

    .custom-checkbox.error {
      border-color: var(--danger);
      background-color: var(--danger-bg);
    }

    .checkbox-label {
      font-size: 13px;
      color: var(--text-muted);
      line-height: 1.45;
    }

    .checkbox-label a {
      color: var(--accent);
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    /* Buttons */
    .btn-primary {
      width: 100%;
      min-height: 48px;
      background: var(--accent);
      color: var(--accent-contrast);
      border: none;
      border-radius: var(--radius-control);
      font-family: var(--font-sans);
      font-size: 15px;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      cursor: pointer;
      transition: background 0.15s ease, transform 0.05s ease;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .btn-primary:hover {
      background: var(--accent-hover);
    }

    .btn-primary:active {
      transform: scale(0.99);
    }

    .btn-primary:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    .btn-primary.loading {
      opacity: 0.85;
      pointer-events: none;
    }

    .btn-primary.disabled,
    .btn-primary:disabled {
      background: var(--border);
      color: var(--text-subtle);
      cursor: not-allowed;
      box-shadow: none;
    }

    .btn-secondary {
      width: 100%;
      min-height: 48px;
      background: transparent;
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: var(--radius-control);
      font-family: var(--font-sans);
      font-size: 14.5px;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      cursor: pointer;
      margin-top: 10px;
    }

    .btn-secondary:hover {
      background: var(--surface-raised);
    }

    .btn-quiet {
      background: transparent;
      border: none;
      color: var(--accent);
      font-size: 13.5px;
      font-weight: 600;
      padding: 8px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 44px;
    }

    .btn-quiet:hover {
      text-decoration: underline;
    }

    .form-links {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
      font-size: 13px;
    }

    .form-links a {
      color: var(--accent);
      text-decoration: none;
      font-weight: 500;
      min-height: 44px;
      display: inline-flex;
      align-items: center;
    }
    .form-links a:hover {
      text-decoration: underline;
    }

    /* Server Banner Error */
    .server-alert-banner {
      background: var(--danger-bg);
      border: 1px solid var(--danger);
      border-radius: var(--radius-control);
      padding: 12px 14px;
      margin-bottom: 20px;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      color: var(--danger);
      font-size: 13px;
      line-height: 1.45;
    }

    .server-alert-banner.warning {
      background: var(--warning-bg);
      border-color: var(--warning);
      color: var(--warning);
    }

    .server-alert-banner.success {
      background: var(--success-bg);
      border-color: var(--success);
      color: var(--success);
    }

    /* Spinner Animation */
    .spinner {
      width: 18px;
      height: 18px;
      border: 2px solid rgba(255,255,255,0.3);
      border-radius: 50%;
      border-top-color: #FFFFFF;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    /* Device Limit Card */
    .device-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-card);
      padding: 14px 16px;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .device-info-left {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .device-icon-wrapper {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      background: var(--surface-raised);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
    }

    .device-title {
      font-weight: 600;
      font-size: 14px;
      color: var(--text);
    }

    .device-meta {
      font-size: 12px;
      color: var(--text-subtle);
    }

    .btn-release-device {
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: transparent;
      color: var(--danger);
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer;
      min-height: 44px;
      white-space: nowrap;
    }
    .btn-release-device:hover {
      background: var(--danger-bg);
      border-color: var(--danger);
    }

    /* Wide Screen Layout Showcase */
    .wide-screen-container {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 20px;
      box-shadow: 0 12px 32px rgba(0,0,0,0.08);
      overflow: hidden;
      margin-top: 24px;
      display: flex;
      min-height: 620px;
    }

    .wide-sidebar {
      width: 240px;
      background: var(--surface);
      border-right: 1px solid var(--border);
      padding: 24px 16px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      flex-shrink: 0;
    }

    .wide-content-area {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 40px 24px;
      background: var(--bg);
    }

    .auth-desktop-card {
      width: 100%;
      max-width: 420px; /* Ściśle zgodnie z ograniczeniem projektowym: max 420px na szerokim ekranie */
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-sheet);
      padding: 36px 32px;
      box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    }

    /* Tabs for state matrix */
    .states-table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 16px;
      font-size: 13.5px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-card);
      overflow: hidden;
    }

    .states-table th {
      text-align: left;
      padding: 12px 16px;
      background: var(--surface-raised);
      border-bottom: 1px solid var(--border);
      font-weight: 600;
      color: var(--text-muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .states-table td {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      color: var(--text);
      vertical-align: middle;
    }

    .states-table tr:last-child td {
      border-bottom: none;
    }

    .state-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 8px;
      border-radius: 4px;
      font-size: 11.5px;
      font-weight: 600;
    }

    .state-badge.empty { background: var(--surface-raised); color: var(--text-muted); }
    .state-badge.filled { background: #EDF1FD; color: #3942B0; }
    .state-badge.validating { background: var(--warning-bg); color: var(--warning); }
    .state-badge.error { background: var(--danger-bg); color: var(--danger); }
    .state-badge.submitting { background: #E8EEFB; color: var(--accent); }

    /* Footer note */
    .footer-note {
      margin-top: 40px;
      padding-top: 20px;
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      color: var(--text-muted);
      font-size: 13px;
      flex-wrap: wrap;
      gap: 12px;
    }
  