/* ==========================================================
   LK Finance CRM — Design System
   Colors extracted from the LK logo gradient
   ========================================================== */

:root {
  /* LK brand gradient */
  --lk-teal:        #2DD4BF;
  --lk-teal-bright: #14E8D0;
  --lk-cyan:        #06B6D4;
  --lk-blue:        #0EA5E9;
  --lk-blue-deep:   #0284C7;

  /* Dark theme (default, matches logo's dark backdrop) */
  --bg:             #0B1220;
  --bg-elevated:    #111B2E;
  --surface:        #152238;
  --surface-hover:  #1B2B44;
  --border:         #233250;
  --border-strong:  #2E4166;

  --text:           #E8EEF5;
  --text-muted:     #8FA1BC;
  --text-faint:     #5E7293;

  --success:        #34D399;
  --warning:        #FBBF24;
  --danger:         #F87171;
  --info:           #60A5FA;
  --purple:         #A78BFA;
  --gold:           #F0C040;

  --shadow-sm:      0 1px 2px rgba(0,0,0,.25);
  --shadow-md:      0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.45);
  --glow:           0 0 32px rgba(20,232,208,.18);

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

  --gradient-brand: linear-gradient(135deg, var(--lk-teal-bright) 0%, var(--lk-cyan) 50%, var(--lk-blue) 100%);
  --gradient-brand-soft: linear-gradient(135deg, rgba(20,232,208,.15) 0%, rgba(6,182,212,.1) 50%, rgba(14,165,233,.1) 100%);
  --gradient-bg: radial-gradient(ellipse at top right, rgba(20,232,208,.08) 0%, transparent 50%),
                 radial-gradient(ellipse at bottom left, rgba(14,165,233,.06) 0%, transparent 50%),
                 #0B1220;
}

/* Light theme */
[data-theme="light"] {
  --bg:             #F1F5F9;
  --bg-elevated:    #FFFFFF;
  --surface:        #FFFFFF;
  --surface-hover:  #F8FAFC;
  --border:         #E2E8F0;
  --border-strong:  #CBD5E1;

  --text:           #0F172A;
  --text-muted:     #475569;
  --text-faint:     #94A3B8;

  --shadow-sm:      0 1px 2px rgba(15,23,42,.06);
  --shadow-md:      0 4px 16px rgba(15,23,42,.08);
  --shadow-lg:      0 12px 40px rgba(15,23,42,.12);
  --glow:           0 0 32px rgba(20,184,166,.18);

  --gradient-bg: radial-gradient(ellipse at top right, rgba(20,184,166,.08) 0%, transparent 50%),
                 radial-gradient(ellipse at bottom left, rgba(14,165,233,.06) 0%, transparent 50%),
                 #F1F5F9;
}

/* ========== Base ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; }
body {
  font-family: 'Rubik','Heebo','Segoe UI',Tahoma,Arial,sans-serif;
  background: var(--gradient-bg);
  color: var(--text);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { outline: none; }

/* ========== Scrollbars ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ========== Login Screen ========== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,232,208,.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  filter: blur(40px);
  animation: float 8s ease-in-out infinite;
}
.login-wrap::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.15) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  filter: blur(40px);
  animation: float 10s ease-in-out infinite reverse;
}
@keyframes float {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(30px,-30px); }
}

.login-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), var(--glow);
  backdrop-filter: blur(20px);
}
.login-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 20px;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(20,232,208,.35));
}
.login-title {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-brand);
  color: #0B1220;
  box-shadow: 0 4px 16px rgba(20,232,208,.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(20,232,208,.4); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--lk-cyan); }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(248,113,113,.4);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(248,113,113,.1); }

.btn-google {
  background: #FFFFFF;
  color: #1F2937;
  border: 1px solid var(--border);
  width: 100%;
  padding: 12px;
}
.btn-google:hover { background: #F9FAFB; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 12px;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.field {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: all .15s;
  direction: rtl;
}
.input:focus {
  border-color: var(--lk-cyan);
  box-shadow: 0 0 0 3px rgba(6,182,212,.15);
}
.input::placeholder { color: var(--text-faint); }
textarea.input { resize: vertical; min-height: 80px; font-family: inherit; }

/* ========== App Layout ========== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  filter: drop-shadow(0 4px 12px rgba(20,232,208,.3));
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}
.sidebar-brand-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--lk-teal);
  margin-top: 2px;
}

.sidebar-stats {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
}
.stat-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.stat-badge {
  background: var(--surface-hover);
  color: var(--text);
  border-radius: 99px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--gradient-brand-soft);
  color: var(--lk-teal-bright);
  font-weight: 700;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--gradient-brand);
  border-radius: 2px 0 0 2px;
}
.nav-item-icon { font-size: 14px; }
.nav-item-label { flex: 1; }
.nav-item-badge {
  background: var(--gradient-brand);
  color: #0B1220;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 800;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.user-chip:hover { background: var(--surface-hover); }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #0B1220;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--lk-teal); text-transform: uppercase; font-weight: 700; letter-spacing: .5px; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.theme-btn {
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  transition: all .15s;
}
.theme-btn.active {
  background: var(--gradient-brand-soft);
  color: var(--lk-teal-bright);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
}

/* ========== Cards ========== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.card:hover { border-color: var(--border-strong); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .08;
  filter: blur(30px);
}
.kpi.teal::before   { background: var(--lk-teal); }
.kpi.blue::before   { background: var(--lk-blue); }
.kpi.purple::before { background: var(--purple); }
.kpi.gold::before   { background: var(--gold); }

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
}
.kpi.teal   .kpi-value { color: var(--lk-teal-bright); }
.kpi.blue   .kpi-value { color: var(--lk-blue); }
.kpi.purple .kpi-value { color: var(--purple); }
.kpi.gold   .kpi-value { color: var(--gold); }

/* ========== Tags / Chips ========== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.score {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  color: var(--text);
}

/* ========== Table ========== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead tr {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.table th {
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.selected { background: rgba(20,232,208,.06); }

/* ========== Detail panel ========== */
.detail-panel {
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 10px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--text-muted); white-space: nowrap; }
.detail-row-value {
  font-weight: 500;
  color: var(--text);
  text-align: left;
  flex: 1;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 4px;
  transition: background .1s;
}
.detail-row-value:hover { background: var(--surface-hover); }
.detail-row-value.editing { background: var(--bg); padding: 0; }
.detail-row-value input,
.detail-row-value select,
.detail-row-value textarea {
  width: 100%;
  padding: 4px 6px;
  background: transparent;
  border: 1px solid var(--lk-cyan);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
}

/* ========== Modal ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11,18,32,.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--glow);
  animation: popIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 11px 24px;
  border-radius: var(--radius-md);
  color: #0B1220;
  background: var(--gradient-brand);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(20,232,208,.3);
  animation: slideDown .3s ease;
}
.toast.error { background: var(--danger); color: #fff; box-shadow: 0 8px 24px rgba(248,113,113,.3); }
@keyframes slideDown { from { transform: translate(-50%,-40px); opacity: 0; } to { transform: translate(-50%,0); opacity: 1; } }

/* ========== Pipeline kanban ========== */
.kanban {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.kanban-head {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-top: 3px solid;
  background: var(--surface);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.kanban-head-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}
.kanban-head-label { font-weight: 700; font-size: 12px; color: var(--text); }
.kanban-head-count {
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.kanban-head-desc { font-size: 10px; color: var(--text-muted); }

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: all .15s;
}
.kanban-card:hover { border-color: var(--lk-cyan); transform: translateY(-1px); }
.kanban-card.selected { border-color: var(--lk-cyan); box-shadow: 0 0 0 2px rgba(6,182,212,.2); }
.kanban-empty {
  padding: 14px 8px;
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ========== Meeting progress bar ========== */
.mtg-bar {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.mtg-cell {
  flex: 1;
  text-align: center;
}
.mtg-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  margin-bottom: 3px;
  transition: background .3s;
}
.mtg-track.filled { background: var(--gradient-brand); }
.mtg-label { font-size: 9px; color: var(--text-faint); }
.mtg-label.filled { color: var(--lk-teal-bright); }

/* ========== Utility ========== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 6px; } .gap-3 { gap: 10px; } .gap-4 { gap: 14px; }
.mt-2 { margin-top: 6px; } .mt-3 { margin-top: 10px; } .mt-4 { margin-top: 14px; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== Boot screen ========== */
.boot {
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: var(--gradient-bg);
}
.boot-logo {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 8px 24px rgba(20,232,208,.4));
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.04); opacity: .9; }
}
.boot-text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .sidebar { width: 72px; }
  .sidebar-brand-name, .sidebar-brand-tag, .nav-item-label,
  .user-info, .sidebar-stats { display: none; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
}
