/* ============================================================
   KLLAKAR DESIGN SYSTEM — Production CSS v4.0
   Aesthetic: Sharp editorial dark · Premium SaaS
   Fonts: Syne (display) · DM Sans (body) · DM Mono (mono)
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:    #080808;
  --bg-2:  #0f0f0f;
  --bg-3:  #161616;
  --bg-4:  #1e1e1e;
  --bg-5:  #272727;
  --bg-6:  #323232;

  /* Borders */
  --border:   rgba(255,255,255,.07);
  --border-2: rgba(255,255,255,.11);
  --border-3: rgba(255,255,255,.18);

  /* Text */
  --text:   #f0f0f0;
  --text-2: #8c8c8c;
  --text-3: #4a4a4a;

  /* Brand */
  --accent:      #c8f542;
  --accent-2:    #b5e033;
  --accent-rgb:  200,245,66;
  --accent-glow: rgba(200,245,66,.06);

  /* Semantic */
  --red:    #ff4d4d;
  --orange: #ff9f0a;
  --blue:   #3b9eff;
  --green:  #30d158;
  --purple: #9d7cf4;
  --teal:   #26c6da;

  /* Sidebar */
  --sidebar-w: 232px;

  /* Radii */
  --r:    3px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Type */
  --font:      'DM Sans',system-ui,sans-serif;
  --font-disp: 'Syne',sans-serif;
  --font-mono: 'DM Mono','Fira Code',monospace;

  /* Shadow */
  --shadow:    0 2px 8px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.75);
  --shadow-glow: 0 0 0 1px rgba(200,245,66,.25), 0 0 20px rgba(200,245,66,.08);

  /* Transition */
  --t:  140ms cubic-bezier(.4,0,.2,1);
  --t2: 220ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--text); }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-6); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }
* { scrollbar-width: thin; scrollbar-color: var(--bg-6) transparent; }

/* ── Selection ─────────────────────────────────────────────── */
::selection { background: rgba(200,245,66,.2); color: var(--text); }

/* ── Top loader bar ────────────────────────────────────────── */
#topLoader {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 9999;
  background: var(--accent); width: 0%; transition: width .3s ease, opacity .4s ease;
  box-shadow: 0 0 12px rgba(200,245,66,.6);
  pointer-events: none;
}
#topLoader.done { width: 100%; opacity: 0; }

/* ── Toast notifications ───────────────────────────────────── */
#toastContainer {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9000; display: flex; flex-direction: column; gap: .55rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .65rem;
  padding: .72rem 1rem; border-radius: var(--r-md);
  background: var(--bg-4); border: 1px solid var(--border-2);
  color: var(--text); font-size: .855rem; font-weight: 450;
  box-shadow: var(--shadow-lg); min-width: 240px; max-width: 360px;
  pointer-events: auto; cursor: pointer;
  animation: toastIn .22s cubic-bezier(.34,1.56,.64,1);
  backdrop-filter: blur(12px);
}
.toast.exiting { animation: toastOut .2s ease forwards; }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.toast.success .toast-dot { background: var(--green); }
.toast.error   .toast-dot { background: var(--red); }
.toast.info    .toast-dot { background: var(--blue); }
.toast.warning .toast-dot { background: var(--orange); }
.toast-msg { flex: 1; }
.toast-close { color: var(--text-3); font-size: 1rem; line-height: 1; }
@keyframes toastIn  { from { opacity:0; transform:translateX(20px) scale(.96); } to   { opacity:1; transform:translateX(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); }               to   { opacity:0; transform:translateX(20px); } }

/* ════════════════════════════════════════════════════════════ */
/* AUTH                                                          */
/* ════════════════════════════════════════════════════════════ */
.auth-body { background: var(--bg); overflow: hidden; height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; height: 100vh; }

.auth-left {
  position: relative; overflow: hidden;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 2.5rem 3rem;
  display: flex; flex-direction: column;
}

/* Grid texture on auth left */
.auth-left::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .4;
  pointer-events: none;
}

/* Large accent mark */
.auth-left::after {
  content: '';
  position: absolute;
  bottom: -80px; right: -80px;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,245,66,.12) 0%, transparent 65%);
  pointer-events: none;
}

.auth-brand {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: .75rem;
  font-family: var(--font-disp); font-size: 1.1rem; font-weight: 700; color: var(--text);
}

.auth-brand-mark {
  width: 36px; height: 36px; border-radius: var(--r);
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.auth-tagline {
  position: relative; z-index: 1;
  margin-top: auto; padding-bottom: 3rem;
}
.auth-tagline h1 {
  font-family: var(--font-disp);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800; line-height: 1.02;
  margin-bottom: .9rem; color: var(--text);
  letter-spacing: -.03em;
}
.auth-tagline h1 em { font-style: normal; color: var(--accent); }
.auth-tagline p { color: var(--text-2); font-size: .9rem; line-height: 1.7; max-width: 360px; }

.auth-features {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: .55rem;
  margin-top: 2rem;
}
.feat {
  display: flex; align-items: center; gap: .6rem;
  color: var(--text-2); font-size: .84rem;
}
.feat-check {
  width: 18px; height: 18px; border-radius: var(--r);
  background: rgba(200,245,66,.1); border: 1px solid rgba(200,245,66,.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}

/* Auth right */
.auth-right {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; background: var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card-header { margin-bottom: 2rem; }
.auth-card-header h2 {
  font-family: var(--font-disp); font-size: 1.75rem; font-weight: 700;
  letter-spacing: -.025em; margin-bottom: .3rem;
}
.auth-card-header p { color: var(--text-2); font-size: .88rem; }

.auth-switch { margin-top: 1.35rem; color: var(--text-2); font-size: .84rem; text-align: center; }
.auth-demo {
  margin-top: 1.25rem; padding: .7rem .9rem;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r); font-size: .77rem; color: var(--text-2);
  font-family: var(--font-mono); line-height: 1.6;
}

/* ════════════════════════════════════════════════════════════ */
/* LAYOUT                                                        */
/* ════════════════════════════════════════════════════════════ */
.app-body { overflow: hidden; height: 100vh; }
.app-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto; overflow-x: hidden;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.15rem 1rem 1rem;
  font-family: var(--font-disp); font-weight: 700; font-size: .92rem; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-mark {
  width: 28px; height: 28px; border-radius: var(--r);
  background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.sidebar-section-label {
  font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3); padding: .9rem 1rem .3rem;
}

.sidebar-nav { padding: 0 .6rem; display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .52rem .72rem; border-radius: var(--r-md);
  color: var(--text-2); font-size: .84rem; font-weight: 400;
  transition: background var(--t), color var(--t);
  position: relative; cursor: pointer; user-select: none;
}
.nav-item:hover { background: var(--bg-4); color: var(--text); }
.nav-item.active {
  background: var(--bg-5); color: var(--text); font-weight: 500;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 28%; bottom: 28%;
  width: 2px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-item-icon {
  width: 28px; height: 28px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: inherit;
}
.nav-item:hover .nav-item-icon,
.nav-item.active .nav-item-icon { background: rgba(255,255,255,.05); }
.nav-item.active .nav-item-icon { color: var(--accent); }

.badge-count {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .6rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 .35rem; letter-spacing: 0; flex-shrink: 0;
}
.badge-count.purple { background: var(--purple); }
.badge-count.orange { background: var(--orange); }

.sidebar-footer {
  margin-top: auto; padding: .85rem .75rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
}

.user-chip { display: flex; align-items: center; gap: .55rem; flex: 1; overflow: hidden; }
.user-avatar {
  width: 30px; height: 30px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: var(--accent);
  background: rgba(200,245,66,.1); border: 1px solid rgba(200,245,66,.2);
  flex-shrink: 0;
}
.user-avatar.admin { color: var(--blue); background: rgba(59,158,255,.1); border-color: rgba(59,158,255,.2); }
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: .78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .67rem; color: var(--text-3); }

.logout-btn {
  padding: .38rem; color: var(--text-3); border-radius: var(--r);
  transition: color var(--t), background var(--t); cursor: pointer;
}
.logout-btn:hover { color: var(--red); background: rgba(255,77,77,.08); }

/* ── App Main ───────────────────────────────────────────────── */
.app-main { overflow-y: auto; height: 100vh; padding: 2rem 2.25rem; }

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.85rem; gap: 1rem;
}
.page-header-left { display: flex; flex-direction: column; gap: .2rem; }
.page-title { font-family: var(--font-disp); font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em; }
.page-sub { color: var(--text-2); font-size: .84rem; }
.page-header-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; flex-shrink: 0; }

.back-link {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--text-3); font-size: .78rem; margin-bottom: .25rem;
  transition: color var(--t);
}
.back-link:hover { color: var(--text-2); }

/* ════════════════════════════════════════════════════════════ */
/* FORMS                                                         */
/* ════════════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: .38rem; margin-bottom: 1.1rem; }
.field label { font-size: .77rem; font-weight: 500; color: var(--text-2); letter-spacing: .02em; }
.field-optional { font-size: .7rem; font-weight: 400; color: var(--text-3); }
.field-hint { font-size: .73rem; color: var(--text-3); margin-top: .15rem; line-height: 1.4; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel],
textarea, select,
.field input, .field textarea, .field select {
  background: var(--bg-3); border: 1px solid var(--border-2);
  color: var(--text); padding: .62rem .85rem;
  border-radius: var(--r); outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%; line-height: 1.5;
}
input:focus, textarea:focus, select:focus,
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(200,245,66,.35);
  box-shadow: 0 0 0 3px rgba(200,245,66,.06);
}
input:hover, textarea:hover, select:hover { border-color: var(--border-3); }
::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 80px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }

.input-with-btn { display: flex; gap: .5rem; align-items: flex-start; }
.input-with-btn input { flex: 1; }

.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-left: 2.4rem; }
.input-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }

.input-reveal { position: relative; }
.input-reveal input { padding-right: 2.6rem; }
.input-reveal-btn {
  position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer; padding: .2rem;
  transition: color var(--t);
}
.input-reveal-btn:hover { color: var(--text); }

/* ════════════════════════════════════════════════════════════ */
/* BUTTONS                                                       */
/* ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.25rem; border-radius: var(--r);
  font-weight: 500; font-size: .855rem; cursor: pointer; border: none;
  transition: all var(--t); white-space: nowrap; position: relative;
  letter-spacing: .01em;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* Loading state */
.btn.loading { pointer-events: none; }
.btn.loading::after {
  content: ''; width: 14px; height: 14px; border: 2px solid currentColor;
  border-top-color: transparent; border-radius: 50%; animation: spin .6s linear infinite;
}

.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-primary:hover { background: #d5f955; box-shadow: 0 0 20px rgba(200,245,66,.2); }

.btn-secondary {
  background: var(--bg-4); color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--bg-5); border-color: var(--border-3); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .75rem; background: transparent; color: var(--text-2);
  border: 1px solid var(--border-2); border-radius: var(--r);
  font-size: .82rem; font-weight: 450; cursor: pointer; transition: all var(--t);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-3); background: var(--bg-3); }

.btn-danger { background: rgba(255,77,77,.1); color: var(--red); border: 1px solid rgba(255,77,77,.2); }
.btn-danger:hover { background: rgba(255,77,77,.18); }

.btn-full { width: 100%; justify-content: center; }

.btn-xs {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .24rem .6rem; font-size: .72rem; font-weight: 500;
  background: var(--bg-4); color: var(--text-2); border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer; transition: all var(--t);
  text-decoration: none; letter-spacing: 0;
}
.btn-xs:hover { color: var(--text); border-color: var(--border-2); background: var(--bg-5); }
.btn-xs.accent { background: rgba(200,245,66,.07); color: var(--accent); border-color: rgba(200,245,66,.2); }
.btn-xs.accent:hover { background: rgba(200,245,66,.13); }
.btn-xs.red { color: var(--red); border-color: rgba(255,77,77,.2); background: rgba(255,77,77,.05); }
.btn-xs.red:hover { background: rgba(255,77,77,.1); }
.btn-xs.purple { color: var(--purple); border-color: rgba(157,124,244,.2); background: rgba(157,124,244,.06); }
.btn-xs.purple:hover { background: rgba(157,124,244,.12); }

.btn-sm {
  padding: .42rem .9rem; font-size: .82rem; font-weight: 500;
  border-radius: var(--r); cursor: pointer; border: none; transition: all var(--t);
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn-confirm { background: var(--accent); color: #000; font-weight: 600; }
.btn-confirm:hover { background: #d5f955; }
.btn-cancel-task { background: var(--bg-5); color: var(--text-2); border: 1px solid var(--border-2); }
.btn-cancel-task:hover { color: var(--text); }

/* ════════════════════════════════════════════════════════════ */
/* BADGES                                                        */
/* ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .52rem; border-radius: var(--r);
  font-size: .67rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.badge-pending  { background: rgba(255,159,10,.08);  color: var(--orange); }
.badge-pending::before  { background: var(--orange); }
.badge-progress { background: rgba(59,158,255,.08);  color: var(--blue); }
.badge-progress::before { background: var(--blue); }
.badge-review   { background: rgba(157,124,244,.08); color: var(--purple); }
.badge-review::before   { background: var(--purple); }
.badge-done     { background: rgba(48,209,88,.08);   color: var(--green); }
.badge-done::before     { background: var(--green); }
.badge-high     { background: rgba(255,77,77,.08);   color: var(--red); }
.badge-high::before     { background: var(--red); }
.badge-medium   { background: rgba(255,159,10,.08);  color: var(--orange); }
.badge-medium::before   { background: var(--orange); }
.badge-low      { background: rgba(74,74,74,.15);    color: var(--text-3); }
.badge-low::before      { background: var(--text-3); }
.badge-new      { background: rgba(255,77,77,.08);   color: var(--red); }
.badge-new::before      { background: var(--red); }
.badge-contacted { background: rgba(59,158,255,.08); color: var(--blue); }
.badge-contacted::before { background: var(--blue); }
.badge-closed   { background: rgba(74,74,74,.15);    color: var(--text-3); }
.badge-closed::before   { background: var(--text-3); }

/* ════════════════════════════════════════════════════════════ */
/* DATA TABLE                                                    */
/* ════════════════════════════════════════════════════════════ */
.data-table-wrap {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: .855rem; }
.data-table thead { background: var(--bg-3); border-bottom: 1px solid var(--border); }
.data-table th {
  padding: .72rem .95rem; text-align: left;
  font-size: .65rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); white-space: nowrap;
}
.data-table td { padding: .78rem .95rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--t); }
.data-table tbody tr:hover { background: rgba(255,255,255,.02); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: rgba(255,255,255,.03); }

.td-id { color: var(--text-3); font-family: var(--font-mono); font-size: .72rem; width: 52px; }
.td-title { max-width: 280px; }
.td-date { color: var(--text-3); font-size: .78rem; white-space: nowrap; }
.td-empty { text-align: center; color: var(--text-3); padding: 3.5rem; font-size: .84rem; }

.type-tag {
  display: inline-block; padding: .14rem .44rem;
  background: var(--bg-4); border: 1px solid var(--border);
  border-radius: var(--r); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; color: var(--text-2); font-family: var(--font-mono);
  text-transform: uppercase;
}

/* Clickable select inline */
.select-inline {
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--text);
  padding: .28rem .6rem; border-radius: var(--r); font-size: .79rem;
  cursor: pointer; outline: none; transition: border-color var(--t); width: auto;
}
.select-inline:hover { border-color: var(--border-3); }
.select-inline:focus { border-color: rgba(200,245,66,.35); }

/* ════════════════════════════════════════════════════════════ */
/* STAT / KPI CARDS                                              */
/* ════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-2); padding: 1.2rem 1.4rem;
  display: flex; align-items: flex-start; gap: .9rem;
  transition: background var(--t);
}
.stat-card:hover { background: var(--bg-3); }
.stat-icon {
  width: 36px; height: 36px; border-radius: var(--r);
  background: var(--bg-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-2);
}
.stat-icon.orange { color: var(--orange); background: rgba(255,159,10,.07); border-color: rgba(255,159,10,.2); }
.stat-icon.blue   { color: var(--blue);   background: rgba(59,158,255,.07);  border-color: rgba(59,158,255,.2); }
.stat-icon.purple { color: var(--purple); background: rgba(157,124,244,.07); border-color: rgba(157,124,244,.2); }
.stat-icon.green  { color: var(--green);  background: rgba(48,209,88,.07);   border-color: rgba(48,209,88,.2); }
.stat-icon.red    { color: var(--red);    background: rgba(255,77,77,.07);   border-color: rgba(255,77,77,.2); }
.stat-icon.accent { color: var(--accent); background: var(--accent-glow);    border-color: rgba(200,245,66,.2); }

.stat-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.stat-value { font-family: var(--font-disp); font-size: 1.55rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .72rem; color: var(--text-2); }

/* ════════════════════════════════════════════════════════════ */
/* SECTION HEADER                                                */
/* ════════════════════════════════════════════════════════════ */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; }
.section-header h2 { font-family: var(--font-disp); font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.link-more { font-size: .79rem; color: var(--text-3); transition: color var(--t); }
.link-more:hover { color: var(--accent); }

/* ════════════════════════════════════════════════════════════ */
/* FILTER BAR                                                    */
/* ════════════════════════════════════════════════════════════ */
.filter-bar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.filter-input {
  width: 220px; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); padding: .5rem .85rem; border-radius: var(--r);
  font-size: .84rem; outline: none; transition: border-color var(--t);
}
.filter-input:focus { border-color: rgba(200,245,66,.3); }
.filter-select {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: .5rem .85rem; border-radius: var(--r); font-size: .84rem;
  cursor: pointer; outline: none; transition: border-color var(--t); width: auto;
}
.filter-select:focus { border-color: rgba(200,245,66,.3); }

/* ════════════════════════════════════════════════════════════ */
/* ALERT INLINE                                                  */
/* ════════════════════════════════════════════════════════════ */
.alert {
  padding: .72rem .95rem; border-radius: var(--r);
  font-size: .84rem; margin-bottom: 1.1rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-error   { background: rgba(255,77,77,.07);  border: 1px solid rgba(255,77,77,.18);  color: #ff8888; }
.alert-success { background: rgba(48,209,88,.07);  border: 1px solid rgba(48,209,88,.18);  color: #6ed88a; }
.alert-info    { background: rgba(59,158,255,.07); border: 1px solid rgba(59,158,255,.18); color: #88bfff; }
.alert-warning { background: rgba(255,159,10,.07); border: 1px solid rgba(255,159,10,.18); color: #ffb84d; }

/* ════════════════════════════════════════════════════════════ */
/* TASK CARDS (client grid)                                      */
/* ════════════════════════════════════════════════════════════ */
.tasks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: .9rem; }

.task-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.2rem;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t2);
  cursor: pointer;
}
.task-card:hover {
  border-color: var(--border-3);
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  transform: translateY(-2px);
}

.task-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; gap: .5rem; }
.task-type-label { font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-family: var(--font-mono); }

.task-card-title { font-size: .92rem; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: .75rem; }

.task-prog-bar { height: 2px; background: var(--bg-6); border-radius: 1px; overflow: hidden; margin-bottom: .8rem; }
.task-prog-fill { height: 100%; border-radius: 1px; transition: width .5s ease; }

.task-card-meta { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .8rem; }
.task-meta-item {
  display: flex; align-items: center; gap: .3rem;
  font-size: .75rem; color: var(--text-2);
}
.task-meta-item svg { color: var(--text-3); flex-shrink: 0; }
.task-meta-item.accent { color: var(--accent); }

.task-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: .72rem; border-top: 1px solid var(--border);
}
.task-date { font-size: .72rem; color: var(--text-3); }

/* Unread badge on card */
.unread-pill {
  display: inline-flex; align-items: center; gap: .28rem;
  padding: .1rem .42rem; background: rgba(200,245,66,.1);
  border: 1px solid rgba(200,245,66,.2); border-radius: 8px;
  color: var(--accent); font-size: .63rem; font-weight: 700;
}

/* ════════════════════════════════════════════════════════════ */
/* EMPTY STATE                                                   */
/* ════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .9rem; min-height: 400px; text-align: center; padding: 3rem;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: var(--r-lg);
  background: var(--bg-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); margin-bottom: .4rem;
}
.empty-state h3 { font-family: var(--font-disp); font-size: 1.2rem; font-weight: 700; color: var(--text); }
.empty-state p { font-size: .875rem; max-width: 300px; color: var(--text-2); line-height: 1.65; }

/* ════════════════════════════════════════════════════════════ */
/* DETAIL LAYOUT                                                 */
/* ════════════════════════════════════════════════════════════ */
.detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.35rem; align-items: start; }
.detail-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.4rem; margin-bottom: 1.1rem;
}
.detail-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.2rem; gap: .5rem;
}
.detail-card-header h3 {
  font-family: var(--font-disp); font-size: .9rem; font-weight: 700;
  display: flex; align-items: center; gap: .5rem; letter-spacing: -.01em;
}
.detail-card-header h3 svg { color: var(--text-3); }

.req-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .84rem;
}
.req-row:last-child { border-bottom: none; padding-bottom: 0; }
.req-key { color: var(--text-2); flex-shrink: 0; }
.req-val { color: var(--text); text-align: right; font-weight: 500; word-break: break-word; }

/* ════════════════════════════════════════════════════════════ */
/* STATUS TIMELINE                                               */
/* ════════════════════════════════════════════════════════════ */
.status-timeline { display: flex; flex-direction: column; }
.st-step { display: flex; align-items: center; gap: .7rem; padding: .52rem 0; font-size: .84rem; color: var(--text-3); position: relative; }
.st-step:not(:last-child)::after {
  content: ''; position: absolute; left: 9px; top: calc(50% + 9px);
  width: 1px; height: calc(100% - 6px); background: var(--border);
}
.st-dot {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-2);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 1; transition: all var(--t);
}
.st-done .st-dot  { background: var(--green); border-color: var(--green); color: #000; }
.st-done          { color: var(--text-2); }
.st-current .st-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(200,245,66,.3); }
.st-current       { color: var(--text); font-weight: 600; }

/* ════════════════════════════════════════════════════════════ */
/* THREAD / COMMENTS                                             */
/* ════════════════════════════════════════════════════════════ */
.thread-wrap {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; background: var(--bg-2); margin-bottom: 1.1rem;
}
.thread-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.15rem; border-bottom: 1px solid var(--border);
  background: var(--bg-3); flex-shrink: 0;
}
.thread-header h3 {
  font-family: var(--font-disp); font-size: .9rem; font-weight: 700;
  display: flex; align-items: center; gap: .48rem;
}
.thread-header h3 svg { color: var(--text-3); }
.thread-count { font-size: .71rem; color: var(--text-3); }

.thread-messages {
  overflow-y: auto; padding: 1rem 1.15rem;
  display: flex; flex-direction: column; gap: .8rem;
  max-height: 420px; min-height: 80px;
}

.thread-empty, .thread-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem; padding: 2.5rem; color: var(--text-3); font-size: .82rem;
  text-align: center; min-height: 80px;
}

.thread-msg { display: flex; gap: .65rem; }
.thread-avatar {
  width: 28px; height: 28px; border-radius: var(--r); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .67rem; font-weight: 700; margin-top: .1rem;
}
.ta-client { background: var(--bg-5); border: 1px solid var(--border-2); color: var(--text-2); }
.ta-admin  { background: rgba(200,245,66,.1); border: 1px solid rgba(200,245,66,.2); color: var(--accent); }
.ta-system { background: var(--bg-4); border: 1px solid var(--border); color: var(--text-3); }

.thread-msg-inner { flex: 1; min-width: 0; }
.thread-msg-meta { display: flex; align-items: center; gap: .42rem; margin-bottom: .28rem; flex-wrap: wrap; }
.thread-author { font-size: .77rem; font-weight: 600; color: var(--text); }
.thread-team-tag {
  font-size: .6rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: rgba(200,245,66,.08);
  padding: .07rem .3rem; border-radius: var(--r); border: 1px solid rgba(200,245,66,.15);
}
.thread-sys-tag {
  font-size: .6rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); background: var(--bg-4);
  padding: .07rem .3rem; border-radius: var(--r); border: 1px solid var(--border);
}
.thread-time { font-size: .69rem; color: var(--text-3); margin-left: auto; }

.thread-msg-body {
  font-size: .855rem; color: var(--text-2); line-height: 1.58;
  padding: .62rem .9rem;
  border-radius: 0 var(--r-md) var(--r-md) var(--r-md);
}
.thread-msg-body.normal { background: var(--bg-3); border: 1px solid var(--border); }
.thread-msg-body.admin-msg { background: rgba(200,245,66,.04); border: 1px solid rgba(200,245,66,.1); color: var(--text); }
.thread-msg-body.sys { background: var(--bg-3); border: 1px solid var(--border); font-size: .79rem; color: var(--text-3); font-style: italic; }

.thread-composer {
  padding: .9rem 1.15rem;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.thread-input-row {
  display: flex; align-items: flex-end; gap: .45rem;
  background: var(--bg-3); border: 1px solid var(--border-2);
  border-radius: var(--r-md); padding: .42rem .5rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.thread-input-row:focus-within {
  border-color: rgba(200,245,66,.3);
  box-shadow: 0 0 0 3px rgba(200,245,66,.05);
}
.thread-input-row textarea {
  flex: 1; background: none; border: none; outline: none; box-shadow: none;
  color: var(--text); font-size: .875rem; padding: .35rem .5rem;
  resize: none; max-height: 120px; line-height: 1.5; min-height: 36px; width: 100%;
}
.thread-send-btn {
  width: 34px; height: 34px; background: var(--accent); color: #000;
  border: none; border-radius: var(--r); display: flex; align-items: center;
  justify-content: center; cursor: pointer; flex-shrink: 0;
  transition: background var(--t), transform var(--t);
}
.thread-send-btn:hover { background: #d5f955; }
.thread-send-btn:active { transform: scale(.95); }
.thread-send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════ */
/* FILE UPLOAD                                                   */
/* ════════════════════════════════════════════════════════════ */
.upload-zone {
  border: 1.5px dashed var(--border-2); border-radius: var(--r-lg);
  padding: 1.85rem; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  color: var(--text-2); transition: all var(--t);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent); background: var(--accent-glow); color: var(--text);
}
.upload-zone-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: var(--bg-4); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); margin-bottom: .3rem;
  transition: all var(--t);
}
.upload-zone:hover .upload-zone-icon, .upload-zone.drag-over .upload-zone-icon {
  background: var(--accent-glow); border-color: rgba(200,245,66,.25); color: var(--accent);
}
.upload-zone p  { font-size: .875rem; font-weight: 500; }
.upload-zone span { font-size: .74rem; color: var(--text-3); }

.prog-bar-wrap { margin-top: .6rem; }
.prog-bar { height: 3px; background: var(--bg-6); border-radius: 2px; overflow: hidden; margin-bottom: .3rem; }
.prog-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .25s ease; }

.admin-files-list { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.admin-file-row {
  display: flex; align-items: center; gap: .72rem;
  padding: .62rem .85rem; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r); transition: border-color var(--t);
}
.admin-file-row:hover { border-color: var(--border-2); }
.admin-file-thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: var(--r);
  border: 1px solid var(--border); flex-shrink: 0;
}
.admin-file-icon {
  width: 44px; height: 44px; background: var(--bg-4); border: 1px solid var(--border);
  border-radius: var(--r); display: flex; align-items: center; justify-content: center;
  color: var(--text-3); flex-shrink: 0;
}
.admin-file-info { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: .12rem; }
.file-name { font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: .7rem; color: var(--text-3); }
.file-label-tag { font-size: .62rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.admin-file-actions { display: flex; gap: .35rem; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════ */
/* FILE PREVIEWS (client)                                        */
/* ════════════════════════════════════════════════════════════ */
.files-preview-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap: .85rem; min-height: 100px;
}
.files-empty, .files-loading {
  grid-column: 1/-1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .7rem;
  padding: 3rem; color: var(--text-3); font-size: .84rem; text-align: center;
}
.file-preview-card {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; transition: border-color var(--t), transform var(--t2);
}
.file-preview-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.file-label-bar {
  padding: .35rem .75rem; font-size: .67rem; font-weight: 700; color: var(--accent);
  background: rgba(200,245,66,.06); border-bottom: 1px solid rgba(200,245,66,.1);
  text-transform: uppercase; letter-spacing: .04em;
}
.file-img-wrap {
  position: relative; aspect-ratio: 4/3; overflow: hidden;
  cursor: pointer; background: var(--bg-5);
}
.file-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.file-img-wrap:hover img { transform: scale(1.05); }
.file-img-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--t); color: #fff;
}
.file-img-wrap:hover .file-img-overlay { opacity: 1; }
.file-meta { padding: .65rem .75rem; }
.file-actions { display: flex; align-items: center; justify-content: space-between; margin-top: .35rem; }

.file-doc-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.1rem; display: flex; flex-direction: column; align-items: center;
  gap: .45rem; text-align: center;
}
.file-doc-icon { color: var(--text-3); }

/* ════════════════════════════════════════════════════════════ */
/* LIGHTBOX                                                      */
/* ════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 9998;
  display: none; align-items: center; justify-content: center; padding: 2rem;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 90vh; object-fit: contain; border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.lightbox-close {
  position: absolute; top: 1.1rem; right: 1.1rem;
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--text);
  width: 36px; height: 36px; border-radius: var(--r); display: flex;
  align-items: center; justify-content: center; cursor: pointer; transition: all var(--t);
}
.lightbox-close:hover { background: var(--bg-4); }

/* ════════════════════════════════════════════════════════════ */
/* SETTINGS & FORM PAGES                                         */
/* ════════════════════════════════════════════════════════════ */
.settings-wrap { max-width: 720px; }
.form-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.85rem; margin-bottom: 1.1rem;
}
.form-card-header { margin-bottom: 1.35rem; }
.form-card-header h3 {
  font-family: var(--font-disp); font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem;
}
.form-card-header p { color: var(--text-2); font-size: .84rem; line-height: 1.6; }

/* ════════════════════════════════════════════════════════════ */
/* CHAT HISTORY (Admin 3-panel)                                  */
/* ════════════════════════════════════════════════════════════ */
.ch-app {
  display: grid; grid-template-columns: 200px 200px 1fr; gap: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; min-height: 620px;
}
.ch-panel { border-right: 1px solid var(--border); overflow-y: auto; }
.ch-panel:last-child { border-right: none; }
.ch-panel-head {
  padding: .7rem .9rem; font-size: .66rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--border); background: var(--bg-3);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.ch-client-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .72rem .9rem; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--t);
}
.ch-client-row:hover { background: var(--bg-3); }
.ch-client-row.active { background: var(--bg-4); }
.ch-client-info { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: .08rem; }
.ch-client-name { font-size: .82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-client-email { font-size: .69rem; color: var(--text-3); }
.ch-time { font-size: .64rem; color: var(--text-3); flex-shrink: 0; }

.ch-conv-item {
  padding: .72rem .9rem; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--t);
}
.ch-conv-item:hover { background: var(--bg-3); }
.ch-conv-item.active { background: var(--bg-4); }
.ch-conv-title { font-size: .81rem; font-weight: 500; margin-bottom: .18rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-conv-meta { font-size: .68rem; color: var(--text-3); display: flex; gap: .4rem; }
.ch-conv-preview { font-size: .72rem; color: var(--text-2); margin-top: .12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ch-msgs-pane { display: flex; flex-direction: column; overflow: hidden; }
.ch-msgs-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1.15rem; border-bottom: 1px solid var(--border);
  background: var(--bg-3); flex-shrink: 0;
}
.ch-msgs-scroll { flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: .8rem; }

.ch-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: .6rem; color: var(--text-3); font-size: .83rem; text-align: center; padding: 2rem;
}

.ch-msg-row { display: flex; gap: .52rem; max-width: 78%; }
.ch-msg-row.user { align-self: flex-end; flex-direction: row-reverse; margin-left: auto; }
.ch-msg-av {
  width: 24px; height: 24px; border-radius: var(--r); flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center; font-size: .63rem; font-weight: 700;
}
.ch-av-user { background: var(--bg-5); border: 1px solid var(--border-2); color: var(--text-2); }
.ch-av-ai   { background: var(--bg-3); border: 1px solid var(--border);   color: var(--accent); }
.ch-msg-inner { flex: 1; min-width: 0; }
.ch-msg-who { font-size: .67rem; color: var(--text-3); margin-bottom: .2rem; }
.ch-msg-bub {
  padding: .6rem .88rem; font-size: .845rem; line-height: 1.55; word-break: break-word;
  border-radius: var(--r-md);
}
.ch-msg-row.user .ch-msg-bub { background: var(--bg-4); border: 1px solid var(--border); border-radius: var(--r-md) var(--r-md) 0 var(--r-md); }
.ch-msg-row.ai   .ch-msg-bub { background: var(--bg-3); border: 1px solid var(--border); border-radius: 0 var(--r-md) var(--r-md) var(--r-md); }

.ch-date-sep { display: flex; align-items: center; gap: .65rem; }
.ch-date-sep::before, .ch-date-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.ch-date-sep span { font-size: .67rem; color: var(--text-3); padding: 0 .25rem; }

.ch-task-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .6rem; background: rgba(200,245,66,.07);
  border: 1px solid rgba(200,245,66,.2); border-radius: var(--r);
  font-size: .72rem; color: var(--accent); font-weight: 600; margin-top: .35rem;
}

.client-avatar {
  width: 30px; height: 30px; border-radius: var(--r); background: var(--bg-4);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.client-avatar.sm { width: 26px; height: 26px; font-size: .63rem; }
.client-name-cell { display: flex; align-items: center; gap: .55rem; }

/* ════════════════════════════════════════════════════════════ */
/* PROMPTS EDITOR                                                */
/* ════════════════════════════════════════════════════════════ */
.prompts-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.prompt-item { display: flex; gap: .65rem; align-items: flex-start; }
.prompt-num {
  width: 22px; height: 22px; border-radius: var(--r); background: var(--bg-4); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: .63rem; font-weight: 700;
  color: var(--text-3); flex-shrink: 0; margin-top: .28rem;
}
.prompt-text { flex: 1; font-size: .79rem; font-family: var(--font-mono); }

/* ════════════════════════════════════════════════════════════ */
/* INLINE MISC                                                   */
/* ════════════════════════════════════════════════════════════ */
.phone-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--text); font-size: .84rem; }
.phone-link:hover { color: var(--accent); }
.dim-text { color: var(--text-3); font-size: .84rem; }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }

.spin-ring {
  width: 22px; height: 22px; border: 2px solid var(--border-2);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .65s linear infinite;
}
.spin-sm {
  width: 14px; height: 14px; border-width: 1.5px; display: inline-block;
  border: 1.5px solid var(--border-2); border-top-color: currentColor;
  border-radius: 50%; animation: spin .65s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════ */
/* CHAT APP                                                      */
/* ════════════════════════════════════════════════════════════ */
.chat-page-body { overflow: hidden; height: 100vh; background: var(--bg); }
.chat-app { display: grid; grid-template-columns: 252px 1fr; height: 100vh; overflow: hidden; }

/* Chat sidebar */
.chat-sidebar {
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}
.chat-sidebar-top { padding: .8rem .8rem .55rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .5rem; }
.chat-brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-disp); font-weight: 700; font-size: .9rem; color: var(--text);
}
.chat-brand-mark { width: 26px; height: 26px; border-radius: var(--r); background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.new-chat-btn {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .52rem .75rem; background: var(--accent); border: none; border-radius: var(--r);
  color: #000; font-size: .81rem; font-weight: 600; cursor: pointer;
  transition: background var(--t), box-shadow var(--t); width: 100%;
}
.new-chat-btn:hover { background: #d5f955; box-shadow: 0 0 14px rgba(200,245,66,.2); }
.new-chat-btn:active { transform: scale(.98); }

.chat-nav-section { padding: .48rem .78rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.chat-nav-link {
  display: flex; align-items: center; gap: .5rem;
  padding: .44rem .6rem; border-radius: var(--r);
  color: var(--text-2); font-size: .81rem; transition: all var(--t);
}
.chat-nav-link:hover { background: var(--bg-3); color: var(--text); }

.conv-section-label {
  font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); padding: .72rem .8rem .28rem;
}
.conv-list { flex: 1; overflow-y: auto; padding: 0 .42rem .5rem; }
.conv-item {
  display: flex; align-items: center; gap: .45rem; padding: .52rem .6rem;
  border-radius: var(--r-md); cursor: pointer; transition: background var(--t);
}
.conv-item:hover { background: var(--bg-3); }
.conv-item.active { background: var(--bg-4); }
.conv-item:hover .conv-del { opacity: 1; }
.conv-icon { color: var(--text-3); flex-shrink: 0; }
.conv-item.active .conv-icon { color: var(--accent); }
.conv-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: .07rem; }
.conv-title { font-size: .8rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: .7rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-del {
  background: none; border: none; color: var(--text-3); cursor: pointer; padding: .22rem;
  border-radius: var(--r); opacity: 0; transition: all var(--t); flex-shrink: 0;
}
.conv-del:hover { color: var(--red); background: rgba(255,77,77,.08); }
.conv-empty-msg { padding: 1.2rem .7rem; font-size: .78rem; color: var(--text-3); text-align: center; line-height: 1.7; }
.conv-skeleton { height: 42px; background: var(--bg-3); border-radius: var(--r-md); margin: .3rem 0; animation: shimmer 1.6s ease-in-out infinite; }
@keyframes shimmer { 0%,100%{opacity:.3} 50%{opacity:.65} }
.chat-sidebar-foot { padding: .8rem; border-top: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }

/* Chat area */
.chat-area { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--bg); }
.chat-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; min-height: 54px;
}
.chat-topbar-l { display: flex; align-items: center; gap: .65rem; }
.chat-topbar-r { display: flex; align-items: center; gap: .35rem; }
.mobile-menu { display: none; background: none; border: none; color: var(--text-2); cursor: pointer; padding: .3rem; }
.ai-indicator { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; }
.ai-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 2px rgba(48,209,88,.2); animation: aiGlow 2.5s ease-in-out infinite;
}
@keyframes aiGlow { 0%,100%{box-shadow:0 0 0 2px rgba(48,209,88,.2)} 50%{box-shadow:0 0 0 5px rgba(48,209,88,.04)} }
.conv-title-display { color: var(--text); font-weight: 500; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1.35rem 1.5rem; display: flex; flex-direction: column; gap: .9rem; }

/* Welcome */
.chat-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; gap: .8rem; padding: 2rem; }
.welcome-mark { width: 52px; height: 52px; border-radius: var(--r-lg); background: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: .5rem; }
.chat-welcome h2 { font-family: var(--font-disp); font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.chat-welcome p { color: var(--text-2); font-size: .9rem; max-width: 360px; }
.welcome-chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .6rem; max-width: 520px; }
.wchip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .95rem; background: var(--bg-3); border: 1px solid var(--border-2);
  border-radius: var(--r-xl); color: var(--text-2); font-size: .8rem; cursor: pointer;
  transition: all var(--t);
}
.wchip:hover { background: var(--bg-4); color: var(--text); border-color: var(--border-3); }

/* Messages */
.msg-date-sep { display: flex; align-items: center; gap: .75rem; }
.msg-date-sep::before, .msg-date-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.msg-date-sep span { font-size: .69rem; color: var(--text-3); white-space: nowrap; padding: 0 .3rem; }

.msg { display: flex; align-items: flex-start; gap: .55rem; max-width: 78%; animation: msgIn .18s ease; }
@keyframes msgIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.msg-user { align-self: flex-end; flex-direction: row-reverse; margin-left: auto; }
.msg-ai   { align-self: flex-start; }
.msg-ai-av {
  width: 26px; height: 26px; border-radius: var(--r); flex-shrink: 0; margin-top: 2px;
  background: var(--bg-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.msg-bubble {
  padding: .7rem 1rem; border-radius: var(--r-lg); font-size: .875rem;
  line-height: 1.58; word-break: break-word; max-width: 100%;
}
.msg-user .msg-bubble {
  background: var(--accent); color: #000; font-weight: 450;
  border-radius: var(--r-lg) var(--r-lg) 2px var(--r-lg);
}
.msg-ai .msg-bubble {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 2px var(--r-lg) var(--r-lg) var(--r-lg);
}
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; opacity: .85; }
.msg-bubble code {
  font-family: var(--font-mono); font-size: .82em;
  background: rgba(255,255,255,.07); padding: .1rem .3rem; border-radius: 3px;
}
.msg-bubble a { color: var(--blue); text-decoration: underline; text-decoration-color: rgba(59,158,255,.4); }

/* Typing dots */
.typing-indicator .msg-bubble { padding: .75rem 1rem; }
.typing-dots { display: flex; gap: 4px; align-items: center; height: 14px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
  animation: typeDot .8s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes typeDot { 0%,80%,100%{transform:scale(1);opacity:.4} 40%{transform:scale(1.4);opacity:1} }

/* Task ready card */
.task-ready-card {
  margin-top: .7rem; background: var(--bg-2);
  border: 1px solid rgba(200,245,66,.25); border-radius: var(--r-md); overflow: hidden;
}
.task-ready-hdr {
  display: flex; align-items: center; gap: .45rem;
  padding: .62rem .95rem; background: rgba(200,245,66,.06); color: var(--accent);
  font-size: .77rem; font-weight: 700; border-bottom: 1px solid rgba(200,245,66,.12);
  letter-spacing: .04em; text-transform: uppercase;
}
.task-ready-rows { padding: .8rem .95rem; display: flex; flex-direction: column; gap: .45rem; }
.trd-row { display: flex; justify-content: space-between; align-items: center; font-size: .835rem; gap: .75rem; }
.trd-row span { color: var(--text-2); }
.trd-row strong { color: var(--text); font-weight: 600; }
.task-ready-foot {
  padding: .55rem .95rem .65rem; font-size: .78rem; color: var(--text-2);
  border-top: 1px solid var(--border); background: var(--bg-3);
}
.task-ready-foot strong { color: var(--accent); }

/* Task confirm bar */
.task-confirm-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .72rem 1.5rem; background: var(--bg-3);
  border-top: 1px solid rgba(200,245,66,.15); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.task-confirm-info { display: flex; align-items: center; gap: .5rem; font-size: .845rem; color: var(--accent); font-weight: 500; }
.task-confirm-acts { display: flex; gap: .45rem; }

/* Task created notice */
.task-created-notice {
  display: flex; align-items: center; gap: .5rem; align-self: center;
  padding: .5rem 1.1rem; background: rgba(48,209,88,.06);
  border: 1px solid rgba(48,209,88,.18); border-radius: var(--r-xl);
  font-size: .82rem; color: var(--green);
}
.task-created-notice a { color: var(--green); font-weight: 600; margin-left: .35rem; text-decoration: underline; }

/* Spinners in chat */
.msg-spinner { display: flex; justify-content: center; padding: 1.5rem; }
.conv-hint {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 2rem 1rem; color: var(--text-3); font-size: .83rem; text-align: center;
}

/* Chat Input */
.chat-input-area { padding: .7rem 1.5rem 1rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.attach-preview-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .45rem .6rem .1rem; }
.attach-thumb {
  position: relative; width: 54px; height: 54px; border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden; flex-shrink: 0; background: var(--bg-5);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb-del {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: rgba(0,0,0,.8); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 10px; line-height: 1; border: none; transition: background var(--t);
}
.attach-thumb-del:hover { background: var(--red); }
.attach-add-btn {
  width: 54px; height: 54px; border-radius: var(--r); border: 1.5px dashed var(--border-2);
  background: var(--bg-3); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .2rem; cursor: pointer; color: var(--text-3); font-size: .6rem;
  transition: all var(--t); flex-shrink: 0;
}
.attach-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.chat-input-box {
  display: flex; align-items: flex-end; gap: .45rem;
  background: var(--bg-3); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); padding: .45rem .5rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.chat-input-box:focus-within {
  border-color: rgba(200,245,66,.3);
  box-shadow: 0 0 0 3px rgba(200,245,66,.05);
}
#chatInput {
  flex: 1; background: none; border: none; outline: none; box-shadow: none;
  color: var(--text); font-size: .9rem; padding: .38rem .65rem;
  resize: none; max-height: 160px; line-height: 1.55; min-height: 36px;
}
#chatInput::placeholder { color: var(--text-3); }
.chat-input-btns { display: flex; align-items: flex-end; gap: .25rem; }
.input-btn {
  width: 36px; height: 36px; border-radius: var(--r); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t); flex-shrink: 0;
}
.attach-btn { background: var(--bg-4); color: var(--text-2); }
.attach-btn:hover { background: var(--bg-5); color: var(--text); }
.attach-btn.has-files { color: var(--accent); background: rgba(200,245,66,.1); }
.mic-btn { background: var(--bg-4); color: var(--text-2); }
.mic-btn:hover { background: var(--bg-5); color: var(--text); }
.mic-btn.listening { background: rgba(255,77,77,.12); color: var(--red); animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 0%,100%{box-shadow:0 0 0 0 rgba(255,77,77,.2)} 50%{box-shadow:0 0 0 5px rgba(255,77,77,.0)} }
.send-btn { background: var(--accent); color: #000; }
.send-btn:hover { background: #d5f955; box-shadow: 0 0 12px rgba(200,245,66,.2); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }
.chat-hint-text { font-size: .7rem; color: var(--text-3); margin-top: .42rem; text-align: center; }

/* Image messages */
.msg-attachments { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.msg-img-thumb {
  width: 140px; height: 105px; object-fit: cover; border-radius: var(--r-md);
  cursor: pointer; border: 1px solid rgba(255,255,255,.1);
  transition: transform .2s ease; display: block;
}
.msg-img-thumb:hover { transform: scale(1.03); }

/* Drag over chat */
.chat-area.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }

/* Chat lightbox */
#chatLightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 9999;
  display: none; align-items: center; justify-content: center; padding: 1.5rem;
}
#chatLightbox.open { display: flex; }
#chatLightbox img { max-width: 92vw; max-height: 90vh; object-fit: contain; border-radius: var(--r-md); }
.lb-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--text);
  width: 36px; height: 36px; border-radius: var(--r); display: flex;
  align-items: center; justify-content: center; cursor: pointer; transition: background var(--t);
}
.lb-close:hover { background: var(--bg-4); }

/* ════════════════════════════════════════════════════════════ */
/* QUICK STATUS BAR (admin task)                                 */
/* ════════════════════════════════════════════════════════════ */
.quick-status-bar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .85rem 1.25rem; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 1.25rem;
}
.qs-step {
  display: flex; align-items: center; gap: .5rem;
  padding: .42rem .85rem; border-radius: var(--r);
  font-size: .79rem; font-weight: 500; cursor: pointer; border: 1px solid transparent;
  transition: all var(--t);
}
.qs-step:hover { background: var(--bg-4); }
.qs-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.qs-arrow { color: var(--text-3); flex-shrink: 0; }
.qs-saved { font-size: .75rem; color: var(--green); margin-left: auto; animation: fadeIn .3s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ════════════════════════════════════════════════════════════ */
/* RESPONSIVE                                                    */
/* ════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .auth-left  { display: none; }
  .auth-wrap  { grid-template-columns: 1fr; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar    { display: none; }
  .app-main   { padding: 1.2rem; }
  .detail-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .tasks-grid  { grid-template-columns: 1fr; }
  .ch-app { grid-template-columns: 1fr; min-height: auto; }
}

@media (max-width: 760px) {
  .chat-app { grid-template-columns: 1fr; }
  .chat-sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0; width: 252px;
    z-index: 200; transition: left .25s ease; box-shadow: var(--shadow-lg);
  }
  .chat-sidebar.open { left: 0; }
  .mobile-menu { display: flex; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .task-confirm-bar { flex-direction: column; align-items: flex-start; }
  .welcome-chips { flex-direction: column; align-items: stretch; }
  .quick-status-bar { flex-direction: column; align-items: flex-start; }
}
