/* TelephonAI shared design system (clean + minimal).
   Loaded on all pages to keep theme + light-mode overrides consistent. */

:root {
  /* Dark by default; theme.js toggles `.light-mode` on `html` + `body`. */
  color-scheme: dark;

  /* Base palette (dark) */
  --tp-bg: #0b1220;
  --tp-surface: #0f172a;
  --tp-surface-2: #111c32;
  --tp-border: rgba(148, 163, 184, 0.16);
  --tp-text: #e5e7eb;
  --tp-muted: #94a3b8;

  /* Brand (v4): Teal + Ember */
  --tp-primary: #14b8a6;
  --tp-primary-600: #0d9488;
  --tp-primary-700: #0f766e;
  --tp-secondary: #f97316;
  --tp-secondary-600: #ea580c;

  /* Interaction */
  --tp-focus: rgba(20, 184, 166, 0.55);
  --tp-glow-1: rgba(20, 184, 166, 0.16);
  --tp-glow-2: rgba(249, 115, 22, 0.14);
}

html,
body {
  height: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

::selection {
  background: rgba(20, 184, 166, 0.24);
}

/* Consistent focus ring across the platform (Tailwind pages already add rings to inputs). */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--tp-focus);
  outline-offset: 2px;
}

/* Subtle scrollbars (works in Chromium + Firefox). */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.32);
}

/* Light mode support (the platform uses a 'light-mode' class toggled by static/js/theme.js). */
.light-mode {
  color-scheme: light;

  /* Base palette (light) */
  --tp-bg: #f8fafc;
  --tp-surface: #ffffff;
  --tp-surface-2: #f1f5f9;
  --tp-border: #e2e8f0;
  --tp-text: #0f172a;
  --tp-muted: #475569;

  background: var(--tp-bg) !important;
  color: var(--tp-text) !important;
}

.light-mode body {
  background: radial-gradient(900px 520px at 16% 8%, var(--tp-glow-1), transparent 62%),
    radial-gradient(860px 520px at 84% 12%, var(--tp-glow-2), transparent 60%),
    var(--tp-bg) !important;
}

.light-mode .bg-slate-950 {
  background: var(--tp-bg) !important;
}
.light-mode .bg-slate-900 {
  background: var(--tp-surface) !important;
}
.light-mode .bg-slate-900\/80 {
  background: rgba(255, 255, 255, 0.92) !important;
}
.light-mode .bg-slate-900\/95 {
  background: rgba(255, 255, 255, 0.94) !important;
}
.light-mode .bg-slate-900\/70 {
  background: rgba(255, 255, 255, 0.88) !important;
}
.light-mode .bg-slate-900\/60 {
  background: rgba(255, 255, 255, 0.86) !important;
}
.light-mode .bg-slate-900\/50 {
  background: rgba(255, 255, 255, 0.86) !important;
}
.light-mode .bg-slate-900\/40 {
  background: rgba(255, 255, 255, 0.82) !important;
}
.light-mode .bg-slate-800 {
  background: var(--tp-surface-2) !important;
}
.light-mode .bg-slate-800\/50,
.light-mode .bg-slate-800\/30 {
  background: rgba(241, 245, 249, 0.82) !important;
}
.light-mode .bg-slate-800\/70 {
  background: rgba(241, 245, 249, 0.92) !important;
}
.light-mode .bg-slate-800\/60 {
  background: rgba(241, 245, 249, 0.9) !important;
}
.light-mode .bg-slate-800\/80 {
  background: rgba(241, 245, 249, 0.96) !important;
}
.light-mode .bg-slate-950\/95 {
  background: rgba(255, 255, 255, 0.96) !important;
}
.light-mode .bg-slate-950\/80 {
  background: rgba(246, 247, 251, 0.88) !important;
}
.light-mode .bg-slate-950\/70 {
  background: rgba(255, 255, 255, 0.88) !important;
}
.light-mode .bg-slate-950\/60 {
  background: rgba(255, 255, 255, 0.86) !important;
}
.light-mode .bg-slate-950\/50 {
  background: rgba(255, 255, 255, 0.84) !important;
}
.light-mode .bg-slate-950\/40 {
  background: rgba(241, 245, 249, 0.9) !important;
}
.light-mode .bg-slate-950\/30 {
  background: rgba(241, 245, 249, 0.82) !important;
}
.light-mode .bg-slate-950\/20 {
  background: rgba(241, 245, 249, 0.74) !important;
}
.light-mode .bg-slate-700 {
  background: #e2e8f0 !important;
}
.light-mode .bg-slate-700\/60 {
  background: rgba(226, 232, 240, 0.82) !important;
}
.light-mode .bg-slate-700\/50 {
  background: rgba(226, 232, 240, 0.72) !important;
}
.light-mode .bg-slate-700\/40 {
  background: rgba(226, 232, 240, 0.6) !important;
}
.light-mode .border-slate-800,
.light-mode .border-slate-700 {
  border-color: var(--tp-border) !important;
}
.light-mode .border-slate-600 {
  border-color: #cbd5e1 !important;
}
.light-mode .border-slate-800\/70 {
  border-color: rgba(226, 232, 240, 0.72) !important;
}
.light-mode .border-slate-800\/80 {
  border-color: rgba(226, 232, 240, 0.78) !important;
}
.light-mode .border-slate-700\/70 {
  border-color: rgba(226, 232, 240, 0.72) !important;
}
.light-mode .border-slate-700\/60 {
  border-color: rgba(226, 232, 240, 0.62) !important;
}
.light-mode .border-slate-700\/50 {
  border-color: rgba(226, 232, 240, 0.54) !important;
}
.light-mode .border-slate-700\/40 {
  border-color: rgba(226, 232, 240, 0.46) !important;
}
.light-mode .border-slate-600\/70 {
  border-color: rgba(203, 213, 225, 0.78) !important;
}

/* Hover utility overrides (Tailwind uses escaped class names in CSS). */
.light-mode .hover\:bg-slate-700:hover {
  background: rgba(226, 232, 240, 0.8) !important;
}
.light-mode .hover\:bg-slate-800:hover {
  background: rgba(241, 245, 249, 0.92) !important;
}
.light-mode .hover\:bg-slate-800\/70:hover {
  background: rgba(241, 245, 249, 0.92) !important;
}
.light-mode .hover\:bg-slate-800\/60:hover {
  background: rgba(241, 245, 249, 0.9) !important;
}
.light-mode .hover\:bg-slate-800\/80:hover {
  background: rgba(241, 245, 249, 0.96) !important;
}
.light-mode .hover\:bg-slate-700\/50:hover {
  background: rgba(226, 232, 240, 0.74) !important;
}
.light-mode .text-white {
  color: var(--tp-text) !important;
}
.light-mode :is(
    .bg-blue-600,
    .bg-blue-500,
    .bg-indigo-600,
    .bg-indigo-500,
    .bg-purple-600,
    .bg-purple-500,
    .bg-emerald-600,
    .bg-green-600,
    .bg-red-600,
    .bg-amber-500
  ).text-white {
  color: #ffffff !important;
}
.light-mode :is(
    .bg-blue-600,
    .bg-blue-500,
    .bg-indigo-600,
    .bg-indigo-500,
    .bg-purple-600,
    .bg-purple-500,
    .bg-emerald-600,
    .bg-green-600,
    .bg-red-600,
    .bg-amber-500
  )
  .text-white {
  color: #ffffff !important;
}
.light-mode .text-slate-200 {
  color: #1f2937 !important;
}
.light-mode .text-slate-300,
.light-mode .text-slate-400 {
  color: #475569 !important;
}
.light-mode .text-slate-500 {
  color: #64748b !important;
}
.light-mode .text-slate-600 {
  color: #475569 !important;
}

.light-mode .shadow-blue-600\/20,
.light-mode .shadow-blue-600\/40 {
  box-shadow: 0 18px 45px rgba(14, 165, 233, 0.16) !important;
}
.light-mode .shadow-indigo-500\/20 {
  box-shadow: 0 18px 45px rgba(14, 165, 233, 0.16) !important;
}

.light-mode .hover\:shadow-\[0_18px_40px_rgba\(59\,130\,246\,0\.25\)\]:hover {
  box-shadow: 0 18px 45px rgba(14, 165, 233, 0.18) !important;
}

.light-mode input,
.light-mode textarea,
.light-mode select {
  color: var(--tp-text) !important;
  background-color: var(--tp-surface) !important;
  border-color: var(--tp-border) !important;
}

.light-mode input::placeholder,
.light-mode textarea::placeholder {
  color: #94a3b8 !important;
}

/* Brand remap for Tailwind utilities used across templates. */
.light-mode .text-blue-200,
.light-mode .text-blue-300,
.light-mode .text-blue-400,
.light-mode .text-sky-300,
.light-mode .text-sky-400 {
  color: var(--tp-primary-700) !important;
}
.light-mode .text-indigo-200,
.light-mode .text-indigo-300,
.light-mode .text-indigo-400,
.light-mode .text-indigo-500 {
  color: var(--tp-primary-700) !important;
}
.light-mode .text-purple-200,
.light-mode .text-purple-300,
.light-mode .text-purple-400,
.light-mode .text-violet-300,
.light-mode .text-violet-400 {
  color: var(--tp-secondary) !important;
}
.light-mode .bg-blue-600,
.light-mode .bg-blue-500 {
  background-color: var(--tp-primary-600) !important;
}
.light-mode .bg-indigo-600,
.light-mode .bg-indigo-500 {
  background-color: var(--tp-primary-600) !important;
}
.light-mode .bg-indigo-600\/80 {
  background-color: rgba(3, 105, 161, 0.9) !important;
}
.light-mode .hover\:bg-blue-700:hover,
.light-mode .hover\:bg-blue-600:hover {
  background-color: var(--tp-primary-700) !important;
}
.light-mode .hover\:bg-indigo-500:hover,
.light-mode .hover\:bg-indigo-600:hover {
  background-color: var(--tp-primary-700) !important;
}
.light-mode .bg-purple-600,
.light-mode .bg-purple-500 {
  background-color: var(--tp-secondary) !important;
}
.light-mode .hover\:bg-purple-700:hover,
.light-mode .hover\:bg-purple-600:hover {
  background-color: var(--tp-secondary-600) !important;
}
.light-mode .border-blue-500\/20,
.light-mode .border-blue-500\/30,
.light-mode .border-blue-500\/60,
.light-mode .border-blue-500 {
  border-color: rgba(14, 165, 233, 0.32) !important;
}
.light-mode .border-indigo-500,
.light-mode .border-indigo-500\/60 {
  border-color: rgba(14, 165, 233, 0.34) !important;
}
.light-mode .hover\:border-indigo-400:hover,
.light-mode .hover\:border-indigo-500\/60:hover {
  border-color: rgba(14, 165, 233, 0.5) !important;
}
.light-mode .border-purple-500\/20,
.light-mode .border-purple-500\/30,
.light-mode .border-purple-500 {
  border-color: rgba(99, 102, 241, 0.28) !important;
}
.light-mode .bg-blue-500\/10,
.light-mode .bg-blue-500\/20,
.light-mode .bg-blue-500\/30 {
  background-color: rgba(14, 165, 233, 0.1) !important;
}
.light-mode .bg-indigo-500\/10,
.light-mode .bg-indigo-500\/15,
.light-mode .bg-indigo-500\/20,
.light-mode .bg-indigo-500\/30 {
  background-color: rgba(14, 165, 233, 0.12) !important;
}
.light-mode .bg-purple-500\/10,
.light-mode .bg-purple-500\/20 {
  background-color: rgba(99, 102, 241, 0.1) !important;
}
.light-mode .focus\:border-blue-500:focus {
  border-color: rgba(14, 165, 233, 0.6) !important;
}
.light-mode .focus\:ring-blue-500\/20:focus {
  --tw-ring-color: rgba(14, 165, 233, 0.22) !important;
}

/* Tailwind gradients: blue->purple becomes teal->violet. */
.light-mode .from-blue-500 {
  --tw-gradient-from: var(--tp-primary) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(14, 165, 233, 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
.light-mode .from-blue-600 {
  --tw-gradient-from: var(--tp-primary-600) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(2, 132, 199, 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
.light-mode .to-purple-600,
.light-mode .to-purple-700 {
  --tw-gradient-to: var(--tp-secondary) var(--tw-gradient-to-position) !important;
}
.light-mode .to-purple-500 {
  --tw-gradient-to: rgba(99, 102, 241, 0.9) var(--tw-gradient-to-position) !important;
}
.light-mode .via-purple-500 {
  --tw-gradient-stops: var(--tw-gradient-from), rgba(99, 102, 241, 0.82) var(--tw-gradient-via-position),
    var(--tw-gradient-to) !important;
}

.light-mode .from-blue-700,
.light-mode .hover\:from-blue-700:hover {
  --tw-gradient-from: var(--tp-primary-700) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(3, 105, 161, 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
.light-mode .hover\:from-indigo-500:hover,
.light-mode .from-indigo-500 {
  --tw-gradient-from: var(--tp-primary) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(14, 165, 233, 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
.light-mode .from-indigo-600 {
  --tw-gradient-from: var(--tp-primary-600) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(2, 132, 199, 0) var(--tw-gradient-to-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
.light-mode .hover\:from-indigo-500:hover,
.light-mode .hover\:from-indigo-600:hover {
  --tw-gradient-from: var(--tp-primary-600) var(--tw-gradient-from-position) !important;
}
.light-mode .hover\:to-purple-700:hover,
.light-mode .hover\:to-purple-600:hover,
.light-mode .hover\:to-purple-500:hover {
  --tw-gradient-to: var(--tp-secondary) var(--tw-gradient-to-position) !important;
}

/* App shell v4: sidebar navigation + mobile drawer + glass content frame. */
body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", "Inter", sans-serif;
  background: radial-gradient(980px 620px at 12% -8%, rgba(20, 184, 166, 0.2), transparent 60%),
    radial-gradient(860px 540px at 88% -12%, rgba(249, 115, 22, 0.18), transparent 62%), var(--tp-bg);
  color: var(--tp-text);
}

.tp-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  flex: 1 1 auto;
}

.tp-content-shell {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.8rem 1rem;
}

.tp-main {
  min-height: calc(100vh - 5.75rem);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.5));
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
}

.tp-mobile-bar {
  position: sticky;
  top: 0;
  z-index: 70;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--tp-border);
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(14px);
}

.tp-mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--tp-text);
  text-decoration: none;
}

.tp-mobile-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tp-mobile-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.tp-mobile-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tp-mobile-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tp-mobile-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--tp-text);
  background: rgba(30, 41, 59, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.tp-mobile-icon:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.42);
  background: rgba(15, 118, 110, 0.25);
}

.tp-mobile-actions details {
  position: relative;
}

.tp-mobile-actions summary {
  list-style: none;
}

.tp-mobile-actions summary::-webkit-details-marker {
  display: none;
}

.tp-mobile-menu {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 0.55rem;
  width: min(20.5rem, calc(100vw - 1rem));
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 1rem;
  padding: 0.45rem;
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.48);
  backdrop-filter: blur(16px);
  z-index: 90;
}

.tp-mobile-actions details[open] .tp-mobile-menu {
  display: block;
  animation: tpMenuIn 0.2s ease;
}

.tp-mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.72rem;
  padding: 0.65rem 0.7rem;
  color: var(--tp-text);
  text-decoration: none;
  font-size: 0.9rem;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tp-mobile-menu-item:hover {
  border-color: rgba(20, 184, 166, 0.28);
  background: rgba(20, 184, 166, 0.12);
}

.tp-mobile-menu-item.is-active {
  color: #ffffff;
  border-color: rgba(20, 184, 166, 0.4);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.3), rgba(249, 115, 22, 0.2));
}

.tp-mobile-divider {
  height: 1px;
  margin: 0.45rem 0;
  background: rgba(148, 163, 184, 0.2);
}

.tp-mobile-lang {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  padding: 0.35rem 0.62rem;
  margin: 0.2rem 0.2rem 0.25rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tp-text);
  background: rgba(30, 41, 59, 0.76);
  cursor: pointer;
}

.tp-mobile-lang:hover {
  border-color: rgba(20, 184, 166, 0.44);
  background: rgba(20, 184, 166, 0.18);
}

.tp-sidebar {
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  border-right: 1px solid var(--tp-border);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.93), rgba(15, 23, 42, 0.8));
  padding: 1.15rem 0.9rem;
  overflow-y: auto;
}

.tp-sidebar-top,
.tp-sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.tp-brand-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.tp-brand {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.72rem;
  text-decoration: none;
  color: var(--tp-text);
}

.tp-sidebar-toggle {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 0.72rem;
  color: var(--tp-text);
  background: rgba(30, 41, 59, 0.62);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.tp-sidebar-toggle:hover {
  border-color: rgba(20, 184, 166, 0.4);
  background: rgba(20, 184, 166, 0.14);
  transform: translateY(-1px);
}

.tp-brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tp-brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.tp-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
}

.tp-brand-copy strong {
  font-size: 0.95rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.tp-brand-copy small {
  font-size: 0.73rem;
  color: var(--tp-muted);
  letter-spacing: 0.02em;
}

.tp-create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.44rem;
  width: 100%;
  padding: 0.66rem 0.8rem;
  border: none;
  border-radius: 0.8rem;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, var(--tp-primary), var(--tp-secondary));
  box-shadow: 0 14px 28px rgba(20, 184, 166, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.tp-create-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 18px 34px rgba(20, 184, 166, 0.34);
}

.tp-tab-nav {
  display: grid;
  gap: 0.45rem;
}

.tp-tab {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.82rem;
  padding: 0.65rem 0.72rem;
  color: var(--tp-text);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  background: rgba(30, 41, 59, 0.44);
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.tp-tab i {
  width: 1rem;
  text-align: center;
  color: var(--tp-muted);
}

.tp-tab:hover {
  transform: translateX(2px);
  border-color: rgba(20, 184, 166, 0.36);
  background: rgba(20, 184, 166, 0.12);
}

.tp-tab.is-active {
  color: #ffffff;
  border-color: rgba(20, 184, 166, 0.44);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.3), rgba(249, 115, 22, 0.2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tp-tab.is-active i {
  color: #ffffff;
}

.tp-sidebar-tools {
  display: flex;
  gap: 0.55rem;
}

.tp-sidebar-tools #lang-dropdown {
  flex: 1 1 auto;
}

.tp-tool-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.72rem;
  padding: 0.56rem 0.68rem;
  color: var(--tp-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(30, 41, 59, 0.5);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.tp-tool-btn:hover {
  border-color: rgba(20, 184, 166, 0.4);
  background: rgba(20, 184, 166, 0.14);
}

#lang-current {
  text-transform: uppercase;
}

.tp-lang-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  min-width: 11.2rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 0.85rem;
  padding: 0.4rem;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 20px 36px rgba(2, 6, 23, 0.48);
  z-index: 110;
}

.tp-lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid transparent;
  border-radius: 0.64rem;
  padding: 0.5rem 0.56rem;
  color: var(--tp-text);
  background: transparent;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tp-lang-option:hover {
  border-color: rgba(20, 184, 166, 0.34);
  background: rgba(20, 184, 166, 0.14);
}

.tp-lang-chip {
  min-width: 2.05rem;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--tp-muted);
  background: rgba(30, 41, 59, 0.6);
}

.tp-profile {
  display: flex;
  align-items: center;
  gap: 0.56rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.86rem;
  padding: 0.52rem;
  background: rgba(30, 41, 59, 0.48);
}

.tp-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 0.66rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--tp-primary), var(--tp-secondary));
}

.tp-profile-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.tp-profile-copy strong {
  color: var(--tp-text);
  font-size: 0.8rem;
  line-height: 1.15;
}

.tp-profile-copy small {
  color: var(--tp-muted);
  font-size: 0.68rem;
  max-width: 9.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-logout {
  width: 1.95rem;
  height: 1.95rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.62rem;
  color: #fca5a5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: rgba(127, 29, 29, 0.12);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.tp-logout:hover {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(239, 68, 68, 0.16);
}

@media (min-width: 768px) {
  .tp-shell {
    display: grid;
    grid-template-columns: 16.8rem minmax(0, 1fr);
  }

  .tp-content-shell {
    padding: 1.15rem 1.35rem 1.25rem;
  }

  .tp-main {
    min-height: calc(100vh - 2.4rem);
  }

  .tp-sidebar {
    display: flex !important;
    position: sticky;
    top: 0;
    height: 100vh;
  }

  body.tp-sidebar-collapsed .tp-shell {
    grid-template-columns: 5.25rem minmax(0, 1fr);
  }

  body.tp-sidebar-collapsed .tp-sidebar {
    padding: 0.95rem 0.52rem;
  }

  body.tp-sidebar-collapsed .tp-brand {
    justify-content: center;
  }

  body.tp-sidebar-collapsed .tp-brand-copy,
  body.tp-sidebar-collapsed .tp-create-btn span,
  body.tp-sidebar-collapsed .tp-tab span,
  body.tp-sidebar-collapsed .tp-profile-copy,
  body.tp-sidebar-collapsed #lang-current {
    display: none;
  }

  body.tp-sidebar-collapsed .tp-sidebar-top,
  body.tp-sidebar-collapsed .tp-sidebar-bottom {
    align-items: center;
  }

  body.tp-sidebar-collapsed .tp-brand-row {
    flex-direction: column;
    width: 100%;
    gap: 0.42rem;
  }

  body.tp-sidebar-collapsed .tp-tab-nav {
    width: 100%;
  }

  body.tp-sidebar-collapsed .tp-tab {
    justify-content: center;
    padding: 0.62rem;
  }

  body.tp-sidebar-collapsed .tp-tab i {
    width: auto;
  }

  body.tp-sidebar-collapsed .tp-create-btn {
    width: 100%;
    padding: 0.62rem;
  }

  body.tp-sidebar-collapsed .tp-sidebar-tools {
    flex-direction: column;
    width: 100%;
  }

  body.tp-sidebar-collapsed .tp-sidebar-tools #lang-dropdown {
    width: 100%;
  }

  body.tp-sidebar-collapsed .tp-tool-btn {
    justify-content: center;
    padding: 0.58rem;
  }

  body.tp-sidebar-collapsed .tp-profile {
    justify-content: center;
    width: 100%;
    padding: 0.5rem;
  }

  body.tp-sidebar-collapsed .tp-avatar {
    width: 1.86rem;
    height: 1.86rem;
  }

  body.tp-sidebar-collapsed .tp-lang-menu {
    right: -8.95rem;
  }
}

@media (min-width: 1280px) {
  .tp-shell {
    grid-template-columns: 17.8rem minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .tp-main {
    min-height: calc(100vh - 4.9rem);
    border-radius: 1.05rem;
  }
}

.light-mode body {
  background: radial-gradient(860px 520px at 8% -5%, rgba(20, 184, 166, 0.16), transparent 58%),
    radial-gradient(840px 500px at 90% 0%, rgba(249, 115, 22, 0.14), transparent 60%), var(--tp-bg) !important;
}

.light-mode .tp-mobile-bar,
.light-mode .tp-sidebar {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(148, 163, 184, 0.28);
}

.light-mode .tp-sidebar-toggle {
  border-color: rgba(203, 213, 225, 0.9);
  background: rgba(248, 250, 252, 0.92);
  color: #0f172a;
}

.light-mode .tp-main {
  border-color: rgba(203, 213, 225, 0.78);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.95));
  box-shadow: 0 18px 38px rgba(148, 163, 184, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.light-mode :is(.tp-mobile-icon, .tp-tab, .tp-tool-btn, .tp-profile, .tp-mobile-lang, .tp-logout) {
  border-color: rgba(203, 213, 225, 0.9);
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
}

.light-mode .tp-brand-copy small,
.light-mode .tp-profile-copy small,
.light-mode .tp-tab i,
.light-mode .tp-lang-chip {
  color: #64748b;
}

.light-mode :is(.tp-mobile-menu, .tp-lang-menu) {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(203, 213, 225, 0.9);
  box-shadow: 0 16px 32px rgba(148, 163, 184, 0.28);
}

.light-mode :is(.tp-mobile-menu-item, .tp-lang-option) {
  color: #0f172a;
}

.light-mode :is(.tp-tab.is-active, .tp-mobile-menu-item.is-active) {
  color: #042f2e;
  border-color: rgba(20, 184, 166, 0.5);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(249, 115, 22, 0.14));
}

@keyframes tpMenuIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
