/* ============================================
   ITAM Portal — Design System
   ============================================ */

:root {
  /* Brand */
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

  /* Surfaces */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --sidebar-bg: #d8dfe7;
  --sidebar-active: #1f2937;

  /* Text */
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;

  /* Borders */
  --border: #e5e7eb;
  --border-soft: #f1f5f9;

  /* Status palette */
  --green: #10b981;
  --green-soft: #d1fae5;
  --blue: #3b82f6;
  --blue-soft: #dbeafe;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --cyan: #06b6d4;
  --cyan-soft: #cffafe;
  --violet: #8b5cf6;
  --violet-soft: #ede9fe;
  --slate: #64748b;
  --slate-soft: #f1f5f9;
  --pink: #ec4899;
  --pink-soft: #fce7f3;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Layout */
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 64px;
  --header-h: 64px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background-color: #f4f6fb;
  background-image:
    radial-gradient(at 12% 4%,  rgba(124, 58, 237, 0.10) 0px, transparent 45%),
    radial-gradient(at 88% 6%,  rgba(236, 72, 153, 0.07) 0px, transparent 45%),
    radial-gradient(at 100% 90%, rgba(79, 70, 229, 0.10) 0px, transparent 50%),
    radial-gradient(at 0% 100%,  rgba(6, 182, 212, 0.07) 0px, transparent 45%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(15,23,42,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.app, .app * { position: relative; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============== Layout ============== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.app.collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  padding: 24px 28px 40px;
  overflow-x: hidden;
}

/* ============== Sidebar ============== */
.sidebar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.25) 100%),
    linear-gradient(180deg, #e9eef5 0%, #d8dfe7 100%);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.25s ease;
  border-right: 1px solid rgba(15,23,42,0.06);
  z-index: 2;
}

.sidebar-brand {
  padding: 18px 20px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

/* Fixed Offlinq ITSM product mark (sidebar) — transparent container, SVG fills */
.sidebar-brand .logo.logo-mark {
  background: none;
  box-shadow: none;
  border-radius: 0;
  width: 36px;
  height: 36px;
}
.sidebar-brand .logo.logo-mark svg { width: 36px; height: 36px; display: block; }

/* Client logo image variant — shows the uploaded logo instead of the initial */
.sidebar-brand .logo.logo-img {
  background: white;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  width: 38px;
  height: 38px;
  padding: 4px;
  overflow: hidden;
}
.sidebar-brand .logo.logo-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand .name {
  font-weight: 700;
  font-size: 15px;
  color: #1f2937;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.sidebar-brand .name span {
  font-weight: 500;
  color: var(--brand);
}

.app.collapsed .sidebar-brand .name { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

.nav-group-label {
  padding: 14px 14px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(31, 41, 55, 0.55);
  text-transform: uppercase;
}

.app.collapsed .nav-group-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--r-md);
  color: #1f2937;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.4px;
  position: relative;
  transition: background 0.15s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.5);
}

.nav-item.active {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #111827;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.nav-item .icon svg { width: 18px; height: 18px; stroke-width: 1.8; }

.app.collapsed .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .nav-item .label { display: none; }
.app.collapsed .nav-item .arrow { display: none; }
.app.collapsed .nav-item.active::before { display: none; }

.nav-item .arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.5;
}

/* ============== Header ============== */
.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: rgba(247, 248, 251, 0.72);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.header .menu-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: #1f2937;
  transition: background 0.15s;
}

.header .menu-toggle:hover { background: rgba(0,0,0,0.04); }

.header .page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #1f2937;
  text-transform: uppercase;
}

.header-spacer { flex: 1; }

.header-search {
  position: relative;
  width: 320px;
}

.header-search input {
  width: 100%;
  height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0 14px 0 40px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  color: var(--text);
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.header-search input:focus {
  background: white;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), 0 4px 16px rgba(79, 70, 229, 0.08);
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: #374151;
  background: transparent;
  position: relative;
  transition: background 0.15s;
}

.icon-btn:hover { background: rgba(0,0,0,0.05); }

.icon-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.user-chip:hover {
  background: white;
  border-color: rgba(124, 58, 237, 0.25);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.user-chip .chev {
  width: 14px; height: 14px;
  color: var(--text-muted);
  margin-left: -2px;
  transition: transform 0.15s;
}

.user-chip.open .chev { transform: rotate(180deg); }

/* User-chip dropdown */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: white;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 70;
  display: none;
  animation: userMenuIn 0.15s ease;
}

.user-chip.open .user-menu { display: block; }

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

.user-menu-header {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(124,58,237,0.06) 0%, rgba(79,70,229,0.04) 100%);
  border-bottom: 1px solid var(--border);
}

.user-menu-header .av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-menu-header .info { min-width: 0; flex: 1; }
.user-menu-header .info .name { font-weight: 700; color: #1f2937; font-size: 14px; }
.user-menu-header .info .role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.user-menu-header .info .em   { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; word-break: break-all; }

.user-menu-section { padding: 6px; }
.user-menu-section + .user-menu-section { border-top: 1px solid var(--border); }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}

.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item .icon { width: 16px; height: 16px; color: var(--text-muted); display: grid; place-items: center; }
.user-menu-item .icon svg { width: 16px; height: 16px; stroke-width: 1.8; }
.user-menu-item.danger { color: var(--red); }
.user-menu-item.danger:hover { background: #fef2f2; }
.user-menu-item.danger .icon { color: var(--red); }

.user-menu-meta {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-soft);
  background: var(--surface-2);
  border-top: 1px solid var(--border-soft);
  text-align: center;
}

/* Dark variant for user portal */
.app.user-app .user-menu-header {
  background: linear-gradient(135deg, rgba(20,184,166,0.10) 0%, rgba(13,148,136,0.05) 100%);
}
.app.user-app .user-menu-header .av {
  background: linear-gradient(135deg, #5eead4 0%, #14b8a6 100%);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.user-chip .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ============== Page card ============== */
.page-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
  position: relative;
}

.page-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(236, 72, 153, 0.04) 50%, rgba(79, 70, 229, 0.10) 100%);
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

.page-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-card h2.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-card h2.card-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 2px;
}

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--brand-grad);
  color: white;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.20), inset 0 1px 0 rgba(255,255,255,0.14);
}

.btn-primary:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.30), inset 0 1px 0 rgba(255,255,255,0.14);
}

.btn-soft {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-soft:hover {
  background: white;
  border-color: rgba(124, 58, 237, 0.25);
  color: var(--brand);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

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

.btn-brand:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25); }

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

.btn-danger:hover { opacity: 1; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { background: rgba(0,0,0,0.04); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; }
.btn-icon svg { width: 15px; height: 15px; }
/* Tint soft-button icons with the brand colour for a two-tone, less mono look */
.btn-soft svg { color: var(--brand); }

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

/* ============== Stats cards ============== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 6px 18px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, transparent 50%);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 4px 8px rgba(15, 23, 42, 0.04),
    0 16px 32px rgba(15, 23, 42, 0.08);
  border-color: rgba(124, 58, 237, 0.18);
}

.stat-card .v {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stat-card .l {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.stat-card .accent {
  position: absolute;
  right: -16px;
  top: -16px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  opacity: 0.05;
  pointer-events: none;
}

.stat-card { border-left: 3px solid transparent; }

.stat-card.s-new      { border-left-color: var(--blue); }       .stat-card.s-new .v      { color: var(--blue); }       .stat-card.s-new .accent      { background: var(--blue); }
.stat-card.s-pending  { border-left-color: var(--amber); }      .stat-card.s-pending .v  { color: var(--amber); }      .stat-card.s-pending .accent  { background: var(--amber); }
.stat-card.s-prov     { border-left-color: var(--violet); }     .stat-card.s-prov .v     { color: var(--violet); }     .stat-card.s-prov .accent     { background: var(--violet); }
.stat-card.s-assigned { border-left-color: var(--cyan); }       .stat-card.s-assigned .v { color: var(--cyan); }       .stat-card.s-assigned .accent { background: var(--cyan); }
.stat-card.s-progress { border-left-color: #f97316; }           .stat-card.s-progress .v { color: #f97316; }           .stat-card.s-progress .accent { background: #f97316; }
.stat-card.s-hold     { border-left-color: var(--slate); }      .stat-card.s-hold .v     { color: var(--slate); }      .stat-card.s-hold .accent     { background: var(--slate); }
.stat-card.s-cancel   { border-left-color: var(--text-muted); } .stat-card.s-cancel .v   { color: var(--text-muted); } .stat-card.s-cancel .accent   { background: var(--text-muted); }
.stat-card.s-reject   { border-left-color: var(--red); }        .stat-card.s-reject .v   { color: var(--red); }        .stat-card.s-reject .accent   { background: var(--red); }
.stat-card.s-resolved { border-left-color: var(--green); }      .stat-card.s-resolved .v { color: var(--green); }      .stat-card.s-resolved .accent { background: var(--green); }
.stat-card.s-closed   { border-left-color: #475569; }           .stat-card.s-closed .v   { color: #475569; }           .stat-card.s-closed .accent   { background: #475569; }
.stat-card.s-wait     { border-left-color: var(--pink); }       .stat-card.s-wait .v     { color: var(--pink); }       .stat-card.s-wait .accent     { background: var(--pink); }
.stat-card.s-reopen   { border-left-color: var(--violet); }     .stat-card.s-reopen .v   { color: var(--violet); }     .stat-card.s-reopen .accent   { background: var(--violet); }
.stat-card.s-total    { border-left-color: #1f2937; background: linear-gradient(180deg, #fafbff 0%, #f4f5fb 100%); }
.stat-card.s-total .v { color: #1f2937; }
.stat-card.s-total .accent { background: #1f2937; }

/* Stat-card trend strip and icon */
.stat-card .trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat-card .trend.up   { color: var(--green); }
.stat-card .trend.down { color: var(--red); }
.stat-card .trend.flat { color: var(--text-muted); }

.stat-card .ico-pill {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.04);
  z-index: 2;
}
.stat-card .ico-pill svg { width: 14px; height: 14px; stroke-width: 2; }
.stat-card.s-new .ico-pill      { background: rgba(59,130,246,0.10);  color: var(--blue); }
.stat-card.s-pending .ico-pill  { background: rgba(245,158,11,0.10);  color: var(--amber); }
.stat-card.s-prov .ico-pill     { background: rgba(139,92,246,0.10);  color: var(--violet); }
.stat-card.s-assigned .ico-pill { background: rgba(6,182,212,0.10);   color: var(--cyan); }
.stat-card.s-progress .ico-pill { background: rgba(249,115,22,0.10);  color: #f97316; }
.stat-card.s-hold .ico-pill     { background: rgba(100,116,139,0.10); color: var(--slate); }
.stat-card.s-cancel .ico-pill   { background: rgba(107,114,128,0.10); color: var(--text-muted); }
.stat-card.s-reject .ico-pill   { background: rgba(239,68,68,0.10);   color: var(--red); }
.stat-card.s-resolved .ico-pill { background: rgba(16,185,129,0.10);  color: var(--green); }
.stat-card.s-closed .ico-pill   { background: rgba(71,85,105,0.10);   color: #475569; }
.stat-card.s-wait .ico-pill     { background: rgba(236,72,153,0.10);  color: var(--pink); }
.stat-card.s-reopen .ico-pill   { background: rgba(139,92,246,0.10);  color: var(--violet); }
.stat-card.s-total .ico-pill    { background: rgba(31,41,55,0.08);    color: #1f2937; }

/* ============== Charts ============== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.chart-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-radius: var(--r-lg);
  padding: 18px 18px 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 24px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.04);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.chart-card:hover {
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.06), 0 16px 36px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.18);
}

.chart-card .chart-title {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
}

.chart-wrap {
  position: relative;
  height: 220px;
  display: grid;
  place-items: center;
}

.chart-wrap canvas {
  max-height: 220px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  margin-top: 8px;
  font-size: 12px;
  color: #374151;
}

.chart-legend .l-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ============== Tables ============== */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-search {
  width: 220px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.input-search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}

.select {
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") right 10px center / 12px no-repeat;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.input-text, .input-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-textarea { min-height: 80px; resize: vertical; }

.input-text:focus, .input-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-md);
}

.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Per-row action icons (edit / generate tag) */
.row-actions { display: inline-flex; gap: 6px; }
.act-ico {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: all .12s ease;
}
.act-ico:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
/* Resend link in the ACK Status cell */
.ack-resend { font-size: 11.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }

/* Reusable compact status strip (replaces walls of stat cards across pages) */
.status-strip, .srq-stats { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 18px; }
.status-pill, .srq-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: border-color .12s, color .12s, background .12s, box-shadow .12s;
}
.status-pill:hover, .srq-pill:hover { border-color: var(--brand); color: var(--text); box-shadow: 0 2px 8px rgba(79,70,229,.08); }
.status-pill .dot, .srq-pill .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-pill .cnt, .srq-pill .cnt { font-weight: 700; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.status-pill.active, .srq-pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.status-pill.active .dot, .srq-pill.active .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.5); }
.status-pill.active .cnt, .srq-pill.active .cnt { color: #fff; }
.status-pill.total, .srq-pill.total { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600; }
.status-pill.total .cnt, .srq-pill.total .cnt { color: var(--brand); }
.status-pill.total.active, .srq-pill.total.active { background: var(--brand); color: #fff; }
.status-pill.total.active .cnt, .srq-pill.total.active .cnt { color: #fff; }
/* Tighter list rows on pages using the strip */
#tickTable tbody td { padding-top: 9px; padding-bottom: 9px; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 880px;
}

table.data thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, white);
  border-bottom: 2px solid color-mix(in srgb, var(--brand) 22%, white);
  white-space: nowrap;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
}

table.data thead th .sort {
  margin-left: 4px;
  font-size: 9px;
  color: var(--brand);
  opacity: 0.55;
  cursor: pointer;
}

table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  color: #374151;
  vertical-align: middle;
}

table.data tbody tr {
  transition: background 0.12s, box-shadow 0.12s;
}

table.data tbody tr:nth-child(even) td { background: rgba(15, 23, 42, 0.012); }
table.data tbody tr:hover td { background: rgba(124, 58, 237, 0.045) !important; }
table.data tbody tr.checked td { background: rgba(79, 70, 229, 0.08) !important; }

table.data input[type=checkbox] {
  cursor: pointer;
  accent-color: var(--brand);
  width: 14px;
  height: 14px;
}

table.data .link {
  color: var(--brand);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

table.data .link:hover { text-decoration: underline; }
/* Keep the inline eye/action icons inside table links small */
table.data .link svg { width: 14px; height: 14px; flex-shrink: 0; }

.table-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.pager-controls {
  display: flex;
  gap: 4px;
}

.pager-controls button {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  font-size: 12px;
  padding: 0 8px;
}

.pager-controls button:hover:not(:disabled) { background: var(--surface-2); }
.pager-controls button.active { background: var(--brand); color: white; border-color: var(--brand); }
.pager-controls button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============== Badges ============== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-transform: capitalize;
}

.b-new { background: var(--red-soft); color: #b91c1c; }
.b-assigned { background: var(--green-soft); color: #047857; }
.b-progress { background: #ffedd5; color: #c2410c; }
.b-hold { background: var(--slate-soft); color: #475569; }
.b-resolved { background: var(--blue-soft); color: #1d4ed8; }
.b-closed { background: #e5e7eb; color: #374151; }
.b-cancelled { background: var(--red-soft); color: #b91c1c; }
.b-rejected { background: var(--red-soft); color: #b91c1c; }
.b-pending { background: var(--amber-soft); color: #b45309; }
.b-allocated { background: var(--green-soft); color: #047857; }
.b-instore { background: var(--blue-soft); color: #1d4ed8; }
.b-sold { background: var(--amber-soft); color: #b45309; }
.b-theft { background: var(--red-soft); color: #b91c1c; }
.b-critical { background: var(--red-soft); color: #b91c1c; }
.b-noncritical { background: var(--green-soft); color: #047857; }
.b-warranty { background: var(--blue-soft); color: #1d4ed8; }
.b-outsupport { background: var(--green-soft); color: #047857; }
.b-na { background: var(--amber-soft); color: #b45309; }

.priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 5px;
  letter-spacing: 0.5px;
}
.p-p0 {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: white;
  box-shadow: 0 1px 3px rgba(185,28,28,0.4);
  position: relative;
}
.p-p0::before {
  content: '';
  width: 6px; height: 6px;
  background: #fca5a5;
  border-radius: 50%;
  margin-right: 2px;
  animation: p0-pulse 1.4s ease-in-out infinite;
}
@keyframes p0-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.p-p1 { background: #fee2e2; color: #b91c1c; }
.p-p2 { background: #fef3c7; color: #b45309; }
.p-p3 { background: #fef9c3; color: #a16207; }
.p-p4 { background: #dcfce7; color: #166534; }

.flag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.flag-new { background: var(--red); }
.flag-open { background: var(--green); }

/* ============== Modal ============== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

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

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 920px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full { grid-column: 1 / -1; }

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

/* ============== Side panel categories (Assets) ============== */
.split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}
/* Let the table column shrink below its content width so .table-wrap scrolls
   horizontally instead of overflowing (and being clipped by main.content). */
.split > * { min-width: 0; }

.cat-list {
  background: linear-gradient(180deg, #f9fafe 0%, #f4f6fb 100%);
  border-radius: var(--r-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.cat-item {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.cat-item:hover {
  background: rgba(124, 58, 237, 0.07);
  color: var(--brand);
}

.cat-item.active {
  background: var(--brand-grad);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.cat-item .count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
}

.cat-item.active .count {
  background: rgba(255,255,255,0.18);
  color: white;
}

/* ============== Empty / Misc ============== */
.empty {
  text-align: center;
  padding: 50px 16px;
  color: var(--text-muted);
}

.empty .ico {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text-soft);
}

.kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-muted);
}

/* ============== Toast ============== */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: var(--surface);
  border-left: 4px solid var(--green);
  border-radius: var(--r-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 260px;
  animation: toastIn 0.2s ease;
}

.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============== Responsive ============== */
@media (max-width: 900px) {
  .app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .sidebar-brand .name, .nav-item .label, .nav-item .arrow, .nav-group-label { display: none; }
  .sidebar-brand { justify-content: center; padding: 18px 0; }
  .nav-item { justify-content: center; padding: 10px; }
  .header-search { display: none; }
  .split { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .user-chip .name { display: none; }
}

@media (max-width: 600px) {
  .content { padding: 18px 14px 32px; }
  .header { padding: 0 14px; }
  .page-card { padding: 16px; }
}

/* CSV dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dropzone .dz-icon {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  color: var(--brand);
  display: grid; place-items: center;
}
.dropzone .dz-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dropzone .dz-hint  { font-size: 12px; color: var(--text-muted); }

.preview-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: block;
  max-height: 240px;
  overflow-y: auto;
}
.preview-table thead th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.preview-table tbody td { padding: 6px 10px; border-top: 1px solid var(--border-soft); }
.preview-table tbody tr.invalid { background: #fef2f2; }
.preview-table tbody tr.invalid td { color: #b91c1c; }

.import-summary {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  margin: 14px 0;
  font-size: 13px;
}
.import-summary .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 12px;
}
.import-summary .pill.ok { background: var(--green-soft); color: #047857; }
.import-summary .pill.err { background: var(--red-soft); color: #b91c1c; }
.import-summary .pill.skip { background: var(--amber-soft); color: #b45309; }

/* User avatar in tables */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-cell .av {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.user-cell .nm { font-weight: 500; color: var(--text); }
.user-cell .em { font-size: 11.5px; color: var(--text-muted); }

/* Filter popover */
.filter-wrap {
  position: relative;
  display: inline-block;
}

.filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 380px;
  max-width: 90vw;
  background: white;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: none;
  max-height: 70vh;
  overflow-y: auto;
}

.filter-popover.open { display: block; animation: filterIn 0.18s ease; }

@keyframes filterIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.filter-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.filter-popover-head h4 {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}

.filter-popover-body { padding: 14px 16px; }

.filter-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-soft);
}
.filter-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

.filter-section .filter-label {
  font-size: 11px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: white;
  color: #4b5563;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s;
  font-weight: 500;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.filter-popover-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: white;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  background: var(--brand);
  color: white;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

/* Action dropdown */
.action-menu {
  position: relative;
  display: inline-block;
}
.action-menu .dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 30;
  padding: 4px;
  display: none;
}
.action-menu.open .dropdown { display: block; }
.action-menu .dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.action-menu .dropdown a:hover { background: var(--surface-2); }
.action-menu .dropdown a.danger { color: var(--red); }
.action-menu .dropdown a.danger:hover { background: #fef2f2; }
.action-menu .dropdown .div { height: 1px; background: var(--border); margin: 4px 0; }

/* Constrain inline SVGs inside dropdown items so they render as small menu icons */
.action-menu .dropdown a svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

/* ============== Login pages ============== */
body.login-page {
  margin: 0;
  background: white;
}

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
}

.login-left.tech    { background: #d8e4dd; }
.login-left.user    { background: #133b3a; }

.login-card {
  background: white;
  border-radius: 22px;
  padding: 38px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.10);
}

.login-card h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 28px;
  line-height: 1.4;
}

.login-card .login-field {
  margin-bottom: 18px;
}

.login-card .login-label {
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 6px;
}

.login-card .login-input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  outline: none;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.login-card .login-input:focus {
  background: white;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.10);
}

.login-card .input-wrap {
  position: relative;
}

.login-card .input-wrap .ico {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.login-card .login-btn {
  width: 100%;
  height: 44px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.login-card .login-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,23,42,0.18); }

.login-card .google-btn {
  width: 100%;
  height: 44px;
  border-radius: var(--r-pill);
  background: white;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  transition: background 0.15s;
}

.login-card .google-btn:hover { background: var(--brand-soft); }

.login-card .google-btn .g-icon {
  width: 18px; height: 18px;
  background: conic-gradient(from -45deg, #4285f4, #34a853, #fbbc05, #ea4335, #4285f4);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  font-family: Arial;
  flex-shrink: 0;
}

.login-card .forgot-link {
  /* Sits below the password input — clear positive margin so it never
     overlaps the input box (was -8px, which caused the overlap reported on
     the End-User Portal). */
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--brand);
  font-weight: 500;
  margin: 8px 0 14px;
  text-decoration: none;
}
.login-card .forgot-link:hover {
  text-decoration: underline;
}

.login-powered {
  position: absolute;
  bottom: 28px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 18px;
  width: calc(100% - 48px);
  max-width: 440px;
  justify-content: center;
}

.login-left.user .login-powered {
  color: rgba(255,255,255,0.65);
  border-top-color: rgba(255,255,255,0.08);
}

.login-powered .dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: inline-block;
}

.login-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: white;
  position: relative;
  overflow: hidden;
}

.login-right .brand-row {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 20px;
}

.login-right .brand-1 {
  font-size: 44px;
  font-weight: 800;
  color: #1f4ba1;
  letter-spacing: -1px;
}

.login-right .brand-1 .tag {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #1f4ba1;
  letter-spacing: 1px;
  text-align: center;
  margin-top: -6px;
}

.login-right .brand-divider { width: 2px; height: 60px; background: #e5e7eb; }

.login-right .brand-2 {
  font-size: 44px;
  font-weight: 800;
  color: #2da64a;
  letter-spacing: -1px;
}

.login-right .brand-2 .tag {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #2da64a;
  margin-top: -2px;
}

.login-right .hero {
  display: flex;
  align-items: center;
  gap: 24px;
  background: white;
  border-radius: 18px;
  padding: 26px 30px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(15,23,42,0.06);
  max-width: 600px;
  width: 100%;
}

.login-right .hero h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
}

.login-right .hero ul {
  list-style: none;
  font-size: 13.5px;
  color: #374151;
  line-height: 1.9;
}

.login-right .hero ul li::before { content: "• "; color: var(--brand); font-weight: 700; }

.login-right .support-info {
  margin-top: 28px;
  font-size: 13px;
  color: #374151;
  text-align: center;
  padding: 16px 24px;
  background: var(--surface-2);
  border-radius: 12px;
  max-width: 600px;
}
.login-right .support-info h4 { color: #1f2937; font-size: 14px; margin-bottom: 6px; }
.login-right .support-info a { color: var(--green); font-weight: 600; }

.login-right .character {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #fde68a;
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-right { display: none; }
}

/* ============== End-user portal ============== */
.app.user-app .sidebar {
  background:
    linear-gradient(180deg, #1f4f4e 0%, #133634 100%);
  border-right: 1px solid rgba(255,255,255,0.05);
}
.app.user-app .sidebar-brand .name { color: white; }
.app.user-app .sidebar-brand .name span { color: #5eead4; }
.app.user-app .sidebar-brand .logo {
  background: linear-gradient(135deg, #5eead4 0%, #14b8a6 100%);
  box-shadow: 0 4px 10px rgba(20,184,166,0.3);
}
.app.user-app .nav-group-label { color: rgba(255,255,255,0.45); }
.app.user-app .nav-item {
  color: rgba(255,255,255,0.72);
  letter-spacing: 1px;
  font-size: 12px;
  font-weight: 600;
}
.app.user-app .nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.app.user-app .nav-item.active {
  background: rgba(255,255,255,0.10);
  color: white;
  box-shadow: none;
}
.app.user-app .nav-item.active::before { display: none; }
.app.user-app .menu-toggle { color: white; }
.app.user-app .menu-toggle:hover { background: rgba(255,255,255,0.08); }

/* User dashboard hero */
.user-hero {
  position: relative;
  border-radius: 22px;
  padding: 44px 40px;
  margin-bottom: 24px;
  background:
    radial-gradient(at 0% 0%,    rgba(94,234,212,0.20) 0px, transparent 45%),
    radial-gradient(at 100% 100%, rgba(20,184,166,0.10) 0px, transparent 45%),
    linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15,23,42,0.06);
}

.user-hero h1 {
  font-size: 28px;
  font-weight: 800;
  color: #134e4a;
  margin-bottom: 18px;
  letter-spacing: -0.4px;
}

.user-hero .kb-search-wrap {
  position: relative;
  max-width: 680px;
}

.user-hero .kb-search-wrap input {
  width: 100%;
  height: 56px;
  border-radius: var(--r-pill);
  border: none;
  padding: 0 24px;
  font-size: 14px;
  outline: none;
  box-shadow: 0 12px 32px rgba(15,23,42,0.12);
}

.user-hero .kb-search-wrap input::placeholder { color: #9ca3af; }

.user-hero .notif-card {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 42%;
  max-width: 460px;
  padding: 22px 26px;
  background: rgba(28, 53, 51, 0.85);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  color: white;
}

.user-hero .notif-card h3 {
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.user-hero .notif-card p {
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
}

.user-hero .notif-dots {
  display: flex; gap: 6px; justify-content: center;
  margin-top: 14px;
}
.user-hero .notif-dots .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
}
.user-hero .notif-dots .dot.active { background: white; }

@media (max-width: 900px) {
  .user-hero .notif-card { display: none; }
}

/* User quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.qa-card {
  background: linear-gradient(180deg, var(--qa-bg, var(--brand-soft)) 0%, white 100%);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  border: 1px solid rgba(15,23,42,0.04);
  min-height: 140px;
}

.qa-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,0.08); }

.qa-card .qa-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: white;
  display: grid; place-items: center;
  color: var(--qa-color, var(--brand));
  margin-bottom: 4px;
}

.qa-card .qa-title {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
}

.qa-card .qa-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.qa-card.qa-incident   { --qa-bg: #f3e8ff; --qa-color: #7c3aed; }
.qa-card.qa-request    { --qa-bg: #fff1e0; --qa-color: #f59e0b; }
.qa-card.qa-asset      { --qa-bg: #d1fae5; --qa-color: #10b981; }
.qa-card.qa-approval   { --qa-bg: #fef3c7; --qa-color: #b45309; }
.qa-card.qa-document   { --qa-bg: #dbeafe; --qa-color: #3b82f6; }
.qa-card.qa-knowledge  { --qa-bg: #fce7f3; --qa-color: #db2777; }

/* SMTP provider preset cards */
.smtp-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.smtp-provider {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.smtp-provider:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.smtp-provider.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(79,70,229,0.10); }

.smtp-provider .logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid; place-items: center;
  margin: 0 auto 6px;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.smtp-provider .name {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
}

.smtp-provider .meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: monospace;
}

.smtp-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  margin-bottom: 18px;
  border: 1px solid;
}

.smtp-status.ok    { background: var(--green-soft); border-color: var(--green); color: #065f46; }
.smtp-status.warn  { background: var(--amber-soft); border-color: var(--amber); color: #92400e; }
.smtp-status.error { background: var(--red-soft);   border-color: var(--red);   color: #b91c1c; }

.smtp-status .ico {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}

.smtp-status h4 { font-size: 14px; font-weight: 700; }
.smtp-status p { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.smtp-test-output {
  margin-top: 12px;
  padding: 12px 14px;
  background: #0f172a;
  color: #4ade80;
  border-radius: 8px;
  font-family: monospace;
  font-size: 11.5px;
  line-height: 1.7;
  max-height: 220px;
  overflow-y: auto;
}

.smtp-test-output .err  { color: #f87171; }
.smtp-test-output .info { color: #93c5fd; }
.smtp-test-output .ok   { color: #4ade80; }

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Drawer (ticket detail) */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 90;
  display: none;
}

.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  z-index: 100;
  box-shadow: -8px 0 24px rgba(15,23,42,0.1);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.drawer.open { transform: translateX(0); }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px 16px;
  margin-bottom: 8px;
  font-size: 13px;
}

.kv .k { color: var(--text-muted); font-weight: 500; }
.kv .v { color: var(--text); font-weight: 500; }

.timeline {
  margin-top: 14px;
  border-left: 2px solid var(--border);
  padding-left: 14px;
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
}

.timeline-item .when { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.timeline-item .what { font-size: 13px; color: var(--text); }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
