/* Voya CRM — theme & UX layer */

:root {
  --crm-accent: #0d9488;
  --crm-accent-dark: #0f766e;
  --crm-accent-soft: #ecfdf5;
  --crm-sidebar: #0c4a4e;
  --crm-sidebar-2: #0d9488;
  --primary: var(--crm-accent);
  --primary-soft: var(--crm-accent-soft);
  --sidebar: var(--crm-sidebar);
  --sidebar-2: var(--crm-sidebar-2);
  --bg: #f0f4f8;
  --shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.main {
  max-width: 1280px;
  width: 100%;
}

html.sidebar-collapsed .main {
  max-width: none;
}

/* Header */
.top {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.top h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.user-chip__role {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--crm-accent-dark);
  background: var(--crm-accent-soft);
  padding: 2px 7px;
  border-radius: 999px;
}

/* Sidebar polish */
.sidebar nav a {
  transition: background .15s ease;
}

.sidebar .muted,
.sidebar-user {
  color: rgba(255, 255, 255, 0.78);
}

.sidebar-user {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  line-height: 1.35;
}

/* Icons */
.crm-icon {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.nav-icon .crm-icon,
.logout-icon .crm-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.filters-panel {
  padding: 16px;
}

.order-hero__main {
  flex: 1;
  min-width: 0;
}

.order-hero__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.top a {
  color: var(--crm-accent-dark);
  text-decoration: none;
}

.top a:hover {
  text-decoration: underline;
}


/* Buttons */
.btn {
  background: var(--crm-accent);
  border: 1px solid transparent;
}

.btn:hover {
  background: var(--crm-accent-dark);
  filter: none;
}

.btn.secondary {
  background: #fff;
  color: var(--crm-accent-dark);
  border-color: #99f6e4;
}

.btn.secondary:hover {
  background: var(--crm-accent-soft);
}

.btn.danger {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}

/* Cards */
.card {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.card-section-title {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Badges */
.badge {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge.ok { background: #dcfce7; color: #166534; }
.badge.on { background: #dbeafe; color: #1d4ed8; }
.badge.off { background: #fee2e2; color: #991b1b; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.muted { background: #f1f5f9; color: #64748b; }
.badge.service { background: #e0f2fe; color: #0369a1; }

/* Flash toast */
.flash {
  border-radius: 10px;
  animation: crm-flash-in .25s ease;
}

@keyframes crm-flash-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash.is-dismissed {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s, transform .2s;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(13, 148, 136, 0.18), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(15, 118, 110, 0.12), transparent 40%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.login-brand {
  margin-bottom: 20px;
  text-align: center;
}

.login-brand__logo {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 14px;
}

.login-brand__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-brand__sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.login-brand__tag {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--crm-accent-soft);
  color: var(--crm-accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Orders index */
.orders-index { display: grid; gap: 14px; }

.queue-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 4px 0 10px;
  margin: -4px 0 0;
  background: linear-gradient(180deg, var(--bg) 75%, rgba(240, 244, 248, 0));
}

.queue-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.8125rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color .15s, background .15s, transform .15s;
}

.queue-tab:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
  text-decoration: none;
  transform: translateY(-1px);
}

.queue-tab.active {
  background: linear-gradient(135deg, var(--crm-sidebar) 0%, var(--crm-accent) 100%);
  border-color: transparent;
  color: #fff;
}

.queue-tab.warn.active { background: linear-gradient(135deg, #b45309, #f59e0b); }
.queue-tab.danger.active { background: linear-gradient(135deg, #b91c1c, #ef4444); }

.queue-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.75rem;
  font-weight: 800;
}

.queue-tab.active .queue-tab__count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.filters-panel.is-collapsed .filters-body {
  display: none;
}

.filters-body {
  display: block;
}


.filters-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.filters-panel__head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.filters-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.filters-grid .field span,
.filter-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.filters-grid input,
.filters-grid select,
.filters-toolbar input,
.filters-toolbar select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font: inherit;
  background: #fff;
}

.filters-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}

.filters-toolbar .search-field {
  flex: 1 1 240px;
  position: relative;
}

.filters-toolbar .search-field svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.filters-toolbar .search-field input {
  width: 100%;
  padding-left: 34px;
  padding-right: 34px;
}

.search-field__hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

.search-field__hint kbd {
  display: inline-flex;
  min-width: 1.25rem;
  justify-content: center;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-family: inherit;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--crm-accent-soft);
  color: var(--crm-accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.filter-chip a {
  color: inherit;
  text-decoration: none;
  opacity: 0.7;
}

.filter-chip a:hover { opacity: 1; }

.period-pills { margin-bottom: 12px; }

.period-pill.active {
  background: var(--crm-accent-soft);
  border-color: #99f6e4;
  color: var(--crm-accent-dark);
}

.table .row-link {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.table .row-link:hover { color: var(--crm-accent-dark); }

.table tbody tr {
  transition: background .12s ease;
}

.order-row {
  cursor: pointer;
}

.order-row:focus-visible {
  outline: 2px solid var(--crm-accent);
  outline-offset: -2px;
}

.table tbody tr:hover td {
  background: #f0fdfa;
}

.row-problem td { background: #fff7f7 !important; }
.row-unassigned .manager-cell { color: #b45309; font-weight: 600; }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

/* Order show */
.order-show { display: grid; gap: 14px; }

.order-hero__back {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0.9;
  text-decoration: none;
  margin-bottom: 2px;
}

.order-hero__back:hover {
  opacity: 1;
  text-decoration: underline;
}

.order-hero {
  background: linear-gradient(135deg, #0c4a4e 0%, #0d9488 55%, #14b8a6 100%);
  border-radius: 14px;
  padding: 18px 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.25);
}

.order-hero__title {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.order-hero__amount {
  text-align: right;
}

.order-hero__amount-label {
  display: block;
  font-size: 0.72rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.order-hero__amount-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.order-hero__badges .badge {
  background: rgba(255, 255, 255, 0.95);
}

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

.order-grid .card--wide {
  grid-column: 1 / -1;
}

.order-grid .card h3,
.order-bottom .card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.order-bottom {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
}

.order-finance {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fafc, #fff);
}

.esim-flow-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  color: #0f766e;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.timeline-item {
  padding-left: 10px;
  border-left: 3px solid var(--line);
}

.timeline-item--note { border-left-color: #8b5cf6; }
.timeline-item--assign { border-left-color: #f59e0b; }
.timeline-item--status { border-left-color: #0284c7; }
.timeline-item--payment,
.timeline-item--payment_status { border-left-color: #16a34a; }

@media (max-width: 960px) {
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-grid,
  .order-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .filters-grid { grid-template-columns: 1fr; }
  .queue-tab { flex: 1 1 calc(50% - 8px); justify-content: center; }
}
