:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --border: #dce4ee;
  --border-strong: #c5d2e2;
  --text: #262626;
  --text-strong: #151a22;
  --text-muted: #5d6978;

  /* Paleta firmowa SANSO (zgodna z sanso.pl i logo SANSO) */
  --sanso-blue: #0e75bc;
  --sanso-blue-dark: #0a5a92;
  --sanso-blue-deep: #08446f;
  --sanso-sky: #4fa3db;
  --sanso-tint: #eef5fb;
  --sanso-tint-strong: #e6ebf3;
  --sanso-dark: #262626;
  --sanso-dark-2: #1c1f24;

  --primary: var(--sanso-blue);
  --primary-hover: var(--sanso-blue-dark);
  --primary-soft: var(--sanso-tint);
  --teal: #0d7a73;
  --teal-soft: #ecfdfb;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;
  --red: #c82333;
  --red-soft: #fef2f2;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --purple: #6d28d9;
  --purple-soft: #f5f3ff;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 10px rgba(14, 117, 188, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 30px rgba(14, 117, 188, 0.12);
}

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

body {
  margin: 0;
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

/* Górny pasek kontaktowy SANSO (jak na sanso.pl) */
.utility-bar {
  background: var(--sanso-blue);
  color: #ffffff;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.utility-bar-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.utility-contact,
.utility-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.utility-bar a {
  color: rgba(255, 255, 255, 0.94);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.utility-bar a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Główny biały nagłówek SANSO (jak na sanso.pl) */
.topbar {
  background: #ffffff;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}
.brand-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo-link:hover { opacity: 0.9; text-decoration: none; }
.brand-logo-img {
  height: 36px;
  width: auto;
  display: block;
}
.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
}
.brand-portal {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-decoration: none;
}
.brand-portal:hover { text-decoration: none; }
.brand-portal-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--sanso-blue);
  text-transform: uppercase;
}
.brand-portal-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-link {
  color: #333333;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  background: var(--sanso-tint);
  color: var(--sanso-blue);
  text-decoration: none;
}
.nav-link.active {
  background: var(--sanso-tint);
  color: var(--sanso-blue);
}
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--sanso-blue);
  border-radius: 2px;
}
.nav-dropdown {
  position: relative;
}
.nav-dropdown-toggle {
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-caret {
  font-size: 11px;
  transition: transform 0.15s;
}
.nav-dropdown.open .nav-caret,
.nav-dropdown:hover .nav-caret {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 196px;
  padding: 6px;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-top: 2px solid var(--sanso-blue);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
}
.nav-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}
.nav-dropdown-item {
  display: block;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 13.5px;
  font-weight: 700;
  color: #333333;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-dropdown-item:hover,
.nav-dropdown-item.active {
  background: var(--sanso-tint);
  color: var(--sanso-blue);
  text-decoration: none;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

/* Sekcja Hero w stylu SANSO */
.sanso-hero {
  background: linear-gradient(135deg, #0b5c96 0%, #0e75bc 55%, #1d8bd4 100%);
  color: #ffffff;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid #094978;
}
.sanso-hero::before {
  content: "";
  position: absolute;
  right: -80px;
  top: -110px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.03) 65%, transparent 72%);
  pointer-events: none;
}
.sanso-hero::after {
  content: "";
  position: absolute;
  left: -60px;
  bottom: -130px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}
.sanso-hero-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 34px 20px 36px;
  position: relative;
  z-index: 1;
}
.sanso-hero-grid {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.sanso-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.16);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.sanso-hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.sanso-hero p {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
  max-width: 960px;
}
.sanso-hero-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.hero-pill {
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 5px 11px;
  border-radius: 999px;
  color: #ffffff;
}
.btn-hero-outline {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-hero-outline:hover {
  background: #ffffff;
  color: var(--sanso-blue);
  border-color: #ffffff;
  text-decoration: none;
}

/* Main container */
.main-wrap {
  flex: 1;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 28px 20px 54px;
}
.container-narrow { max-width: 1000px; margin: 0 auto; }
.container-xs { max-width: 560px; margin: 28px auto; }

/* Ciemna stopka korporacyjna SANSO (zgodna z sanso.pl) */
.footer {
  background: var(--sanso-dark);
  color: #cbd5e1;
  border-top: 3px solid var(--sanso-blue);
  margin-top: auto;
}
.footer-inner {
  max-width: 1540px;
  margin: 0 auto;
  padding: 32px 20px 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.footer-logo {
  height: 30px;
  width: auto;
  display: block;
  margin-bottom: 12px;
}
.footer-tagline {
  font-size: 13.5px;
  color: #a8b3c2;
  margin: 0 0 10px;
  max-width: 340px;
}
.footer h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
}
.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13.5px;
}
.footer a { color: #cbd5e1; }
.footer a:hover { color: var(--sanso-sky); text-decoration: none; }
.footer-bottom {
  background: var(--sanso-dark-2);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 13px 20px;
  font-size: 12.5px;
  color: #94a3b8;
}
.footer-bottom-inner {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.card-accent {
  border-top: 3px solid var(--sanso-blue);
}
.card + .card { margin-top: 18px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-strong);
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 900;
  color: var(--text-strong);
}
.subtitle { color: var(--text-muted); margin: 0; font-size: 14.5px; }

/* Alerts */
.alerts { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid transparent;
  font-weight: 500;
}
.alert-error, .alert-danger { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.alert-success { background: var(--green-soft); color: #166534; border-color: #bbf7d0; }
.alert-info { background: var(--sanso-tint); color: var(--sanso-blue-deep); border-color: #bfd9ee; }
.alert-warning { background: var(--amber-soft); color: #92400e; border-color: var(--amber-border); }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
.field label {
  font-size: 13px;
  font-weight: 700;
  color: #333333;
}
.req { color: var(--red); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sanso-blue);
  box-shadow: 0 0 0 3px rgba(14, 117, 188, 0.15);
}
textarea { resize: vertical; }
.field-help { font-size: 12px; color: var(--text-muted); }
.field-error { font-size: 12px; color: var(--red); font-weight: 700; }

/* Honeypot (invisible to humans) */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--sanso-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(14, 117, 188, 0.25);
}
.btn-primary:hover {
  background: var(--sanso-blue-dark);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 117, 188, 0.32);
}
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--sanso-tint); border-color: var(--sanso-blue); color: var(--sanso-blue); }
.btn-teal { background: var(--teal); color: #ffffff; }
.btn-teal:hover { background: #0a635d; color: #ffffff; }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-xs { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 15px; height: 15px; flex-shrink: 0; display: block; }
.btn-xs .btn-icon { width: 14px; height: 14px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-blue { background: #dceefa; color: #0a5a92; }
.badge-cyan { background: #cffafe; color: #155e75; }
.badge-teal { background: #ccfbf1; color: #115e59; }
.badge-indigo { background: #e0e7ff; color: #3730a3; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-pink { background: #fce7f3; color: #9d174d; }
.badge-gray { background: #e6ebf3; color: #334155; }

.color-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.color-swatch-input {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
}
.color-swatch-input::-webkit-color-swatch-wrapper { padding: 2px; }
.color-swatch-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.color-hex-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.badge-new { background: #e6ebf3; color: #ff4646; }

.sid-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 13px;
  background: var(--sanso-tint);
  color: var(--sanso-blue);
  border: 1px solid #cce2f4;
  padding: 3px 9px;
  border-radius: 6px;
  display: inline-block;
}

/* Composer (images + files) */
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.editor-shell {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.editor-shell:focus-within {
  border-color: var(--sanso-blue);
  box-shadow: 0 0 0 3px rgba(14, 117, 188, 0.15);
}
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.editor-shell textarea {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 12px 14px;
  display: block;
}
.btn-media {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 7px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--sanso-blue-dark);
  background: var(--sanso-tint);
  border: 1px solid #bfd9ee;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn-media-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sanso-blue);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-media-badge svg {
  width: 13px;
  height: 13px;
  display: block;
}
.btn-media:hover {
  background: var(--sanso-blue);
  border-color: var(--sanso-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 117, 188, 0.25);
}
.btn-media:hover .btn-media-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.editor-hint {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 4px;
  line-height: 1.4;
}
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface-alt);
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--sanso-blue);
  background: var(--sanso-tint);
  color: var(--sanso-blue-dark);
}
.preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  max-width: 240px;
}
.preview-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
}
.preview-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.preview-remove:hover { color: var(--red); }

/* Chat layout */
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}
.chat-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-top: 3px solid var(--sanso-blue);
  position: relative;
}
.chat-card.is-resized .chat-messages {
  max-height: none;
}
.chat-card.is-resizing {
  user-select: none;
  box-shadow: 0 0 0 2px rgba(14, 117, 188, 0.35), var(--shadow-md);
}
.ticket-layout.chat-stacked {
  grid-template-columns: 1fr;
}
.chat-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  cursor: nwse-resize;
  z-index: 10;
  touch-action: none;
  border-bottom-right-radius: var(--radius);
  background:
    linear-gradient(135deg,
      transparent 0%, transparent 46%,
      #94a3b8 46%, #94a3b8 54%,
      transparent 54%, transparent 66%,
      #94a3b8 66%, #94a3b8 74%,
      transparent 74%, transparent 86%,
      #94a3b8 86%, #94a3b8 94%,
      transparent 94%);
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.chat-resize-handle:hover,
.chat-card.is-resizing .chat-resize-handle {
  opacity: 1;
  background:
    linear-gradient(135deg,
      transparent 0%, transparent 46%,
      var(--sanso-blue) 46%, var(--sanso-blue) 54%,
      transparent 54%, transparent 66%,
      var(--sanso-blue) 66%, var(--sanso-blue) 74%,
      transparent 74%, transparent 86%,
      var(--sanso-blue) 86%, var(--sanso-blue) 94%,
      transparent 94%);
}
.chat-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.chat-messages {
  padding: 22px;
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 560px;
  max-height: 65vh;
  min-height: 320px;
  overflow-y: auto;
  overflow-anchor: auto;
  scroll-behavior: auto;
}
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 84%;
}
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.msg-row.theirs { align-self: flex-start; align-items: flex-start; }
.msg-row.system {
  align-self: center;
  max-width: 90%;
  text-align: center;
}
@keyframes msgEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-enter {
  animation: msgEnter 0.18s ease-out;
}
.msg-cluster {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}
.msg-row.mine .msg-cluster {
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  margin-top: 2px;
  user-select: none;
}
.avatar-staff {
  background: var(--sanso-blue);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(14, 117, 188, 0.25);
}
.avatar-client {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.msg-content-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}
.msg-row.mine .msg-content-col {
  align-items: flex-end;
}
.msg-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.msg-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  max-width: 100%;
}
.msg-row.theirs .msg-bubble {
  background: #ffffff;
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.msg-row.mine .msg-bubble {
  background: var(--sanso-tint);
  border: 1px solid #bfd9ee;
  border-top-right-radius: 4px;
}
.msg-row.internal .msg-bubble {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #78350f;
}
.msg-system-pill {
  display: inline-block;
  background: var(--sanso-tint-strong);
  color: #475569;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
}

.inline-image-wrap {
  margin: 10px 0;
  display: inline-block;
  max-width: 100%;
}
.inline-image-wrap img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 340px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #e9eff6;
  cursor: zoom-in;
}
.inline-image-wrap figcaption {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.msg-attachments {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.att-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
}
.att-file-chip:hover {
  border-color: var(--sanso-blue);
  color: var(--sanso-blue);
  text-decoration: none;
}
.att-thumb-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px;
  width: 190px;
}
.att-thumb-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 5px;
  background: #e9eff6;
  cursor: zoom-in;
}
.att-thumb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.chat-composer {
  padding: 16px 26px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-composer-feedback {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.chat-composer-feedback.is-error {
  background: var(--red-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}
.chat-composer-feedback.is-success {
  background: var(--green-soft);
  color: #166534;
  border: 1px solid #bbf7d0;
}
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Sidebar info */
.info-list { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf2f7;
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-label { color: var(--text-muted); font-weight: 500; }
.info-val { font-weight: 700; text-align: right; word-break: break-word; }

/* KPI & Tables */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sanso-blue);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 26px; font-weight: 900; margin-top: 4px; color: var(--text-strong); }

.filter-bar {
  display: grid;
  grid-template-columns: 2fr repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  padding: 11px 12px;
  background: var(--sanso-tint-strong);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #334155;
  white-space: nowrap;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--sanso-tint); }

/* Stopwatch */
.stopwatch-box {
  background: linear-gradient(135deg, #1d242c 0%, #263240 100%);
  color: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
  text-align: center;
  border-top: 3px solid var(--sanso-blue);
}
.stopwatch-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.stopwatch-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

.time-entry-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.time-entry-item:last-child { border-bottom: none; }

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-content {
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lightbox-content img {
  max-width: 90vw;
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #f8fafc;
  font-size: 13px;
}

/* Modal RODO / okna dialogowe */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] {
  display: none;
}
.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  animation: msgEnter 0.16s ease-out;
}
.modal-header {
  background: linear-gradient(90deg, #0b5c96 0%, #0e75bc 100%);
  color: #ffffff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}
.modal-close {
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.modal-body p {
  margin: 0 0 14px;
}
.rodo-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  justify-content: flex-end;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.checkbox-row input { width: auto; }

@media (max-width: 980px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .msg-row { max-width: 94%; }
  .brand-logo-img { height: 28px; }
  .sanso-hero h1 { font-size: 22px; }
}
