/* ═══════════════════════════════════════════════════════════════
   HR Portal — Centro de Mensajería  v2.0
   Design: light theme, DM Sans, primary #1D9E75
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables (dark theme) ── */
:root {
  --primary:        #1D9E75;
  --primary-light:  rgba(29,158,117,0.18);
  --primary-dark:   #0F6E56;
  --primary-hover:  #22B585;
  --bg-primary:     #0E1C27;
  --bg-secondary:   #091117;
  --bg-tertiary:    #152130;
  --text-primary:   #E4EDF5;
  --text-secondary: #BECBD8;
  --text-muted:     #7F9DB5;
  --text-xmuted:    #4E6E88;
  --border:         rgba(255,255,255,0.08);
  --border-med:     rgba(255,255,255,0.13);
  --danger:         #F05252;
  --danger-light:   rgba(240,82,82,0.14);
  --warning:        #FBBF24;
  --warning-light:  rgba(251,191,36,0.12);
  --success:        #1D9E75;
  --success-light:  rgba(29,158,117,0.14);
  --shadow-sm:      0 1px 3px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow:         0 4px 12px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.6), 0 4px 10px rgba(0,0,0,.4);
  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --nav-w:          64px;
  --nav-w-open:     220px;
  --font:           'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition:     0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); font-size: 14px; color: var(--text-primary); background: var(--bg-secondary); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════════════════════════════
   LOGIN OVERLAY
   ══════════════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, rgba(29,158,117,.18), transparent 50%), var(--bg-secondary);
  animation: fadeIn 0.25s ease;
}
.login-card {
  width: min(92vw, 420px);
  background: var(--bg-primary); border-radius: var(--radius-xl);
  padding: 40px 36px; box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand__icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; font-weight: 800; font-size: 16px; display: grid; place-items: center;
}
.login-brand__eyebrow { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.14em; }
.login-brand__title { font-size: 18px; font-weight: 700; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.login-subtitle strong { color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════ */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.app-shell[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   LEFT NAV SIDEBAR
   ══════════════════════════════════════════════════════════════ */
.app-nav {
  width: var(--nav-w); min-width: var(--nav-w);
  background: var(--bg-primary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width var(--transition); overflow: hidden; z-index: 10;
}
.app-nav:hover, .app-nav.open { width: var(--nav-w-open); }
.app-nav__header {
  height: 64px; min-height: 64px; display: flex; align-items: center;
  gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--border);
}
.app-nav__logo {
  width: 36px; min-width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
.app-nav__label-brand {
  font-size: 14px; font-weight: 700; white-space: nowrap;
  opacity: 0; transition: opacity var(--transition);
}
.app-nav:hover .app-nav__label-brand, .app-nav.open .app-nav__label-brand { opacity: 1; }
.app-nav__list { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; }

.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius); color: var(--text-muted);
  position: relative; transition: background var(--transition), color var(--transition);
  white-space: nowrap; border: none; background: none; cursor: pointer;
}
.nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item__icon { width: 20px; height: 20px; min-width: 20px; }
.nav-item__label { font-size: 13px; font-weight: 500; opacity: 0; transition: opacity var(--transition); flex: 1; text-align: left; }
.app-nav:hover .nav-item__label, .app-nav.open .nav-item__label { opacity: 1; }
.nav-item__badge {
  background: var(--danger); color: white; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; opacity: 0; transition: opacity var(--transition);
}
.nav-item__badge--green { background: var(--primary); }
.app-nav:hover .nav-item__badge:not([hidden]), .app-nav.open .nav-item__badge:not([hidden]) { opacity: 1; }

.app-nav__footer {
  padding: 12px 8px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.app-nav__user { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.app-nav__user-info { opacity: 0; transition: opacity var(--transition); overflow: hidden; min-width: 0; }
.app-nav:hover .app-nav__user-info, .app-nav.open .app-nav__user-info { opacity: 1; }
.app-nav__user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-nav__user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.nav-logout {
  min-width: 32px; height: 32px; padding: 6px; border-radius: var(--radius-sm);
  color: var(--text-muted); transition: background var(--transition), color var(--transition);
}
.nav-logout:hover { background: var(--danger-light); color: var(--danger); }
.nav-logout svg { width: 16px; height: 16px; display: block; }

/* ══════════════════════════════════════════════════════════════
   MODULE VIEWS
   ══════════════════════════════════════════════════════════════ */
.module-view { flex: 1; min-width: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.module-view[hidden] { display: none !important; }

.module-page { flex: 1; overflow-y: auto; padding: 28px 32px; background: var(--bg-secondary); }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-header__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ══════════════════════════════════════════════════════════════
   INBOX LAYOUT (3 columns)
   ══════════════════════════════════════════════════════════════ */
.inbox-layout {
  flex: 1; display: grid;
  grid-template-columns: 280px minmax(0,1fr) 260px;
  min-height: 0; overflow: hidden;
}
.inbox-sidebar {
  border-right: 1px solid var(--border); background: var(--bg-primary);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.inbox-sidebar__toolbar {
  padding: 12px 14px 8px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  color: var(--text-muted); background: var(--bg-secondary);
  transition: background var(--transition), color var(--transition); cursor: pointer; border: none;
}
.filter-tab:hover { background: var(--bg-tertiary); color: var(--text-secondary); }
.filter-tab.active { background: var(--primary-light); color: var(--primary); }
.inbox-stats {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}
.stat-chip { display: inline-flex; gap: 3px; }
.stat-chip.unread span { color: var(--danger); font-weight: 600; }
.inbox-stats .btn { margin-left: auto; }

.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.chat-item:hover { background: var(--bg-secondary); }
.chat-item.active { background: var(--primary-light); }
.chat-item__avatar { position: relative; flex-shrink: 0; }
.chat-item__unread {
  position: absolute; top: -3px; right: -3px;
  background: var(--primary); color: white;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
}
.chat-item__body { flex: 1; min-width: 0; }
.chat-item__header { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.chat-item__name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item__time { font-size: 11px; color: var(--text-xmuted); flex-shrink: 0; }
.chat-item__preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-item__tags { display: flex; gap: 4px; margin-top: 3px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.tag--group { background: rgba(99,102,241,0.18); color: #A5B4FC; }

/* Inbox main */
.inbox-main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--bg-primary); border-bottom: 1px solid var(--border); gap: 12px;
}
.chat-header__identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-header__name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header__meta { font-size: 12px; color: var(--text-muted); }
.chat-header__actions { display: flex; gap: 8px; flex-shrink: 0; }

.message-list { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-secondary); }
.message-bubble {
  max-width: 68%; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; position: relative;
}
.message-bubble--out {
  align-self: flex-end;
  background: var(--primary); color: white;
  border-bottom-right-radius: 4px;
}
.message-bubble--in {
  align-self: flex-start;
  background: var(--bg-primary); color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.message-bubble__meta { font-size: 10px; margin-top: 4px; opacity: 0.65; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.message-bubble--in .message-bubble__meta { justify-content: flex-start; }
.message-bubble__author { font-size: 11px; font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.message-date-divider {
  align-self: center; font-size: 11px; color: var(--text-muted);
  background: rgba(0,0,0,0.06); padding: 3px 12px; border-radius: 999px; margin: 8px 0;
}

.composer {
  padding: 10px 16px; background: var(--bg-primary); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.composer__input-wrap {
  flex: 1; display: flex; align-items: center;
  background: var(--bg-secondary); border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-med);
  transition: border-color var(--transition);
}
.composer__input-wrap:focus-within { border-color: var(--primary); }
.composer__input { flex: 1; padding: 10px 14px; background: none; border: none; outline: none; font-size: 14px; color: var(--text-primary); }
.composer__attach { padding: 8px 10px; color: var(--text-muted); cursor: pointer; transition: color var(--transition); }
.composer__attach:hover { color: var(--primary); }
.composer__preview {
  background: var(--primary-light); font-size: 12px; color: var(--primary-dark);
  padding: 5px 16px; display: flex; align-items: center; gap: 8px;
  border-top: 1px solid rgba(29,158,117,0.2);
}
.composer__preview-clear { cursor: pointer; opacity: 0.6; font-size: 14px; }
.composer__preview-clear:hover { opacity: 1; color: var(--danger); }
.composer-status { padding: 2px 16px 6px; font-size: 12px; color: var(--text-muted); min-height: 20px; }

.empty-state { margin: auto; text-align: center; padding: 48px 20px; }
.empty-state__icon { font-size: 44px; margin-bottom: 14px; }
.empty-state__title { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state__text { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.inbox-panel { background: var(--bg-primary); border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.panel-section__title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.panel-section__actions { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }

.status-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 10px; font-size: 13px; }
.status-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.status-row:last-child { border-bottom: none; }
.status-row__label { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.status-row__value { font-size: 12px; font-weight: 500; text-align: right; word-break: break-all; }

.participant-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 340px; }
.participant-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--bg-secondary); }
.participant-item__info { flex: 1; min-width: 0; }
.participant-item__name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant-item__number { font-size: 11px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════ */
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border-med); border-radius: var(--radius);
  background: var(--bg-primary); color: var(--text-primary); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,158,117,0.1);
}
.form-input--sm { padding: 7px 10px; font-size: 13px; }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath stroke='%236B7280' stroke-width='1.5' fill='none' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.char-counter { font-size: 11px; color: var(--text-xmuted); text-align: right; }
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 12px; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  transition: background var(--transition), transform 0.1s ease, box-shadow var(--transition);
  white-space: nowrap; cursor: pointer; border: none; font-family: inherit;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(29,158,117,0.3); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn--danger { background: var(--danger); color: white; }
.btn--danger:hover:not(:disabled) { background: #c43f3e; }
.btn--ghost { background: var(--bg-primary); color: var(--text-secondary); border: 1.5px solid var(--border-med); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-secondary); }
.btn--link { background: none; color: var(--primary); padding: 4px 8px; }
.btn--link:hover { background: var(--primary-light); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--full { width: 100%; }
.btn--icon { padding: 7px; border-radius: var(--radius-sm); }

/* ══════════════════════════════════════════════════════════════
   AVATARS
   ══════════════════════════════════════════════════════════════ */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-weight: 700; font-size: 14px;
  display: grid; place-items: center; flex-shrink: 0;
}
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }
.avatar--group { background: rgba(99,102,241,0.22); color: #A5B4FC; }
.avatar--sq { border-radius: var(--radius-sm); }

/* ══════════════════════════════════════════════════════════════
   BADGES & PILLS
   ══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--bg-tertiary); color: var(--text-muted);
}
.status-pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bg-tertiary); color: var(--text-muted);
}
.status-pill--ready  { background: #D1FAE5; color: #065F46; }
.status-pill--error  { background: var(--danger-light); color: var(--danger); }
.status-pill--warn   { background: var(--warning-light); color: #92400E; }
.status-pill--active { background: var(--primary-light); color: var(--primary-dark); }

/* ══════════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════════ */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.alert--danger  { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(226,75,74,.2); }
.alert--success { background: var(--success-light); color: var(--success); border: 1px solid rgba(22,163,74,.2); }
.alert--warning { background: var(--warning-light); color: #92400E; border: 1px solid rgba(239,159,39,.2); }
.alert--info    { background: var(--primary-light); color: var(--primary-dark); border: 1px solid rgba(29,158,117,.2); }

/* ══════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════ */
.card { background: var(--bg-primary); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ══════════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-primary); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-secondary); }
th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-secondary); }
.td-actions { display: flex; gap: 6px; }

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
  display: grid; place-items: center;
  animation: fadeIn 0.15s ease; padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }
.modal {
  background: var(--bg-primary); border-radius: var(--radius-xl);
  width: min(100%, 560px); max-height: 90vh;
  box-shadow: var(--shadow-lg); animation: slideUp 0.2s ease;
  display: flex; flex-direction: column;
}
.modal--wide { width: min(100%, 720px); }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__close { width: 30px; height: 30px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text-muted); transition: background var(--transition); }
.modal__close:hover { background: var(--bg-secondary); }
.modal__body { flex: 1; overflow-y: auto; padding: 24px; }
.modal__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════════
   TOGGLE
   ══════════════════════════════════════════════════════════════ */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__track { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-tertiary); transition: background var(--transition); cursor: pointer; }
.toggle__track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: white; top: 3px; left: 3px; transition: transform var(--transition); box-shadow: var(--shadow-sm); }
.toggle input:checked + .toggle__track { background: var(--primary); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════════
   TEMPLATES MODULE
   ══════════════════════════════════════════════════════════════ */
.template-filters { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.template-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow var(--transition); }
.template-card:hover { box-shadow: var(--shadow); }
.template-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.template-card__name { font-size: 15px; font-weight: 700; }
.template-card__category { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); flex-shrink: 0; }
.template-card__preview { font-size: 13px; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.template-card__footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: auto; }
.template-card--inactive { opacity: 0.55; }
.var-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.var-chip { padding: 3px 10px; border-radius: 999px; background: rgba(251,191,36,0.14); color: #FCD34D; font-size: 12px; font-weight: 600; cursor: pointer; transition: background var(--transition); border: none; font-family: inherit; }
.var-chip:hover { background: rgba(251,191,36,0.24); }

/* ══════════════════════════════════════════════════════════════
   AUTO-RESPONSE MODULE
   ══════════════════════════════════════════════════════════════ */
.rule-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius); transition: box-shadow var(--transition); margin-bottom: 8px; }
.rule-row:hover { box-shadow: var(--shadow-sm); }
.rule-row__name { font-weight: 600; font-size: 14px; min-width: 140px; }
.rule-row__keywords { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; min-width: 0; }
.keyword-chip { padding: 2px 10px; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.rule-row__meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.rule-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1.5px solid var(--border-med); border-radius: var(--radius); background: var(--bg-primary); min-height: 44px; cursor: text; }
.tags-input:focus-within { border-color: var(--primary); }
.tag-input-chip { display: flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--primary-light); color: var(--primary); font-size: 12px; font-weight: 500; }
.tag-input-chip__del { cursor: pointer; opacity: 0.6; font-size: 13px; background: none; border: none; color: inherit; padding: 0; }
.tag-input-chip__del:hover { opacity: 1; }
.tags-input__field { border: none; outline: none; background: none; font-family: inherit; font-size: 13px; min-width: 80px; flex: 1; }

/* ══════════════════════════════════════════════════════════════
   BULK MODULE
   ══════════════════════════════════════════════════════════════ */
.wizard-steps { display: flex; gap: 0; margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.wizard-step { flex: 1; padding: 14px 12px; text-align: center; font-size: 13px; font-weight: 500; color: var(--text-muted); background: var(--bg-secondary); border-right: 1px solid var(--border); transition: background var(--transition), color var(--transition); }
.wizard-step:last-child { border-right: none; }
.wizard-step.active { background: var(--primary); color: white; }
.wizard-step.done { background: var(--primary-light); color: var(--primary); }
.wizard-step__num { display: block; font-size: 20px; font-weight: 800; }
.progress-bar { height: 8px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.progress-bar__fill { height: 100%; background: linear-gradient(90deg, var(--primary), #22C997); transition: width 0.3s ease; border-radius: 999px; }
.bulk-log { height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; font-size: 12px; background: #1a1a2e; color: #a8b2d8; font-family: 'Courier New', monospace; display: flex; flex-direction: column; gap: 3px; }
.log-entry { display: flex; gap: 8px; }
.log-entry--ok  { color: #7effd8; }
.log-entry--err { color: #ff6b6b; }
.log-entry--wait { color: #a8b2d8; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
input[type="range"] { flex: 1; accent-color: var(--primary); }
.range-value { min-width: 50px; font-weight: 700; color: var(--primary); }
.recipient-check-wrap { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.recipient-check-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.recipient-check-item:last-child { border-bottom: none; }
.recipient-check-item:hover { background: var(--bg-secondary); }
.recipient-check-item label { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; }

/* ══════════════════════════════════════════════════════════════
   REPORTS MODULE
   ══════════════════════════════════════════════════════════════ */
.stats-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 24px; }
.stat-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.stat-card__label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card__value { font-size: 32px; font-weight: 800; color: var(--text-primary); margin-top: 6px; line-height: 1; }
.stat-card__sub { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.stat-card--primary .stat-card__value { color: var(--primary); }
.stat-card--danger .stat-card__value { color: var(--danger); }
.charts-grid { display: grid; gap: 20px; grid-template-columns: 2fr 1fr; }
.chart-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.chart-card__title { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   CONTACTS MODULE
   ══════════════════════════════════════════════════════════════ */
.contacts-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; }
.contacts-detail { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: sticky; top: 0; }
.contact-meta-field { margin-bottom: 16px; }
.contact-meta-field > label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.06em; }
.label-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.label-chip { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; gap: 5px; }
.label-chip__del { cursor: pointer; opacity: 0.6; font-size: 13px; border: none; background: none; color: inherit; }
.label-chip__del:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   SETTINGS MODULE
   ══════════════════════════════════════════════════════════════ */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.settings-nav { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.settings-nav-item { display: block; width: 100%; text-align: left; padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); transition: background var(--transition), color var(--transition); cursor: pointer; border: none; background: none; border-bottom: 1px solid var(--border); font-family: inherit; }
.settings-nav-item:last-child { border-bottom: none; }
.settings-nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.settings-nav-item.active { background: var(--primary-light); color: var(--primary); }
.settings-section { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.settings-section__title { font-size: 16px; font-weight: 700; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 24px; }
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-row__info { min-width: 0; }
.settings-row__label { font-size: 14px; font-weight: 500; }
.settings-row__sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.qr-wrap { text-align: center; padding: 16px; }
.qr-wrap img { max-width: 200px; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ══════════════════════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════════════════════ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--text-primary); color: white; padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; max-width: 340px; box-shadow: var(--shadow-lg); pointer-events: all; animation: slideInRight 0.25s ease; display: flex; align-items: center; gap: 10px; }
.toast--success { background: var(--primary); }
.toast--danger  { background: var(--danger); }
.toast--warning { background: var(--warning); color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 13px; }
.text-xs      { font-size: 12px; }
.text-center  { text-align: center; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-20        { margin-top: 20px; }
.mb-12        { margin-bottom: 12px; }
.mb-16        { margin-bottom: 16px; }
.mb-20        { margin-bottom: 20px; }
.hidden       { display: none !important; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.35); border-top-color: white; animation: spin 0.6s linear infinite; display: inline-block; }
.spinner--dark { border-color: rgba(0,0,0,0.1); border-top-color: var(--primary); }
.section-divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   SCROLLBARS
   ══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-xmuted); }
