/* =============================================
   CABINET LIGHT THEME — Modern SaaS Override
   Full layout, typography, icons, cards redesign
   ============================================= */

/* ── DESIGN TOKENS ── */
body.dash {
  --dash-bg: #f9fafb !important;
  --dash-card-bg: #ffffff !important;
  --dash-card-border: #e5e7eb !important;
  --dash-text: #111827 !important;
  --dash-text-secondary: #6b7280 !important;
  --dash-muted: #9ca3af !important;
  --dash-accent: #4f46e5;
  --dash-accent-light: #eef2ff;
  --dash-accent-hover: #4338ca;
  --dash-radius: 10px;
  --dash-radius-sm: 8px;
  --dash-radius-xs: 6px;
  --dash-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --dash-shadow-md: 0 2px 8px rgba(0,0,0,.06), 0 0 1px rgba(0,0,0,.04);
  --dash-shadow-lg: 0 8px 30px rgba(0,0,0,.08);
  --dash-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--dash-bg) !important;
  color: var(--dash-text) !important;
  font-family: var(--dash-font);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── SIDEBAR ── */
.dash-sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e5e7eb !important;
  color: #4b5563 !important;
  box-shadow: none !important;
  width: 240px !important;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px) !important;
}
.dash-sidebar__top {
  border-bottom: 1px solid #f3f4f6 !important;
  padding: 16px 18px 14px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dash-sidebar__logo {
  color: #111827 !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  letter-spacing: -.02em !important;
  text-decoration: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.dash-sidebar__logo svg {
  flex-shrink: 0;
}
.dash-sidebar__close {
  color: #94a3b8 !important;
}

/* ── SIDEBAR NAV ── */
.dash-sidebar__nav {
  padding: 6px 8px !important;
  flex: 1;
  overflow-y: auto;
}

.dash-sidebar__section-label {
  display: block;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .08em !important;
  color: #9ca3af !important;
  padding: 6px 12px 4px !important;
  margin-top: 4px;
}

.dash-sidebar__divider {
  height: 1px;
  background: #f3f4f6;
  margin: 6px 12px 4px;
}

.dash-sidebar__link {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  color: #4b5563 !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  border-radius: 7px !important;
  padding: 7px 12px !important;
  margin-bottom: 1px !important;
  transition: all .15s ease !important;
  text-decoration: none !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.dash-sidebar__link svg {
  width: 18px !important;
  height: 18px !important;
  opacity: .6;
  color: #6b7280;
  flex-shrink: 0;
  transition: all .15s ease;
  stroke-width: 1.75;
}
.dash-sidebar__link:hover {
  color: #111827 !important;
  background: #f3f4f6 !important;
}
.dash-sidebar__link:hover svg {
  opacity: .85;
  color: #374151;
}
.dash-sidebar__link.active {
  color: #4f46e5 !important;
  background: #eef2ff !important;
  font-weight: 600 !important;
  border-left: 3px solid #4f46e5 !important;
  padding-left: 9px !important;
}
.dash-sidebar__link.active svg {
  opacity: 1 !important;
  color: #4f46e5 !important;
}

/* ── SIDEBAR BOTTOM ── */
.dash-sidebar__bottom {
  border-top: 1px solid #e5e7eb !important;
  padding: 8px 10px 12px !important;
  margin-top: auto;
  background: #f9fafb !important;
}
.dash-sidebar__user {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 12px 4px !important;
  margin-top: 4px;
}
.dash-sidebar__avatar {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: .02em;
}
.dash-sidebar__userinfo {
  overflow: hidden;
}
.dash-sidebar__userinfo strong {
  display: block !important;
  color: #0f172a !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.dash-sidebar__userinfo span {
  display: block !important;
  color: #94a3b8 !important;
  font-size: 11.5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ── TOPBAR ── */
.dash-topbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.03) !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 0 24px !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
  height: calc(56px + env(safe-area-inset-top, 0px)) !important;
  min-height: calc(56px + env(safe-area-inset-top, 0px)) !important;
}
.dash-topbar__title {
  color: #111827 !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  letter-spacing: -.015em !important;
  white-space: nowrap !important;
  margin: 0 !important;
}
.dash-topbar__burger {
  color: #475569 !important;
  background: none !important;
  border: none !important;
  padding: 4px !important;
  cursor: pointer;
}

/* Topbar search */
.dash-topbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 14px;
  margin-left: auto;
  max-width: 260px;
  flex: 1;
  transition: border-color .15s, box-shadow .15s;
}
.dash-topbar__search:focus-within {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(79,70,229,.06);
  background: #fff;
}
.dash-topbar__search svg {
  color: #9ca3af;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.dash-topbar__search-input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-size: 13px !important;
  color: #111827 !important;
  width: 100% !important;
  padding: 2px 0 !important;
  font-family: var(--dash-font) !important;
}
.dash-topbar__search-input::placeholder {
  color: #9ca3af !important;
}

/* Topbar actions */
.dash-topbar__actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-left: 12px !important;
}
.dash-topbar__user {
  color: #475569 !important;
}
.dash-topbar__username {
  color: #1e293b !important;
  font-weight: 500 !important;
  font-size: 13px !important;
}
.dash-topbar__avatar-placeholder {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff) !important;
  color: #4f46e5 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}


/* Notifications bell */
.dash-notif__bell {
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #f8fafc !important;
  border: 1px solid #f1f5f9 !important;
  border-radius: 8px !important;
  color: #64748b !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all .15s;
}
.dash-notif__bell:hover {
  background: #f1f5f9 !important;
  color: #1e293b !important;
}
.dash-notif__badge {
  position: absolute !important;
  top: 4px !important;
  right: 4px !important;
  width: 8px !important;
  height: 8px !important;
  background: #ef4444 !important;
  border-radius: 50% !important;
  border: 1.5px solid #fff !important;
  font-size: 0 !important;
}
.dash-notif__dropdown {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: var(--dash-shadow-lg) !important;
}
.dash-notif__header {
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 12px 16px !important;
  color: #0f172a !important;
}

/* Logout button */
#dashNewBtn {
  border-radius: 8px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  gap: 6px !important;
  padding: 6px 14px !important;
}

/* ── MAIN CONTENT ── */
.dash-main {
  background: #f9fafb !important;
  margin-left: 240px !important;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.dash-topbar { flex-shrink: 0; }
.dash-content {
  background: #f9fafb !important;
  padding: 24px 28px !important;
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* ── CARDS ── */
.dash-card {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 10px !important;
  box-shadow: var(--dash-shadow-sm) !important;
  padding: 0 !important;
  transition: box-shadow .2s ease !important;
  overflow: hidden !important;
}
.dash-card:hover {
  box-shadow: var(--dash-shadow-md) !important;
}
.dash-card__header {
  padding: 16px 20px 10px !important;
  border-bottom: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}
.dash-card__header h3 {
  color: #111827 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  margin: 0 !important;
  letter-spacing: -.01em;
}
.dash-card__link {
  color: #4f46e5 !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  text-decoration: none !important;
}
.dash-card__link:hover {
  text-decoration: underline !important;
}
.dash-card__body {
  padding: 0 24px 20px !important;
}

/* ── STAT CARDS ── */
.dash-stats {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 14px !important;
  margin-bottom: 22px !important;
}
.dash-stat, .dash-stat-card {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 10px !important;
  box-shadow: var(--dash-shadow-sm) !important;
  padding: 18px 20px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 14px !important;
  transition: box-shadow .2s;
}
.dash-stat:hover, .dash-stat-card:hover {
  box-shadow: var(--dash-shadow-md) !important;
}
.dash-stat__icon, .dash-stat-card__icon {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  border-radius: 10px !important;
  background: #eef2ff !important;
  color: #4f46e5 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
.dash-stat__icon svg, .dash-stat-card__icon svg {
  width: 18px !important;
  height: 18px !important;
  stroke-width: 1.75;
}
.dash-stat__info, .dash-stat-card__info {
  display: flex !important;
  flex-direction: column !important;
}
.dash-stat__value, .dash-stat-card__value {
  color: #111827 !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  letter-spacing: -.02em;
}
.dash-stat__label, .dash-stat-card__label {
  color: #6b7280 !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
  margin-top: 2px !important;
}

/* ── GRID LAYOUTS ── */
.dash-grid {
  display: grid !important;
  gap: 20px !important;
}
.dash-grid--3 {
  grid-template-columns: repeat(3, 1fr) !important;
}
.dash-grid--2 {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* ── TABLES ── */
.dash-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.dash-table thead th {
  background: #f8fafc !important;
  color: #64748b !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  padding: 10px 16px !important;
  white-space: nowrap;
}
.dash-table tbody td {
  color: #1e293b !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 12px 16px !important;
  font-size: 13.5px !important;
}
.dash-table tbody tr:hover td {
  background: #f8fafc !important;
}
.dash-table tbody tr:last-child td {
  border-bottom: none !important;
}

/* ── FORMS ── */
.dash-input,
.dash-select,
.dash-textarea,
input.dash-input,
select.dash-select,
textarea.dash-textarea {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-family: var(--dash-font) !important;
  padding: 9px 12px !important;
  transition: border-color .15s, box-shadow .15s !important;
}
.dash-input:focus,
.dash-select:focus,
.dash-textarea:focus {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,.1) !important;
  outline: none !important;
}
.dash-input::placeholder {
  color: #94a3b8 !important;
}
.dash-label,
.dash-form__label {
  color: #475569 !important;
  font-weight: 600 !important;
  font-size: 13px !important;
}

/* ── BUTTONS ── */
body.dash .btn--primary {
  background: #4f46e5 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  box-shadow: 0 1px 2px rgba(79,70,229,.15) !important;
  transition: all .15s !important;
}
body.dash .btn--primary:hover {
  background: #4338ca !important;
  box-shadow: 0 2px 8px rgba(79,70,229,.2) !important;
}
body.dash .btn--outline {
  background: #fff !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  transition: all .15s !important;
}
body.dash .btn--outline:hover {
  border-color: #a5b4fc !important;
  color: #4f46e5 !important;
  background: #fafaff !important;
}
body.dash .btn--sm {
  border-radius: 8px !important;
  padding: 6px 14px !important;
  font-size: 12.5px !important;
}
body.dash .btn--xs {
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 11.5px !important;
}

/* ── ICON BUTTONS ── */
.dash-icon-btn {
  color: #64748b !important;
  border-radius: 8px !important;
  transition: all .15s;
}
.dash-icon-btn:hover {
  background: #f1f5f9 !important;
  color: #1e293b !important;
}
.dash-icon-btn--danger,
[data-doc-delete].dash-icon-btn {
  color: #ef4444 !important;
}
.dash-icon-btn--danger:hover,
[data-doc-delete].dash-icon-btn:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

/* ── BADGES / STATUS ── */
.dash-badge, .status-badge {
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 11.5px !important;
  padding: 3px 8px !important;
}

/* ── EMPTY STATES ── */
.dash-empty, .empty-state {
  color: #94a3b8 !important;
  text-align: center !important;
  padding: 48px 24px !important;
}

/* ── OVERLAY ── */
.dash-overlay {
  background: rgba(15,23,42,.15) !important;
  backdrop-filter: blur(2px) !important;
}

/* ── PROFILE ── */
.profile-hero__info h2 { color: #0f172a !important; }
.profile-hero__info span { color: #64748b !important; }
.profile-field__label { color: #64748b !important; font-size: 12px !important; }
.profile-field__value { color: #0f172a !important; font-size: 13.5px !important; }
.profile-field { border-color: #f1f5f9 !important; }
.profile-form__subtitle {
  color: #0f172a !important;
  border-color: #f1f5f9 !important;
  font-weight: 700 !important;
}
.profile-logo,
.profile-logo-preview {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #94a3b8 !important;
  border-radius: 12px !important;
}

/* ── SETTINGS ── */
.settings-row__label strong { color: #0f172a !important; font-weight: 600 !important; }
.settings-row__label span { color: #64748b !important; }
.settings-row__value { color: #1e293b !important; }

/* ── MODALS / POPUPS ── */
.plan-marker-popup,
.plan-upload-modal,
.plan-marker-modal {
  background: #ffffff !important;
  color: #1e293b !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.12) !important;
  border-radius: 16px !important;
}
.plan-marker-popup__header {
  border-bottom-color: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}
.plan-marker-popup__close {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border-radius: 8px !important;
}
.plan-marker-popup__close:hover {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}
.plan-marker-popup__label { color: #64748b !important; }
.plan-marker-popup__value {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
  border-radius: 8px !important;
}
.plan-marker-popup__thumb { border-color: #e2e8f0 !important; border-radius: 8px !important; }
.plan-marker-modal .dash-label { color: #475569 !important; }
.plan-marker-modal .dash-input {
  background: #fff !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

/* ── COMPANY ANALYSIS ── */
.ca-search__status { color: #1e293b !important; }
.ca-rating-desc,
.ca-ins-item__form,
.ca-ins-item__detail b { color: #1e293b !important; }
.ca-board-card__detail,
.ca-ins-item__detail,
.ca-bis-section,
.ca-bis-section__label,
.ca-share-stat__label,
.ca-share-table__pk,
.ca-fin-kpi__label,
.ca-fin-tab { color: #64748b !important; }
.ca-share-table thead th,
.ca-share-table tbody td,
.ca-fin-tbl thead th,
.ca-fin-tbl td,
.ca-fin-kpi__value,
.ca-fin-tab.active { color: #0f172a !important; }
.ca-share-table thead th { border-bottom-color: #e2e8f0 !important; }
.ca-share-table tbody td { border-bottom-color: #f1f5f9 !important; }
.ca-share-table tbody tr:hover td { background: #f8fafc !important; }
.ca-fin-kpi { background: #f8fafc !important; border-color: #e2e8f0 !important; border-radius: 10px !important; }
.ca-fin-tabs { border-bottom-color: #e2e8f0 !important; }
.ca-fin-tab:hover { color: #1e293b !important; }
.ca-fin-tab.active { border-bottom-color: #4f46e5 !important; color: #4f46e5 !important; }
.ca-fin-tbl th,
.ca-fin-tbl td { border-bottom-color: #f1f5f9 !important; }
.ca-fin-tbl th:first-child,
.ca-fin-tbl td:first-child,
.ca-fin-tbl thead th,
.ca-fin-tbl thead th:first-child,
.ca-fin-tbl__bold td { background: #f8fafc !important; }
.ca-ins-item { background: #f8fafc !important; border-color: #e2e8f0 !important; border-radius: 10px !important; }
.ca-ins-item--active { background: #fef2f2 !important; border-color: #fca5a5 !important; }
.ca-card--danger { border-color: #fca5a5 !important; background: #fef2f2 !important; }

/* ── EMPLOYEE DOCS ── */
.emp-docs-generators h4,
.emp-photo-hint,
.nodarb-extra-row__name,
.ts-emp-checkbox,
.ts-emp-checkbox small { color: #1e293b !important; }

/* ── ESTIMATES / SPREADSHEET ── */
.est-delete-btn {
  color: #475569 !important;
  border-color: #e2e8f0 !important;
  border-radius: 6px !important;
}

/* ── MARKER VIEW ── */
.plan-marker-view__value {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
  border-radius: 8px !important;
}
.plan-marker-view__thumb {
  border-color: #e2e8f0 !important;
  background: #f8fafc !important;
  border-radius: 8px !important;
}

/* ── TABS (generic dashboard tabs) ── */
.dash-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 20px;
}
.dash-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.dash-tab:hover {
  color: #1e293b;
}
.dash-tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
  font-weight: 600;
}

/* ── SCROLLBAR ── */
body.dash ::-webkit-scrollbar { width: 5px; height: 5px; }
body.dash ::-webkit-scrollbar-track { background: transparent; }
body.dash ::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
body.dash ::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ── TOAST / NOTIFICATIONS ── */
.toast {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: var(--dash-shadow-lg) !important;
  border-radius: 12px !important;
}


/* ── RESPONSIVE (≤1024px — tablet + mobile) ── */
@media (max-width: 1024px) {
  .dash-main {
    margin-left: 0 !important;
    padding-top: calc(52px + env(safe-area-inset-top, 0px)) !important;
  }
  .dash-topbar {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    z-index: 10002 !important;
    height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  .dash-topbar__burger {
    display: block !important;
  }
  .dash-sidebar {
    transform: translateX(-100%) !important;
    box-shadow: none !important;
    position: fixed !important;
    z-index: 10001 !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 270px !important;
    max-width: 82vw !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s ease !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  .dash-sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.12) !important;
  }
  .dash-sidebar__top {
    display: flex !important;
  }
  .dash-sidebar__close {
    display: flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
  }
  .dash-sidebar__link {
    padding: 10px 12px !important;
    font-size: 14px !important;
    -webkit-tap-highlight-color: rgba(79,70,229,.1) !important;
    touch-action: manipulation !important;
    min-height: 44px !important;
    cursor: pointer !important;
  }
  .dash-sidebar__link.active {
    border-left: 3px solid #4f46e5 !important;
    padding-left: 9px !important;
  }
  .dash-overlay {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    background: rgba(0,0,0,.4) !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }
  .dash-overlay.active {
    display: block !important;
  }
  .dash-topbar__search {
    display: none !important;
  }
  .dash-content {
    padding: 20px 16px !important;
  }
  .dash-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}

/* ── PWA standalone override — same hamburger menu as mobile ── */
@media (display-mode: standalone) {
  .dash-sidebar {
    display: flex !important;
    transform: translateX(-100%) !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  .dash-sidebar.open {
    display: flex !important;
    transform: translateX(0) !important;
  }
}
body.pwa-standalone .dash-sidebar {
  display: flex !important;
  transform: translateX(-100%) !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
}
body.pwa-standalone .dash-sidebar.open {
  display: flex !important;
  transform: translateX(0) !important;
}

@media (max-width: 600px) {
  .dash-content {
    padding: 16px 12px !important;
  }
  .dash-stats {
    grid-template-columns: 1fr !important;
  }
  .dash-stat, .dash-stat-card {
    padding: 16px 18px !important;
  }
  .dash-topbar {
    padding: 0 12px !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
  }
  .dash-topbar__title {
    font-size: 16px !important;
  }
}

@media (min-width: 1025px) {
  .dash-sidebar__close {
    display: none !important;
  }
  .dash-topbar__burger {
    display: none !important;
  }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   KONSULTĀCIJA — LegalAI-style 3-panel layout
   ============================================= */

/* Full-height section override — any section with k-layout fills available space */
.dash-section.active:has(.k-layout) {
  display: flex !important;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0 !important;
}
#sec-konsultacija.active,
#sec-apelacijas.active,
#sec-doc-analysis.active,
#sec-doc-drafting.active,
#sec-strategy.active,
#sec-opinion.active,
#sec-case-prediction.active {
  display: flex !important;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0 !important;
}
.dash-section .k-layout {
  margin: 0 !important;
  flex: 1;
  min-height: 0;
  height: 100% !important;
}

.k-layout {
  display: grid;
  grid-template-columns: 250px 1fr 270px;
  height: 100%;
  width: 100%;
  gap: 0;
  background: #fff;
}

/* ── LEFT PANEL (Sessions) ── */
.k-left {
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.k-left__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}
.k-left__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
}
.k-left__title svg { color: #4f46e5; width: 15px; height: 15px; }

.k-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.k-session {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: #64748b;
  transition: all .15s;
  margin-bottom: 2px;
}
.k-session:hover { background: #f3f4f6; color: #111827; }
.k-session.active { background: #eef2ff; color: #4f46e5; font-weight: 600; }
.k-session.active svg { color: #4f46e5; }
.k-session svg { color: #9ca3af; width: 16px; height: 16px; flex-shrink: 0; }
.k-session--empty {
  flex-direction: column;
  text-align: center;
  padding: 40px 16px;
  cursor: default;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}
.k-session--empty svg { color: #cbd5e1; margin-bottom: 4px; }
.k-session__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.k-session__date { font-size: 10.5px; color: #94a3b8; white-space: nowrap; }

/* ── CENTER (Content) ── */
.k-center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  position: relative;
}

/* Tabs */
.k-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 20px;
  background: #fff;
  flex-shrink: 0;
}
.k-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.k-tab:hover { color: #111827; }
.k-tab:hover svg { color: #6b7280; }
.k-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; font-weight: 600; }
.k-tab.active svg { color: #4f46e5; }
.k-tab svg { color: #d1d5db; transition: color .15s; width: 14px; height: 14px; }
.k-tabs__actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

/* Content area */
.k-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* Welcome state */
.k-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  min-height: 400px;
  color: #6b7280;
}
.k-welcome__icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #eef2ff;
  border: 1px solid #ddd6fe;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.k-welcome__icon svg { color: #4f46e5; width: 28px; height: 28px; stroke-width: 1.5; }
.k-welcome h2 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}
.k-welcome p {
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
  margin: 0 0 22px;
  max-width: 440px;
}
.k-welcome__hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.k-hint {
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.k-hint:hover {
  border-color: #a5b4fc;
  color: #4f46e5;
  background: #fafaff;
}

/* Loading state */
.k-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  text-align: center;
}
.k-loading__spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: 14px;
}
.k-loading p {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
}
.k-loading span {
  font-size: 12px;
  color: #9ca3af;
}

/* Tab panels */
.k-tab-panel { display: none; }
.k-tab-panel.active { display: block; }

/* Meta info */
.k-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}
.k-meta:empty { display: none; }
.k-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  font-size: 11.5px;
  color: #475569;
}
.k-meta-item strong {
  color: #0f172a;
  font-weight: 600;
}

/* Analysis text */
.k-analysis-text {
  font-size: 14px;
  line-height: 1.85;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
}
.k-analysis-text h3,
.k-analysis-text h2 {
  color: #0f172a;
  margin: 24px 0 8px;
  font-size: 15px;
}
.k-analysis-text strong { color: #0f172a; }

/* Sources list */
.k-sources-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.k-source-item {
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  font-size: 13px;
  color: #1e293b;
  transition: border-color .15s;
}
.k-source-item:hover { border-color: #c7d2fe; }
.k-source-item__name { font-weight: 600; }
.k-source-item__type { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* References list */
.k-refs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.k-ref-group { margin-bottom: 8px; }
.k-ref-group__title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  padding: 8px 0 6px;
  border-bottom: 2px solid #eef2ff;
  margin-bottom: 8px;
}
.k-ref-item {
  padding: 8px 0 8px 14px;
  border-left: 2px solid #e2e8f0;
  margin-bottom: 6px;
}
.k-ref-item__nr { font-size: 11px; color: #94a3b8; font-weight: 600; }
.k-ref-item__name { font-size: 13px; font-weight: 600; color: #1e293b; margin: 2px 0 4px; }
.k-ref-item__text { font-size: 12.5px; color: #64748b; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* ── BOTTOM INPUT BAR (always pinned at bottom of k-center) ── */
.k-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 20px 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.k-input-bar__attach {
  flex-shrink: 0;
}
.k-input-bar__files {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  padding-bottom: 6px;
}
.k-input-bar__files.has-files {
  display: flex;
}
.k-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #eef2ff;
  border-radius: 100px;
  font-size: 11px;
  color: #4f46e5;
  font-weight: 500;
}
.k-file-chip__remove {
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  padding: 0;
  border: none;
  background: none;
}
.k-file-chip__remove:hover { color: #ef4444; }

.k-input-bar__textarea {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--dash-font);
  color: #111827;
  background: #f9fafb;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  line-height: 1.5;
}
.k-input-bar__textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,.08);
  background: #fff;
}
.k-input-bar__textarea::placeholder { color: #9ca3af; }

.k-input-bar__send {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 8px;
  border: none;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(79,70,229,.3);
}
.k-input-bar__send:hover {
  background: #4338ca;
  box-shadow: 0 2px 8px rgba(79,70,229,.35);
}
.k-input-bar__send:disabled {
  opacity: .5;
  pointer-events: none;
}

.k-input-bar__mic {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.k-input-bar__mic:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: #eef2ff;
}
.k-input-bar__mic.recording {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.3); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ── ICON BUTTONS ── */
.k-btn-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  transition: all .15s;
}
.k-btn-icon:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #e2e8f0;
}

/* ── RIGHT PANEL ── */
.k-right {
  background: #f9fafb;
  overflow-y: auto;
  padding: 0;
}
.k-right__section {
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.k-right__section h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #4b5563;
  margin: 0 0 10px;
}
.k-right__section h4 svg { color: #4f46e5; width: 13px; height: 13px; }
.k-right__empty {
  font-size: 12px;
  color: #9ca3af;
}
.k-right__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.k-right__source-item {
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  font-size: 12px;
  color: #111827;
  line-height: 1.4;
}
.k-right__source-item strong { display: block; font-size: 11px; color: #4f46e5; margin-bottom: 1px; font-weight: 600; }
.k-right__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.k-right__tag {
  display: inline-block;
  padding: 3px 10px;
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.k-right__detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
}
.k-right__detail-row:last-child { border-bottom: none; }
.k-right__detail-label { color: #9ca3af; font-size: 11.5px; }
.k-right__detail-value { color: #111827; font-weight: 500; font-size: 12px; }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
  .k-layout { grid-template-columns: 240px 1fr; }
  .k-right { display: none; }
}
@media (max-width: 900px) {
  .k-layout { grid-template-columns: 1fr; }
  .k-left { display: none; }
  .k-right { display: none; }
  .k-content { padding: 16px; }
  .k-input-bar {
    padding: 10px 12px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

/* When konsultacija / apelacijas is active, content becomes edge-to-edge */
.dash-content.k-mode {
  padding: 0 !important;
  overflow: hidden !important;
  background: #f9fafb !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 0 !important;
}


/* === APELĀCIJAS UPLOAD ZONE === */
.apel-upload-area {
  margin-top: 24px;
  width: 100%;
  max-width: 480px;
}

.apel-upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #64748b;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.apel-upload-zone:hover,
.apel-upload-zone.drag-over {
  border-color: #6366f1;
  background: #f5f3ff;
}

.apel-upload-zone p {
  margin: 0;
  font-size: 13px;
}

.apel-upload-zone span {
  font-size: 11px;
  color: #94a3b8;
}

.apel-upload-btn {
  background: none;
  border: none;
  color: #6366f1;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
  font-size: inherit;
}

.apel-or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 20px 0;
  color: #94a3b8;
  font-size: 12px;
}

.apel-or-divider::before,
.apel-or-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid #e2e8f0;
}

.apel-paste-area {
  width: 100%;
  max-width: 480px;
}

.apel-paste-textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  color: #1e293b;
  transition: border-color .2s;
}

.apel-paste-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.apel-start-btn {
  min-width: 200px;
}

.apel-doc-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: #334155;
  font-size: 12px;
  transition: background .15s;
  border-bottom: 1px solid #f1f5f9;
}
.apel-doc-link:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.apel-doc-link svg {
  flex-shrink: 0;
  margin-top: 2px;
  stroke: #6366f1;
}
.apel-doc-link--new {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  font-weight: 600;
  margin-bottom: 6px;
}
.apel-doc-link--new svg {
  stroke: #4f46e5;
}
.apel-doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.apel-doc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.apel-doc-meta {
  font-size: 11px;
  color: #94a3b8;
}
