/* ══════════════════════════════════════════════════════════
   أظلال AI — Design System
   ══════════════════════════════════════════════════════════ */

/* ─── Tokens ─── */
:root {
  /* Brand */
  --accent:        #16a34a;
  --accent-2:      #22c55e;
  --accent-mid:    #15803d;
  --accent-strong: #166534;
  --accent-soft:   #dcfce7;
  --accent-glow:   rgba(22,163,74,.15);

  /* Surface */
  --bg:      #f8fafc;
  --panel:   #ffffff;
  --panel-2: #f1f5f9;
  --panel-3: #e8f0fe;
  --border:  #e2e8f0;
  --border-2:#cbd5e1;

  /* Text */
  --text:        #0f172a;
  --text-2:      #334155;
  --muted:       #64748b;
  --muted-light: #94a3b8;

  /* Feedback */
  --error:      #dc2626;
  --error-soft: #fee2e2;
  --warn:       #d97706;
  --warn-soft:  #fef3c7;
  --info:       #0284c7;
  --info-soft:  #e0f2fe;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08);
  --shadow-card: 0 2px 8px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.12);
  --shadow-xl:   0 20px 48px rgba(0,0,0,.18);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Layout */
  --sidebar-w:  280px;
  --tools-w:    260px;
  --topbar-h:   56px;

  /* Transition */
  --tr: .18s ease;
}

[data-theme="dark"] {
  --accent:        #22c55e;
  --accent-2:      #4ade80;
  --accent-mid:    #16a34a;
  --accent-strong: #4ade80;
  --accent-soft:   rgba(22,163,74,.2);
  --accent-glow:   rgba(34,197,94,.12);

  --bg:      #0d1117;
  --panel:   #161b22;
  --panel-2: #1c2230;
  --panel-3: #1e2d3d;
  --border:  #30363d;
  --border-2:#404040;

  --text:        #e6edf3;
  --text-2:      #b1bac4;
  --muted:       #8b949e;
  --muted-light: #656d76;

  --error-soft: rgba(220,38,38,.18);
  --warn-soft:  rgba(217,119,6,.18);
  --info-soft:  rgba(2,132,199,.18);

  --shadow-sm:   0 1px 2px rgba(0,0,0,.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4);
  --shadow-card: 0 2px 8px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.04);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.5);
  --shadow-xl:   0 20px 48px rgba(0,0,0,.6);
}

/* ─── Reset / Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
input, textarea { font-family: inherit; }
ul { list-style: none; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* ─── Scrollbars ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }


/* ══════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 60% 40%, var(--accent-glow) 0%, var(--bg) 70%);
  z-index: 200;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 40px 36px;
  width: min(400px, 92vw);
  display: flex; flex-direction: column; gap: 18px;
}

.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 4px; }
.login-logo { width: 64px; height: 64px; object-fit: contain; border-radius: var(--radius-md); }

.login-title {
  font-size: 22px; font-weight: 700;
  text-align: center; color: var(--text);
}

.login-subtitle {
  font-size: 13px; color: var(--muted);
  text-align: center; margin-top: -10px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.form-field input {
  padding: 10px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--tr), box-shadow var(--tr);
  outline: none;
}
.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#login-btn {
  padding: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px; font-weight: 700;
  border-radius: var(--radius-md);
  transition: background var(--tr), transform var(--tr);
  margin-top: 4px;
  border: none; cursor: pointer;
}
#login-btn:hover { background: var(--accent-mid); transform: translateY(-1px); }
#login-btn:active { transform: translateY(0); }

.login-error {
  color: var(--error);
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}


/* ══════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ─── Drawer backdrop ─── */
.drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 49;
}
.drawer-open .drawer-backdrop { display: block; }


/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-inline-start: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--tr);
  position: relative;
  z-index: 50;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.brand-name { font-size: 17px; font-weight: 700; color: var(--accent-strong); }

.new-chat {
  margin: 12px;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  transition: background var(--tr), transform var(--tr);
  border: none; cursor: pointer;
}
.new-chat:hover { background: var(--accent-mid); transform: translateY(-1px); }
.new-chat-icon { font-size: 18px; line-height: 1; }

.search-box {
  margin: 0 12px 8px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.search-icon { color: var(--muted); flex-shrink: 0; width: 14px; height: 14px; }
#session-search {
  border: none; background: transparent;
  font-size: 13px; color: var(--text);
  flex: 1; outline: none;
}
#session-search::placeholder { color: var(--muted-light); }

.sidebar-label {
  padding: 4px 16px;
  font-size: 11px; font-weight: 700;
  color: var(--muted-light);
  text-transform: uppercase; letter-spacing: .06em;
}

.sessions {
  flex: 1; overflow-y: auto;
  padding: 0 8px;
  display: flex; flex-direction: column; gap: 2px;
}

.session-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--tr);
  position: relative;
}
.session-item:hover { background: var(--panel-2); }
.session-item.active { background: var(--accent-soft); color: var(--accent-strong); }

.session-icon { font-size: 14px; flex-shrink: 0; }
.session-text { flex: 1; overflow: hidden; }
.session-title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-date { font-size: 11px; color: var(--muted); }

.session-del-btn {
  opacity: 0; transition: opacity var(--tr);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 14px; color: var(--muted);
}
.session-item:hover .session-del-btn { opacity: 1; }
.session-del-btn:hover { color: var(--error); background: var(--error-soft); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Status rows */
.server-status { display: flex; flex-direction: column; gap: 5px; }
.status-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.status-label { color: var(--muted); flex: 1; }
.status-val { font-weight: 600; color: var(--text-2); font-size: 11px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-light); flex-shrink: 0;
}
.status-dot.online { background: var(--accent); }
.status-dot.warn { background: var(--warn); }
.status-dot.error { background: var(--error); }

/* User block */
.user-block { display: flex; flex-direction: column; gap: 6px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role {
  font-size: 11px; color: var(--muted);
  background: var(--panel-2);
  padding: 1px 6px; border-radius: 3px;
}
.user-actions {
  display: flex; align-items: center; gap: 6px; justify-content: flex-end;
}

.icon-btn {
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background var(--tr), color var(--tr);
  font-size: 14px; border: none; cursor: pointer; background: none;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.btn-logout {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--border);
  background: none; cursor: pointer;
  transition: all var(--tr);
}
.btn-logout:hover { border-color: var(--error); color: var(--error); background: var(--error-soft); }


/* ══════════════════════════════════════════════════════════
   MAIN COLUMN
   ══════════════════════════════════════════════════════════ */
.main-col {
  flex: 1; min-width: 0; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}


/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}

.drawer-toggle { display: none; flex-shrink: 0; }

.topbar-title {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1;
}
.header-logo { width: 30px; height: 30px; border-radius: 7px; object-fit: contain; flex-shrink: 0; }
.topbar-text { min-width: 0; }
.topbar-text h2 { font-size: 14px; font-weight: 700; color: var(--text); }
.chat-title {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Context bar */
.context-bar {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
  padding: 0 4px;
}
.context-bar::-webkit-scrollbar { display: none; }

.ctx-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
  border: 1.5px solid var(--border);
  background: var(--panel); color: var(--text-2);
  transition: all var(--tr);
}
.ctx-chip-employee { border-color: #c4b5fd; background: #f5f3ff; color: #6d28d9; }
.ctx-chip-period   { border-color: #a5f3fc; background: #ecfeff; color: #0e7490; }
.ctx-chip-metric   { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
[data-theme="dark"] .ctx-chip-employee { border-color: #4c1d95; background: rgba(109,40,217,.2); color: #c4b5fd; }
[data-theme="dark"] .ctx-chip-period   { border-color: #164e63; background: rgba(14,116,144,.2); color: #67e8f9; }
[data-theme="dark"] .ctx-chip-metric   { border-color: #78350f; background: rgba(217,119,6,.18); color: #fcd34d; }
.ctx-chip-icon { font-size: 13px; }

.conn-status {
  flex-shrink: 0; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.conn-status.online   { background: var(--accent-soft); color: var(--accent-strong); }
.conn-status.offline  { background: var(--error-soft); color: var(--error); }
.conn-status.checking { background: var(--warn-soft); color: var(--warn); }

/* Command palette topbar trigger */
.cmd-palette-topbar-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--panel-2);
  color: var(--text-2); font-size: 12px; font-family: inherit;
  cursor: pointer; transition: all var(--tr); flex-shrink: 0;
}
.cmd-palette-topbar-btn:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.cmd-palette-topbar-btn kbd {
  padding: 1px 5px; border-radius: 4px;
  background: var(--panel); border: 1px solid var(--border);
  font-size: 10px; font-family: monospace; color: var(--muted);
}

/* ─── Chat area ─── */
.chat {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex; flex-direction: column;
  gap: 12px; scroll-behavior: smooth;
}


/* ══════════════════════════════════════════════════════════
   WELCOME SCREEN
   ══════════════════════════════════════════════════════════ */
.welcome-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 32px; min-height: 100%;
  padding: 32px 16px; text-align: center;
}

.welcome-hero {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 480px;
}
.welcome-logo {
  width: 72px; height: 72px; border-radius: 18px;
  object-fit: contain; box-shadow: var(--shadow-md);
}
.welcome-title { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.2; }
.welcome-subtitle { font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 380px; }

.welcome-mic-btn {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 28px;
  background: var(--accent); color: #fff;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 16px var(--accent-glow);
  border: none; cursor: pointer;
  transition: all var(--tr);
}
.welcome-mic-btn:hover { background: var(--accent-mid); transform: translateY(-2px); }

.welcome-commands { max-width: 540px; width: 100%; }
.welcome-commands-title {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
}
.welcome-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.welcome-cmd {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--tr);
}
.welcome-cmd:hover {
  border-color: var(--accent); background: var(--accent-soft);
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.welcome-cmd-icon { font-size: 24px; }
.welcome-cmd-text { font-size: 12px; font-weight: 600; color: var(--text-2); }
.welcome-cmd:hover .welcome-cmd-text { color: var(--accent-strong); }

/* ─── KPI Tiles — live dashboard on welcome screen ─── */
.kpi-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%; max-width: 560px;
}
.kpi-tile {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--tr);
  text-align: right;
  animation: card-enter .3s ease-out both;
}
.kpi-tile:nth-child(2) { animation-delay: .06s; }
.kpi-tile:nth-child(3) { animation-delay: .12s; }
.kpi-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.kpi-tile-icon { font-size: 26px; flex-shrink: 0; }
.kpi-tile-body { flex: 1; min-width: 0; }
.kpi-tile-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.kpi-tile-value { font-size: 17px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-tile-sub   { font-size: 10px; color: var(--muted); margin-top: 2px; }
.kpi-tile:hover .kpi-tile-value { color: var(--accent-strong); }

/* Skeleton shimmer inside tile */
.kpi-skel {
  display: block; height: 18px; width: 80px; border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3, #2a2a2a) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
[data-theme="light"] .kpi-skel {
  background: linear-gradient(90deg, #e8ecef 25%, #f4f6f8 50%, #e8ecef 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}

/* Accent left-border per tile type */
.kpi-tile-sales { border-right: 3px solid var(--accent); }
.kpi-tile-coll  { border-right: 3px solid #f59e0b; }
.kpi-tile-inv   { border-right: 3px solid #ef4444; }

@media (max-width: 480px) {
  .kpi-tiles { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   MESSAGE ROWS
   ══════════════════════════════════════════════════════════ */
.msg-row {
  display: flex; flex-direction: column;
  max-width: 88%;
  animation: fadeSlideIn .22s ease both;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-row.user  { align-self: flex-start; }
.msg-row.bot   { align-self: flex-end; max-width: min(700px, 92%); }
.msg-row.error { align-self: center; }

/* ─── User bubble ─── */
.msg-bubble {
  padding: 10px 14px;
  background: var(--accent); color: #fff;
  border-radius: 16px 16px 4px 16px;
  font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.msg-row.error .msg-bubble {
  background: var(--error-soft); color: var(--error);
  border: 1px solid #fca5a5; border-radius: var(--radius-md);
}
.msg-row.user .msg-time,
.msg-row.error .msg-time {
  font-size: 10px; color: var(--muted-light);
  margin-top: 4px; text-align: start;
}

/* ─── Bot message card ─── */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.msg-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden; width: 100%;
  animation: card-enter 0.22s ease-out;
}

/* Skeleton state */
.msg-card.skeleton { pointer-events: none; }
.skel-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.skel-line {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3, #2a2a2a) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel-line.wide  { height: 13px; width: 70%; }
.skel-line.skel-big  { height: 38px; width: 55%; border-radius: 8px; }
.skel-line.narrow { height: 11px; width: 45%; }
[data-theme="light"] .skel-line {
  background: linear-gradient(90deg, #e8ecef 25%, #f4f6f8 50%, #e8ecef 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}

.msg-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 0;
}
.msg-card-source {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--accent-strong);
  text-transform: uppercase; letter-spacing: .05em;
}
.msg-card-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulseDot 2.5s ease-in-out infinite;
}
.msg-card-time { font-size: 11px; color: var(--muted); }

/* ─── Number result ─── */
.result-number {
  padding: 20px 24px; text-align: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
}
.result-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.result-value {
  font-size: clamp(28px, 4vw, 38px); font-weight: 800;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.02em;
}
.result-currency {
  font-size: 14px; font-weight: 600; color: var(--muted);
  margin-inline-start: 6px; vertical-align: super;
}
.result-meta { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.result-period { margin-top: 4px; font-size: 11px; color: var(--muted-light); font-variant-numeric: tabular-nums; }
.result-badge {
  display: inline-block; margin-top: 8px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px solid rgba(22,163,74,.25);
}

/* ─── Employee sales report card ─── */
.emp-report-body {
  direction: rtl;
  text-align: right;
}
.emp-report-hero {
  border-bottom: 1px solid var(--border);
}
.emp-report-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px 22px;
}
.emp-report-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.emp-report-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}
.emp-report-value {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.emp-report-value--employee {
  font-size: clamp(20px, 2.8vw, 24px);
  font-weight: 800;
  color: var(--text);
}
.emp-report-value--period {
  font-size: clamp(17px, 2.3vw, 20px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.emp-report-value--money {
  color: var(--accent-strong);
  font-weight: 800;
}
.emp-report-value--refund {
  color: var(--error);
  font-weight: 800;
}
.emp-report-value--refund-zero {
  color: var(--muted);
  font-weight: 700;
}
.emp-report-value--count {
  font-size: clamp(20px, 2.8vw, 24px);
  font-weight: 800;
  color: var(--text);
}

/* ─── List result ─── */
.result-list { }
.result-list-title {
  padding: 10px 14px 8px;
  font-size: 13px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.result-list-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background var(--tr);
}
.result-list-item:last-child { border-bottom: none; }
.result-list-item:hover { background: var(--panel-2); }
.result-list-rank {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  margin-top: 2px;
}
.result-list-rank.top1 { background: #fef3c7; color: #92400e; }
.result-list-rank.top2 { background: #f1f5f9; color: var(--text-2); }
.result-list-rank.top3 { background: #fce7f3; color: #9d174d; }
.result-list-info { flex: 1; min-width: 0; }
.result-list-name-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.result-list-name { font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-list-amount { font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Progress bar */
.result-list-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.result-list-bar-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent);
  transition: width 0.65s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.result-list-bar-fill.top1 { background: var(--accent); }
.result-list-bar-fill.top2 { background: #00c07a; }
.result-list-bar-fill.top3 { background: #00d486; }
.result-list-bar-fill:not(.top1):not(.top2):not(.top3) { background: var(--border-2); }
[data-theme="dark"] .result-list-rank.top1 { background: #78350f; color: #fde68a; }
[data-theme="dark"] .result-list-rank.top2 { background: #1e293b; color: var(--text-2); }
[data-theme="dark"] .result-list-rank.top3 { background: #500724; color: #fbcfe8; }

/* ─── Text result ─── */
.result-text {
  padding: 12px 14px;
  font-size: 14px; line-height: 1.75; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ─── Period clarification ─── */
.result-period-clarification { padding: 16px 14px; text-align: center; }
.period-question { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.period-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.period-chip-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all var(--tr);
}
.period-chip-btn:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }

/* ─── Card footer ─── */
.msg-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
}
.action-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.action-chip {
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--panel);
  color: var(--text-2); font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all var(--tr);
}
.action-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.action-chip.highlight { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

.msg-card-copy-btn {
  padding: 4px 8px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; background: none;
  cursor: pointer; transition: all var(--tr); border: none;
}
.msg-card-copy-btn:hover { color: var(--text); background: var(--panel); }

/* ─── Old KPI card (backward compat) ─── */
.kpi-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
}
.kpi-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 32px; font-weight: 800; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.kpi-currency { font-size: 15px; color: var(--muted); }
.kpi-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ─── Old msg-label ─── */
.msg-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }

/* ─── Old msg-actions ─── */
.msg-actions { display: flex; gap: 4px; margin-top: 4px; opacity: 0; transition: opacity var(--tr); }
.msg-row:hover .msg-actions { opacity: 1; }
.msg-action-btn { padding: 3px 8px; border-radius: 4px; font-size: 11px; color: var(--muted); cursor: pointer; transition: all var(--tr); background: none; border: none; }
.msg-action-btn:hover { background: var(--panel-2); color: var(--text); }

/* ─── Typing indicator ─── */
.typing {
  align-self: flex-end;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  max-width: 160px;
}
.typing-text { font-size: 12px; color: var(--muted); }
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: typingBounce 1.2s ease infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%,80%,100% { transform: scale(.8); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes pulseDot {
  0%,100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════════════════════
   QUICK TOOLS BAR
   ══════════════════════════════════════════════════════════ */
.quick-tools-bar {
  display: none;
  align-items: center; gap: 6px;
  overflow-x: auto; padding: 6px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel); flex-shrink: 0;
  scrollbar-width: none;
}
.quick-tools-bar::-webkit-scrollbar { display: none; }
.qtool-btn {
  padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--bg);
  color: var(--text-2); font-size: 12px; font-weight: 500;
  white-space: nowrap; cursor: pointer; font-family: inherit;
  transition: all var(--tr);
}
.qtool-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.qtool-calendar { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.qtool-calendar.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.qtool-sep { width: 1px; height: 18px; background: var(--border-2); flex-shrink: 0; margin: 0 2px; }

/* ─── Date Picker Panel ─── */
.date-picker-panel {
  position: absolute; bottom: calc(100% + 4px); left: 16px; right: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-xl, 14px); box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 120; overflow: hidden;
  animation: card-enter .18s ease-out;
}
.date-picker-panel.hidden { display: none; }
.dpp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border);
}
.dpp-title { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.dpp-close { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.dpp-close:hover { background: var(--panel-2); color: var(--text); }
.dpp-presets { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; }
.dpp-chip {
  padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--bg);
  color: var(--text-2); font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all var(--tr);
}
.dpp-chip:hover  { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.dpp-chip.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.dpp-divider { height: 1px; background: var(--border); margin: 0 14px; }
.dpp-custom { padding: 10px 14px 12px; }
.dpp-custom-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dpp-date-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.dpp-date-field input[type="date"] {
  padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--bg); color: var(--text); font-size: 12px; font-family: inherit;
  cursor: pointer;
}
.dpp-apply-btn {
  padding: 5px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; border: none;
  font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: opacity var(--tr);
}
.dpp-apply-btn:hover { opacity: .85; }

/* Period badge inside composer */
.period-badge-wrap {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px 0;
}
.period-badge-wrap.hidden { display: none; }
.period-badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px solid var(--accent); font-size: 11px; font-weight: 600;
}
.period-badge::before { content: '📅 '; font-size: 10px; margin-left: 4px; }
.period-badge-clear {
  background: none; border: none; color: var(--muted); font-size: 11px;
  cursor: pointer; padding: 0 4px; border-radius: 4px; line-height: 1;
}
.period-badge-clear:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════
   COMPOSER
   ══════════════════════════════════════════════════════════ */
.composer-wrap {
  padding: 10px 16px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.composer-form { display: flex; flex-direction: column; gap: 6px; }

.attachment-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-preview:empty { display: none; }
.attachment-thumb {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; color: var(--text-2);
}
.attachment-thumb img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.attachment-remove { color: var(--muted); cursor: pointer; transition: color var(--tr); background: none; border: none; }
.attachment-remove:hover { color: var(--error); }

.recording-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--error-soft); border: 1px solid #fca5a5;
  border-radius: 6px; font-size: 12px; color: var(--error);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--error);
  animation: pulseDot 1.2s ease-in-out infinite;
}
.recording-text { }

.composer-bar {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border-2);
  border-radius: var(--radius-xl); padding: 6px 8px;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.composer-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.plus-menu-wrap { position: relative; flex-shrink: 0; }
.composer-icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); border: none; background: none; cursor: pointer;
  transition: all var(--tr);
}
.composer-icon-btn:hover { background: var(--panel-2); color: var(--text); }

#input {
  flex: 1; border: none; background: transparent;
  font-size: 14px; color: var(--text);
  resize: none; outline: none;
  min-height: 34px; max-height: 160px;
  padding: 7px 4px; line-height: 1.5; overflow-y: auto;
}
#input::placeholder { color: var(--muted-light); }

.composer-mic-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0;
  border: none; background: none; cursor: pointer;
  transition: all var(--tr);
}
.composer-mic-btn:hover { color: var(--accent); }
.composer-mic-btn.recording { color: var(--error); animation: pulseDot 1s ease-in-out infinite; }

.composer-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; flex-shrink: 0;
  border: none; cursor: pointer;
  transition: all var(--tr);
}
.composer-send-btn:hover { background: var(--accent-mid); transform: scale(1.05); }
.composer-send-btn:disabled { background: var(--border-2); color: var(--muted); transform: none; cursor: not-allowed; }

.composer-dropdown {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 220px; z-index: 100; overflow: hidden;
}
[dir="rtl"] .composer-dropdown { right: auto; left: 0; }

.composer-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  font-size: 13px; color: var(--text-2);
  text-align: start; cursor: pointer;
  background: none; border: none; font-family: inherit;
  transition: background var(--tr);
}
.composer-menu-item:hover { background: var(--panel-2); color: var(--text); }
.composer-menu-item.disabled { color: var(--muted-light); cursor: not-allowed; }
.composer-menu-item.disabled:hover { background: none; }

.recent-dropdown { min-width: 280px; max-height: 240px; overflow-y: auto; }


/* ══════════════════════════════════════════════════════════
   TOOLS PANEL
   ══════════════════════════════════════════════════════════ */
.tools {
  width: var(--tools-w); min-width: var(--tools-w); max-width: var(--tools-w);
  height: 100dvh; overflow-y: auto;
  background: var(--panel);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.tools-head {
  padding: 14px 14px 8px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.tool-group { border-bottom: 1px solid var(--border); }
.tool-group > summary {
  padding: 10px 14px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
  transition: background var(--tr);
}
.tool-group > summary:hover { background: var(--panel-2); }
.tool-grid { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.tool-btn {
  display: block; width: 100%;
  padding: 8px 12px; text-align: start;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  cursor: pointer; font-family: inherit;
  transition: all var(--tr);
}
.tool-btn:hover {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent-strong); transform: translateX(-2px);
}
.session-info { margin-top: auto; border-top: 1px solid var(--border); }
.session-info > summary {
  padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background var(--tr);
}
.session-info > summary:hover { background: var(--panel-2); }
.info-rows { padding: 4px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.info-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.info-row span { color: var(--muted); }
.info-row b { font-weight: 600; color: var(--text-2); }


/* ══════════════════════════════════════════════════════════
   COMMAND PALETTE
   ══════════════════════════════════════════════════════════ */
@keyframes cmd-in {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1);   }
}
.cmd-palette {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: clamp(60px, 12vh, 120px);
}
.cmd-palette.hidden { display: none; }
.cmd-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
}
.cmd-modal {
  position: relative; z-index: 1;
  width: min(620px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  overflow: hidden;
  animation: cmd-in .18s cubic-bezier(.22,1,.36,1);
}
.cmd-search-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-search-icon { color: var(--muted); flex-shrink: 0; }
.cmd-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 15px; font-family: inherit; color: var(--text);
  direction: rtl;
}
.cmd-input::placeholder { color: var(--muted); }
.cmd-esc {
  padding: 2px 7px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  font-size: 11px; color: var(--muted); font-family: monospace;
  flex-shrink: 0;
}

/* Results */
.cmd-results { max-height: 380px; overflow-y: auto; padding: 6px 0; }
.cmd-results::-webkit-scrollbar { width: 4px; }
.cmd-results::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }
.cmd-group-label {
  padding: 6px 16px 3px;
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px;
  cursor: pointer; transition: background var(--tr);
  border-radius: 0;
}
.cmd-item:hover, .cmd-item.selected {
  background: var(--accent-soft);
}
.cmd-item.selected .cmd-item-label { color: var(--accent-strong); }
.cmd-item-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.cmd-item.selected .cmd-item-icon { background: var(--accent-soft); border-color: var(--accent); }
.cmd-item-text { flex: 1; min-width: 0; }
.cmd-item-label { font-size: 13px; font-weight: 500; color: var(--text); }
.cmd-item-desc  { font-size: 11px; color: var(--muted); margin-top: 1px; }
.cmd-item-enter {
  font-size: 11px; color: var(--muted); opacity: 0;
  transition: opacity var(--tr);
}
.cmd-item.selected .cmd-item-enter { opacity: 1; }

/* Footer */
.cmd-footer {
  display: flex; align-items: center; gap: 16px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 11px; color: var(--muted);
}
.cmd-footer kbd {
  padding: 1px 5px; border-radius: 4px;
  background: var(--panel); border: 1px solid var(--border-2);
  font-size: 10px; font-family: monospace;
}
.cmd-footer-tip { margin-right: auto; }

/* ══════════════════════════════════════════════════════════
   VOICE MODAL
   ══════════════════════════════════════════════════════════ */
.voice-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.voice-modal-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
  padding: 36px 32px 28px;
  width: min(420px, 92vw);
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.voice-waveform { display: flex; align-items: center; gap: 5px; height: 56px; }
.wave-bar {
  width: 5px; border-radius: 3px; background: var(--accent);
  animation: waveDance 1.2s ease-in-out infinite;
}
.wave-bar:nth-child(1) { height: 16px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 28px; animation-delay: .1s; }
.wave-bar:nth-child(3) { height: 40px; animation-delay: .2s; }
.wave-bar:nth-child(4) { height: 52px; animation-delay: .3s; }
.wave-bar:nth-child(5) { height: 40px; animation-delay: .4s; }
.wave-bar:nth-child(6) { height: 28px; animation-delay: .5s; }
.wave-bar:nth-child(7) { height: 16px; animation-delay: .6s; }
@keyframes waveDance {
  0%,100% { transform: scaleY(.5); opacity: .5; }
  50% { transform: scaleY(1); opacity: 1; }
}

.voice-status-text { font-size: 15px; font-weight: 600; color: var(--text); }
.voice-transcript-wrap {
  min-height: 54px; width: 100%;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px;
}
.voice-transcript {
  font-size: 14px; color: var(--text); line-height: 1.6;
  min-height: 34px; text-align: center;
}
.voice-transcript:empty::before { content: "ابدأ بالكلام..."; color: var(--muted-light); }

.voice-modal-actions { display: flex; gap: 12px; width: 100%; }
.voice-modal-actions .btn-ghost {
  flex: 1; padding: 11px;
  border: 1.5px solid var(--border-2); border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; color: var(--text-2);
  background: var(--bg); cursor: pointer; font-family: inherit;
  transition: all var(--tr);
}
.voice-modal-actions .btn-ghost:hover { border-color: var(--text-2); }
.voice-modal-actions .btn-primary {
  flex: 1; padding: 11px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--tr);
}
.voice-modal-actions .btn-primary:hover { background: var(--accent-mid); }
.voice-modal-actions .btn-primary:disabled { background: var(--border-2); color: var(--muted-light); cursor: not-allowed; }


/* ══════════════════════════════════════════════════════════
   CONFIRM MODAL
   ══════════════════════════════════════════════════════════ */
.confirm-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
}
.confirm-card {
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); padding: 28px 28px 22px;
  width: min(340px, 90vw);
  display: flex; flex-direction: column; gap: 20px;
}
#confirm-message { font-size: 15px; font-weight: 500; color: var(--text); text-align: center; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.btn-ghost {
  padding: 9px 22px; border: 1.5px solid var(--border-2);
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; color: var(--text-2);
  background: var(--bg); cursor: pointer; font-family: inherit;
  transition: all var(--tr);
}
.btn-ghost:hover { border-color: var(--text-2); }
.btn-danger {
  padding: 9px 22px; background: var(--error); color: #fff;
  border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background var(--tr);
}
.btn-danger:hover { background: #b91c1c; }
.btn-primary {
  padding: 9px 22px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background var(--tr);
}
.btn-primary:hover { background: var(--accent-mid); }


/* ══════════════════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════════════════ */
.toasts {
  position: fixed; bottom: 20px; left: 20px;
  z-index: 500; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
[dir="rtl"] .toasts { left: auto; right: 20px; }
.toast {
  padding: 12px 18px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease; pointer-events: auto;
  max-width: 320px; line-height: 1.4;
}
@keyframes toastIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.toast.success { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid rgba(22,163,74,.3); }
.toast.error   { background: var(--error-soft); color: var(--error); border: 1px solid #fca5a5; }
.toast.info    { background: var(--info-soft); color: var(--info); border: 1px solid #7dd3fc; }


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .tools { display: none; }
  .quick-tools-bar { display: flex; }
}

@media (max-width: 900px) {
  .tools { display: none; }
  .quick-tools-bar { display: flex; }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(var(--sidebar-w), 85vw); min-width: 0;
    transform: translateX(100%);
    z-index: 50; transition: transform .25s ease;
  }
  [dir="rtl"] .sidebar { right: auto; left: 0; transform: translateX(-100%); }
  .drawer-open .sidebar { transform: translateX(0); }
  .drawer-toggle { display: flex !important; }
  .main-col { width: 100%; }
  .welcome-grid { grid-template-columns: repeat(2, 1fr); }
  .msg-row { max-width: 95%; }
  .msg-row.bot { max-width: 95%; }
  .context-bar { display: none; }
}

@media (max-width: 480px) {
  .welcome-title { font-size: 20px; }
  .result-value { font-size: 26px; }
  .voice-modal-card { padding: 28px 20px 22px; }
}


/* ══════════════════════════════════════════════════════════
   SESSION SIDEBAR — MENU + ACTIONS (generated by JS)
   ══════════════════════════════════════════════════════════ */
.session-head {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
}

.session-star { color: #f59e0b; font-size: 13px; }

.session-actions {
  display: flex; align-items: center; gap: 2px;
  opacity: 0; transition: opacity var(--tr);
  flex-shrink: 0;
}
.session-item:hover .session-actions { opacity: 1; }

.session-menu-wrap { position: relative; }

.session-menu-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px); right: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 150px; z-index: 200; overflow: hidden;
}
[dir="rtl"] .session-menu-dropdown { right: auto; left: 0; }
.session-menu-dropdown.open { display: block; }

.session-menu-item {
  display: block; width: 100%;
  padding: 9px 14px;
  font-size: 13px; color: var(--text-2);
  text-align: start; background: none; border: none;
  cursor: pointer; font-family: inherit;
  transition: background var(--tr);
}
.session-menu-item:hover { background: var(--panel-2); color: var(--text); }
.session-menu-item.danger { color: var(--error); }
.session-menu-item.danger:hover { background: var(--error-soft); }

.session-title-input {
  flex: 1; min-width: 0;
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 2px 6px; font-size: 13px;
  background: var(--bg); color: var(--text);
  outline: none;
}

/* Attachment chip (composer) */
.attachment-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; color: var(--text-2);
}
.attachment-chip-uploading { opacity: .7; }
.attachment-chip-icon { font-size: 14px; }
.attachment-chip-body { display: flex; flex-direction: column; gap: 2px; }
.attachment-chip-name { font-weight: 500; }
.attachment-progress { height: 3px; background: var(--border); border-radius: 2px; width: 80px; }
.attachment-progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width .2s; }
.attachment-chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  padding: 0 2px;
}
.attachment-chip-remove:hover { color: var(--error); }

/* msg-attachments (in user bubble) */
.msg-attachments { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.msg-attachment-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(255,255,255,.2); font-size: 12px;
}

.copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  transition: all var(--tr);
}
.copy-btn:hover { color: var(--text); background: var(--panel-2); }

.recent-empty {
  padding: 12px 14px; font-size: 12px; color: var(--muted);
  text-align: center;
}

/* ─── Dashboard topbar link ─── */
.dash-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
}
.dash-topbar-link:hover {
  background: var(--panel-2);
  color: var(--accent);
  border-color: var(--accent);
}
