/* ═══════════════════════════════════════════════════════════════════════════════
   ASGARD CRM — COMPONENTS LIBRARY v2.5
   Nordic Dark + Red/Blue/Gold Design System
   Reset & base styles are in design-tokens.css — no duplication here.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   BUTTONS — v2.5 (Red / Blue / Gold)
   ═══════════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg3);
  color: var(--t1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--fast);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  border-color: var(--t3);
  background: var(--bg4);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.98);
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button — Blue */
.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--text-on-accent);
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--blue-h);
  border-color: var(--blue-h);
  box-shadow: 0 0 20px rgba(30,77,140,0.35), 0 4px 12px rgba(30,77,140,0.25);
}

/* Secondary Button */
.btn.secondary {
  background: var(--bg3);
  border-color: var(--brd);
  color: var(--t1);
}

.btn.secondary:hover {
  background: var(--bg4);
  border-color: var(--t3);
}

/* Ghost Button */
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--t2);
}

.btn.ghost:hover {
  background: var(--bg3);
  color: var(--t1);
}

/* Gold Button — VIP accent */
.btn.gold {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg0);
  font-weight: 600;
}

.btn.gold:hover {
  background: var(--gold-h);
  border-color: var(--gold-h);
  box-shadow: 0 0 20px rgba(212,168,67,0.35), 0 4px 12px rgba(212,168,67,0.25);
}

/* Red/Danger Button */
.btn.red,
.btn.danger {
  background: var(--red);
  border-color: var(--red);
  color: var(--text-on-accent);
}

.btn.red:hover,
.btn.danger:hover {
  background: var(--red-h);
  border-color: var(--red-h);
  box-shadow: 0 0 20px rgba(200,41,59,0.35), 0 4px 12px rgba(200,41,59,0.25);
}

/* Green/Success Button */
.btn.green,
.btn.success {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--text-on-accent);
}

.btn.green:hover,
.btn.success:hover {
  background: var(--ok-t);
  box-shadow: var(--shadow-glow-green);
}

/* Amber/Warning Button */
.btn.amber,
.btn.warning {
  background: var(--warn);
  border-color: var(--warn);
  color: var(--bg0);
}

/* Blue Button (info variant) */
.btn.blue {
  background: var(--info);
  border-color: var(--info);
  color: var(--text-on-accent);
}

.btn.blue:hover {
  box-shadow: var(--blue-glow);
}

/* Button Sizes */
.btn.mini {
  padding: var(--sp-xs) 10px;
  font-size: 11px;
  border-radius: var(--r-sm);
}

.btn.sm {
  padding: var(--sp-sm) 14px;
  font-size: 12px;
}

.btn.lg {
  padding: var(--sp-md) 28px;
  font-size: 15px;
}

/* Icon Button */
.btn.icononly,
.iconbtn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg3);
  color: var(--t2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--fast);
}

.btn.icononly:hover,
.iconbtn:hover {
  border-color: var(--t3);
  color: var(--t1);
  background: var(--bg4);
}

/* Button Group */
.btn-group {
  display: inline-flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
  margin-left: -1px;
}

.btn-group .btn:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
  margin-left: 0;
}

.btn-group .btn:last-child {
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* Loading Button */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   FORMS — v2.5
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base Input Styles */
input,
select,
textarea,
.inp {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg3);
  color: var(--t1);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  transition: all var(--fast);
}

input:hover,
select:hover,
textarea:hover,
.inp:hover {
  border-color: var(--t3);
}

input:focus,
select:focus,
textarea:focus,
.inp:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}

input::placeholder,
textarea::placeholder {
  color: var(--t3);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
select[readonly],
textarea[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg2);
}

/* Invalid State */
input:invalid:not(:placeholder-shown),
input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--red);
}

input:invalid:not(:placeholder-shown):focus,
input.invalid:focus,
select.invalid:focus,
textarea.invalid:focus {
  box-shadow: 0 0 0 3px var(--red-bg);
}

/* Select with Custom Arrow */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

html[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A5568' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
}

/* Textarea */
textarea {
  min-height: 100px;
  resize: vertical;
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--blue);
  flex-shrink: 0;
}

input[type="radio"] {
  border-radius: 50%;
}

/* Checkbox/Radio Label */
.checkbox-label,
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--t2);
}

.checkbox-label:hover,
.radio-label:hover {
  color: var(--t1);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--brd);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--fast);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--fast);
  box-shadow: var(--shadow-sm);
}

.toggle-switch.active,
.toggle-switch:checked {
  background: var(--blue);
}

.toggle-switch.active::after,
.toggle-switch:checked::after {
  transform: translateX(20px);
}

/* Form Labels */
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Form Field Container */
.field {
  margin-bottom: var(--sp-4);
}

.field label {
  margin-bottom: 6px;
}

/* Float Label */
.field-float {
  position: relative;
}

.field-float input,
.field-float textarea {
  padding-top: 20px;
}

.field-float label {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--t3);
  pointer-events: none;
  transition: all var(--fast);
  text-transform: none;
  letter-spacing: normal;
}

.field-float input:focus ~ label,
.field-float input:not(:placeholder-shown) ~ label,
.field-float textarea:focus ~ label,
.field-float textarea:not(:placeholder-shown) ~ label {
  top: 8px;
  transform: translateY(0);
  font-size: 11px;
  color: var(--blue-l);
}

/* Form Row (Grid Layout) */
.formrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

/* Form Group */
.formgroup {
  display: flex;
  flex-direction: column;
}

/* Input with Icon */
.input-icon {
  position: relative;
}

.input-icon input {
  padding-left: 44px;
}

.input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t3);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Table Wrapper */
.tbl-wrap,
.table-wrap,
.tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
  border: none;
}

/* Base Table */
table,
.tbl,
table.asg {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

/* Table Header */
table th,
.tbl th,
table.asg th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t2);
  background: linear-gradient(180deg, var(--bg4), var(--bg3));
  border-bottom: 1px solid var(--brd);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

/* Table Cells */
table td,
.tbl td,
table.asg td {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg2);
  border-bottom: 1px solid var(--brd-m);
  color: var(--t1);
  vertical-align: middle;
  transition: background var(--fast);
}

/* Table Row Hover */
table tbody tr:hover td,
.tbl tbody tr:hover td,
table.asg tbody tr:hover td {
  background: var(--bg3);
}

/* Blue accent on hover first cell */
.tbl tbody tr:hover td:first-child,
table.asg tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--blue);
}

/* Active Row */
table tr.active td,
.tbl tr.active td {
  background: var(--blue-bg);
  border-color: var(--blue);
}

/* Last Row */
table tbody tr:last-child td,
.tbl tbody tr:last-child td {
  border-bottom: none;
}

/* Sortable Headers */
table th.sortable,
.tbl th.sortable {
  cursor: pointer;
  user-select: none;
}

table th.sortable:hover,
.tbl th.sortable:hover {
  color: var(--t1);
}

table th.sortable::after {
  content: '↕';
  margin-left: 6px;
  opacity: 0.4;
}

table th.sortable.asc::after {
  content: '↑';
  opacity: 1;
}

table th.sortable.desc::after {
  content: '↓';
  opacity: 1;
}

/* Enhanced ASG Table */
table.asg {
  border-spacing: 0 8px;
  border-collapse: separate;
}

table.asg th {
  background: transparent;
  border-bottom: none;
  padding: 0 var(--sp-4) 8px;
  color: var(--t3);
}

table.asg td {
  border: none;
  background: var(--bg4);
  border-bottom: 1px solid var(--brd-m);
}

table.asg tr td:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
}

table.asg tr td:last-child {
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════════ */

.card,
.panel {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.card::before,
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--blue));
  opacity: 0;
  transition: opacity var(--base);
  z-index: 1;
}

.card {
  padding: var(--sp-5);
}

.panel {
  padding: var(--sp-6);
}

.card:hover,
.panel:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  transition: all var(--base);
}

.card:hover::before,
.panel:hover::before {
  opacity: 0.6;
}

.card h3,
.panel h3,
.form-section,
.section-title,
.dash-widget-header {
  margin: 0 0 var(--sp-3);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 13px;
}

.card p,
.panel p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--t2);
  line-height: 1.6;
}

/* Stat Card */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  position: relative;
  overflow: hidden;
}

.stat-card .stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--fw-extra);
  color: var(--t1);
}

.stat-card .stat-label {
  font-size: var(--text-xs);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-card .stat-delta {
  font-size: var(--text-xs);
  font-family: var(--ff-mono);
  padding: 2px 8px;
  border-radius: var(--r-xs);
}

.stat-card .stat-delta.up {
  color: var(--ok-t);
  background: var(--ok-bg);
}

.stat-card .stat-delta.down {
  color: var(--err-t);
  background: var(--err-bg);
}

/* Rune Divider */
.rune-divider {
  text-align: center;
  padding: 8px 0;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.5em;
  opacity: 0.4;
  user-select: none;
}

.rune-divider::before {
  content: "ᚱ ◆ ᚨ ◆ ᚷ";
}

/* KPI Cards */
.kpi {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
}

.kpi .v {
  font-size: var(--text-3xl);
  font-weight: var(--fw-extra);
  color: var(--t1);
}

.kpi .t {
  font-size: var(--text-xs);
  color: var(--t3);
  text-transform: uppercase;
}

.kpi .delta {
  font-size: var(--text-xs);
  font-family: var(--ff-mono);
  padding: 4px 8px;
  border-radius: var(--r-xs);
}

.kpi .delta.up {
  color: var(--ok-t);
  background: var(--ok-bg);
}

.kpi .delta.down {
  color: var(--err-t);
  background: var(--err-bg);
}

/* KPI Row */
.kpi-row,
.kpi.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
}

.kpi .k {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  position: relative;
  overflow: hidden;
  transition: all var(--base);
}

.kpi .k:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi .k::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi .k:nth-child(1)::before { background: var(--red); }
.kpi .k:nth-child(2)::before { background: var(--blue); }
.kpi .k:nth-child(3)::before { background: var(--gold); }
.kpi .k:nth-child(4)::before { background: var(--ok); }
.kpi .k:nth-child(5)::before { background: var(--red); }
.kpi .k:nth-child(6)::before { background: var(--blue); }

.kpi .k .t {
  font-size: var(--text-xs);
  color: var(--t3);
  font-weight: var(--fw-bold);
}

.kpi .k .v {
  font-size: var(--text-xl);
  font-weight: var(--fw-black);
  margin-top: var(--sp-1);
  color: var(--t1);
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
}

.kpi .k .s {
  font-size: var(--text-xs);
  color: var(--t2);
  margin-top: var(--sp-1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BADGES, PILLS, TAGS
   ═══════════════════════════════════════════════════════════════════════════════ */

.badge,
.tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg3);
  font-size: var(--text-xs);
  font-weight: var(--fw-med);
  color: var(--t2);
  white-space: nowrap;
}

/* Badge Variants */
.badge.success,
.badge.ok,
.badge.green {
  background: var(--ok-bg);
  border-color: var(--ok-t);
  color: var(--ok-t);
}

.badge.warning,
.badge.warn,
.badge.amber {
  background: var(--warn-bg);
  border-color: var(--warn-t);
  color: var(--warn-t);
}

.badge.danger,
.badge.error,
.badge.red {
  background: var(--err-bg);
  border-color: var(--err-t);
  color: var(--err-t);
}

.badge.info,
.badge.blue {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

.badge.purple {
  background: rgba(147,51,234,0.12);
  border-color: rgba(147,51,234,0.3);
  color: var(--purple, #A855F7);
}

.badge.gold {
  background: var(--gold-bg);
  border-color: var(--gold-border);
  color: var(--gold);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
}

.status-badge.new,
.status-badge.pending {
  background: var(--info-bg);
  color: var(--info);
}

.status-badge.in-progress,
.status-badge.working {
  background: var(--warn-bg);
  color: var(--warn-t);
}

.status-badge.approved,
.status-badge.success,
.status-badge.done,
.status-badge.completed {
  background: var(--ok-bg);
  color: var(--ok-t);
}

.status-badge.rejected,
.status-badge.error,
.status-badge.problem,
.status-badge.failed {
  background: var(--err-bg);
  color: var(--err-t);
}

/* Status Dot */
.dot,
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green { background: var(--ok-t); box-shadow: 0 0 8px var(--ok-t); }
.dot.red { background: var(--err-t); box-shadow: 0 0 8px var(--err-t); }
.dot.amber { background: var(--warn-t); box-shadow: 0 0 8px var(--warn-t); }
.dot.blue { background: var(--info); box-shadow: 0 0 8px var(--info); }
.dot.gold { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* Saga Badge (Viking style) */
.saga-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-md);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
}

/* Pills with User Info */
.pill .who {
  color: var(--t1);
  font-weight: var(--fw-med);
}

.pill .role {
  font-family: var(--ff-mono);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--gold);
  padding: 2px 8px;
  background: var(--gold-glow);
  border-radius: var(--r-xs);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════════ */

.modalback,
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: var(--glass-blur);
  overflow-y: auto;
  z-index: var(--z-modal);
}

.modalback.show,
.modal-overlay.show,
.modal-overlay.active {
  display: flex;
}

.modal,
.modal-content {
  width: min(900px, 95vw);
  max-height: 90vh;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-slide-up 0.3s ease;
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


.modal.wide,
.modal-content.wide {
  width: min(1200px, 96vw);
  max-height: 92vh;
}

.modal.fullscreen,
.modal-content.fullscreen {
  width: min(1600px, 98vw);
  height: 95vh;
  max-height: 95vh;
}

/* Modal Header */
.mh,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--brd);
  background: var(--bg2);
  position: relative;
}

.modal::before,
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold) 50%, var(--blue));
  z-index: 1;
}

.mh::before,
.modal-header::before {
  content: none;
}

.mh .ttl,
.modal-header h2,
.modal-header .title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--t1);
  margin: 0;
}

/* Modal Body */
.mc,
.modal-body {
  flex: 1;
  padding: var(--sp-6);
  overflow-y: auto;
}

/* Modal Footer */
.mf,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--brd);
  background: var(--bg2);
}

/* Close Button */
.xbtn,
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: var(--t3);
  cursor: pointer;
  transition: all var(--fast);
  font-size: 16px;
}

.xbtn:hover,
.modal-close:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--err-bg);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg2);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.15);
  overflow-x: auto;
}

.tab,
.tab-btn {
  flex: 1;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--t2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: all var(--fast);
  white-space: nowrap;
  position: relative;
}

.tab:hover,
.tab-btn:hover {
  color: var(--t1);
  background: var(--bg3);
}

.tab.active,
.tab-btn.active {
  background: var(--blue-bg);
  color: var(--blue-l);
  box-shadow: var(--shadow-sm);
}

.tab.active::after,
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

/* Tab Content */
.tab-content {
  display: none;
  padding: var(--sp-4) 0;
}

.tab-content.active {
  display: block;
  animation: tab-fade-in 0.2s ease;
}

@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Vertical Tabs */
.tabs-vertical {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-2);
  background: var(--bg2);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.15);
}

.tabs-vertical .tab,
.tabs-vertical .tab-btn {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
}

.tabs-vertical .tab.active::after,
.tabs-vertical .tab-btn.active::after {
  display: none;
}

.tabs-vertical .tab.active::before,
.tabs-vertical .tab-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS — Redesigned
   ═══════════════════════════════════════════════════════════════════════════════ */
.toastwrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-left: 3px solid var(--brd);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  animation: toast-in 250ms ease forwards;
}

.toast-success { border-left-color: var(--ok); }
.toast-error   { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--gold); }
.toast-info    { border-left-color: var(--blue); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.toast-exit {
  animation: toast-out 200ms ease forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* Icon circle */
.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Variants */
.toast-success .toast-icon {
  background: var(--ok-bg);
  color: var(--ok-t);
}

.toast-error .toast-icon {
  background: var(--err-bg);
  color: var(--err-t);
}

.toast-warning .toast-icon {
  background: var(--warn-bg);
  color: var(--warn-t);
}

.toast-info .toast-icon {
  background: var(--info-bg);
  color: var(--info-text);
}

/* Content */
.toast-content { flex: 1; min-width: 0; }

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
}

.toast-msg {
  font-size: 12px;
  color: var(--t3);
  margin-top: 2px;
  word-break: break-word;
}

/* Close */
.toast-close {
  background: none;
  border: none;
  color: var(--t3);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--fast);
}

.toast-close:hover { color: var(--t1); }

/* Progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 12px 12px;
  animation: toast-progress 4s linear forwards;
}

.toast-success .toast-progress { background: var(--ok); }
.toast-error .toast-progress { background: var(--red); }
.toast-warning .toast-progress { background: var(--warn); }
.toast-info .toast-progress { background: var(--info); }

@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Light theme */
html[data-theme="light"] .toast {
  background: var(--bg2);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-lg);
}

/* Mobile: full width above tab bar */
@media (max-width: 768px) {
  .toastwrap {
    top: auto;
    bottom: 70px;
    right: 8px;
    left: 8px;
    max-width: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABLE ENHANCEMENTS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Sticky table header */
.tbl-wrap {
  position: relative;
}

.tbl thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.tbl thead th {
  background: var(--bg4);
  border-bottom: 1px solid var(--brd);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--t2);
  padding: 10px 12px;
  white-space: nowrap;
}

html[data-theme="light"] .tbl thead th {
  background: var(--bg3);
  color: var(--t2);
}

/* Zebra striping (opt-in) */
.tbl.zebra tbody tr:nth-child(even) {
  background: var(--bg3);
}

html[data-theme="light"] .tbl.zebra tbody tr:nth-child(even) {
  background: var(--bg3);
}

/* Sort indicator */
.tbl th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
}

.tbl th[data-sort]::after {
  content: '⇅';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--t3);
  opacity: 0.4;
}

.tbl th[data-sort].asc::after { content: '↑'; opacity: 1; color: var(--blue-l); }
.tbl th[data-sort].desc::after { content: '↓'; opacity: 1; color: var(--blue-l); }

/* Row count footer */
.tbl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--t3);
  border-top: 1px solid var(--brd);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════════ */

.alert {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg2);
  margin-bottom: var(--sp-4);
}

.alert.success,
.success-box {
  background: var(--ok-bg);
  border-color: var(--ok-t);
  color: var(--ok-t);
}

.alert.warning,
.warning-box {
  background: var(--warn-bg);
  border-color: var(--warn-t);
  color: var(--warn-t);
}

.alert.error,
.alert.danger {
  background: var(--err-bg);
  border-color: var(--err-t);
  color: var(--err-t);
}

.alert.info,
.info-box {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

/* Help Text */
.help,
.hint {
  font-size: var(--text-xs);
  color: var(--t3);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PROGRESS
   ═══════════════════════════════════════════════════════════════════════════════ */

.progress,
.progress-bg {
  height: 8px;
  background: var(--brd);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: var(--r-full);
  transition: width var(--slow);
}

.progress-bar.success { background: var(--ok-t); }
.progress-bar.warning { background: var(--warn-t); }
.progress-bar.danger { background: var(--err-t); }
.progress-bar.info { background: var(--info-t); }

/* ═══════════════════════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════════════════════ */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: var(--t2);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--fast);
}

.page-btn:hover {
  border-color: var(--t3);
  color: var(--t1);
  background: var(--bg3);
}

.page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--text-on-accent);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOOLTIPS
   ═══════════════════════════════════════════════════════════════════════════════ */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  background: var(--bg0);
  color: var(--t1);
  font-size: var(--text-xs);
  border-radius: var(--r-sm);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

[data-tooltip]::before {
  content: '';
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  border: 5px solid transparent;
  border-top-color: var(--bg0);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

[data-tooltip]:hover::after {
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip]:hover::before {
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ACCORDION
   ═══════════════════════════════════════════════════════════════════════════════ */

.accordion-item,
details {
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
  overflow: hidden;
}

.accordion-header,
summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg2);
  color: var(--t1);
  font-weight: var(--fw-med);
  cursor: pointer;
  transition: all var(--fast);
  list-style: none;
}

.accordion-header:hover,
summary:hover {
  background: var(--bg3);
}

details[open] summary {
  border-bottom: 1px solid var(--brd);
  color: var(--blue-l);
}

summary::marker,
summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 18px;
  color: var(--t3);
  transition: transform var(--fast);
}

details[open] summary::after {
  transform: rotate(45deg);
  color: var(--blue-l);
}

.accordion-content,
details > *:not(summary) {
  padding: var(--sp-4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LOADING STATES
   ═══════════════════════════════════════════════════════════════════════════════ */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-5);
}

.loading-text {
  margin-top: var(--sp-4);
  font-size: var(--text-sm);
  color: var(--t2);
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--brd);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--sp-2);
  width: 100%;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--sp-3);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
}

.skeleton-row {
  height: 44px;
  margin-bottom: 4px;
  border-radius: var(--r-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Visibility */
.hidden { display: none !important; }
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* Text Colors */
.text-gold { color: var(--gold) !important; }
.text-green { color: var(--ok-t) !important; }
.text-red { color: var(--err-t) !important; }
.text-blue { color: var(--info) !important; }
.text-amber { color: var(--warn-t) !important; }
.text-muted { color: var(--t3) !important; }
.text-primary { color: var(--t1) !important; }
.text-secondary { color: var(--t2) !important; }

/* Background Colors */
.bg-gold { background: var(--gold-bg) !important; }
.bg-green { background: var(--ok-bg) !important; }
.bg-red { background: var(--err-bg) !important; }
.bg-blue { background: var(--info-bg) !important; }

/* Spacing */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.p-0 { padding: 0 !important; }

.mt-1 { margin-top: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }

.mb-1 { margin-bottom: var(--sp-1) !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-3 { margin-bottom: var(--sp-3) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }

.p-1 { padding: var(--sp-1) !important; }
.p-2 { padding: var(--sp-2) !important; }
.p-3 { padding: var(--sp-3) !important; }
.p-4 { padding: var(--sp-4) !important; }

/* Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--sp-5);
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Grid Spans */
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

@media (max-width: 1200px) {
  .span-3, .span-4 { grid-column: span 6; }
}

@media (max-width: 768px) {
  .span-3, .span-4, .span-6 { grid-column: span 12; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Info Sections */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--brd);
}

.info-section {
  margin-bottom: var(--sp-6);
}

/* Page Head */
.page-head h1 {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--t1);
  margin: 0 0 var(--sp-2);
}

.page-head .desc {
  font-size: var(--text-sm);
  color: var(--t2);
}

/* Horizontal Rule */
.hr {
  height: 1px;
  margin: var(--sp-6) 0;
  border: none;
  background: linear-gradient(90deg, transparent, var(--brd), transparent);
}

/* Rune Separator */
.runesep {
  text-align: center;
  padding: var(--sp-4) 0;
  color: var(--gold-dim);
  font-size: var(--text-xs);
  letter-spacing: 0.4em;
  user-select: none;
}

.runesep::before {
  content: "⟡ ◆ ⟡ ◆ ⟡";
}

/* Credit */
.credit {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--t3);
  padding: var(--sp-2) 0;
}

/* Tools Section */
.tools {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: var(--sp-4);
}

.tools .field {
  min-width: 200px;
  margin-bottom: 0;
}

/* Mobile Visibility */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .show-mobile { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ENHANCED ANIMATIONS & MICRO-INTERACTIONS
   Business Viking 2026 Design System
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Page Transition Animation */
@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main,
.panel,
.page-content {
  animation: page-fade-in 0.3s ease-out;
}

/* Card Entrance Animation */
@keyframes card-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: card-slide-up 0.4s ease-out;
  animation-fill-mode: both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

/* KPI Card Value Animation */
@keyframes kpi-value-pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.kpi .k .v,
.stat-value,
.kpi-value {
  animation: kpi-value-pop 0.5s ease-out 0.2s;
  animation-fill-mode: both;
}

/* Button Press Effect */
.btn:active {
  transform: scale(0.98);
}

/* Pulse Animation for Notifications */
@keyframes notification-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(192, 57, 43, 0);
  }
}

.bellcount,
.notification-badge {
  animation: notification-pulse 2s ease-in-out infinite;
}

/* Floating Action Button Animation */
@keyframes fab-entrance {
  from {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.fab {
  animation: fab-entrance 0.4s ease-out;
}

/* Skeleton Loading Animation */
@keyframes skeleton-wave {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.skeleton,
.loading-placeholder {
  background: linear-gradient(
    90deg,
    var(--bg4) 25%,
    var(--bg3) 50%,
    var(--bg4) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}

/* Smooth Expand/Collapse for Nav Groups — REMOVED: old expand/collapse sidebar
   rules conflicted with flyout navigation. Flyout visibility is now controlled
   exclusively by .flyout-open class in layout.css. See commit for details. */

/* ═══════════════════════════════════════════════════════════════════════════════
   FADE-IN ANIMATIONS (Stage 7)
   ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fade-up 300ms ease forwards;
  opacity: 0;
}

/* Staggered delay for lists */
.fade-in:nth-child(1) { animation-delay: 0ms; }
.fade-in:nth-child(2) { animation-delay: 40ms; }
.fade-in:nth-child(3) { animation-delay: 80ms; }
.fade-in:nth-child(4) { animation-delay: 120ms; }
.fade-in:nth-child(5) { animation-delay: 160ms; }
.fade-in:nth-child(6) { animation-delay: 200ms; }
.fade-in:nth-child(7) { animation-delay: 240ms; }
.fade-in:nth-child(8) { animation-delay: 280ms; }
.fade-in:nth-child(9) { animation-delay: 320ms; }
.fade-in:nth-child(10) { animation-delay: 360ms; }

/* Card hover lift */
.card:hover {
  border-color: var(--t3);
}

/* Focus Ring Animation */
@keyframes focus-ring-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px var(--blue-glow);
  }
  50% {
    box-shadow: 0 0 0 4px var(--blue-glow);
  }
}

/* Table Row Hover Effect */
.tbl tbody tr {
  transition: background-color var(--base) ease, transform var(--fast) ease;
}

.tbl tbody tr:hover {
  transform: translateX(2px);
}

/* Success/Error State Animations */
@keyframes success-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes success-check {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(-45deg);
  }
  100% {
    transform: scale(1) rotate(-45deg);
    opacity: 1;
  }
}

.success-animation {
  animation: success-check 0.4s ease-out;
}

.error-animation {
  animation: success-shake 0.4s ease-out;
}

/* Tooltip Fade Animation */
@keyframes tooltip-fade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  animation: tooltip-fade 0.2s ease-out;
}

/* Badge Count Update Animation */
@keyframes badge-bump {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.badge-animate {
  animation: badge-bump 0.3s ease-out;
}

/* Dropdown Menu Animation */
@keyframes dropdown-slide {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-menu,
.context-menu,
.popover {
  animation: dropdown-slide 0.2s ease-out;
  transform-origin: top center;
}

/* Progress Bar Animation */
@keyframes progress-fill {
  from { width: 0; }
}

.progress-bar,
.progress-fill {
  animation: progress-fill 0.8s ease-out;
}

/* Stagger Animation Helper Classes */
.stagger-1 { animation-delay: 0.05s !important; }
.stagger-2 { animation-delay: 0.1s !important; }
.stagger-3 { animation-delay: 0.15s !important; }
.stagger-4 { animation-delay: 0.2s !important; }
.stagger-5 { animation-delay: 0.25s !important; }
.stagger-6 { animation-delay: 0.3s !important; }

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PHASE 2: COMMUNICATIONS & TASKS
   M3 (Групповые чаты) + M4 (Канбан-доска) + M5 (Совещания)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────────
   KANBAN BOARD
   ───────────────────────────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: var(--sp-4);
  min-height: calc(100vh - 160px);
  padding: var(--sp-4) 0;
  overflow-x: auto;
  scroll-behavior: smooth;
}

.kanban-column {
  flex: 0 0 320px;
  min-width: 320px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  border-radius: var(--r-lg);
  overflow: hidden;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border-bottom: none;
  background: transparent;
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--fw-semi);
  color: var(--t1);
}

.kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--sp-2);
  background: transparent;
  border: none;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--gold);
}

.kanban-column-body {
  flex: 1;
  padding: var(--sp-3);
  overflow-y: auto;
  min-height: 200px;
}

.kanban-column-body.drag-over {
  background: var(--gold-glow);
  border: 2px dashed var(--gold);
  border-radius: var(--r-md);
}

/* Kanban Card */
.kanban-card {
  position: relative;
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  cursor: grab;
  transition: all var(--base);
  box-shadow: none;
}

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

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(3deg);
  box-shadow: none;
}

.kanban-card-priority {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.kanban-card-priority.low { background: var(--ok-t); }
.kanban-card-priority.normal { background: var(--blue); }
.kanban-card-priority.high { background: var(--warn-t); }
.kanban-card-priority.urgent { background: var(--red); animation: priority-pulse 1s ease-in-out infinite; }

@keyframes priority-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.kanban-card-title {
  font-weight: var(--fw-semi);
  color: var(--t1);
  margin-bottom: var(--sp-2);
  line-height: 1.4;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.kanban-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--gradient-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--bg1);
}

.kanban-card-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: transparent;
  border-radius: var(--r-sm);
}

.kanban-card-deadline.overdue {
  background: var(--err-bg);
  color: var(--red);
}

.kanban-card-deadline.soon {
  background: var(--warn-bg);
  color: var(--warn-t);
}

.kanban-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

.kanban-tag {
  padding: 2px 8px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  color: var(--t2);
}

/* Kanban Column Colors — only top accent, no extra borders */
.kanban-column[data-column="new"] { border-top: 3px solid var(--blue); }
.kanban-column[data-column="in_progress"] { border-top: 3px solid var(--gold); }
.kanban-column[data-column="review"] { border-top: 3px solid var(--purple, #A855F7); }
.kanban-column[data-column="done"] { border-top: 3px solid var(--ok-t); }

/* Kanban Filters */
.kanban-filters {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: transparent;
  border: none;
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

/* ─────────────────────────────────────────────────────────────────────────────────
   GROUP CHATS — Telegram/WhatsApp-inspired UI
   ───────────────────────────────────────────────────────────────────────────────── */
.chat-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  height: calc(100vh - 160px);
  height: calc(100dvh - 160px);
  min-height: 400px;
  max-height: none;
  max-height: none;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

/* ── Sidebar ────────────────────────────────────────────── */
.chat-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--brd);
  background: var(--bg3);
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--brd);
}

.chat-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--t1);
}

.chat-sidebar-icon {
  font-size: 22px;
}

.chat-create-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-gold);
  color: var(--bg1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--base) ease;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.chat-create-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.5);
}

.chat-search-bar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--brd);
}

.chat-search-input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg1);
  color: var(--t1);
  font-size: 13px;
  outline: none;
  transition: border-color var(--base);
}

.chat-search-input:focus {
  border-color: var(--gold-border);
}

.chat-search-input::placeholder {
  color: var(--text-tertiary);
}

/* ── Chat List ────────────────────────────────────────────── */
.chat-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}

.chat-list::-webkit-scrollbar {
  width: 4px;
}

.chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--fast) ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
}

.chat-item:hover {
  background: var(--bg3);
}

.chat-item.active {
  background: rgba(212, 175, 55, 0.1);
  border-left: 3px solid var(--gold);
}

.chat-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.chat-item-avatar.group {
  background: var(--gradient-gold);
  color: var(--bg1);
}

.chat-item-avatar-letter {
  text-transform: uppercase;
}

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

.chat-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.chat-item-preview {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.chat-item-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

.chat-item-unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--ok);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Empty State ────────────────────────────────────────── */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.chat-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.chat-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 4px;
}

.chat-empty-desc {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ── Welcome Screen ──────────────────────────────────────── */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.03) 0%, transparent 70%);
}

.chat-welcome-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.chat-welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 8px;
}

.chat-welcome-desc {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ── Chat Main Area ──────────────────────────────────────── */
.chat-main {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg1);
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--brd);
  background: var(--bg2);
  min-height: 56px;
  flex-shrink: 0;
}

.chat-back-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--fast);
  margin-right: 4px;
}

.chat-back-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--gold);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-header-avatar.group {
  background: var(--gradient-gold);
  color: var(--bg1);
}

.chat-header-details {
  display: flex;
  flex-direction: column;
}

.chat-header-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--t1);
}

.chat-header-status {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  animation: chat-online-pulse 2s infinite;
}

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

.chat-header-actions {
  display: flex;
  gap: 4px;
}

.chat-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--fast) ease;
}

.chat-header-btn:hover {
  background: var(--bg2);
  color: var(--t1);
}

/* ── Messages Area ───────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg1);
  background-image:
    radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(100, 100, 255, 0.02) 0%, transparent 50%);
  scrollbar-width: thin;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
}

/* Date Dividers */
.chat-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.chat-date-divider span {
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

/* No Messages */
.chat-no-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  flex: 1;
}

.chat-no-messages-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.chat-no-messages-text {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ── Message Bubbles ─────────────────────────────────────── */
.chat-message {
  display: flex;
  gap: 8px;
  max-width: 65%;
  align-items: flex-end;
  position: relative;
  margin-bottom: 2px;
  animation: chat-msg-appear 0.2s ease-out;
}

@keyframes chat-msg-appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.own {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.chat-message-bubble {
  padding: 8px 12px;
  background: var(--bg2);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  position: relative;
  min-width: 80px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message.own .chat-message-bubble {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.15));
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 3px rgba(212, 175, 55, 0.15);
}

.chat-message-sender {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
}

.chat-message-text {
  color: var(--t1);
  line-height: 1.45;
  word-wrap: break-word;
  font-size: 14px;
  white-space: pre-wrap;
}

.chat-message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
}

.chat-message-time {
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.8;
}

.chat-msg-read {
  font-size: 12px;
  color: var(--cyan, #4FC3F7);
  letter-spacing: -3px;
  margin-left: 2px;
}

/* ── Reply in message ────────────────────────────────────── */
.chat-msg-reply {
  padding: 6px 10px;
  background: var(--bg3);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  margin-bottom: 6px;
}

.chat-msg-reply-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 1px;
}

.chat-msg-reply-text {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Reactions ───────────────────────────────────────────── */
.chat-msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.chat-msg-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all var(--fast);
}

.chat-msg-reaction:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chat-msg-reaction.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: rgba(212, 175, 55, 0.4);
}

/* ── Message Actions (hover) ─────────────────────────────── */
.chat-msg-actions {
  display: none;
  gap: 2px;
  position: absolute;
  top: -4px;
  right: 0;
  z-index: 5;
}

.chat-message.own .chat-msg-actions {
  right: auto;
  left: 0;
}

.chat-message:hover .chat-msg-actions {
  display: flex;
}

.chat-msg-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg2);
  color: var(--t2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--fast);
}

.chat-msg-action-btn:hover {
  background: var(--gold-glow);
  color: var(--t1);
}

/* ── Reaction Picker ─────────────────────────────────────── */
.chat-reaction-picker {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg2);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  margin-top: 6px;
  animation: chat-picker-pop 0.15s ease-out;
}

@keyframes chat-picker-pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.chat-reaction-option {
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: transform var(--fast);
}

.chat-reaction-option:hover {
  transform: scale(1.3);
  background: var(--bg2);
}

/* ── Emoji Picker Panel ──────────────────────────────────── */
.chat-emoji-picker-panel {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--brd);
  animation: chat-picker-pop 0.15s ease-out;
}

.chat-emoji-option {
  font-size: 24px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  text-align: center;
  transition: transform var(--fast), background var(--fast);
}

.chat-emoji-option:hover {
  transform: scale(1.2);
  background: var(--bg2);
}

/* ── Reply Bar ───────────────────────────────────────────── */
.chat-reply-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--brd);
  border-left: 3px solid var(--gold);
}

.chat-reply-bar-content {
  flex: 1;
  min-width: 0;
}

.chat-reply-bar-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.chat-reply-bar-text {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-reply-bar-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--fast);
}

.chat-reply-bar-close:hover {
  background: var(--bg2);
  color: var(--t1);
}

/* ── Typing Indicator ────────────────────────────────────── */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.chat-typing-dots {
  display: flex;
  gap: 3px;
  padding: 8px 12px;
  background: var(--bg2);
  border-radius: 18px;
}

.chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: chat-typing-bounce 1.4s infinite;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chat-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-typing-text {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ── Input Area ──────────────────────────────────────────── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--brd);
  background: var(--bg2);
  flex-shrink: 0;
  z-index: 5;
  position: relative;
}

.chat-emoji-btn,
.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--fast) ease;
  flex-shrink: 0;
}

.chat-emoji-btn:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

.chat-send-btn {
  background: var(--gradient-gold);
  color: var(--bg1);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.5);
}

.chat-send-btn.sending {
  opacity: 0.6;
  pointer-events: none;
}

.chat-attach-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--fast);
}

.chat-attach-btn:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

.chat-item-type-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple-l, #a78bfa);
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 22px;
  color: var(--t1);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color var(--base);
}

.chat-input:focus {
  border-color: var(--gold-border);
  outline: none;
  background: var(--bg2);
}

.chat-input::placeholder {
  color: var(--text-tertiary);
}

/* ── Member Picker (Create Modal) ────────────────────────── */
.chat-member-picker {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  scrollbar-width: thin;
}

.chat-member-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--fast);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-member-option:hover {
  background: var(--bg3);
}

.chat-member-option input[type="checkbox"] {
  display: none;
}

.chat-member-option input[type="checkbox"]:checked ~ .chat-member-option-avatar {
  box-shadow: 0 0 0 2px var(--gold);
}

.chat-member-option input[type="checkbox"]:checked ~ .chat-member-option-info .chat-member-option-name {
  color: var(--gold);
}

.chat-member-option-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  transition: box-shadow var(--fast);
}

.chat-member-option-info {
  display: flex;
  flex-direction: column;
}

.chat-member-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  transition: color var(--fast);
}

.chat-member-option-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ── Member Row (Members Modal) ──────────────────────────── */
.chat-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-member-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-member-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.chat-member-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--bg2);
}

.chat-member-row-info {
  display: flex;
  flex-direction: column;
}

.chat-member-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
}

.chat-member-row-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ─────────────────────────────────────────────────────────────────────────────────
   ESTIMATE CHATS (H3)
   ───────────────────────────────────────────────────────────────────────────────── */

/* Section header in sidebar */
.ec-section-header {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--gold, #D4A843);
}

/* Estimate chat items in sidebar */
.chat-item[data-entity-type="estimate"] {
  border-left: 3px solid var(--gold, #D4A843);
}
.chat-item[data-entity-type="estimate"] .chat-item-type-badge {
  background: rgba(212,168,67,.15);
  color: var(--gold, #D4A843);
}

/* Status badges */
.ec-status-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.ec-status-badge--sent     { background: rgba(212,168,67,.15); color: #D4A843; }
.ec-status-badge--approved { background: rgba(102,187,106,.15); color: #66BB6A; }
.ec-status-badge--rework   { background: rgba(255,179,0,.15); color: #FFB300; }
.ec-status-badge--question { background: rgba(126,176,232,.15); color: #7EB0E8; }
.ec-status-badge--rejected { background: rgba(200,41,59,.15); color: #C8293B; }
.ec-status-badge--draft    { background: rgba(136,136,136,.15); color: #888; }

/* Pinned estimate card */
.ec-pinned-card {
  background: var(--bg3, #1e1e1e);
  border: 1px solid rgba(212,168,67,.25);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 16px 8px;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.ec-pinned-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212,168,67,.12);
}
.ec-pinned-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ec-pinned-card__title {
  font-weight: 600;
  color: var(--t1, #fff);
  font-size: 14px;
}
.ec-pinned-card__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 10px 0;
}
.ec-metric { text-align: center; }
.ec-metric__label { font-size: 11px; color: var(--t3, #888); display: block; margin-bottom: 2px; }
.ec-metric__value { font-size: 16px; font-weight: 700; color: var(--t1, #fff); }
.ec-pinned-card__link {
  color: var(--gold, #D4A843);
  font-size: 13px;
  text-decoration: none;
  display: block;
  text-align: right;
}
.ec-pinned-card__link:hover { text-decoration: underline; }
.ec-pinned-card--flash { box-shadow: 0 0 12px rgba(212,168,67,.4); transition: box-shadow 300ms; }
.ec-pinned-card__info {
  font-size: 12px;
  color: var(--t2, #aaa);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ec-pinned-card__details {
  font-size: 11px;
  color: var(--t3, #888);
  margin-bottom: 8px;
}

/* Mimir estimate avatar & bubble */
.ec-mimir-avatar {
  background: linear-gradient(135deg, #C8293B, #1E4D8C) !important;
  border: 2px solid var(--gold, #D4A843) !important;
}
.ec-mimir-avatar span { color: var(--gold, #D4A843) !important; font-weight: 700; }
.ec-mimir-bubble {
  background: #1a1a0e !important;
  border: 1px solid rgba(212,168,67,.3) !important;
}
.ec-mimir-pill {
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(212,168,67,.15);
  color: var(--gold, #D4A843);
  border-radius: 8px;
  margin-left: 6px;
}

/* Action badges (approval) */
.ec-action-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; margin-left: 8px; }
.ec-action-badge--approve  { background: rgba(102,187,106,.15); color: #66BB6A; }
.ec-action-badge--rework   { background: rgba(255,179,0,.15); color: #FFB300; }
.ec-action-badge--question { background: rgba(126,176,232,.15); color: #7EB0E8; }
.ec-action-badge--reject   { background: rgba(200,41,59,.15); color: #C8293B; }

/* System pill (estimate_update) */
.ec-system-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  margin: 8px auto;
  background: rgba(212,168,67,.08);
  border: 1px solid rgba(212,168,67,.15);
  border-radius: 16px;
  width: fit-content;
  position: relative;
  cursor: default;
}
.ec-system-pill__icon { font-size: 14px; }
.ec-system-pill__text { font-size: 12px; color: var(--t2, #aaa); }
/* H6: Show timestamp on hover */
.ec-system-pill .ec-system-pill__time {
  display: none;
  font-size: 10px;
  color: var(--t3, #666);
  margin-left: 4px;
}
.ec-system-pill:hover .ec-system-pill__time {
  display: inline;
}

/* Add member button accent for estimate chats */
.ec-add-member-btn { color: var(--gold, #D4A843) !important; }
.ec-add-member-btn:hover { background: rgba(212,168,67,.1) !important; }

/* ─────────────────────────────────────────────────────────────────────────────────
   MEETINGS
   ───────────────────────────────────────────────────────────────────────────────── */
.meeting-card {
  position: relative;
  padding: var(--sp-4);
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-lg);
  transition: all var(--base);
}

.meeting-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-md);
}

.meeting-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.meeting-card-title {
  font-weight: var(--fw-semi);
  color: var(--t1);
  font-size: var(--text-lg);
}

.meeting-card-time {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--gold);
}

.meeting-card-location {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--t2);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-3);
}

.meeting-card-participants {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.meeting-participant-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--bg3);
  border: 2px solid var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  margin-left: -8px;
}

.meeting-participant-avatar:first-child {
  margin-left: 0;
}

.meeting-participant-more {
  background: var(--gold-glow);
  color: var(--gold);
  border-color: var(--gold-border);
}

.meeting-rsvp {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--brd);
}

.meeting-rsvp-btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  background: var(--bg3);
  color: var(--t2);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--fast);
}

.meeting-rsvp-btn:hover {
  border-color: var(--gold-border);
  color: var(--gold);
}

.meeting-rsvp-btn.accepted {
  background: var(--ok-bg);
  border-color: var(--ok-t);
  color: var(--ok-t);
}

.meeting-rsvp-btn.declined {
  background: var(--err-bg);
  border-color: var(--red);
  color: var(--red);
}

.meeting-rsvp-btn.tentative {
  background: var(--warn-bg);
  border-color: var(--warn-t);
  color: var(--warn-t);
}

/* Meeting Status Badge */
.meeting-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
}

.meeting-status.scheduled { background: var(--info-bg); color: var(--blue); }
.meeting-status.in_progress { background: var(--ok-bg); color: var(--ok-t); animation: status-pulse 2s ease-in-out infinite; }
.meeting-status.completed { background: var(--bg3); color: var(--text-tertiary); }
.meeting-status.cancelled { background: var(--err-bg); color: var(--red); text-decoration: line-through; }

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ─────────────────────────────────────────────────────────────────────────────────
   HOME WIDGETS (Mini Cards)
   ───────────────────────────────────────────────────────────────────────────────── */
.widget-task-mini {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  transition: all var(--fast);
  cursor: pointer;
}

.widget-task-mini:hover {
  border-color: var(--gold-border);
  background: var(--gold-glow);
}

.widget-task-priority {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.widget-task-priority.low { background: var(--ok-t); }
.widget-task-priority.normal { background: var(--blue); }
.widget-task-priority.high { background: var(--warn-t); }
.widget-task-priority.urgent { background: var(--red); }

.widget-task-content {
  flex: 1;
  min-width: 0;
}

.widget-task-title {
  font-weight: var(--fw-med);
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-task-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.widget-meeting-mini {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  transition: all var(--fast);
  cursor: pointer;
}

.widget-meeting-mini:hover {
  border-color: var(--gold-border);
  background: var(--gold-glow);
}

.widget-meeting-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-md);
  min-width: 50px;
}

.widget-meeting-time-hour {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--gold);
  line-height: 1;
}

.widget-meeting-time-min {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.widget-meeting-content {
  flex: 1;
  min-width: 0;
}

.widget-meeting-title {
  font-weight: var(--fw-med);
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-meeting-location {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Widget Empty State */
.widget-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  text-align: center;
  color: var(--text-tertiary);
}

.widget-empty-icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--sp-2);
  opacity: 0.5;
}

.widget-empty-text {
  font-size: var(--text-sm);
}

/* ─────────────────────────────────────────────────────────────────────────────────
   LIGHT THEME OVERRIDES FOR PHASE 2
   ───────────────────────────────────────────────────────────────────────────────── */
html[data-theme="light"] .kanban-column {
  background: transparent;
}

html[data-theme="light"] .kanban-card {
  background: transparent;
}

html[data-theme="light"] .chat-container {
  background: var(--bg2);
  box-shadow: var(--shadow-lg);
}

html[data-theme="light"] .chat-sidebar {
  background: var(--bg3);
}

html[data-theme="light"] .chat-search-input {
  background: var(--bg2);
  border-color: var(--brd);
}

html[data-theme="light"] .chat-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .chat-item.active {
  background: rgba(212, 175, 55, 0.08);
}

html[data-theme="light"] .chat-main {
  background: var(--bg3);
}

html[data-theme="light"] .chat-messages {
  background: var(--bg3);
  background-image: none;
}

html[data-theme="light"] .chat-message-bubble {
  background: var(--bg2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .chat-message.own .chat-message-bubble {
  background: var(--ok-bg, #dcf8c6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .chat-date-divider span {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.65);
}

html[data-theme="light"] .chat-input {
  background: var(--bg2);
  border-color: var(--brd);
}

html[data-theme="light"] .chat-input:focus {
  background: var(--bg2);
}

html[data-theme="light"] .chat-msg-reply {
  background: rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .chat-msg-reaction {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .chat-typing-dots {
  background: var(--bg2);
}

html[data-theme="light"] .chat-msg-action-btn {
  background: var(--bg2);
  box-shadow: var(--shadow-md);
}

html[data-theme="light"] .meeting-card {
  background: white;
}

html[data-theme="light"] .widget-task-mini,
html[data-theme="light"] .widget-meeting-mini {
  background: rgba(248, 250, 252, 0.9);
}

/* ─────────────────────────────────────────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS FOR PHASE 2
   ───────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kanban-board {
    padding: var(--sp-3);
  }

  .kanban-column {
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 280px;
  }

  .chat-container {
    grid-template-columns: 1fr;
    height: calc(100vh - 160px);
  }

  .chat-sidebar {
    display: none;
  }

  .chat-sidebar.open {
    display: flex;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .chat-emoji-picker-panel {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 768px) {
  .kanban-column {
    flex: 0 0 260px;
    min-width: 260px;
    max-width: 260px;
  }

  .chat-message {
    max-width: 85%;
  }

  .chat-container {
    grid-template-columns: 1fr;
  }

  .meeting-rsvp {
    flex-wrap: wrap;
  }

  .meeting-rsvp-btn {
    flex: 1 1 calc(50% - var(--sp-1));
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SLIDE-OVER DRAWER
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Overlay */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--base) ease, visibility var(--base);
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Drawer Panel */
.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--bg2);
  border-left: 1px solid var(--brd);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.3);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--base) cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.drawer.open {
  transform: translateX(0);
}

/* Width variants */
.drawer.drawer-normal { width: min(480px, 90vw); }
.drawer.drawer-wide { width: min(640px, 90vw); }
.drawer.drawer-full { width: 90vw; }

/* Header */
.drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
  background: var(--bg2);
}

.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: var(--t3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--fast);
}

.drawer-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.drawer-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Scrollbar */
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb {
  background: var(--brd);
  border-radius: 3px;
}
.drawer-body::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dim);
}

/* Mobile: full width */
@media (max-width: 768px) {
  .drawer.drawer-normal,
  .drawer.drawer-wide,
  .drawer.drawer-full { width: 100vw; }
}

/* Light theme */
html[data-theme="light"] .drawer {
  background: var(--bg2);
  border-left-color: var(--brd);
  box-shadow: var(--shadow-xl);
}

html[data-theme="light"] .drawer-overlay {
  background: rgba(0, 0, 0, 0.25);
}

/* ─────────────────────────────────────────────────────────────────
   Drawer — Data Display Helpers
   ───────────────────────────────────────────────────────────────── */
.drawer-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--brd);
  gap: 12px;
}

.drawer-field:last-child { border-bottom: none; }

.drawer-field-label {
  font-size: 12px;
  color: var(--t3);
  flex-shrink: 0;
  min-width: 100px;
}

.drawer-field-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  text-align: right;
  word-break: break-word;
}

.drawer-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--t2);
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--brd);
}

.drawer-section:first-child { margin-top: 0; }

/* ═══════════════════════════════════════════════════════════════════════════════
   SEMANTIC STATUS SYSTEM
   Unified status badges for all modules
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base status badge */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Status variants — v2.5 semantic tokens */
.status-new,
.status-gray {
  background: rgba(100, 116, 139, 0.12);
  color: var(--t3);
  border-color: rgba(100, 116, 139, 0.25);
}

.status-progress,
.status-blue {
  background: var(--info-bg);
  color: var(--info-t);
  border-color: rgba(59, 130, 246, 0.25);
}

.status-review,
.status-purple {
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple-l, #a78bfa);
  border-color: rgba(139, 92, 246, 0.25);
}

.status-warning,
.status-yellow {
  background: var(--warn-bg);
  color: var(--warn-t);
  border-color: rgba(212, 168, 67, 0.25);
}

.status-success,
.status-green {
  background: var(--ok-bg);
  color: var(--ok-t);
  border-color: rgba(45, 134, 89, 0.25);
}

.status-danger,
.status-red {
  background: var(--err-bg);
  color: var(--err-t);
  border-color: rgba(200, 41, 59, 0.25);
}

.status-gold {
  background: var(--gold-bg);
  color: var(--gold);
  border-color: rgba(212, 168, 67, 0.25);
}

/* Light theme status overrides */
html[data-theme="light"] .status-new,
html[data-theme="light"] .status-gray {
  background: rgba(100, 116, 139, 0.08);
  color: var(--t2);
}

html[data-theme="light"] .status-progress,
html[data-theme="light"] .status-blue {
  background: var(--info-bg);
  color: var(--blue);
}

html[data-theme="light"] .status-review,
html[data-theme="light"] .status-purple {
  background: rgba(139, 92, 246, 0.08);
  color: var(--purple, #7c3aed);
}

html[data-theme="light"] .status-warning,
html[data-theme="light"] .status-yellow {
  background: var(--warn-bg);
  color: var(--gold-h);
}

html[data-theme="light"] .status-success,
html[data-theme="light"] .status-green {
  background: var(--ok-bg);
  color: var(--ok);
}

html[data-theme="light"] .status-danger,
html[data-theme="light"] .status-red {
  background: var(--err-bg);
  color: var(--red);
}

html[data-theme="light"] .status-gold {
  background: var(--gold-bg);
  color: var(--gold-h);
}

/* Status dot indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.gray { background: var(--t3); }
.status-dot.blue { background: var(--info); }
.status-dot.purple { background: var(--purple, #A855F7); }
.status-dot.yellow { background: var(--warn); }
.status-dot.green { background: var(--ok-t); }
.status-dot.red { background: var(--err-t); }
.status-dot.gold { background: var(--gold); }

/* Pulsing dot (for live/active) */
.status-dot.pulse {
  animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Button press effect */
.btn {
  transition: all var(--fast);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

/* Table row hover — highlight + left border */
.tbl tbody tr {
  transition: background var(--fast);
  border-left: 3px solid transparent;
}

.tbl tbody tr:hover {
  background: var(--bg3) !important;
  border-left-color: var(--blue);
}

/* Clickable rows */
.tbl tbody tr[data-id],
.tbl tbody tr[onclick],
.tbl tbody tr.clickable {
  cursor: pointer;
}

.tbl tbody tr[data-id]:active,
.tbl tbody tr.clickable:active {
  transform: scale(0.998);
}

/* Input focus — Blue accent ring */
input:focus,
select:focus,
textarea:focus,
.inp:focus {
  outline: none;
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px var(--blue-glow);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .inp:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px var(--blue-glow);
}

/* KPI value — count-up feel */
.kpi-val,
.kpi .val {
  transition: color var(--base);
}

/* Badge bounce on change */
@keyframes badge-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.bellcount {
  animation: badge-pop 300ms ease;
}

/* Tooltip on icon rail hover (shows group name) */
.nav-group-header[title] {
  position: relative;
}

/* Disabled on desktop — flyout shows instead */
@media (hover: hover) {
  .nav-group-header::after {
    content: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DASHBOARD WIDGETS — Nordic Dark Theme
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Dashboard header ── */
.custom-dash h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.custom-dash .dash-subtitle {
  font-size: 12px;
  color: var(--t3);
  letter-spacing: 0.3em;
  margin-top: 2px;
}

/* ── Rune divider ── */
.dash-rune-divider {
  text-align: center;
  padding: 8px 0 16px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.6em;
  opacity: 0.5;
  user-select: none;
}

/* ── Widget grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* ── Widget card ── */
.dash-widget {
  background: var(--bg2);
  border-radius: var(--r-lg);
  border: none;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--base), border-color var(--base), transform var(--base);
  position: relative;
}

/* Viking gradient top accent line */
.dash-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold) 50%, var(--blue));
  opacity: 0.7;
  z-index: 1;
}

.dash-widget:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(212, 168, 67, 0.08);
}

.dash-widget:hover::before {
  opacity: 1;
}

.dash-widget.wide {
  grid-column: span 2;
}

@media (max-width: 700px) {
  .dash-widget.wide { grid-column: span 1; }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ── Widget header ── */
.dash-widget-header {
  padding: 14px 18px 0;
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.06), rgba(200, 41, 59, 0.03));
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: none;
  font-size: var(--text-sm);
  color: var(--gold);
  font-weight: 700;
}

.dash-widget-header > span:first-of-type {
  font-size: 18px;
}

/* ── Widget content ── */
.dash-widget-content {
  padding: 14px 18px 18px;
  min-height: 80px;
}

/* ── Remove button ── */
.btn-remove {
  background: none;
  border: none;
  color: var(--t3);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
  transition: all var(--fast);
}

.btn-remove:hover {
  color: var(--err-t);
  background: rgba(239, 68, 68, 0.12);
}

/* ── Drag handle ── */
.drag-handle {
  cursor: grab;
  color: var(--t3);
  font-size: var(--text-base);
  opacity: 0.3;
  transition: opacity var(--fast);
}

.dash-widget:hover .drag-handle { opacity: 0.8; }
.dash-widget[draggable]:active { cursor: grabbing; }
.dash-widget.drag-over {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(212, 168, 67, 0.2);
}
.dash-widget.dragging { opacity: 0.4; }

/* ── Viking Welcome Widget ── */
.viking-welcome {
  text-align: center;
  padding: 8px 0 4px;
}

.viking-welcome .vw-rune {
  font-size: 36px;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(212, 168, 67, 0.4);
  animation: rune-pulse 3s ease-in-out infinite;
  display: block;
  margin-bottom: 12px;
}

.viking-welcome .vw-greeting {
  font-size: 17px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 4px;
}

.viking-welcome .vw-role {
  font-size: 12px;
  color: var(--t3);
  margin-bottom: 14px;
}

.viking-welcome .vw-saga-wrap {
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.08), rgba(200, 41, 59, 0.06));
  border: 1px solid rgba(212, 168, 67, 0.18);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-top: 8px;
}

.viking-welcome .vw-saga-label {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  background: rgba(212, 168, 67, 0.12);
  border: 1px solid rgba(212, 168, 67, 0.25);
  border-radius: var(--r-sm);
  padding: 2px 8px;
  margin-bottom: 6px;
}

.viking-welcome .vw-saga-text {
  font-size: 13px;
  font-style: italic;
  color: var(--t2);
  line-height: 1.5;
}

.viking-welcome .vw-runes-row {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.4em;
  opacity: 0.35;
  margin-top: 12px;
  user-select: none;
}

/* Light theme dashboard */
html[data-theme="light"] .dash-widget {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .dash-widget:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(212, 168, 67, 0.4);
}

html[data-theme="light"] .dash-widget-header {
  background: transparent;
}

html[data-theme="light"] .viking-welcome .vw-rune {
  color: var(--red);
  text-shadow: 0 0 12px rgba(200, 41, 59, 0.3);
}

html[data-theme="light"] .viking-welcome .vw-saga-wrap {
  background: linear-gradient(135deg, rgba(200, 41, 59, 0.06), rgba(30, 77, 140, 0.04));
  border-color: rgba(200, 41, 59, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FORM SECTIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Section divider in forms */
.form-section {
  font-size: 13px;
  font-weight: 700;
  color: var(--t1);
  padding: 16px 0 8px;
  margin: 8px 0;
  border-bottom: 1px solid var(--brd);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.form-section-icon { font-size: 16px; }

/* Form grid — fields in columns */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  margin-bottom: 16px;
}

.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-1 { grid-template-columns: 1fr; }

@media (max-width: 768px) {
  .form-grid,
  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Span full width in grid */
.form-grid .full-width { grid-column: 1 / -1; }

/* Form field with label */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--t3);
}

.form-field .help {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
}

/* Required indicator */
.form-field label .req {
  color: var(--err-t);
  margin-left: 2px;
}

/* Form actions bar */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 0 0;
  border-top: 1px solid var(--brd);
  margin-top: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EMPTY STATE (Stage 9)
   ═══════════════════════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--sp-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--t1);
  margin-bottom: var(--sp-1);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--t3);
  max-width: 300px;
  margin-bottom: var(--sp-4);
}

.empty-state .btn {
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FILE PREVIEW
   ═══════════════════════════════════════════════════════════════════════════════ */

.cr-file-preview-frame {
  width: 100%;
  height: calc(90vh - 80px);
  border: none;
  border-radius: var(--r-md);
  background: var(--bg1);
}

.cr-file-preview-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(90vh - 100px);
  overflow: auto;
}

.cr-file-preview-img {
  max-width: 100%;
  max-height: calc(90vh - 120px);
  object-fit: contain;
  border-radius: var(--r-md);
}

/* Document list item */
.cr-doc-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg3);
  font-size: var(--text-sm);
  color: var(--t2);
}

.cr-doc-item .cr-doc-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-doc-item .cr-doc-info b {
  color: var(--t1);
}

.cr-doc-item .cr-doc-info a {
  color: var(--blue-l);
}

.cr-doc-item .cr-doc-info a:hover {
  text-decoration: underline;
}

.cr-doc-actions {
  display: flex;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PRE-TENDER KANBAN BOARD
   ═══════════════════════════════════════════════════════════════════════════════ */

.pt-kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.pt-kanban-col {
  flex: 0 0 280px;
  background: transparent;
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  scroll-snap-align: start;
}

.pt-kanban-col-header {
  padding: 12px 14px;
  font-weight: 800;
  font-size: 13px;
  border-bottom: 1px solid var(--brd);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1;
  background: inherit;
  border-radius: 8px 8px 0 0;
}

.pt-kanban-col-header .count {
  background: transparent;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.pt-kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 100px;
  transition: background var(--base);
}

.pt-kanban-col-body.drag-over {
  background: rgba(212, 168, 70, 0.08);
}

.pt-kanban-card {
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: transform var(--fast), border-color var(--fast);
  user-select: none;
}

.pt-kanban-card:hover {
  border-color: transparent;
  box-shadow: none;
}

.pt-kanban-card:active {
  cursor: grabbing;
}

.pt-kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

/* Fast-track button */
.btn-fast-track {
  background: var(--grad-gold);
  color: var(--bg0);
  font-weight: 800;
  border: none;
  transition: all var(--base);
}

.btn-fast-track:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: var(--gold-glow);
}

/* Mobile kanban */
@media (max-width: 768px) {
  .pt-kanban {
    flex-direction: column;
    gap: 8px;
  }

  .pt-kanban-col {
    flex: 0 0 auto;
    max-height: none;
  }

  .pt-kanban-col-body {
    max-height: 300px;
  }

  .btn-fast-track {
    min-height: 44px;
    font-size: 15px;
  }
}

/* Fix #15: Keyboard focus visibility */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   WORKER PROFILE DESKTOP — Анкета-характеристика (десктоп-модалка)
   v2 — skeleton, fade transitions, improved comment UX
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Modal width override (specificity > .modal) */
.modal.wp-desktop-modal-size,
.modal-content.wp-desktop-modal-size {
  width: min(720px, 95vw);
  max-height: 85vh;
}

/* Fullscreen override for worker profile modal */
.modal.wp-desktop-modal-size.fullscreen,
.modal-content.wp-desktop-modal-size.fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}

.wp-desktop-root {
  overflow-y: auto;
  max-height: calc(85vh - 60px);
  transition: opacity 0.2s ease;
}

.modal.fullscreen .wp-desktop-root {
  max-height: calc(100vh - 60px);
}

/* ── Skeleton loading ── */
.wp-desktop-skeleton { animation: wp-skel-pulse 1.5s ease-in-out infinite; }
.wp-desktop-skel-hero {
  height: 140px;
  background: linear-gradient(135deg, rgba(30,58,95,0.4), rgba(13,20,40,0.4));
  border-radius: 12px 12px 0 0;
}
.wp-desktop-skel-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.wp-desktop-skel-label {
  width: 35%;
  height: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  margin-bottom: 6px;
}
.wp-desktop-skel-value {
  height: 22px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}
@keyframes wp-skel-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Hero ── */
.wp-desktop-hero {
  background: var(--hero-grad, linear-gradient(135deg, #1e3a5f, #0d1428));
  padding: 24px;
  border-radius: 12px 12px 0 0;
  position: relative;
  overflow: hidden;
}

.wp-desktop-hero svg.wp-desktop-hero-rune {
  position: absolute;
  right: 20px;
  top: 12px;
  pointer-events: none;
}

.wp-desktop-hero-actions {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.wp-desktop-icon-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  transition: background 0.15s;
}
.wp-desktop-icon-btn:hover {
  background: rgba(255,255,255,0.2);
}

.wp-desktop-hero-row {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.wp-desktop-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(255,255,255,0.3);
}

.wp-desktop-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 28px;
  font-weight: 800;
}

.wp-desktop-avatar-wrap {
  position: relative;
}

.wp-desktop-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.15s;
}
.wp-desktop-avatar-wrap:hover .wp-desktop-avatar-overlay {
  opacity: 1;
}

.wp-desktop-hero-info {
  flex: 1;
  min-width: 0;
}

.wp-desktop-hero-name {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.wp-desktop-hero-role {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

.wp-desktop-hero-gauge {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.wp-desktop-hero-progress {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.wp-desktop-progress-bar {
  width: 100px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.wp-desktop-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #51cf66, #ffd700);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.wp-desktop-hero-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

/* ── Grid 2 columns ── */
.wp-desktop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px;
}

.wp-desktop-col {}

/* ── Section ── */
.wp-desktop-section {
  margin-bottom: 20px;
}

.wp-desktop-section-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--t1);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--brd);
  margin-bottom: 12px;
}

/* ── Field row ── */
.wp-desktop-field-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.wp-desktop-field-row.wp-desktop-important {
  border-left: 3px solid var(--err-t, #ff4444);
  padding-left: 12px;
}

.wp-desktop-field-label {
  font-size: 12px;
  color: var(--t3);
  margin-bottom: 4px;
  font-weight: 500;
}

.wp-desktop-field-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wp-desktop-empty {
  font-size: 12px;
  color: var(--t3);
  opacity: 0.5;
  font-style: italic;
}

/* ── Badge ── */
.wp-desktop-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Text block ── */
.wp-desktop-text-block {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--t1);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Comment ── */
.wp-desktop-comment {
  font-size: 11px;
  color: var(--t3);
  margin-top: 4px;
  padding-left: 2px;
}

/* ── Edit: pills ── */
.wp-desktop-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.wp-desktop-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--t2);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.wp-desktop-pill:hover {
  opacity: 0.85;
  background: rgba(255,255,255,0.08);
}
.wp-desktop-pill.selected {
  transform: scale(1.02);
  border-color: transparent;
  font-weight: 600;
}

/* ── Edit: score circles ── */
.wp-desktop-scores {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.wp-desktop-score-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--t2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.34,1.56,.64,1);
  user-select: none;
}
.wp-desktop-score-circle:hover {
  transform: scale(1.1);
  border-color: rgba(255,255,255,0.25);
}
.wp-desktop-score-circle.selected {
  transform: scale(1.12);
  border-color: transparent;
  font-weight: 700;
}

/* ── Edit: textarea / input ── */
.wp-desktop-textarea,
.wp-desktop-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--t1);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.15s;
}
.wp-desktop-textarea:focus,
.wp-desktop-input:focus {
  border-color: var(--blue);
  outline: none;
}

/* ── Edit: comment — visible on hover, when focused, or when has value ── */
.wp-desktop-comment-edit {
  display: none;
  margin-top: 6px;
}
.wp-desktop-field-editable:hover .wp-desktop-comment-edit,
.wp-desktop-comment-edit:focus-within,
.wp-desktop-comment-edit.wp-desktop-comment-visible,
.wp-desktop-comment-edit.wp-desktop-comment-focused {
  display: block;
}

.wp-desktop-comment-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: var(--t3);
  font-size: 11px;
  font-family: inherit;
}
.wp-desktop-comment-input:focus {
  border-color: var(--blue);
  outline: none;
  color: var(--t1);
}

/* ── Footer ── */
.wp-desktop-footer {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--brd);
  justify-content: flex-end;
}

/* ── Empty state ── */
.wp-desktop-empty-state {
  padding: 60px 24px;
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   STATUS BADGES — Тендеры и Работы
   ════════════════════════════════════════════════════════════ */
.cr-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  color: #fff;
}

/* ════════════════════════════════════════════════════════════
   PRINT STYLES — Worker Profile Desktop
   ════════════════════════════════════════════════════════════ */
/* Scoped to body.wp-desktop-print-active so other prints aren't affected */
@media print {
  body.wp-desktop-print-active > *:not(.modalback),
  body.wp-desktop-print-active .modalback > *:not(.modal),
  body.wp-desktop-print-active .mh,
  body.wp-desktop-print-active .sidebar,
  body.wp-desktop-print-active .nav,
  body.wp-desktop-print-active .topbar,
  body.wp-desktop-print-active .wp-desktop-icon-btn,
  body.wp-desktop-print-active .wp-desktop-footer,
  body.wp-desktop-print-active .wp-desktop-hero-actions,
  body.wp-desktop-print-active #modalTitle {
    display: none !important;
  }

  body.wp-desktop-print-active .modalback {
    display: block !important;
    position: static !important;
    background: none !important;
  }

  body.wp-desktop-print-active .modal,
  body.wp-desktop-print-active .modal-content {
    position: static !important;
    width: 100% !important;
    max-height: none !important;
    border: none !important;
    background: #fff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.wp-desktop-print-active .wp-desktop-root {
    max-height: none !important;
    overflow: visible !important;
    font-size: 11pt !important;
  }

  /* Hero: B&W */
  body.wp-desktop-print-active .wp-desktop-hero {
    background: #f5f5f5 !important;
    color: #000 !important;
    border-radius: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body.wp-desktop-print-active .wp-desktop-hero-name,
  body.wp-desktop-print-active .wp-desktop-hero-role,
  body.wp-desktop-print-active .wp-desktop-hero-meta,
  body.wp-desktop-print-active .wp-desktop-hero-progress {
    color: #333 !important;
  }
  body.wp-desktop-print-active .wp-desktop-hero-rune { display: none !important; }

  /* Grid: 1 column for A4 */
  body.wp-desktop-print-active .wp-desktop-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 12px 0 !important;
  }

  /* Section: avoid page break inside */
  body.wp-desktop-print-active .wp-desktop-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  body.wp-desktop-print-active .wp-desktop-section-title {
    color: #000 !important;
    border-bottom-color: #ccc !important;
  }

  body.wp-desktop-print-active .wp-desktop-field-label { color: #555 !important; }

  /* Badges as bordered text */
  body.wp-desktop-print-active .wp-desktop-badge {
    background: transparent !important;
    border: 1px solid #999 !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.wp-desktop-print-active .wp-desktop-text-block {
    background: #f9f9f9 !important;
    color: #000 !important;
    border: 1px solid #ddd !important;
  }

  body.wp-desktop-print-active .wp-desktop-field-row {
    border-bottom-color: #eee !important;
  }
  body.wp-desktop-print-active .wp-desktop-important {
    border-left-color: #cc0000 !important;
  }

  body.wp-desktop-print-active .wp-desktop-comment { color: #666 !important; }

  body.wp-desktop-print-active .wp-desktop-avatar { width: 60px !important; height: 60px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HUGINN — Chat Tabs (Telegram Folders)
   ═══════════════════════════════════════════════════════════════════════════════ */
.hg-chat-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: var(--bg2, #1a1a2e);
}
.hg-chat-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--t3, #888);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}
.hg-chat-tab:hover {
  color: var(--t1, #eee);
  background: rgba(255,255,255,0.04);
}
.hg-chat-tab[data-tab="all"].active {
  color: #fff;
  border-bottom-color: #fff;
  font-weight: 600;
}
.hg-chat-tab[data-tab="estimates"].active {
  color: #D4A843;
  border-bottom-color: #D4A843;
  font-weight: 600;
}
.hg-chat-tab[data-tab="personal"].active {
  color: #1F6FEB;
  border-bottom-color: #1F6FEB;
  font-weight: 600;
}
.hg-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-blue, #1F6FEB);
  color: #fff;
}
.hg-chat-tab[data-tab="estimates"] .hg-tab-badge {
  background: #D4A843;
}
/* H6: Animated tab indicator */
.hg-chat-tabs {
  position: relative;
}
.hg-tab-indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  transition: left 200ms cubic-bezier(.4,0,.2,1), width 200ms cubic-bezier(.4,0,.2,1), background 200ms;
}
/* H6: Badge pulse animation */
.hg-tab-badge {
  animation: hgBadgePulse 300ms ease-out;
}
@keyframes hgBadgePulse {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ═══ OOPS BUBBLE ═══ */
.oops-bubble {
  position: fixed;
  z-index: 99999;
  transform: translate(-50%, -100%);
  padding: 8px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #D4A843, #B8860B);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(212, 168, 67, 0.4);
  animation: oopsBubbleAnim 1.8s ease-out forwards;
}
@keyframes oopsBubbleAnim {
  0% { opacity: 0; transform: translate(-50%, -100%) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -100%) scale(1.05); }
  25% { transform: translate(-50%, -100%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -140%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(0.8); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FORM REQUIRED MARKER
   ═══════════════════════════════════════════════════════════════════════════════ */
label.cr-required::after {
  content: ' *';
  color: var(--red, #C0392B);
  font-weight: 700;
}
.cr-field-hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PUSH PROMPT (desktop modal)
   ═══════════════════════════════════════════════════════════════════════════════ */
.cr-push-prompt {
  text-align: center;
  padding: var(--sp-4) 0;
}
.cr-push-prompt p {
  color: var(--t2);
  margin-bottom: var(--sp-4);
  line-height: 1.5;
}
.cr-push-prompt__actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   STAFF REQUESTS — HR Employee Picker (.sr-*)
   ═══════════════════════════════════════════════════════════════════════════════ */
.sr-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(13,20,40,0.7), rgba(30,61,114,0.2));
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.sr-header .title { font-size: 16px; font-weight: 700; color: var(--t1); }
.sr-header .sub { font-size: 13px; color: var(--t2); margin-top: 4px; }
.sr-header__right { text-align: right; }
.sr-header__date { font-size: 11px; color: var(--t3); margin-top: 6px; }
.sr-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--t2);
}
.sr-badge--sent { background: var(--info); }
.sr-badge--answered { background: var(--amber); }
.sr-badge--approved { background: var(--ok-t); }
.sr-badge--rework { background: var(--err-t); }
.sr-section { margin-top: 16px; }
.sr-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-l, #d4af37);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sr-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(212,168,67,0.2);
}
.sr-role-group {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.sr-role-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.sr-role-name { font-weight: 700; font-size: 14px; color: var(--t1); }
.sr-role-need {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(74,144,217,0.15);
  color: var(--info);
}
.sr-emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}
.sr-emp-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.15s;
}
.sr-emp-card:hover {
  background: rgba(74,144,217,0.08);
  border-color: rgba(74,144,217,0.2);
}
.sr-emp-card.selected {
  background: rgba(74,144,217,0.12);
  border-color: rgba(74,144,217,0.4);
}
.sr-emp-name { font-size: 13px; font-weight: 600; color: var(--t1); }
.sr-emp-info { font-size: 11px; color: var(--t2); }
.sr-emp-vachta {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 60px;
}
.sr-emp-vachta label {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 11px;
  cursor: pointer;
}
.sr-chat-msg {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}
.sr-chat-msg .who { font-size: 11px; color: var(--gold-l); font-weight: 600; }
.sr-chat-msg .when { font-size: 10px; color: var(--t3); }
.sr-chat-msg .text { font-size: 13px; color: var(--t1); margin-top: 4px; }
.sr-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
  color: var(--t1);
  font-size: 13px;
}
.sr-search::placeholder { color: var(--t3); }
.sr-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 0 0;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  z-index: 2;
}
.sr-compos-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(74,144,217,0.1);
  border: 1px solid rgba(74,144,217,0.2);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
}
.sr-compos-count {
  background: var(--info);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.sr-compos-empty { color: var(--t2); font-style: italic; }
.sr-vachta-note {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(212,168,67,0.08);
  border-radius: 8px;
  font-size: 12px;
  color: var(--gold-l);
}
.sr-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
  color: var(--t1);
  font-size: 13px;
}
.sr-chat-area { max-height: 200px; overflow-y: auto; }
.sr-msg-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 10px; }
.sr-msg-row > div:first-child { flex: 1; }
.sr-modal-scroll { max-height: 85vh; overflow-y: auto; padding: 4px; }

/* Replacement pill (between = space-between layout) */
.pill.between {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  white-space: normal;
}
/* Status pill in table row */
.sr-status-pill {
  display: inline-block;
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
/* Collection picker card */
.sr-col-card {
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
}
.sr-col-card:hover { background: var(--bg4); }
.sr-col-name { font-weight: 700; color: var(--gold); }
.sr-col-count { font-size: 12px; color: var(--t3); }
/* Chat message header row */
.sr-chat-msg-head { display: flex; justify-content: space-between; }
/* Replace dialog */
.sr-replace-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.sr-replace-scroll { max-height: 70vh; overflow: auto; }
/* History log entry */
.sr-history-detail { margin: 6px 0 10px; }

/* ═══════════════════════════════════════════════════════════════════════════
   TENDER COMMENTS — Feed (.tc-*)
   ═══════════════════════════════════════════════════════════════════════════ */
.cr-field-full { grid-column: 1 / -1; }

.tc-feed {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tc-empty {
  color: var(--t3);
  font-style: italic;
  font-size: 13px;
  padding: 12px 0;
}
.tc-comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tc-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--bg4);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-body {
  flex: 1;
  min-width: 0;
}
.tc-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.tc-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-l, var(--gold));
}
.tc-time {
  font-size: 10px;
  color: var(--t3);
}
.tc-delete {
  font-size: 10px;
  color: var(--t3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.tc-comment:hover .tc-delete { opacity: 1; }
.tc-delete:hover { color: var(--err-t); }
.tc-text {
  font-size: 13px;
  color: var(--t1);
  line-height: 1.4;
  word-break: break-word;
}
.tc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 8px;
}
.tc-input-row textarea {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: var(--r-sm, 6px);
  color: var(--t1);
  padding: 8px 10px;
  font-size: 13px;
  resize: none;
  font-family: inherit;
}
.tc-input-row textarea:focus {
  border-color: var(--gold);
  outline: none;
}

/* ── Gantt quick-scale navigation bar (S9) ── */
.cr-gantt-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}
.cr-gantt-nav__scales {
  display: flex;
  gap: 2px;
  background: var(--bg2, #1a1a2e);
  border-radius: 8px;
  padding: 2px;
}
.cr-gantt-nav__btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--t2, #aaa);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.cr-gantt-nav__btn:hover {
  color: var(--t1, #fff);
  background: var(--bg3, #222);
}
.cr-gantt-nav__btn--active {
  color: var(--t1, #fff);
  background: var(--accent, #2a6cf1);
}
.cr-gantt-nav__arrow {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, rgba(255,255,255,.1));
  background: transparent;
  color: var(--t2, #aaa);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease, color 150ms ease;
}
.cr-gantt-nav__arrow:hover {
  color: var(--t1, #fff);
  background: var(--bg3, #222);
}
.cr-gantt-nav__today {
  padding: 6px 12px;
  border: 1px solid var(--gold, #D4A843);
  background: transparent;
  color: var(--gold, #D4A843);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease;
}
.cr-gantt-nav__today:hover {
  background: rgba(212,168,67,.1);
}
.cr-gantt-nav__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1, #fff);
  min-width: 120px;
  text-align: center;
}
.cr-gantt-modal-body {
  max-height: 70vh;
  overflow: auto;
}
.cr-drop-active {
  outline: 2px dashed var(--accent, #2a6cf1);
  outline-offset: -2px;
  background: rgba(42, 108, 241, 0.05);
  border-radius: 8px;
}
