/* Transitional HTML components. Actual shadcn React components are a later step. */
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
}
#app-layout { height: 100dvh; gap: 0; }
#main-content { min-width: 0; padding: 2rem; }
#sidebar-container { flex: 0 0 224px; height: 100%; }
#sidebar {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  padding: 1rem 0.75rem; background: var(--sidebar);
  color: var(--sidebar-foreground); border-right: 1px solid var(--border);
}
.workspace-brand { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; margin-bottom: 1.5rem; }
.workspace-brand strong { display: block; font-size: 0.9375rem; color: var(--foreground); }
.workspace-brand small { display: block; font-size: 0.75rem; color: var(--muted-foreground); }
.workspace-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--radius); background: var(--primary); color: var(--primary-foreground); font-weight: 600;
}
.nav-group-label { padding: 0 0.75rem; margin-bottom: 0.5rem; color: var(--muted-foreground); font-size: 0.6875rem; font-weight: 500; }
#sidebar nav { flex: 1; min-height: 0; overflow-y: auto; }
#sidebar .nav-item, #logout-btn {
  display: flex; align-items: center; gap: 0.625rem; margin: 0.125rem 0;
  padding: 0.625rem 0.75rem; border-radius: calc(var(--radius) - 2px);
  color: var(--sidebar-foreground); font-size: 0.8125rem; font-weight: 500;
  background: transparent; box-shadow: none;
}
#sidebar .ui-icon { font-size: 20px; }
#sidebar .nav-item:hover, #logout-btn:hover { background: var(--sidebar-accent); }
#sidebar .nav-item.active { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.workspace-footer { padding-top: 0.75rem; border-top: 1px solid var(--border); }
#right-sidebar-container { border-left: 1px solid var(--border); }
#right-sidebar { border-radius: 0; background: var(--card); box-shadow: none; }
#main-content header, #main-content section, .dark #main-content section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: none; backdrop-filter: none;
}
#main-content header { padding: 1.25rem; }
#main-content section { padding: 1.25rem; }
.page-title, .section-title, .detail-section h3 {
  background: none; -webkit-text-fill-color: currentColor; color: var(--foreground);
}
h1, h2, h3 { letter-spacing: -0.025em; }
.btn { border-radius: calc(var(--radius) - 2px); font-weight: 500; padding: 0.5rem 1rem; min-height: 36px; }
.btn-primary, .dark .btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: none; }
.btn:hover, .card:hover { transform: none; }
.card, .dark .card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card:hover { box-shadow: var(--shadow-md); }
/* Reconcile the repeated legacy utility colors with semantic tokens. */
#app-layout .bg-white, #login-screen .bg-white { background-color: var(--card); }
#app-layout .text-gray-800, #app-layout .text-gray-900,
#login-screen .text-gray-900 { color: var(--foreground); }
#app-layout .text-gray-500, #app-layout .text-gray-600,
#login-screen .text-gray-600 { color: var(--muted-foreground); }
#app-layout .bg-gray-100 { background-color: var(--muted); }
#app-layout .bg-primary, #login-screen .bg-primary,
#floating-sidebar-toggle, #mobile-chat-toggle { color: var(--primary-foreground); }
#app-layout .rounded-2xl { border-radius: var(--radius); }
#app-layout .shadow-sm { box-shadow: var(--shadow-sm); }
#app-layout .border-l-4 { border-left-width: 1px; border: 1px solid var(--border); }
#app-layout input:not([type='checkbox']):not([type='radio']),
#app-layout select, #app-layout textarea, #login-screen input {
  background-color: var(--card); color: var(--foreground);
  border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
}
input::placeholder, textarea::placeholder { color: var(--muted-foreground); }
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--ring); outline-offset: 3px;
}
#login-screen { min-height: 100dvh; background: var(--background); }
#login-screen > div:nth-child(2) > div {
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
#login-screen h2 { font-weight: 600; letter-spacing: -0.035em; }
thead { background: var(--muted); }
.chip { text-transform: none; letter-spacing: normal; font-weight: 500; }
@media (min-width: 769px) and (max-width: 1200px) {
  #sidebar-container { flex-basis: 192px; }
  #main-content { padding: 1.25rem; }
  #right-sidebar-container, #right-sidebar { width: 272px; }
}
@media (max-width: 768px) {
  #sidebar .nav-item::after { content: none; }
  #sidebar .workspace-footer { width: 100%; }
  #sidebar .workspace-brand { margin-bottom: 1.5rem !important; }
  #main-content section { padding: 1rem; }
  #main-content [class*='grid-cols-2'] { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
#right-sidebar { width: 100%; }
#logout-btn::after { content: none; }
#logout-btn { width: 100%; }

.ui-icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; flex-shrink: 0; font-size: 1.25rem; line-height: 1; }
.ui-icon svg { width: 1em; height: 1em; }
[data-ui] { border-color: var(--border); }
[data-ui="metric"] { border-radius: var(--radius); }
[data-ui="account"] { display: flex; flex-direction: column; }
[data-ui="account"] > :last-child { margin-top: auto; }
#app-layout [data-ui="metric"] .text-muted-foreground { color: var(--muted-foreground); }

/* Dashboard groups organize cards without creating another card surface. */
#main-content #view-dashboard section.dashboard-group {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}
#view-dashboard .dashboard-group > .bg-white {
  border: 1px solid var(--border);
}
#view-dashboard .dashboard-crm-row + .dashboard-crm-row {
  border-top: 1px solid var(--border);
}
