:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #152238;
  --muted: #6f7f98;
  --brand: #0071b9;
  --brand-dark: #005b94;
  --brand-light: #3e9fe9;
  --sidebar-start: #0f2339;
  --sidebar-end: #012455;
  --danger: #d62b37;
  --border: #dfe6f0;
  --shadow: 0 8px 28px rgba(17, 38, 74, 0.12);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 700px at -20% -20%, #d8e8ff 0%, transparent 60%),
    radial-gradient(900px 600px at 120% -10%, #ffe6df 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
}

body.login-body {
  background: linear-gradient(180deg, #081c32 0%, #0f3762 100%);
}

a { color: inherit; }

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 320px;
  background: linear-gradient(180deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
  color: #f3f7ff;
  padding: 18px 14px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .22s ease;
  box-shadow: 8px 0 30px rgba(0,0,0,.25);
}

.app-sidebar.is-closed {
  transform: translateX(-100%);
}

.sidebar-top {
  min-height: 0;
  overflow-y: auto;
}

.brand-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 8px 0 16px;
}

.brand-logo {
  width: 215px;
  height: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.3333px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, filter .2s ease;
}

.btn:active { transform: translateY(1px); }

.btn-create {
  width: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  color: #fff;
  margin-bottom: 14px;
}

.main-nav {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.sidebar-nav-section {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}

.sidebar-nav-title {
  padding: 0 2px 2px;
  color: #9cb4d7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  border-radius: 10px;
  padding: 0 12px;
  text-decoration: none;
  background: rgba(255,255,255,.06);
  color: #dce9ff;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-light));
  color: #fff;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  background: rgba(255,255,255,.22);
  color: #fff;
  border: 1px solid rgba(255,255,255,.34);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-section-title {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9cb4d7;
  margin: 16px 4px 10px;
}

.sidebar-bottom {
  display: grid;
  gap: 10px;
}

.sidebar-settings-link {
  margin: 0;
}

.accordion-list {
  display: grid;
  gap: 8px;
}

.accordion-item {
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  color: #ecf2ff;
  font-weight: 700;
  padding: 10px 10px;
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.accordion-trigger .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--cat-color, var(--brand));
}

.accordion-trigger .count,
.stage-link .count {
  color: #c7d9f5;
  font-size: 12px;
  font-weight: 800;
}

.accordion-panel {
  display: none;
  padding: 2px 8px 10px;
}

.accordion-item.open .accordion-panel {
  display: grid;
  gap: 4px;
}

.stage-link {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  padding: 6px 8px;
  text-decoration: none;
  color: #d8e5ff;
}

.stage-link .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.stage-link:hover {
  background: rgba(255,255,255,.08);
}

.sidebar-bottom {
  margin-top: 16px;
  font-size: 12px;
  color: #8fa3c1;
  text-align: center;
}

.app-main {
  flex: 1;
  margin-left: 320px;
  min-width: 0;
}

.app-shell.sidebar-closed .app-main {
  margin-left: 0;
}

.app-main.full {
  margin-left: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 68px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(9px);
  border-bottom: 1px solid rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  overflow: visible;
}

.menu-toggle {
  border: 0;
  background: var(--sidebar-start);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.topbar-right .online-btn,
.topbar-right .user-chip,
.topbar-right .btn-logout,
.topbar-right .notif-btn {
  min-height: 42px;
  border-radius: 10px;
}

.online-wrap {
  position: relative;
}

.online-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0px solid #18864c;
  background: linear-gradient(90deg, #1a8a4d, #2fb667);
  color: #fff;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.online-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #d6ffe7;
  box-shadow: 0 0 0 4px rgba(214, 255, 231, .18);
}

.online-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,.28);
}

.online-dropdown {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 8px);
  width: min(330px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 120;
}

.online-list {
  max-height: 340px;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.online-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e3ebf7;
  border-radius: 10px;
  background: #f8fbff;
}

.online-item-link {
  text-decoration: none;
  color: inherit;
}

.online-item-link:hover {
  background: #f0f7ff;
  border-color: #d0deef;
}

.online-item-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.online-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--online-color, #8ea5c2);
  flex: 0 0 auto;
}

.online-item-name {
  font-weight: 700;
  color: #1b2e49;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-item-main small {
  color: #6f7f98;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 2px;
}

.online-item-time {
  color: #8094ad;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  padding: 0 12px;
  font-weight: 700;
}

.user-chip small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
}

.user-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--user-color, var(--brand));
}

.btn-logout {
  background: #0c2136;
  color: #fff;
  padding: 0 14px;
}

.page-content {
  padding: 20px;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.alert-success { border-color: #8ed2a1; }
.alert-danger  { border-color: #f2a6aa; }
.alert-warning { border-color: #f0d182; }
.alert-info    { border-color: #a7cfec; }

.alert-success {
  background: linear-gradient(120deg, #1f8f4d, #36b868);
  border-color: #1d8a4a;
  color: #fff;
}

.flash-toast-stack {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, calc(100vw - 24px));
  display: grid;
  gap: 10px;
  z-index: 350;
  pointer-events: none;
}

.flash-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  box-shadow: 0 12px 34px rgba(17, 38, 74, .18);
  animation: flashToastIn .2s ease;
}

.flash-toast-success {
  background: linear-gradient(120deg, #1a8a4d, #30b868);
  border-color: #167a45;
  color: #fff;
}

.flash-toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: #1c7a45;
  background: #e4ffe9;
  animation: flashToastPulse .9s ease-out 1;
}

.flash-toast-text {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.flash-toast-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.flash-toast-close:hover {
  background: rgba(255,255,255,.3);
}

.flash-toast.is-leaving {
  animation: flashToastOut .18s ease forwards;
}

@keyframes flashToastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flashToastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-6px) scale(.98);
  }
}

@keyframes flashToastPulse {
  0% {
    transform: scale(.85);
  }
  55% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card-body {
  padding: 16px;
}

.section-title {
  font-family: "Space Grotesk", sans-serif;
  margin: 0 0 12px;
  letter-spacing: -.02em;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.report-filter-wide {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 14px;
}

.settings-split {
  grid-template-columns: minmax(300px, .9fr) minmax(0, 2.8fr);
}

.kpi {
  padding: 14px;
  border-radius: 14px;
  color: #fff;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi .kpi-label { font-size: 13px; opacity: .9; }
.kpi .kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }

.kpi.kpi-neutral {
  background: #f2f5fb;
  border: 1px solid var(--border);
  color: var(--text);
}

.kpi.kpi-neutral .kpi-label {
  color: var(--text);
  opacity: 1;
}

.kpi.kpi-neutral .kpi-value {
  color: var(--text);
}

.kpi-link {
  text-decoration: none;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform .12s ease, filter .18s ease;
}

.kpi-link:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.kpi.open   { background: linear-gradient(120deg, var(--brand-dark), var(--brand-light)); }
.kpi.today  { background: linear-gradient(120deg, #b32a38, #e24a56); }
.kpi.week   { background: linear-gradient(120deg, #df6f08, #f7961d); }
.kpi.done   { background: linear-gradient(120deg, #1f8f4d, #3cb86b); }

.columns {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--workflow-cols-desktop, 3), minmax(240px, 1fr));
}

.stage-col {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  min-height: 240px;
  overflow: hidden;
}

.stage-head {
  padding: 10px 12px;
  color: #fff;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-list {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.project-list.drop-target {
  background: #edf6ff;
  border-radius: 10px;
  outline: 2px dashed #86addd;
  outline-offset: -4px;
}

.project-list.drop-invalid {
  background: #fff4f4;
  border-radius: 10px;
  outline: 2px dashed #d8a0a0;
  outline-offset: -4px;
}

.project-mini {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-decoration: none;
  color: var(--ink);
  background: #f8fbff;
}

.project-mini:hover {
  background: #edf5ff;
}

.project-mini-draggable {
  cursor: grab;
}

.project-mini-draggable:active {
  cursor: grabbing;
}

.project-mini.is-dragging {
  opacity: .55;
}

.project-mini .title {
  font-weight: 800;
  margin-bottom: 6px;
}

.project-mini .meta {
  color: var(--muted);
  font-size: 12px;
}

.form-control,
.form-select,
textarea {
  width: 100%;
  border: 1px solid #cfd9e8;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

textarea { min-height: 130px; resize: vertical; }

label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  display: inline-block;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-catalog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-bottom: 16px;
}

.catalog-extra-toggle {
  margin-top: 16px;
}

.catalog-extra-body {
  padding: 12px;
}

.report-actions {
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.report-actions-left,
.report-actions-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.report-actions-right {
  margin-left: auto;
}

.report-asset-autocomplete {
  position: relative;
}

.report-asset-suggestions {
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid #cfdbeb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(18, 39, 65, .18);
  padding: 6px;
}

.report-asset-option {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #17243b;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
}

.report-asset-option:hover,
.report-asset-option:focus {
  background: #edf5ff;
  outline: none;
}

.report-asset-option strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-asset-option small {
  color: #6f7f98;
  overflow-wrap: anywhere;
}

.report-asset-no-results {
  color: #6f7f98;
  padding: 10px 12px;
  font-weight: 700;
}

.ticket-routing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.ticket-routing-field {
  flex: 1 1 220px;
  max-width: 340px;
  min-width: 0;
}

.ticket-guide-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.ticket-catalog-search {
  max-width: 760px;
  position: relative;
}

.ticket-catalog-search-wrap {
  position: relative;
}

.ticket-catalog-suggestions {
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid #cfdbeb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(18, 39, 65, .18);
  padding: 6px;
}

.ticket-catalog-option {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #17243b;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label kind"
    "path path";
  gap: 3px 10px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
}

.ticket-catalog-option:hover,
.ticket-catalog-option:focus {
  background: #edf5ff;
  outline: none;
}

.ticket-catalog-option strong {
  grid-area: label;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ticket-catalog-option span {
  grid-area: kind;
  align-self: start;
  border-radius: 999px;
  background: #e9f2ff;
  color: #24547b;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.ticket-catalog-option small {
  grid-area: path;
  color: #6f7f98;
  overflow-wrap: anywhere;
}

.ticket-catalog-no-results {
  color: #6f7f98;
  padding: 10px 12px;
  font-weight: 700;
}

.creator-toggle {
  border: 1px dashed #d3dfef;
  border-radius: 12px;
  background: #f8fbff;
}

.creator-summary {
  list-style: none;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
  color: #1c3554;
}

.creator-summary::-webkit-details-marker {
  display: none;
}

.creator-toggle[open] .creator-summary {
  border-bottom: 1px solid #e2ebf7;
}

.compact-create-form {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.compact-create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compact-create-row > .form-control,
.compact-create-row > .form-select {
  width: auto;
  min-width: 140px;
  flex: 1 1 170px;
}

.compact-create-row .btn {
  flex: 0 0 auto;
}

.compact-color {
  width: 44px;
  min-width: 44px;
  height: 38px;
  padding: 4px;
}

.compact-order {
  width: 86px;
  min-width: 86px;
}

.compact-select-sm {
  width: auto;
  min-width: 160px;
  flex: 0 1 180px;
}

.compact-workflow-row .compact-color,
.compact-workflow-row .compact-order,
.compact-fields-row .compact-order {
  flex: 0 0 auto;
}

.compact-workflow-row select[name="next_stage_id"] {
  flex: 1 1 220px;
}

.compact-workflow-footer {
  justify-content: space-between;
}

.fields-options-wrap {
  width: 100%;
}

.fields-options-wrap label {
  margin-bottom: 4px;
}

.list-tools {
  margin-bottom: 10px;
}

.search-control {
  max-width: 420px;
}

.entity-list {
  display: grid;
  gap: 10px;
}

.entity-row {
  border-radius: 12px;
  box-shadow: none;
}

.entity-row .card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px;
}

.entity-row-body {
  width: 100%;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.compact-row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  flex: 1 1 auto;
  min-width: 0;
}

.compact-row-form > .form-control,
.compact-row-form > .form-select {
  width: auto;
  min-width: 130px;
  flex: 1 1 160px;
}

.compact-row-form > .tag {
  flex: 0 0 auto;
}

.compact-categories-existing,
.compact-workflow-existing,
.compact-fields-existing,
.compact-users-existing {
  gap: 12px;
}

.compact-categories-existing .field-inline {
  flex: 0 0 240px;
}

.compact-categories-existing .field-inline-sm {
  flex: 0 0 90px;
  min-width: 90px;
}

.compact-categories-existing .tag {
  flex: 0 0 110px;
}

.compact-categories-existing .inline-check {
  flex: 0 0 90px;
}

.compact-workflow-existing .tag {
  flex: 0 0 110px;
}

.compact-workflow-existing .field-inline {
  flex: 0 0 220px;
}

.compact-workflow-existing .field-inline-sm {
  flex: 0 0 90px;
  min-width: 90px;
}

.compact-workflow-existing .field-inline-lg {
  flex: 0 0 260px;
  min-width: 240px;
}

.compact-workflow-existing .inline-check {
  flex: 0 0 110px;
}

.compact-fields-existing .tag {
  flex: 0 0 110px;
}

.compact-fields-existing .field-inline {
  flex: 0 0 220px;
}

.compact-fields-existing .field-inline-sm {
  flex: 0 0 110px;
  min-width: 110px;
}

.compact-fields-existing .inline-check {
  flex: 0 0 110px;
}

.compact-users-existing .tag {
  flex: 0 0 110px;
}

.compact-users-existing .field-inline-sm {
  flex: 0 0 140px;
}

.compact-users-existing .field-inline {
  flex: 0 0 200px;
}

.compact-users-existing .field-inline:nth-of-type(3) {
  flex: 0 0 230px;
}

.compact-users-existing .inline-check {
  flex: 0 0 90px;
}

.field-inline {
  display: grid;
  gap: 4px;
  flex: 1 1 180px;
  min-width: 160px;
}

.field-inline .form-control,
.field-inline .form-select {
  width: 100%;
  min-width: 0;
}

.field-inline-sm {
  flex: 0 0 auto;
  min-width: 92px;
}

.field-inline-lg {
  flex: 1 1 260px;
}

.mini-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5f7390;
  font-weight: 800;
  line-height: 1;
}

.compact-row-form .compact-color {
  width: 44px;
  min-width: 44px;
  flex: 0 0 44px;
}

.compact-row-form .compact-order {
  width: 86px;
  min-width: 86px;
  flex: 0 0 86px;
}

.field-inline-sm .compact-color {
  width: 44px;
  min-width: 44px;
}

.field-inline-sm .compact-order {
  width: 86px;
  min-width: 86px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 700;
  color: #3d5676;
  white-space: nowrap;
}

.inline-check input {
  margin: 0;
}

.compact-inline-form {
  margin-left: auto;
}

.compact-inline-form .btn {
  height: 40px;
}

.entity-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  align-self: end;
}

.entity-actions .compact-inline-form {
  margin-left: 0;
}

.compact-field-form {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.compact-fields-existing {
  width: 100%;
}

.compact-field-options {
  display: grid;
  gap: 4px;
}

.compact-field-options label {
  margin: 0;
  color: #5f7390;
  font-size: 12px;
  font-weight: 700;
}

.compact-options {
  min-height: 76px;
}

.compact-categories-existing .field-inline:first-of-type {
  min-width: 220px;
}

.compact-workflow-existing .field-inline:first-of-type {
  min-width: 190px;
}

.compact-workflow-existing .field-inline-lg {
  min-width: 260px;
}

.compact-users-create .form-control {
  flex: 1 1 170px;
}

.compact-users-create-footer {
  justify-content: space-between;
}

.compact-users-existing input[type="text"] {
  flex: 1 1 140px;
}

.compact-users-existing input[type="email"] {
  flex: 1 1 170px;
}

.compact-users-existing input[type="password"] {
  flex: 1 1 200px;
  min-width: 180px;
}

.compact-users-existing select {
  flex: 0 1 220px;
}

.compact-users-existing .field-inline {
  min-width: 170px;
}

.compact-users-existing .field-inline-sm {
  min-width: 140px;
}

.compact-users-existing .field-inline-sm .compact-color {
  width: 100%;
  min-width: 0;
}

.settings-user-body {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.compact-users-existing {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
}

.settings-user-row {
  display: grid;
  align-items: end;
  column-gap: 12px;
  row-gap: 10px;
  min-width: 0;
}

.settings-user-row-main {
  grid-template-columns: minmax(90px, 110px) minmax(145px, .9fr) minmax(175px, 1fr) minmax(220px, 1.25fr);
}

.settings-user-row-secondary {
  grid-template-columns: minmax(190px, 1.05fr) minmax(190px, 1fr) minmax(160px, .8fr) minmax(82px, auto) minmax(220px, 1.1fr);
}

.settings-user-row > * {
  min-width: 0;
}

.settings-user-row .tag {
  align-self: center;
  justify-self: stretch;
  text-align: center;
}

.settings-user-row .field-inline,
.settings-user-row .field-inline-sm {
  min-width: 0;
}

.settings-user-row .compact-select-sm,
.settings-user-row .compact-color {
  width: 100%;
  min-width: 0;
}

.settings-user-active {
  min-height: 40px;
  align-self: end;
}

.settings-user-areas .grid {
  grid-template-columns: repeat(3, max-content);
  gap: 6px 12px;
  align-items: center;
}

.settings-user-actions {
  align-self: end;
  padding-bottom: 1px;
}

.compact-roles-existing {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  letter-spacing: -.02em;
}

.role-perm-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.role-perm-summary > span:first-child {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.role-perm-summary > span:first-child small {
  color: #6f7f98;
  font-weight: 700;
}

.role-perm-form {
  padding-top: 8px;
}

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

.perm-check {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #dbe5f3;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.perm-check input {
  margin: 2px 0 0;
}

.perm-check .perm-label {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.perm-check .perm-label small {
  color: #6f7f98;
  font-size: 11px;
  font-weight: 700;
}

.perm-check.is-hidden {
  display: none;
}

.btn-primary {
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  color: #fff;
}

.btn-secondary {
  background: #1a2740;
  color: #fff;
}

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

.btn-danger-soft {
  background: #ffe7ea;
  color: #8b1f2a;
}

.table-wrap { overflow: auto; }

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  color: var(--brand-dark);
}

.sort-arrow {
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f1fb;
  color: #31567d;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.projects-result-meta {
  margin-top: 10px;
  color: #60758f;
  font-size: 13px;
  font-weight: 700;
}

.projects-filters-row {
  display: grid;
  grid-template-columns: minmax(300px, 2.2fr) minmax(130px, .9fr) minmax(130px, .95fr) minmax(130px, .95fr) minmax(90px, .6fr);
  gap: 12px;
  align-items: end;
}

.projects-filters-row .form-actions {
  grid-column: 1 / -1;
}

.projects-filter-per-page .form-select {
  min-width: 0;
  max-width: 96px;
}

.projects-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.projects-bulk-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.projects-bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.projects-bulk-actions .form-select {
  width: auto;
  min-width: 200px;
}

.projects-bulk-stage.is-hidden {
  display: none;
}

.projects-title-link {
  font-weight: 800;
  text-decoration: none;
}

.projects-title-link:hover {
  text-decoration: underline;
}

.table tr.is-selected td {
  background: #edf5ff;
}

.projects-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  border-bottom: 1px solid #e6edf7;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.table th {
  background: #f7fbff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5c728f;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.documents-store-picker {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(560px, 100%);
}

.documents-store-search-wrap {
  position: relative;
  width: min(460px, 100%);
}

.documents-store-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid #cfdbeb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(18, 39, 65, .18);
  padding: 6px;
}

.documents-store-option {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #17243b;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "code name"
    "code area";
  gap: 2px 10px;
  padding: 9px 10px;
  text-align: left;
  font: inherit;
}

.documents-store-option:hover,
.documents-store-option:focus {
  background: #edf5ff;
  outline: none;
}

.documents-store-option strong {
  grid-area: code;
  color: #0d65a2;
  font-weight: 900;
}

.documents-store-option span { grid-area: name; font-weight: 800; }
.documents-store-option small { grid-area: area; color: #6b7f9b; }

.documents-shared-create {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  align-items: end;
  gap: 10px;
}

.documents-table .documents-actions-col,
.documents-table .documents-actions-cell {
  text-align: right;
}

.documents-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.documents-actions .inline-details {
  position: relative;
}

.documents-actions .inline-details > summary {
  list-style: none;
}

.documents-actions .inline-details > summary::-webkit-details-marker {
  display: none;
}

.documents-actions .documents-visibility-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
}

.documents-actions .documents-visibility-form .form-select {
  min-width: 210px;
  max-width: 260px;
}

.btn-download {
  background: #e7f7ef;
  color: #13633c;
  border: 1px solid #bfe8d2;
}

.document-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.doc-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
}

.doc-icon svg {
  width: 23px;
  height: 23px;
}

.doc-icon-folder {
  background: #fff5d7;
  color: #c88707;
}

.doc-icon-folder svg path {
  fill: currentColor;
}

.doc-icon-file {
  background: #edf5ff;
  color: #31567d;
}

.doc-icon-file svg path,
.doc-icon-pdf svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.doc-icon-pdf {
  background: #fff0f1;
  color: #b3202e;
}

.doc-icon-pdf span {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}

.documents-up-link::before {
  content: "<- ";
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf5ff;
  color: #31567d;
  font-size: 12px;
  font-weight: 700;
}

.notif-wrap { position: relative; }

.notif-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  position: relative;
}

.icon-bell {
  width: 18px;
  height: 18px;
  stroke: #1b2c43;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #e12834;
  color: #fff;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.notif-dropdown {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 120;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #eef3fa;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.notif-list {
  max-height: 340px;
  overflow: auto;
}

.notif-item {
  padding: 10px;
  border-bottom: 1px solid #eef3fa;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.notif-item.unread {
  background: #f5fbff;
}

.notif-link {
  text-decoration: none;
  color: var(--ink);
}

.notif-title { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.notif-body { font-size: 12px; color: #5d738e; margin-bottom: 4px; }
.notif-time { font-size: 11px; color: #8ca0bb; }

.notif-mark {
  border: 0;
  background: #e6f2ff;
  color: #1e6ca0;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.notif-empty {
  padding: 16px;
  color: #6f7f98;
  font-size: 13px;
}

.messages-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.messages-users-card .card-body,
.messages-thread-card .card-body {
  padding: 14px;
}

.messages-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.messages-switch-btn {
  flex: 1 1 0;
  min-height: 38px;
  border: 1px solid #d1deee;
  border-radius: 10px;
  background: #fff;
  color: #2b4b75;
  text-decoration: none;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.messages-switch-btn.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
}

.messages-group-create {
  margin-bottom: 10px;
}

.messages-members-picker {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.messages-users {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 2px;
}

.messages-user-link {
  text-decoration: none;
  color: inherit;
  border: 1px solid #dbe6f5;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.messages-user-link:hover {
  border-color: #bed2ec;
  background: #f7fbff;
}

.messages-user-link.active {
  border-color: #7eaee2;
  background: #edf5ff;
}

.messages-group-mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: #e3eeff;
  color: #245184;
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.messages-user-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.messages-user-main small {
  color: #6f7f98;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
}

.messages-user-name-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.messages-user-name-row strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #93a8c4;
  flex: 0 0 auto;
}

.messages-user-dot.is-online {
  background: #1f9b58;
  box-shadow: 0 0 0 4px rgba(31, 155, 88, .16);
}

.messages-unread-pill {
  min-width: 22px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  background: #e5f0ff;
  color: #164b87;
  font-size: 11px;
  font-weight: 800;
}

.messages-user-meta {
  display: grid;
  gap: 4px;
}

.messages-last-time {
  font-size: 11px;
  color: #7488a4;
  font-weight: 700;
}

.messages-last-preview {
  font-size: 12px;
  color: #4f6483;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-thread-card {
  min-height: 520px;
}

.messages-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.messages-thread-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.messages-group-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.group-member-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.messages-thread {
  border: 1px solid #dbe6f5;
  border-radius: 12px;
  background: #f7fbff;
  min-height: 240px;
  max-height: calc(100vh - 390px);
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.message-row {
  display: flex;
}

.message-row.me {
  justify-content: flex-end;
}

.message-bubble {
  width: fit-content;
  max-width: min(78%, 740px);
  background: #fff;
  border: 1px solid #dbe6f5;
  border-radius: 12px;
  padding: 10px 12px;
}

.message-row.me .message-bubble {
  background: #eaf3ff;
  border-color: #c6dbf5;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #6b7f9b;
  font-size: 11px;
}

.message-body {
  color: #1d3352;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-compose {
  display: grid;
  gap: 8px;
}

.message-compose textarea {
  min-height: 110px;
}

.login-wrap {
  width: 100%;
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: center;
  place-items: center;
  padding: 24px;
  gap: 14px;
}

.login-card {
  width: min(440px, 100%);
  max-width: 100%;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-logo {
  width: 180px;
  display: block;
  margin: 0 auto 14px;
}

.login-title {
  font-size: 24px;
  text-align: center;
}

.password-wrap {
  position: relative;
}

.password-wrap .form-control {
  padding-right: 44px;
}

.input-icon-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5f728e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.input-icon-btn:hover {
  background: #edf4fb;
}

.icon-eye {
  width: 18px;
  height: 18px;
}

.input-icon-btn .eye-slash {
  opacity: 0;
}

.input-icon-btn.is-visible .eye-slash {
  opacity: 1;
}

.remember-row {
  margin-top: -2px;
}

.remember-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #415b7c;
  font-weight: 700;
}

.auth-links-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.auth-links-center {
  justify-content: center;
  margin-top: 12px;
}

.auth-link {
  color: #1f5f97;
  font-weight: 700;
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-note {
  margin: 0 0 8px;
  color: #385375;
  font-size: 13px;
  line-height: 1.35;
}

.mini-help {
  display: block;
  margin-top: 6px;
  color: #5f728e;
  font-size: 12px;
  line-height: 1.3;
}

.pwa-install-btn {
  border: 1px solid #005b94;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  color: #ffffff;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
}

.pwa-install-btn:hover {
  filter: brightness(1.03);
}

.login-pwa-wrap {
  width: min(440px, 100%);
  max-width: 100%;
  display: grid;
  gap: 6px;
}

.pwa-install-cta {
  width: 100%;
}

.pwa-install-inline-msg {
  margin: 0;
  text-align: center;
  color: #1f5f97;
}

.pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: grid;
  place-items: center;
  padding: 16px;
}

.pwa-modal[hidden] {
  display: none !important;
}

.pwa-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 25, 44, .58);
}

.pwa-modal-dialog {
  position: relative;
  width: min(420px, 100%);
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
}

.pwa-modal-title {
  margin: 0 0 8px;
  font-size: 19px;
}

.pwa-ios-steps {
  margin: 0;
  padding-left: 18px;
  color: #345377;
  font-size: 13px;
  line-height: 1.35;
}

.pwa-ios-steps li + li {
  margin-top: 2px;
}

.upload-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e9f1fb;
  overflow: hidden;
}

.upload-progress .bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  transition: width .18s ease;
}

@media (max-width: 1200px) {
  .columns { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perm-grid { grid-template-columns: 1fr; }
  .projects-filters-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .projects-filter-search {
    grid-column: 1 / -1;
  }
  .projects-filter-per-page .form-select {
    max-width: none;
  }
  .messages-layout {
    grid-template-columns: 1fr;
  }
  .messages-users {
    max-height: 280px;
  }
  .messages-thread {
    max-height: 420px;
  }
}

@media (max-width: 900px) {
  .app-main { margin-left: 0; }
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar:not(.is-closed) { transform: translateX(0); }
  .menu-toggle {
    position: relative;
    z-index: 95;
  }
  .app-shell:not(.sidebar-closed) .menu-toggle {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    z-index: 125;
    box-shadow: 0 8px 20px rgba(10, 27, 49, .28);
  }
  .app-shell:not(.sidebar-closed) .topbar-right {
    opacity: 0;
    pointer-events: none;
  }
  .form-row { grid-template-columns: 1fr; }
  .ticket-routing-row {
    display: grid;
    grid-template-columns: 1fr;
  }
  .ticket-routing-field { max-width: none; }
  .ticket-catalog-search { max-width: none; }
  .ticket-guide-actions {
    grid-column: auto;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    justify-content: stretch;
  }
  .ticket-guide-actions .btn {
    width: 100%;
  }
  .ticket-guide-actions .btn:only-child {
    grid-column: 1 / -1;
  }
  .settings-split {
    grid-template-columns: 1fr;
  }
  .compact-create-row,
  .compact-row-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .compact-create-row > .form-control,
  .compact-create-row > .form-select,
  .compact-row-form .form-control,
  .compact-row-form .form-select,
  .compact-select-sm,
  .compact-order,
  .compact-color {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
  .field-inline {
    min-width: 0;
    width: 100%;
  }
  .compact-categories-existing .field-inline,
  .compact-categories-existing .field-inline-sm,
  .compact-categories-existing .tag,
  .compact-categories-existing .inline-check,
  .compact-workflow-existing .tag,
  .compact-workflow-existing .field-inline,
  .compact-workflow-existing .field-inline-sm,
  .compact-workflow-existing .field-inline-lg,
  .compact-workflow-existing .inline-check,
  .compact-fields-existing .tag,
  .compact-fields-existing .field-inline,
  .compact-fields-existing .field-inline-sm,
  .compact-fields-existing .inline-check,
  .compact-users-existing .tag,
  .compact-users-existing .field-inline,
  .compact-users-existing .field-inline-sm,
  .compact-users-existing .inline-check {
    flex: 1 1 auto;
    min-width: 0;
  }
  .field-inline-sm .compact-color,
  .field-inline-sm .compact-order {
    width: 100%;
    min-width: 0;
  }
  .compact-inline-form {
    margin-left: 0;
    width: auto;
  }
  .compact-inline-form .btn {
    width: auto;
  }
  .settings-user-row-main,
  .settings-user-row-secondary {
    grid-template-columns: 1fr;
  }
  .settings-user-actions {
    justify-content: flex-start;
  }
  .settings-user-areas .grid {
    grid-template-columns: repeat(3, max-content);
  }
  .entity-row .card-body {
    align-items: stretch;
    flex-direction: column;
  }
  .entity-row-body {
    grid-template-columns: 1fr;
  }
  .entity-actions {
    justify-content: flex-start;
  }
  .compact-workflow-footer {
    justify-content: flex-start;
  }
  .search-control {
    max-width: 100%;
  }
  .role-perm-summary {
    flex-direction: column;
    align-items: flex-start;
  }
  .projects-filters-row {
    grid-template-columns: 1fr;
  }
  .projects-filter-search {
    grid-column: auto;
  }
  .projects-bulk-actions {
    width: 100%;
  }
  .projects-bulk-actions .form-select,
  .projects-bulk-actions .btn {
    width: 100%;
    min-width: 0;
  }
  .documents-store-picker {
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }
  .documents-store-search-wrap {
    width: 100%;
  }
  .documents-shared-create {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .report-filter-wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .columns { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 14px; }
  .topbar { padding: 10px; }
  .login-wrap {
    padding: 12px;
    gap: 10px;
  }
  .login-card,
  .login-pwa-wrap {
    width: 100%;
  }
  .login-card {
    padding: 20px 16px;
  }
  .pwa-modal-dialog { padding: 14px 12px 12px; }
  .user-chip small { display: none; }
  .topbar-right { gap: 6px; }
  .notif-dropdown {
    width: min(330px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
  }
  .online-btn span:not(.online-count):not(.online-dot) {
    display: none;
  }
  .online-wrap {
    position: static;
  }
  .online-dropdown {
    position: fixed;
    top: calc(70px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    z-index: 140;
  }
  .online-list {
    max-height: min(340px, calc(100vh - 130px));
  }
  .flash-toast-stack {
    top: 74px;
    width: calc(100vw - 16px);
  }
  .documents-store-picker,
  .documents-management-grid {
    width: 100%;
  }
  .documents-store-picker {
    display: grid;
    grid-template-columns: 1fr;
  }
  .documents-store-picker .btn,
  .documents-shared-create .btn {
    width: 100%;
  }
  .documents-store-suggestions {
    position: fixed;
    top: auto;
    left: 14px;
    right: 14px;
    max-height: min(320px, calc(100vh - 140px));
  }
  .report-asset-suggestions {
    position: fixed;
    top: auto;
    left: 14px;
    right: 14px;
    max-height: min(320px, calc(100vh - 140px));
  }
  .ticket-catalog-suggestions {
    position: fixed;
    top: auto;
    left: 14px;
    right: 14px;
    max-height: min(340px, calc(100vh - 140px));
  }
  .documents-table-compact-mobile th:nth-child(2),
  .documents-table-compact-mobile td:nth-child(2),
  .documents-table-compact-mobile th:nth-child(3),
  .documents-table-compact-mobile td:nth-child(3) {
    display: none;
  }
  .documents-table .documents-actions-col,
  .documents-table .documents-actions-cell {
    text-align: left;
  }
  .documents-actions {
    justify-content: flex-start;
    gap: 6px;
  }
  .documents-actions .btn {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
  }
  .documents-actions .documents-visibility-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .documents-actions .documents-visibility-form .form-select {
    min-width: 0;
    max-width: none;
  }
  .document-name-cell {
    min-width: 170px;
    align-items: flex-start;
  }
  .doc-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .doc-icon svg {
    width: 20px;
    height: 20px;
  }
}
