/* ============================================
   PostPro Customer Portal — Light content + dark chrome (nav/header)
   Full dark theme: portal-dark.css (optional)
   ============================================ */

:root {
  color-scheme: light;

  /* AMT Brand Colors - Primary */
  --primary: #4FC3CA;
  --primary-dark: #3BA8AF;
  --primary-light: rgba(79, 195, 202, 0.12);
  --primary-glow: rgba(79, 195, 202, 0.25);
  --secondary: #152E35;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* AMT Brand Colors Extended */
  --amt-turquoise: #4FC3CA;
  --amt-turquoise-dark: #3BA8AE;
  --amt-turquoise-light: rgba(79, 195, 202, 0.1);
  --amt-dark-grey: #152E35;
  --amt-grey: #38484D;
  --amt-light-grey: #A89E9E;
  --amt-green: #22C55E;
  --amt-green-light: rgba(34, 197, 94, 0.08);

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography Scale — min 16px body for readability & mobile inputs */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  /* Background Colors — light shell */
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-surface: rgba(255, 255, 255, 0.92);

  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Border Colors */
  --border-color: rgba(15, 23, 42, 0.08);
  --border-light: rgba(15, 23, 42, 0.06);
  --border-medium: rgba(15, 23, 42, 0.12);

  /* Header / sidebar — always dark (white logo; light main area below) */
  --sidebar-bg: #152e35;
  --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --sidebar-text: rgba(255, 255, 255, 0.55);
  --sidebar-text-bright: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-active-bg: rgba(79, 195, 202, 0.12);
  --sidebar-active-border: var(--primary);

  /* Shadows — layered for depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.10), 0 8px 20px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 0 3px var(--primary-glow);

  /* Border Radius */
  --border-radius: 12px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Gradients */
  --accent-gradient: linear-gradient(135deg, #4FC3CA 0%, #38B2B8 100%);
  --surface-gradient: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
  --grid-line: rgba(0, 0, 0, 0.02);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Sidebar width */
  --sidebar-width: 240px;
  --header-height: 64px;
}

/* ============ RESELLER DARK THEME ============ */
/* Applied via body.reseller-theme — toggled by JS */

body.reseller-theme {
  --sidebar-bg: #0C0F13;
  --sidebar-bg-hover: rgba(255, 255, 255, 0.05);
  --sidebar-text: rgba(255, 255, 255, 0.45);
  --sidebar-text-bright: rgba(255, 255, 255, 0.95);
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(79, 195, 202, 0.10);
}

/* ============ RESET & BASE ============ */

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

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  font-weight: 400;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

/* IDs, serials, versions — tabular figures without full monospace UI */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection {
  background: var(--primary);
  color: white;
}

/* ============ UTILITIES ============ */

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  gap: 10px;
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============ AUTH SCREENS (login / verify / org picker) — always dark ============ */

.auth-screen {
  --auth-bg-deep: #050810;
  --auth-card: #0b1120;
  --auth-border: rgba(255, 255, 255, 0.06);
  --auth-text: #f1f5f9;
  --auth-muted: #94a3b8;
  --auth-dim: #475569;
  --auth-turquoise: #4fc3ca;
  align-items: center;
  justify-content: flex-start;
  background: var(--auth-bg-deep);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0));
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 30%, rgba(79, 195, 202, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 300px at 80% 70%, rgba(79, 195, 202, 0.045) 0%, transparent 70%),
    radial-gradient(ellipse 800px 600px at 50% 50%, rgba(79, 195, 202, 0.02) 0%, transparent 80%);
  animation: authAmbientDrift 22s ease-in-out infinite alternate;
}

@keyframes authAmbientDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, 1.5%) rotate(0.8deg); }
}

.auth-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 195, 202, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 195, 202, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.auth-screen .particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--auth-turquoise);
  border-radius: 50%;
  opacity: 0;
  animation: authParticleFloat linear infinite;
}

@keyframes authParticleFloat {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 0.55; }
  90% { opacity: 0.55; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

.auth-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: authFadeInUp 0.75s ease-out;
}

.auth-layout--compact {
  justify-content: center;
  min-height: min(70vh, 560px);
}

@keyframes authFadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.logo-orbit {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-orbit::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: var(--auth-turquoise);
  border-right-color: rgba(79, 195, 202, 0.35);
  animation: authOrbitSpin 4s linear infinite;
}

.logo-orbit::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-bottom-color: rgba(79, 195, 202, 0.22);
  border-left-color: rgba(79, 195, 202, 0.12);
  animation: authOrbitSpin 7s linear infinite reverse;
}

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

.auth-logo-img {
  width: 56px;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  filter: brightness(1.08);
  position: relative;
  z-index: 1;
}

.auth-brand-title {
  font-family: 'Bebas Neue', var(--font-display);
  font-size: clamp(36px, 10vw, 42px);
  letter-spacing: 0.14em;
  color: var(--auth-text);
  line-height: 1;
}

.auth-brand-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--auth-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 8px;
}

.auth-card {
  background: var(--auth-card);
  border: 1px solid var(--auth-border);
  border-radius: 16px;
  padding: clamp(24px, 5vw, 36px);
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--auth-turquoise), transparent);
  opacity: 0.45;
}

.auth-status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}

.auth-status-dot {
  width: 6px;
  height: 6px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.35);
  animation: authStatusPulse 2s ease-in-out infinite;
}

@keyframes authStatusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.auth-status-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--auth-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-card-heading {
  font-family: var(--font-family);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--auth-text);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  text-align: center;
}

.auth-card-lead {
  font-size: var(--text-sm);
  color: var(--auth-muted);
  line-height: 1.55;
  text-align: center;
  margin: 0 0 22px;
}

.auth-info-box {
  margin-top: 22px;
  background: rgba(79, 195, 202, 0.06);
  border: 1px solid rgba(79, 195, 202, 0.12);
  border-radius: 10px;
  padding: 14px 16px;
}

.auth-info-box-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--auth-turquoise);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-info-box p {
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.auth-divider {
  height: 1px;
  background: var(--auth-border);
  margin: 22px 0;
  position: relative;
}

.auth-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 6px;
  height: 6px;
  border: 1px solid var(--auth-border);
  background: var(--auth-card);
}

.auth-footer-contact {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--auth-muted);
  margin: 0 0 14px;
}

.auth-footer-contact a {
  color: var(--auth-turquoise);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer-contact a:hover {
  text-decoration: underline;
}

.auth-legal {
  margin: 0;
  font-size: 11px;
  color: var(--auth-dim);
  line-height: 1.55;
  text-align: center;
}

.auth-legal a {
  color: var(--auth-muted);
  text-decoration: underline;
}

.auth-bottom-tag {
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--auth-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  text-align: center;
}

/* Login form inside auth card */
#loginScreen .login-form {
  gap: 18px;
}

#loginScreen .form-group label {
  color: var(--auth-muted);
  font-size: 12px;
}

#loginScreen .form-group input {
  min-height: 48px;
  padding: 12px 14px;
  font-size: 16px;
  background: #111827;
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--auth-text);
}

#loginScreen .form-group input::placeholder {
  color: var(--auth-dim);
}

#loginScreen .form-group input:focus {
  background: #0f172a;
  border-color: var(--auth-turquoise);
  box-shadow: 0 0 0 3px rgba(79, 195, 202, 0.18);
}

.btn-auth-submit {
  width: 100%;
  justify-content: center;
  padding: 14px 20px;
  font-size: 15px;
  border-radius: 10px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo svg {
  width: 36px;
  height: 36px;
  color: var(--primary);
}

.logo span {
  font-size: 20px;
  font-weight: 700;
  color: var(--secondary);
}

.login-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  transition: all var(--transition-fast);
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: white;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(79, 195, 202, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(79, 195, 202, 0.4);
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(79, 195, 202, 0.25);
}

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-sm svg {
  width: 15px;
  height: 15px;
}

.btn .spinner {
  display: none;
  width: 18px;
  height: 18px;
  animation: spin 0.7s linear infinite;
}

.btn.loading span { display: none; }
.btn.loading .spinner { display: block; }

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

/* Login feedback */
.login-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  display: none;
  font-weight: 500;
}

.login-message.success {
  display: block;
  background: rgba(34, 197, 94, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.login-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .auth-backdrop,
  .logo-orbit::before,
  .logo-orbit::after,
  .auth-status-dot,
  .auth-particle {
    animation: none !important;
  }
  .auth-layout {
    animation: none;
  }
}

/* ============ VERIFY SCREEN ============ */

#verifyScreen {
  justify-content: center;
}

.verify-container {
  text-align: center;
  max-width: 420px;
  padding: 40px 28px !important;
}

.verify-container.auth-card {
  margin: 0 auto;
}

.verify-icon svg {
  width: 56px;
  height: 56px;
  color: var(--auth-turquoise);
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}

.verify-container h2 {
  font-family: var(--font-family);
  color: var(--auth-text);
  margin-bottom: 8px;
  font-size: var(--text-xl);
}

.verify-container p {
  color: var(--auth-muted);
  font-size: var(--text-sm);
}

.error-message {
  margin-top: 16px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border-radius: var(--radius-sm);
  display: none;
  font-size: var(--text-sm);
}

.error-message.show { display: block; }

.verify-container .error-message {
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.22);
}

/* ============ PORTAL LAYOUT ============ */

#portalScreen {
  flex-direction: column;
}

/* ---- Header ---- */
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--header-height);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
}

.header-left .logo {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 12px 0;
  margin-bottom: 0;
}

.header-left .logo img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Org logo — shown next to PostPro logo */
.header-org-logo {
  height: 28px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  display: block;
  opacity: 0.9;
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--sidebar-border);
}

.header-divider {
  height: 22px;
  width: 1px;
  background: var(--sidebar-border);
  margin: 0 14px;
  flex-shrink: 0;
}

.header-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--sidebar-text-bright);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.header-left .logo svg { color: var(--primary); }
.header-left .logo span {
  font-size: 16px;
  font-weight: 700;
  color: var(--sidebar-text-bright);
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Theme toggle (header) */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-full);
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-bright);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.theme-toggle-btn .theme-icon {
  width: 20px;
  height: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- User Menu ---- */
.user-menu { position: relative; }

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--sidebar-bg-hover);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--sidebar-text-bright);
  transition: all var(--transition-fast);
}

.user-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--accent-gradient);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.user-menu-btn svg {
  width: 14px;
  height: 14px;
  color: var(--sidebar-text);
  transition: transform var(--transition-fast);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  display: none;
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.show { display: block; }

.dropdown-header { padding: 16px 18px; }

.user-info strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
}

.user-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
}

/* ---- Portal Body ---- */
.portal-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

/* ---- Sidebar Navigation ---- */
.portal-nav {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 12px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.portal-nav ul {
  list-style: none;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  background: none;
  border: none;
  border-right: none;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-bright);
}

.nav-item.active {
  color: var(--primary);
  background: var(--sidebar-active-bg);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
  line-height: 1.5;
}

/* ---- Main Content ---- */
.portal-content {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
  min-width: 0;
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ============ DASHBOARD ============ */

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.summary-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.summary-card:hover::before {
  opacity: 1;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-icon.tickets {
  background: rgba(79, 195, 202, 0.10);
  color: var(--primary);
}

.card-icon.machines {
  background: rgba(34, 197, 94, 0.08);
  color: var(--success);
}

.card-icon.action {
  background: rgba(245, 158, 11, 0.10);
  color: var(--warning);
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Dashboard sections */
.dashboard-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition-normal);
}

.dashboard-section:hover {
  box-shadow: var(--shadow-md);
}

.dashboard-section h2 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============ DASHBOARD CHARTS (light content — styles required without portal-dark.css) ============ */

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 8px;
}

.chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.chart-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.35;
}

.chart-card h3 {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.donut-chart {
  width: 140px;
  height: 140px;
  margin: 0 auto 16px;
  position: relative;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-chart circle {
  fill: none;
  stroke-width: 20;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center .donut-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.donut-center .donut-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
}

.chart-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.attention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attention-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  gap: 12px;
}

.attention-item:hover {
  border-color: rgba(79, 195, 202, 0.35);
  background: rgba(79, 195, 202, 0.06);
}

.attention-serial {
  font-family: var(--font-mono);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}

.attention-type {
  color: var(--text-muted);
  font-size: 12px;
}

.attention-tickets {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
}

/* ============ KNOWLEDGE CENTER — filters (pill chips; no native button chrome) ============ */

.kc-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.kc-tag-filters,
.kc-difficulty-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.kc-filters .form-input,
.kc-filters input[type="text"] {
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  min-height: 48px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-family);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kc-filters input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.kc-filters input[type="text"]::placeholder {
  color: var(--text-muted);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  line-height: 1.3;
}

.filter-chip:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: rgba(79, 195, 202, 0.08);
}

.filter-chip.active {
  color: #0f172a;
  background: rgba(79, 195, 202, 0.25);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

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

.kc-tag-filters .filter-chip {
  font-size: 13px;
  padding: 7px 14px;
}

.kc-difficulty {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kc-diff-beginner {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.kc-diff-intermediate {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.kc-diff-advanced {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

/* ============ FILTERS ============ */

.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.filters-bar select,
.filters-bar input {
  padding: 9px 13px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.filters-bar input {
  flex: 1;
  max-width: 280px;
}

.filters-bar input::placeholder {
  color: var(--text-muted);
}

.filters-bar select:focus,
.filters-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

/* ============ LIST ITEMS ============ */

.ticket-list,
.machine-list,
.contact-list,
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.ticket-item,
.machine-item,
.contact-item,
.activity-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: none;
  position: relative;
}

.ticket-item:last-child,
.machine-item:last-child,
.contact-item:last-child,
.activity-item:last-child {
  border-bottom: none;
}

.ticket-item:hover,
.machine-item:hover,
.contact-item:hover {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border-color);
}

/* Forked branch ticket — nested under parent row (same list, reddit-style thread) */
.ticket-item.ticket-fork-child {
  margin-left: 18px;
  padding-left: 14px;
  border-left: 3px solid rgba(13, 148, 136, 0.55);
  background: rgba(13, 148, 136, 0.04);
}
.ticket-item.ticket-fork-child .fork-thread-marker {
  color: var(--accent-primary, #0d9488);
  font-weight: 600;
  margin-right: 2px;
}

.activity-item:hover {
  background: var(--bg-tertiary);
}

/* Machine image in list */
.machine-image {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  margin-right: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.machine-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.machine-image svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

/* Machine detail page */
.machine-detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.machine-detail-image {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.machine-detail-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.machine-detail-info {
  flex: 1;
  min-width: 0;
}

.machine-detail-info .detail-card {
  margin-bottom: 0;
}

/* Item parts */
.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: var(--text-base);
}

.item-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.item-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============ STATUS BADGES ============ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-new {
  background: rgba(59, 130, 246, 0.08);
  color: #2563EB;
}

.badge-open {
  background: rgba(79, 195, 202, 0.10);
  color: var(--primary-dark);
}

.badge-in-progress {
  background: rgba(245, 158, 11, 0.10);
  color: #D97706;
}

.badge-awaiting {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

.badge-resolved {
  background: rgba(34, 197, 94, 0.08);
  color: #16A34A;
}

.badge-closed {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.badge-escalated {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

.badge-low {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
}

.badge-medium {
  background: rgba(245, 158, 11, 0.10);
  color: #D97706;
}

.badge-high {
  background: rgba(249, 115, 22, 0.08);
  color: #EA580C;
}

.badge-critical {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

/* Contact item badges */
.contact-item .item-meta .badge {
  font-size: 10px;
  padding: 2px 8px;
}

.contact-item .item-meta { align-items: center; }

/* ============ DETAIL VIEWS ============ */

.ticket-detail,
.machine-detail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.detail-card:hover {
  box-shadow: var(--shadow-md);
}

.detail-card h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  text-align: right;
}

/* ============ COMMENTS ============ */

.comments-section { margin-top: 24px; }

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment {
  display: flex;
  gap: 12px;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.comment-avatar.customer {
  background: var(--accent-gradient);
  color: white;
}

.comment-avatar.staff {
  background: var(--secondary);
  color: white;
}

.comment-content {
  flex: 1;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border-light);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  align-items: baseline;
}

.comment-author {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.comment-date {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-text {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-secondary);
}

/* Shared documents in comments */
.comment-shared-documents {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.shared-docs-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shared-docs-badge {
  background: rgba(34, 197, 94, 0.08);
  color: #16A34A;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.shared-docs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shared-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #065f46;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.shared-doc-link:hover {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.25);
  text-decoration: none;
}

.shared-doc-link.disabled {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.shared-doc-icon { font-size: 16px; }

.shared-doc-name {
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-doc-size {
  color: var(--text-muted);
  font-size: 11px;
}

.shared-doc-expired {
  color: var(--danger);
  font-size: 12px;
}

/* Add comment */
.add-comment { margin-top: 20px; }

.add-comment textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  resize: vertical;
  min-height: 90px;
  transition: all var(--transition-fast);
}

.add-comment textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.add-comment button { margin-top: 10px; }

/* ============ SR THREAD (Reddit-style) ============ */

.sr-thread {
  display: flex;
  flex-direction: column;
  position: relative;
}

.sr-thread-post {
  display: flex;
  gap: 0;
  position: relative;
  padding: 0;
}

.sr-thread-post:last-child .sr-thread-rail::after { display: none; }

.sr-thread-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 44px;
  flex-shrink: 0;
  position: relative;
}

.sr-thread-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 2.5px var(--bg-secondary);
}

.sr-thread-avatar.sr-org-customer {
  background: linear-gradient(135deg, #3B82F6 0%, #6366F1 100%);
  color: white;
}

.sr-thread-avatar.sr-org-reseller {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.sr-thread-avatar.sr-org-staff {
  background: linear-gradient(135deg, #374151, #1f2937);
  color: white;
}

/* Per-comment attachments */
.sr-thread-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sr-thread-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}

.sr-thread-attachment-link:hover {
  background: var(--border-color);
}

.sr-thread-attachment-link .att-icon { font-size: 13px; }
.sr-thread-attachment-link .att-size { color: var(--text-muted); font-size: 11px; }

/* Image attachment previews */
.sr-thread-attachments { align-items: flex-start; }
.sr-attachment-image { display: flex; flex-direction: column; gap: 6px; max-width: 200px; }
.sr-attachment-image-btn { display: block; padding: 0; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-secondary); cursor: zoom-in; overflow: hidden; line-height: 0; }
.sr-attachment-image-btn:hover { border-color: var(--primary, #4FC3CA); }
.sr-attachment-thumb { display: block; max-width: 100%; max-height: 120px; width: auto; height: auto; object-fit: contain; }
.sr-attachment-image-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; }
.sr-attachment-image-dl { border: none; background: transparent; padding: 0; color: var(--primary, #4FC3CA); font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; word-break: break-all; }
.sr-attachment-image-dl:hover { text-decoration: underline; }
.sr-compose-size-hint { font-size: 11px; color: var(--text-muted); }
.portal-image-lightbox {
  position: fixed; inset: 0; z-index: 10000; background: rgba(0, 0, 0, 0.88);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.portal-image-lightbox img { max-width: min(96vw, 1200px); max-height: 90vh; object-fit: contain; border-radius: 4px; }
.portal-image-lightbox-close {
  position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 24px; cursor: pointer; line-height: 1;
}
.portal-image-lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }

/* File input in compose area */
.sr-compose-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sr-compose-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.sr-compose-file-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
}

.sr-compose-file-remove {
  cursor: pointer;
  color: var(--text-muted);
  margin-left: 2px;
}

.sr-compose-file-remove:hover {
  color: var(--danger);
}

/* Ticket reseller badge in detail view */
.ticket-reseller-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb, 0, 128, 128), 0.08), rgba(var(--primary-rgb, 0, 128, 128), 0.04));
  border: 1px solid rgba(var(--primary-rgb, 0, 128, 128), 0.2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--primary);
}

.ticket-sr-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

/* Vertical connector line */
.sr-thread-rail::after {
  content: '';
  position: absolute;
  top: 42px;
  bottom: -4px;
  left: 50%;
  width: 2px;
  background: var(--border-color);
  transform: translateX(-50%);
  border-radius: 1px;
}

.sr-thread-body {
  flex: 1;
  padding: 6px 0 24px 14px;
  min-width: 0;
}

.sr-thread-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  line-height: 1;
}

.sr-thread-author {
  font-weight: 650;
  font-size: 13.5px;
  color: var(--text-primary);
}

.sr-thread-org {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-hover);
}

.sr-thread-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.sr-thread-message {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.sr-thread-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.sr-thread-empty svg {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.35;
  width: 36px;
  height: 36px;
}

/* SR Compose area */
.sr-compose {
  display: flex;
  gap: 0;
  align-items: flex-start;
  padding-top: 4px;
}

.sr-compose .sr-thread-rail::after { display: none; }

.sr-compose-body {
  flex: 1;
  padding-left: 14px;
}

.sr-compose-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  min-height: 80px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sr-compose-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.sr-compose-textarea::placeholder {
  color: var(--text-muted);
}

.sr-compose-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.sr-compose-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* SR Description block */
.sr-description-block {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 6px;
}

.sr-description-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sr-description-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Create Ticket from SR modal */
.sr-ticket-preview {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.sr-ticket-preview h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.sr-ai-summary {
  position: relative;
}

.sr-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7C3AED;
  background: rgba(124, 58, 237, 0.08);
  padding: 3px 9px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.sr-ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.sr-ai-loading .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: #7C3AED;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ============ MODALS ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-body { padding: 24px; }

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

/* ============ INFO BANNER ============ */

.info-banner {
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: var(--radius-sm);
  color: var(--info);
  font-size: var(--text-sm);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============ TOAST NOTIFICATIONS ============ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  padding: 12px 18px;
  background: var(--text-primary);
  color: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 280px;
  max-width: 400px;
}

.toast.success {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
}

.toast.error {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

@keyframes toastIn {
  from { transform: translateY(12px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============ PAGINATION ============ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pagination button {
  padding: 8px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-light);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(79, 195, 202, 0.3);
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 8px;
  font-weight: 500;
}

/* ============ EMPTY STATE ============ */

.empty-state {
  text-align: center;
  padding: 56px var(--space-lg);
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
}

.empty-state svg {
  width: 52px;
  height: 52px;
  margin-bottom: var(--space-md);
  opacity: 0.35;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state .btn { margin-top: var(--space-md); }

/* ============ DOCUMENTS ============ */

.document-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-xs);
}

.document-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

/* Document group header */
.portal-doc-group {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 2px;
}
.portal-doc-group:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, var(--bg-tertiary));
}

/* Folder browser */
.folder-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 13px;
}
.folder-crumb {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
}
.folder-crumb:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.folder-crumb.active {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}
.folder-crumb-sep {
  color: var(--text-muted);
}
.portal-doc-folder {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-normal), background-color var(--transition-normal);
  margin-bottom: 8px;
  color: inherit;
  font: inherit;
}
.portal-doc-folder:hover {
  border-color: var(--primary);
  background: var(--bg-tertiary);
}
.portal-doc-folder:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--primary);
}
.portal-folder-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}
.portal-folder-body {
  flex: 1;
  min-width: 0;
}
.portal-folder-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-folder-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.portal-folder-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.65;
}

.document-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.document-icon svg { width: 22px; height: 22px; }

.document-icon.doc-pdf {
  background: rgba(239, 68, 68, 0.08);
  color: #EF4444;
}
.document-icon.doc-image {
  background: rgba(16, 185, 129, 0.08);
  color: #10B981;
}
.document-icon.doc-spreadsheet {
  background: rgba(16, 185, 129, 0.08);
  color: #10B981;
}
.document-icon.doc-word {
  background: rgba(59, 130, 246, 0.08);
  color: #3B82F6;
}
.document-icon.doc-generic {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.document-info {
  flex: 1;
  min-width: 0;
}

.document-info h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 3px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  letter-spacing: normal;
  border-bottom: none;
  padding-bottom: 0;
}

.document-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 6px 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.document-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.doc-category {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-version {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.doc-date { color: var(--text-muted); }

.document-actions { flex-shrink: 0; }
.document-actions .btn { padding: 8px; }
.document-actions .btn svg { width: 17px; height: 17px; }

/* Document Detail */
.document-detail .detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}

.document-detail .detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.document-detail .detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.document-detail .doc-description {
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.65;
  font-size: var(--text-sm);
}

.document-detail .doc-thumbnail-preview {
  margin-bottom: 18px;
  text-align: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.document-detail .doc-thumbnail-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.document-detail .info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.document-detail .info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.document-detail .info-item label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.document-detail .info-item span {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.document-detail .doc-tags {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

.document-detail .doc-tags label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.document-detail .tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.document-detail .tag {
  padding: 3px 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

/* Version List */
.version-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.version-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.version-item.current {
  background: var(--primary-light);
  border-color: rgba(79, 195, 202, 0.2);
}

.version-info { flex: 1; }

.version-info strong {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.version-info .badge-current {
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.version-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.version-notes {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 6px 0 4px 0;
  font-style: italic;
}

.version-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* Machine Rules */
.machine-rules-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.machine-rule-badge {
  padding: 5px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ============ DOCUMENTS LAYOUT WITH SIDEBAR ============ */

.page-header-actions {
  display: flex;
  gap: 8px;
}

.documents-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 20px;
}

.documents-sidebar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 24px;
}

.documents-sidebar .sidebar-section h3 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.categories-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.category-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.category-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: rgba(79, 195, 202, 0.15);
  font-weight: 600;
}

.category-item .category-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-item .category-count {
  font-size: 11px;
  padding: 1px 7px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 600;
}

.category-item.active .category-count {
  background: var(--primary);
  color: white;
}

.loading-spinner-sm {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 12px;
  text-align: center;
}

.documents-main { min-width: 0; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.active-filter button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  opacity: 0.75;
}

.active-filter button:hover { opacity: 1; }

/* ============ FAVORITES ============ */

.favorite-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  fill: none;
  transition: all var(--transition-fast);
}

.favorite-btn:hover svg { stroke: var(--danger); }

.favorite-btn.active svg {
  stroke: var(--danger);
  fill: var(--danger);
}

/* ============ DOWNLOAD HISTORY ============ */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.history-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.history-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-info h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 3px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.history-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============ UTILITY CLASSES ============ */

.u-muted { color: var(--text-muted); }
.u-primary { color: var(--primary); }
.u-success { color: var(--success); }
.u-warning { color: var(--warning); }
.u-danger { color: var(--danger); }

.stack { display: flex; flex-direction: column; }
.stack-sm { gap: var(--space-sm); }
.stack-md { gap: var(--space-md); }
.stack-lg { gap: var(--space-lg); }

.row { display: flex; flex-direction: row; align-items: center; }
.row-between { justify-content: space-between; }

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.is-clickable { cursor: pointer; }
.is-hidden { display: none; }
.hidden { display: none !important; }

/* ============ FOCUS SYSTEM ============ */

:focus { outline: none; }

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

.btn:focus-visible,
.nav-item:focus-visible,
.mobile-nav-item:focus-visible,
.dropdown-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: var(--shadow-glow);
}

.ticket-item:focus-visible,
.machine-item:focus-visible,
.document-item:focus-visible,
.contact-item:focus-visible,
.activity-item:focus-visible,
.category-item:focus-visible,
.history-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px var(--primary-light);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible,
.filters-bar input:focus-visible,
.filters-bar select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.modal-close:focus-visible,
.pagination button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============ SKELETON LOADING ============ */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1em; margin-bottom: 0.5em; }
.skeleton-text-sm { height: 0.75em; width: 60%; }
.skeleton-card {
  height: 80px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}
.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.skeleton-content { flex: 1; }

/* ============ MOBILE BOTTOM NAV ============ */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--sidebar-border);
  padding: var(--space-xs) 0;
  padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom, 0));
  z-index: 100;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
  min-width: 56px;
}

.mobile-nav-item svg {
  width: 21px;
  height: 21px;
}

.mobile-nav-item span { font-weight: 500; }

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  color: var(--sidebar-text-bright);
  background: var(--sidebar-bg-hover);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active svg { stroke-width: 2.5; }

.mobile-nav-badge {
  position: absolute;
  top: 0;
  right: 6px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  min-width: 16px;
  text-align: center;
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skeleton { animation: none; background: var(--bg-tertiary); }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
  .portal-nav { display: none; }
  .mobile-nav { display: flex; }

  .portal-content {
    padding: 16px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header-actions { flex-wrap: wrap; }
  .filters-bar { flex-direction: column; }
  .filters-bar input { max-width: none; }
  .summary-cards { grid-template-columns: 1fr; }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .detail-label { font-size: 12px; }
  .detail-value { text-align: left; }

  .document-detail .detail-grid { grid-template-columns: 1fr; }
  .document-detail .info-grid { grid-template-columns: 1fr; }

  .document-item { flex-wrap: wrap; }
  .document-info { width: calc(100% - 60px); }
  .document-actions {
    width: 100%;
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
  }

  .documents-layout { grid-template-columns: 1fr; }
  .documents-sidebar { position: static; }

  .history-item { flex-wrap: wrap; }
  .history-info { width: calc(100% - 56px); }
  .history-date { width: 100%; margin-top: 6px; }

  .machine-detail-header { flex-direction: column; }
  .machine-detail-image {
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
  }

  .machine-image {
    width: 44px;
    height: 44px;
    margin-right: 12px;
  }

  .header-title { font-size: 15px; }
}

/* ============ PORTAL FORMS ============ */

.portal-form-wrapper {
  max-width: 740px;
  margin: 0 auto;
}

.portal-form-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 600px) {
  .portal-form-card { padding: 20px 16px; }
}

.portal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}

@media (max-width: 600px) {
  .portal-form-grid { grid-template-columns: 1fr; }
}

.portal-form-grid .span-2 { grid-column: span 2; }

@media (max-width: 600px) {
  .portal-form-grid .span-2 { grid-column: span 1; }
}

.portal-form-section-header {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin-top: 12px;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

.portal-form-section-header:first-child { margin-top: 0; }

.portal-form-field.form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.portal-form-field .form-field-input,
.portal-form-field select.form-field-input {
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  width: 100%;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.portal-form-field .form-field-input:focus,
.portal-form-field select.form-field-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: var(--shadow-glow);
}

.portal-form-field .form-field-input:disabled,
.portal-form-field select.form-field-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.portal-form-field textarea.form-field-input {
  resize: vertical;
  min-height: 100px;
}

.portal-form-readonly-value {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  min-height: 20px;
}

.portal-form-help {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  background: var(--bg-tertiary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

/* Toggle */
.portal-form-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.portal-form-toggle:hover {
  border-color: var(--primary);
  background: white;
}

.portal-form-toggle label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  flex: 1;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  line-height: 1.4;
}

.portal-form-toggle .toggle-track {
  position: relative;
  width: 42px;
  height: 22px;
  background: #CBD5E1;
  border-radius: 11px;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.portal-form-toggle .toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.portal-form-toggle input[type="checkbox"] { display: none; }

.portal-form-toggle input:checked + .toggle-track {
  background: var(--primary);
}

.portal-form-toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.portal-form-toggle.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.required-mark { color: var(--danger); }

.portal-form-file-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.portal-form-checkbox-group-readonly {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.form-context-bar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-submitted-banner {
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #16A34A;
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
}

.form-actions .btn-primary {
  padding: 11px 28px;
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.portal-form-description {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.65;
  font-size: var(--text-sm);
}

/* ============ SIGNATURE ============ */

.signature-section {
  border-top: 2px solid var(--border-color);
  margin-top: 28px;
  padding-top: 24px;
}

.signature-section h3 {
  margin-bottom: 18px;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  padding-bottom: 0;
  border-bottom: none;
}

.signature-preview {
  font-family: 'Dancing Script', cursive;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 12px 14px;
  min-height: 52px;
  border-bottom: 2px solid var(--text-primary);
  margin-top: 8px;
  margin-bottom: 18px;
  line-height: 1.3;
}

.signature-preview:empty::after {
  content: 'Your signature will appear here';
  color: var(--text-muted);
  font-size: 15px;
  font-family: var(--font-family);
  font-weight: 400;
  font-style: italic;
}

.signature-display {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin-top: 10px;
}

.signature-display-name {
  font-family: 'Dancing Script', cursive;
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--text-primary);
  padding-bottom: 4px;
  display: inline-block;
  margin-bottom: 8px;
}

.signature-display-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.signature-display-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.signature-confirmed-badge {
  margin-top: 8px;
  font-size: var(--text-sm);
  color: #16A34A;
}

.portal-form-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.portal-form-file-max {
  font-size: 11px;
  color: #16A34A;
  margin-top: 4px;
}

/* Upload progress bar */
.form-upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.form-upload-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border-color, #e2e8f0);
  border-radius: 3px;
  overflow: hidden;
}
.form-upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-primary, #3b82f6);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.form-upload-progress-text {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}

/* ============ FORM LIST CARDS ============ */

.form-list-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 8px;
  box-shadow: var(--shadow-xs);
}

.form-list-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.form-list-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.form-list-card-icon.submitted { background: rgba(34, 197, 94, 0.06); }
.form-list-card-icon.pending { background: rgba(245, 158, 11, 0.08); }
.form-list-card-icon.in-progress { background: rgba(59, 130, 246, 0.06); }

.form-list-card-info {
  flex: 1;
  min-width: 0;
}

.form-list-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-list-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.form-list-card-badge {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.form-list-card-badge.submitted { background: rgba(34, 197, 94, 0.06); color: #16A34A; }
.form-list-card-badge.pending { background: rgba(245, 158, 11, 0.08); color: #D97706; }
.form-list-card-badge.in-progress { background: rgba(59, 130, 246, 0.06); color: #2563EB; }

/* ============ SETTINGS TAB ============ */

.settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.logo-upload-area {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.logo-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.logo-upload-area.has-logo {
  border-style: solid;
  border-color: var(--border-color);
}

.logo-upload-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-upload-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-upload-preview svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.logo-upload-text {
  flex: 1;
}

.logo-upload-text h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.logo-upload-text p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.logo-upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ============ OPERATOR ORG PICKER ============ */

.org-picker-container {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px;
  min-height: min(100vh, 900px);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.org-picker-header {
  text-align: center;
  margin-bottom: 24px;
}

.org-picker-header h1 {
  font-size: clamp(20px, 4vw, 22px);
  font-weight: 700;
  margin: 16px 0 4px;
  color: var(--auth-text, var(--text-primary));
}

.org-picker-header p {
  color: var(--auth-muted, var(--text-muted));
  font-size: 14px;
}

.org-picker-search {
  margin-bottom: 16px;
}

.org-picker-search input {
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  background: #111827;
  color: var(--auth-text, var(--text-primary));
}

.org-picker-search input::placeholder {
  color: var(--auth-dim, var(--text-muted));
}

.org-picker-search input:focus {
  border-color: var(--auth-turquoise, var(--primary));
  box-shadow: 0 0 0 3px rgba(79, 195, 202, 0.15);
}

.org-picker-list {
  flex: 1;
  overflow-y: auto;
  max-height: min(50vh, 420px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.org-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: rgba(255, 255, 255, 0.03);
}

.org-picker-item:hover {
  border-color: rgba(79, 195, 202, 0.35);
  background: rgba(79, 195, 202, 0.06);
}

.org-picker-item-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--auth-text, var(--text-primary));
}

.org-picker-item-meta {
  font-size: 12px;
  color: var(--auth-muted, var(--text-muted));
}

.org-picker-item-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.org-picker-item-badge.reseller {
  background: #DBEAFE;
  color: #1E40AF;
}

.org-picker-item-badge.indirect {
  background: #FEF3C7;
  color: #92400E;
}

.org-picker-footer {
  text-align: center;
  margin-top: 24px;
}

/* ============ OPERATOR BANNER ============ */

.operator-banner {
  background: #FEF3C7;
  border-bottom: 1px solid #FCD34D;
  padding: 6px 16px;
  font-size: 13px;
  color: #92400E;
  z-index: 100;
}

.operator-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.operator-switch-btn,
.operator-exit-btn {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid #D97706;
  cursor: pointer;
  background: transparent;
  color: #92400E;
  transition: all 0.15s;
}

.operator-switch-btn {
  margin-left: auto;
}

.operator-exit-btn {
  margin-left: 4px;
  background: #DC2626;
  color: white;
  border-color: #DC2626;
}

.operator-switch-btn:hover {
  background: #FDE68A;
}

.operator-exit-btn:hover {
  background: #B91C1C;
}

/* Organisation-uploaded docs vs File Centre library */
.portal-doc-source-heading {
  margin: 16px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
.portal-doc-source-heading:first-child {
  margin-top: 0;
}
.doc-source-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.doc-source-label.doc-source-org {
  color: #D97706;
}
.doc-source-label.doc-source-lib {
  color: #4FC3CA;
}
.document-item .doc-source-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.doc-source-badge.doc-source-org {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
}
.doc-source-badge.doc-source-lib {
  background: rgba(79, 195, 202, 0.15);
  color: #4FC3CA;
}
