/* ════════════════════════════════════════════════════════
   HONEYCOMB DESIGN SYSTEM  —  styles.css  v3.0
════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --purple:       #7c5cbf;
  --purple2:      #6b4dab;
  --purple3:      #9070d0;
  --purple-light: #f0ebfa;
  --purple-glow:  rgba(124, 92, 191, 0.18);
  --teal:         #3ecfcf;
  --teal2:        #2dbdbd;
  --coral:        #f07070;
  --coral2:       #e85c5c;
  --sand:         #f5d98a;
  --green:        #5ac87a;
  --orange:       #f09050;
  --red:          #e85555;
  --sidebar-bg:   linear-gradient(160deg, #7c5cbf 0%, #5a3e98 100%);
  --bg:           #f0f2f7;
  --white:        #ffffff;
  --border:       #e4e8f0;
  --text:         #3a3d4e;
  --text2:        #7a7f96;
  --text3:        #a0a5be;
  --shadow:       0 2px 12px rgba(80, 60, 140, 0.09);
  --shadow2:      0 8px 32px rgba(80, 60, 140, 0.14);
  --sidebar-w:    220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Nunito Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}

/* ═══════════════════════════════════════
   AUTH / INIT SCREENS
═══════════════════════════════════════ */
#auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: var(--white);
  padding: 44px 40px; border-radius: 18px; width: 380px;
  box-shadow: var(--shadow2);
  text-align: center;
}
.auth-logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--sidebar-bg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
}
.auth-logo svg { width: 28px; height: 28px; }
.auth-title { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 24px; margin-bottom: 8px; }
.auth-sub   { font-size: 14px; color: var(--text2); margin-bottom: 28px; line-height: 1.5; }
.input-auth {
  width: 100%; padding: 13px 16px; border-radius: 9px;
  border: 1.5px solid var(--border); margin-bottom: 14px;
  font-size: 15px; font-family: inherit; outline: none; transition: 0.2s;
  background: #fafbfd;
}
.input-auth:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-glow); }
.btn-auth {
  width: 100%; padding: 13px; border-radius: 9px;
  background: var(--purple); color: #fff; font-weight: 700;
  font-family: 'Nunito', sans-serif; font-size: 13px; letter-spacing: 0.06em;
  border: none; cursor: pointer; transition: 0.2s;
}
.btn-auth:hover { background: var(--purple2); transform: translateY(-1px); }

/* Agent list */
.agent-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 9px;
  border: 1.5px solid var(--border); background: #fff;
  cursor: pointer; transition: 0.18s; text-align: left;
  font-family: 'Nunito', sans-serif;
}
.agent-btn:hover { border-color: var(--purple); background: var(--purple-light); }
.agent-av-sm {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sidebar-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
}

/* ═══════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════ */
.app-container { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; color: #fff;
  overflow: hidden; position: relative;
}
.sidebar::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.06) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.sidebar-profile {
  padding: 22px 18px 18px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #f0c060, #e08040);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
  font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 800; color: #fff;
  letter-spacing: 0.02em;
}
.profile-name {
  font-family: 'Nunito', sans-serif;
  font-size: 12px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-role { font-size: 10px; color: rgba(255,255,255,0.55); margin-top: 2px; }

/* Nav */
.nav-list { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 11.5px; font-weight: 600;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; transition: all 0.18s; position: relative;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item.active { color: #fff; background: rgba(255,255,255,0.14); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: #fff; border-radius: 0 2px 2px 0;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--red);
  color: #fff; font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; letter-spacing: 0.04em;
}
.sidebar-bottom {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  font-size: 11px; color: rgba(255,255,255,0.5);
}

/* ── Main area ── */
main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Top bar */
.top-bar {
  height: 62px; flex-shrink: 0;
  background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px;
  gap: 14px; box-shadow: 0 1px 0 var(--border);
}
.topbar-title {
  font-family: 'Nunito', sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--text); letter-spacing: -0.02em;
}
.topbar-spacer { flex: 1; }
.search-box input {
  padding: 9px 16px; border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 13px; font-family: inherit; outline: none;
  background: #fafbfd; transition: 0.2s; width: 280px;
}
.search-box input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-glow); }

/* Content area */
.content-area { flex: 1; padding: 28px 30px; overflow-y: auto; }
.content-area::-webkit-scrollbar { width: 5px; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══════════════════════════════════════
   COMPONENTS
═══════════════════════════════════════ */
/* Cards */
.card {
  background: #fff; border-radius: 12px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-title {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 15px;
}
.card-content { padding: 20px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-box {
  padding: 22px 20px; background: #fff; border-radius: 12px;
  border-bottom: 3px solid var(--purple); box-shadow: var(--shadow);
}
.stat-val { font-family: 'Nunito', sans-serif; font-size: 30px; font-weight: 800; color: var(--purple); }
.stat-lbl { font-size: 11px; color: var(--text2); text-transform: uppercase; font-weight: 700; margin-top: 4px; letter-spacing: 0.06em; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 11px 16px;
  font-size: 10.5px; font-weight: 800; color: var(--text3);
  border-bottom: 2px solid var(--border); text-transform: uppercase; letter-spacing: 0.08em;
}
td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f5ff; cursor: pointer; }

/* Badges */
.badge { padding: 3px 9px; border-radius: 6px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.priority-Normal    { background: #eff3ff; color: #4361ee; }
.priority-Low       { background: #e8faf2; color: #1dac63; }
.priority-High      { background: #fff8e1; color: #f59a00; }
.priority-Emergency { background: #fee2e2; color: #e03030; }
.status-Open        { background: #e8f9f5; color: #0e9f6e; }
.status-Closed      { background: #f1f5f9; color: #64748b; }
.status-Resolved    { background: #eef2ff; color: #6366f1; }
.status-            { background: #f1f5f9; color: #64748b; }

/* Forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.f-group  { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 11.5px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }
input, select, textarea {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  outline: none; font-family: inherit; font-size: 14px;
  background: #fafbfd; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-glow);
}

/* Buttons */
.btn { padding: 10px 20px; border-radius: 8px; font-weight: 700; cursor: pointer; border: none; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; font-family: 'Nunito', sans-serif; letter-spacing: 0.04em; }
.btn-p { background: var(--purple); color: #fff; box-shadow: 0 3px 12px rgba(124,92,191,0.3); }
.btn-p:hover { background: var(--purple2); transform: translateY(-1px); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(30, 20, 60, 0.45);
  z-index: 200; align-items: center; justify-content: center;
  display: none; /* toggled to flex */
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff; width: 820px; max-width: 96vw;
  max-height: 88vh; border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 16px 48px rgba(30,20,60,0.25);
}
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h2 { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 18px; }
.modal-head button {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border);
  background: transparent; cursor: pointer; font-size: 16px;
  color: var(--text2); display: flex; align-items: center; justify-content: center;
  transition: 0.18s;
}
.modal-head button:hover { background: #fee2e2; border-color: var(--coral); color: var(--coral2); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-field label { display: block; font-size: 10.5px; font-weight: 800; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.modal-field p { font-size: 14px; color: var(--text); padding: 2px 0; }
.modal-field + .modal-field { margin-top: 18px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
