:root, body.theme-light {
  --bg: #F4F6FC; /* Very soft pastel blue/gray background matching Uizard */
  --panel: #ffffff; /* Clean white card and modal background */
  --ink: #0F172A; /* Slate dark text color */
  --muted: #64748B; /* Slate gray muted text */
  --line: #E2E8F0; /* Clean light gray borders */
  --primary: #2B55E5; /* Royal blue brand color */
  --primary-hover: #1F43C6; /* Darker blue for hover */
  --accent: #2B55E5; /* Accent blue */
  --success: #10B981; /* Premium emerald green */
  --danger: #EF4444; /* Premium crimson red */
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --input-bg: #D5E0F2;

  /* Compatibility variables for dashboard layouts */
  --surface: #ffffff;
  --surface-2: #F8FAFC;
  --border: #E2E8F0;
  --input: #F8FAFC;
  --text: #0F172A;
  --text-1: #0F172A;
  --text-2: #64748B;
  --text-3: #94A3B8;

  /* Header specific variables for light theme */
  --header-bg: #ffffff;
  --header-ink: #0F172A;
  --header-line: #E2E8F0;
  --header-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);

  /* Sidebar specific variables */
  --sidebar-bg: #ffffff;
  --sidebar-line: #E2E8F0;
}

body.theme-dark {
  --bg: #0F172A; /* Slate 900 */
  --panel: #1E293B; /* Slate 800 */
  --ink: #F8FAFC; /* Slate 50 */
  --muted: #94A3B8; /* Slate 400 */
  --line: #334155; /* Slate 700 */
  --primary: #3B82F6; /* Bright electric blue for dark theme */
  --primary-hover: #60A5FA;
  --accent: #3B82F6;
  --success: #10B981;
  --danger: #EF4444;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --input-bg: #0F172A;

  /* Compatibility variables for dashboard layouts */
  --surface: #1E293B;
  --surface-2: #0F172A;
  --border: #334155;
  --input: #0F172A;
  --text: #F8FAFC;
  --text-1: #F8FAFC;
  --text-2: #94A3B8;
  --text-3: #64748B;

  /* Header specific variables for dark theme */
  --header-bg: #1E293B;
  --header-ink: #F8FAFC;
  --header-line: #334155;
  --header-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);

  /* Sidebar specific variables */
  --sidebar-bg: #1E293B;
  --sidebar-line: #334155;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

/* Main Container */
.main-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Horizontal Top Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 70px;
  background: var(--header-bg);
  color: var(--header-ink);
  border-bottom: 1px solid var(--header-line);
  padding: 0 24px;
  z-index: 10;
  box-shadow: var(--header-shadow);
}

/* Sidebar Brand Logo */
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.sidebar .brand strong {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.sidebar .brand small {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  margin-top: 1px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--primary);
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-session {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Header Control Panel Card */
.header-control-card {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 30px; /* Rounded pill shape */
  padding: 4px 16px;
  box-shadow: var(--shadow);
  height: 52px;
}

.header-control-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 12px;
}

.header-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all 150ms ease;
}

.header-control-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

body.theme-dark .header-control-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.header-control-btn svg,
.header-control-btn i {
  width: 18px;
  height: 18px;
}

/* User profile badge inside header card */
.header-user-badge {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: all 150ms ease;
  user-select: none;
}

.header-user-badge:hover {
  background: var(--bg);
}

body.theme-dark .header-user-badge:hover {
  background: rgba(255, 255, 255, 0.05);
}

.header-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.header-user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.header-user-branch {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  margin-top: 2px;
}

.header-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(43, 85, 229, 0.2);
}

.header-user-avatar svg,
.header-user-avatar i {
  width: 16px;
  height: 16px;
}

.top-header .icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--header-ink);
  background: rgba(0, 0, 0, 0.05);
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}

.top-header .icon-button:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

body.theme-dark .top-header .icon-button {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .top-header .icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

body.theme-dark .icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Main Container Layout */
.main-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Sidebar Styling */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  width: 280px;
  background: var(--primary);
  border-right: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 24px;
  flex-shrink: 0;
  transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 86px;
  padding: 24px 0;
  align-items: center;
  background: var(--primary);
  border-right: 0;
  box-shadow: 0 4px 20px rgba(43, 85, 229, 0.15);
}

.app-shell.sidebar-collapsed .sidebar .brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin-bottom: 32px;
}

.app-shell.sidebar-collapsed .sidebar .brand span:last-child {
  display: block;
}

.app-shell.sidebar-collapsed .sidebar .brand span:last-child strong {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar .brand span:last-child small {
  display: block !important;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  text-align: center;
}

.app-shell.sidebar-collapsed .sidebar .brand-mark {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-shell.sidebar-collapsed .nav-tab {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  padding: 14px 6px;
  border-radius: 0;
  width: 100%;
  color: rgba(255, 255, 255, 0.7);
}

.app-shell.sidebar-collapsed .nav-tab span {
  display: block !important;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  text-align: center;
}

.app-shell.sidebar-collapsed .nav-tab i,
.app-shell.sidebar-collapsed .nav-tab svg {
  width: 22px;
  height: 22px;
  color: #ffffff;
  margin: 0;
}

.app-shell.sidebar-collapsed .nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.app-shell.sidebar-collapsed .nav-tab.is-active {
  background: var(--bg);
  color: var(--primary);
  position: relative;
}

.app-shell.sidebar-collapsed .nav-tab.is-active i,
.app-shell.sidebar-collapsed .nav-tab.is-active svg {
  color: var(--primary);
}

.app-shell.sidebar-collapsed .nav-tab.is-active span {
  color: var(--primary);
}

.app-shell.sidebar-collapsed .logout-button {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 6px;
  border-radius: 0;
  width: 100%;
  color: rgba(255, 255, 255, 0.7);
}

.app-shell.sidebar-collapsed .logout-button span {
  display: block !important;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  text-align: center;
}

.app-shell.sidebar-collapsed .logout-button i,
.app-shell.sidebar-collapsed .logout-button svg {
  width: 22px;
  height: 22px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.app-shell.sidebar-collapsed .logout-button:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ffffff;
}

.app-shell.sidebar-collapsed .logout-button:hover i,
.app-shell.sidebar-collapsed .logout-button:hover svg,
.app-shell.sidebar-collapsed .logout-button:hover span {
  color: #ffffff;
}

.nav-tabs {
  display: grid;
  gap: 6px;
  width: 100%;
}

.nav-tab {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 200ms ease;
}

.nav-tab span {
  display: inline-block;
}

.nav-tab i,
.nav-tab svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
  margin: 0;
  transition: transform 150ms ease;
}

.nav-tab:hover i,
.nav-tab:hover svg {
  transform: translateX(2px);
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-tab.is-active {
  background: var(--bg);
  color: var(--primary);
}

.nav-tab.is-active i,
.nav-tab.is-active svg {
  color: var(--primary);
}

.nav-tab.is-active span {
  color: var(--primary);
}

.sidebar-bottom {
  width: 100%;
  margin-top: auto;
}

.logout-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  color: var(--danger);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  transition: all 200ms ease;
}

.logout-button:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* Workspace Layout */
.workspace {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}

h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* Toolbar Controls */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(400px, 100%);
  padding: 0 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 150ms ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 85, 229, 0.15);
}

.search-box svg {
  color: var(--muted);
  width: 18px;
  height: 18px;
}

.search-box input {
  width: 100%;
  min-height: 40px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder {
  color: var(--muted);
}

/* Button Stylings */
.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  transition: all 150ms ease;
  border: 0;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: var(--bg);
  border-color: var(--muted);
}

.danger-button {
  background: var(--danger);
  color: #ffffff;
}

.danger-button:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--text-2, var(--muted));
  background: var(--surface-2, transparent);
  border: 1px solid var(--border, transparent);
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background: var(--border, rgba(0, 0, 0, 0.05));
  color: var(--text-1, var(--ink));
}

.icon-button.danger,
.icon-button.js-delete {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.15);
}

.icon-button.danger:hover,
.icon-button.js-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Unified Date Filter Component Styles */
.unified-date-filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.date-filter-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.date-filter-item input[type="date"],
.date-filter-item select {
  font-family: inherit;
  transition: all 0.2s ease;
}

.date-filter-item input[type="date"]:focus,
.date-filter-item select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

/* Data Table Panel */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.data-table th {
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--ink);
  background: var(--line);
}

.data-table tbody tr {
  background: var(--panel);
  transition: background 150ms ease;
}

.data-table tbody tr:hover {
  background: var(--bg);
}

.row-actions {
  display: flex;
  gap: 4px;
}

/* Empty State */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  flex: 1;
}

.empty-state.is-visible {
  display: flex;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--muted);
  margin-bottom: 16px;
}

.empty-state strong {
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-state span {
  font-size: 13px;
  color: var(--muted);
}

/* Status Pill Styling */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pill.active {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.status-pill.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.status-pill.locked {
  background: #f1f5f9;
  color: #475569;
}

/* Toast Notification */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 400px;
  padding: 12px 18px;
  border-radius: 8px;
  color: #ffffff;
  background: #1e293b;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 13px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #065f46;
  border-left: 4px solid #10b981;
}

.toast.error {
  background: #991b1b;
  border-left: 4px solid #ef4444;
}

/* Modal Panels */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
}

.modal.is-visible {
  display: flex;
}

.modal-panel {
  width: 90%;
  max-width: 1000px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.modal-panel.small {
  width: min(94%, 480px);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.confirm-copy {
  padding: 28px 24px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

/* Forms layout */
.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 24px;
}

.record-form label {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.record-form label.wide.next-visit-check-label,
.record-form label.next-visit-check-label {
  display: inline-flex !important;
  grid-template-columns: none !important;
  width: auto !important;
  gap: 0.5rem !important;
}

/* Next Visit Field Alignment Fix */
.next-visit-wrapper {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.next-visit-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
}

.next-visit-date-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.next-visit-date-label {
  display: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.next-visit-date-input {
  width: 160px;
  height: 38px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--input);
  color: var(--text);
  font-size: 0.8125rem;
  box-sizing: border-box;
}

/* WebKit & Mobile Date Height & Value Alignment Fix */
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.4em;
  display: flex;
  align-items: center;
}

.record-form label.wide span {
  margin-top: 10px;
}

.record-form input:not([type="checkbox"]),
.record-form select,
.record-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  outline: 0;
  color: var(--ink);
  background: var(--input-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  font-size: 13px;
  transition: all 150ms ease;
}

.record-form textarea {
  min-height: 80px;
  resize: vertical;
}

.record-form input:focus, .record-form select:focus, .record-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,85,229,0.1);
}

.form-group input.is-invalid, .form-group select.is-invalid, .form-group textarea.is-invalid {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.form-group input.is-invalid:focus, .form-group select.is-invalid:focus, .form-group textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.field-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
  font-weight: 500;
}

select option {
  background-color: var(--panel);
  color: var(--ink);
}

/* Toggle Switch Control */
.switch-container {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 34px;
}

.switch-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--danger);
  border-radius: 17px;
  transition: all 200ms ease;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.switch-handle {
  position: absolute;
  height: 28px;
  width: 28px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-label-active,
.switch-label-inactive {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.switch-label-active {
  left: 12px;
  opacity: 0;
}

.switch-label-inactive {
  right: 12px;
  opacity: 1;
}

.switch-input:checked + .switch-slider {
  background-color: var(--success);
}

.switch-input:checked + .switch-slider .switch-handle {
  transform: translateX(86px);
}

.switch-input:checked + .switch-slider .switch-label-active {
  opacity: 1;
}

.switch-input:checked + .switch-slider .switch-label-inactive {
  opacity: 0;
}

/* Tag-Based Multiselect Dropdown Combobox */
.multiselect-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: start;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.multiselect-field.wide {
  grid-column: 1 / -1;
}

.multiselect-field > span {
  margin-top: 10px;
}

.combo-container {
  position: relative;
  width: 100%;
}

.combo-select-tags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 150ms ease;
}

.combo-select-tags:hover {
  border-color: #9ca3af;
}

.combo-container.is-open .combo-select-tags {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 85, 229, 0.15);
}

.combo-tags-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: calc(100% - 40px);
}

.combo-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(43, 85, 229, 0.08);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  user-select: none;
}

.combo-remove-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(43, 85, 229, 0.6);
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.combo-remove-tag:hover {
  color: var(--primary);
  background: rgba(43, 85, 229, 0.15);
}

.combo-search-input {
  flex: 1;
  min-width: 60px;
  border: 0 !important;
  background: transparent !important;
  outline: 0 !important;
  color: var(--ink) !important;
  padding: 2px 0 !important;
  box-shadow: none !important;
  min-height: auto !important;
  font-size: 13px !important;
}

.combo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.combo-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
}

.combo-clear-btn:hover {
  color: var(--danger);
}

.combo-arrow {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 150ms ease;
}

.combo-container.is-open .combo-arrow {
  transform: rotate(180deg);
}

.combo-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  z-index: 110;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: 4px;
}

.combo-container.is-open .combo-dropdown {
  display: block;
}

.combo-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  transition: background 100ms ease;
}

.combo-dropdown-item:hover {
  background: var(--bg);
}

.combo-dropdown-item.is-selected {
  background: rgba(43, 85, 229, 0.05);
  color: var(--primary);
  font-weight: 600;
}

.combo-dropdown-item.is-selected::after {
  content: "✓";
  font-size: 11px;
  color: var(--primary);
}

/* Session Company dropdown in Topbar */
.session-company-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--header-ink);
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 4px;
  padding: 2px 8px;
  display: inline-block;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-company-select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--header-ink);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 4px 24px 4px 10px;
  outline: none;
  cursor: pointer;
  max-width: 200px;
  width: 100%;
  transition: all 150ms ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
}

body.theme-dark .session-company-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.session-company-select:hover {
  background-color: var(--line);
  border-color: var(--muted);
}

.session-company-select option {
  background: var(--panel);
  color: var(--ink);
}

/* No Menus Warning Banner */
.no-menus-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  margin: 8px 0;
}

.no-menus-warning svg {
  color: var(--danger);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.app-shell.sidebar-collapsed .no-menus-warning {
  padding: 8px;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  margin: 0;
}

.app-shell.sidebar-collapsed .no-menus-warning span {
  display: none;
}

.app-shell.sidebar-collapsed .no-menus-warning svg {
  width: 20px;
  height: 20px;
  animation: pulse-warn-light 2s infinite;
}

@keyframes pulse-warn-light {
  0% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.6; transform: scale(1); }
}

/* Login View Styling */
.login-view {
  display: none;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

.login-view.is-visible {
  display: flex;
}

.login-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.login-graphic {
  flex: 1.2;
  position: relative;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #ffffff;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  box-sizing: border-box;
}

.login-graphic::before {
  display: none;
}

.login-graphic-overlay {
  position: relative;
  z-index: 2;
  width: 100%;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand strong {
  font-size: 26px;
  color: #ffffff;
  font-weight: 800;
}

.login-form-pane {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  position: relative;
}

.login-panel {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
}

.login-panel h2 {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 24px;
  color: var(--ink);
}

.login-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

.login-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  outline: 0;
  background: var(--panel);
  color: var(--ink);
  transition: all 150ms ease;
}

.login-panel input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 85, 229, 0.15);
}

.login-panel button {
  margin-top: 10px;
  width: 100%;
  min-height: 42px;
}

.hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}

.table-filters-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
  flex-wrap: wrap;
}

.treatment-step2-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .login-graphic {
    display: none;
  }
  .login-form-pane {
    border-left: 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  .main-container {
    flex: 1;
    overflow-y: auto;
  }
  .sidebar {
    width: 100% !important;
    height: auto !important;
    order: 2;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    gap: 8px;
    z-index: 50;
  }
  .sidebar .brand {
    display: none;
  }
  .nav-tabs {
    width: 100%;
    display: flex;
    justify-content: space-around;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }
  .nav-tabs::-webkit-scrollbar {
    height: 0px;
  }
  .nav-tab {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-width: 60px;
    border-radius: 8px;
  }
  .nav-tab span {
    display: block !important;
    font-size: 10px;
    margin-top: 4px;
    text-align: center;
  }
  .sidebar-bottom {
    margin-top: 0;
    width: auto;
  }
  .logout-button {
    padding: 8px 12px;
  }
  .workspace {
    padding: 24px 20px;
  }
  .treatment-step2-grid {
    grid-template-columns: 1fr;
  }
  .table-filters-group {
    border-left: 0;
    padding-left: 0;
    margin-top: 0.5rem;
  }
}

@media (max-width: 640px) {
  .top-header {
    padding: 0 16px;
    flex-direction: column;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 10px;
    align-items: stretch;
  }
  .header-session {
    justify-content: space-between;
  }
  .sidebar {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .nav-tab span {
    display: none;
  }
  .record-form {
    grid-template-columns: 1fr;
  }
  .record-form label {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 6px;
  }
}

/* User Profile container overrides cleaned up */

.session-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px; /* Smooth rounded corners */
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 16px -6px rgba(15, 23, 42, 0.05);
  width: 260px; /* Spacious width */
  padding: 8px;
  z-index: 100;
}

/* Dropdown list item style */
.session-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px; /* High quality height */
  padding: 10px 16px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  border-radius: 8px;
  transition: all 150ms ease;
  cursor: pointer;
}

.session-dropdown .dropdown-item:hover {
  background: var(--bg);
  color: var(--primary);
}

.session-dropdown .dropdown-item svg,
.session-dropdown .dropdown-item i {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.session-dropdown .dropdown-item:hover svg,
.session-dropdown .dropdown-item:hover i {
  color: var(--primary);
}

/* Branch display item in dropdown */
.dropdown-company-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
}

.dropdown-company-info svg,
.dropdown-company-info i {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.dropdown-company-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.dropdown-company-details small {
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dropdown-company-details .company-name-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-company-details .session-company-select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 6px 28px 6px 10px; /* Better height */
  outline: none;
  cursor: pointer;
  width: 100%;
  transition: all 150ms ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
}

body.theme-dark .dropdown-company-details .session-company-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.dropdown-company-details .session-company-select:hover {
  background-color: var(--line);
  border-color: var(--muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

/* Sidebar Bottom (relocating theme switcher and logout buttons on same line) */
.sidebar-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-line);
}

.logout-button {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1; /* Takes remaining space next to theme toggle button */
  padding: 12px 16px;
  color: var(--danger);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  transition: all 200ms ease;
  cursor: pointer;
}

.logout-button:hover {
  background: rgba(239, 68, 68, 0.08);
}

.theme-toggle-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  transition: all 200ms ease;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle-icon-button:hover {
  background: rgba(43, 85, 229, 0.05);
  color: var(--primary);
  border-color: var(--primary);
}

body.theme-dark .theme-toggle-icon-button:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

.theme-toggle-icon-button svg,
.theme-toggle-icon-button i {
  width: 18px;
  height: 18px;
}

/* Collapsed Sidebar bottom styling overrides */
.app-shell.sidebar-collapsed .sidebar-bottom {
  flex-direction: row;
  justify-content: center;
  padding: 16px 4px 0 4px;
  gap: 4px;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.app-shell.sidebar-collapsed .logout-button {
  justify-content: center;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex: 0 0 36px;
}

.app-shell.sidebar-collapsed .logout-button span {
  display: none !important;
}

.app-shell.sidebar-collapsed .logout-button svg,
.app-shell.sidebar-collapsed .logout-button i {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.7);
}

.app-shell.sidebar-collapsed .logout-button:hover {
  background: rgba(239, 68, 68, 0.2);
}

.app-shell.sidebar-collapsed .logout-button:hover svg,
.app-shell.sidebar-collapsed .logout-button:hover i {
  color: #ffffff;
}

.app-shell.sidebar-collapsed .theme-toggle-icon-button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
  flex: 0 0 36px;
}

.app-shell.sidebar-collapsed .theme-toggle-icon-button svg,
.app-shell.sidebar-collapsed .theme-toggle-icon-button i {
  width: 18px;
  height: 18px;
  color: #ffffff;
}

.app-shell.sidebar-collapsed .theme-toggle-icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

/* Radio Buttons Grid & Item styling */
.radio-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.radio-field.wide {
  grid-column: 1 / -1;
}

.radio-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  min-height: 38px;
}

.radio-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  user-select: none;
}

.radio-item input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  min-height: auto !important;
  accent-color: var(--primary);
  cursor: pointer;
}

@media (max-width: 640px) {
  .radio-field {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 6px;
  }
}

/* Custom Single-Select Dropdown Component Styles (Uizard Style) */
.custom-select-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.custom-select-field.wide {
  grid-column: 1 / -1;
}

.custom-select-field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}

.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  overflow: hidden;
  transition: all 150ms ease;
}

.custom-select-trigger:hover {
  border-color: #9ca3af;
}

.custom-select-container.is-open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 85, 229, 0.15);
}

.custom-select-text {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-arrow-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 38px;
  background: var(--primary);
  color: #ffffff !important;
  border-left: 1px solid var(--line);
  transition: background 150ms ease;
}

.custom-select-arrow-box svg,
.custom-select-arrow-box i {
  width: 16px;
  height: 16px;
  color: #ffffff !important;
  transition: transform 150ms ease;
}

.custom-select-container.is-open .custom-select-arrow-box svg,
.custom-select-container.is-open .custom-select-arrow-box i {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 240px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 100;
  overflow-y: auto;
  padding: 6px;
  display: none;
}

.custom-select-container.is-open .custom-select-dropdown {
  display: block;
}

.custom-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: all 150ms ease;
}

.custom-select-item:hover {
  background: var(--bg);
}

.custom-select-item.is-selected {
  background: var(--bg);
  color: var(--primary);
  font-weight: 600;
}

.custom-select-item svg,
.custom-select-item i {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.custom-select-item.is-selected svg,
.custom-select-item.is-selected i {
  color: var(--primary);
}

@media (max-width: 640px) {
  .custom-select-field,
  .date-select-field {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 6px;
  }
}

/* SVG Icon mask support */
.icon-svg-mask {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  margin: 0;
  vertical-align: middle;
}

/* Custom select item icon overrides for SVG mask */
.custom-select-item .icon-svg-mask,
.custom-select-trigger .icon-svg-mask {
  width: 16px;
  height: 16px;
}

/* Align icon preview in Menu table grid */
.grid-icon-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid-icon-preview .icon-svg-mask {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

/* Nav tab support for SVG mask */
.nav-tab .icon-svg-mask {
  background-color: #ffffff;
  transition: transform 150ms ease;
}
.nav-tab:hover .icon-svg-mask {
  transform: translateX(2px);
}
.nav-tab.is-active .icon-svg-mask {
  background-color: var(--primary);
}

/* Collapsed sidebar nav tab support for SVG mask */
.app-shell.sidebar-collapsed .nav-tab .icon-svg-mask {
  width: 22px;
  height: 22px;
  background-color: #ffffff;
  margin: 0;
}
.app-shell.sidebar-collapsed .nav-tab.is-active .icon-svg-mask {
  background-color: var(--primary);
}

/* Custom Date Select Field Styles */
.date-select-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.date-select-field.wide {
  grid-column: 1 / -1;
}
.date-select-field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}

.date-select-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 38px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: all 150ms ease;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.date-select-container:hover {
  border-color: #9ca3af;
}

.date-select-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 85, 229, 0.15);
}

.date-select-input {
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink) !important;
  box-shadow: none !important;
  cursor: pointer;
}

.date-select-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 38px;
  background: var(--primary);
  color: #ffffff !important;
  flex-shrink: 0;
  cursor: pointer;
  border-left: 1px solid var(--line);
}

.date-select-icon-box i,
.date-select-icon-box svg {
  width: 16px;
  height: 16px;
  color: #ffffff !important;
}

/* Make native picker indicator overlay the blue button area so clicking there triggers picker */
.date-select-input::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* --- Dental Charting Styles --- */
.teeth-chart-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  user-select: none;
}

.teeth-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.teeth-toolbar-label {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-right: 0.5rem;
}

.teeth-btn {
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  cursor: pointer;
  transition: all 150ms ease;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.teeth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.teeth-btn svg, .teeth-btn i {
  width: 14px;
  height: 14px;
}

.teeth-btn-caries {
  background: #FEE2E2;
  color: #B91C1C;
  border-color: #FCA5A5;
}
.teeth-btn-caries:hover { background: #FCA5A5; }

.teeth-btn-filled {
  background: #D1FAE5;
  color: #047857;
  border-color: #6EE7B7;
}
.teeth-btn-filled:hover { background: #6EE7B7; }

.teeth-btn-missing {
  background: #F3F4F6;
  color: #4B5563;
  border-color: #D1D5DB;
}
.teeth-btn-missing:hover { background: #D1D5DB; }

.teeth-btn-crown {
  background: #FEF3C7;
  color: #B45309;
  border-color: #FCD34D;
}
.teeth-btn-crown:hover { background: #FCD34D; }

.teeth-btn-implant {
  background: #F3E8FF;
  color: #6D28D9;
  border-color: #D8B4FE;
}
.teeth-btn-implant:hover { background: #D8B4FE; }

.teeth-btn-clear {
  border-color: var(--primary);
  color: var(--primary);
}
.teeth-btn-clear:hover { background: rgba(43, 85, 229, 0.08); }

.teeth-arch {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.teeth-arch-title {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.teeth-row {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.375rem;
  background: var(--surface-2);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  justify-content: space-between;
}

/* Scrollbar styling for teeth row */
.teeth-row::-webkit-scrollbar {
  height: 5px;
}
.teeth-row::-webkit-scrollbar-track {
  background: transparent;
}
.teeth-row::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2.5px;
}

.tooth-card {
  flex: 1;
  min-width: 38px;
  max-width: 46px;
  height: 54px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  cursor: pointer;
  transition: all 150ms ease;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.01);
}

.tooth-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 3px 5px -1px rgba(0,0,0,0.03);
}

.tooth-card i, .tooth-card svg {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  transition: color 150ms ease;
}

.tooth-card-number {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-2);
}

/* Selected state - thick border or blue ring */
.tooth-card.is-selected {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(43, 85, 229, 0.15);
}

/* Status colors matching screenshot */
.tooth-card.status-caries {
  background: #FEE2E2;
  border-color: #EF4444;
}
.tooth-card.status-caries i, .tooth-card.status-caries svg { color: #EF4444; }
.tooth-card.status-caries .tooth-card-number { color: #B91C1C; }

.tooth-card.status-filled {
  background: #D1FAE5;
  border-color: #10B981;
}
.tooth-card.status-filled i, .tooth-card.status-filled svg { color: #10B981; }
.tooth-card.status-filled .tooth-card-number { color: #047857; }

.tooth-card.status-missing {
  background: #F3F4F6;
  border-color: #9CA3AF;
}
.tooth-card.status-missing i, .tooth-card.status-missing svg {
  color: #9CA3AF;
  opacity: 0.3;
}
.tooth-card.status-missing .tooth-card-number { color: #4B5563; }
.tooth-card.status-missing::after {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.875rem;
  color: #EF4444;
  font-weight: 300;
  line-height: 1;
}

.tooth-card.status-crown {
  background: #FEF3C7;
  border-color: #F59E0B;
}
.tooth-card.status-crown i, .tooth-card.status-crown svg { color: #F59E0B; }
.tooth-card.status-crown .tooth-card-number { color: #B45309; }

.tooth-card.status-implant {
  background: #F3E8FF;
  border-color: #A855F7;
}
.tooth-card.status-implant i, .tooth-card.status-implant svg { color: #A855F7; }
.tooth-card.status-implant .tooth-card-number { color: #6D28D9; }

.teeth-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.25rem;
  align-items: center;
}

.teeth-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
}

.teeth-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.teeth-legend-color.color-caries { background: #FEE2E2; border-color: #EF4444; }
.teeth-legend-color.color-filled { background: #D1FAE5; border-color: #10B981; }
.teeth-legend-color.color-missing {
  background: #F3F4F6;
  border-color: #9CA3AF;
  position: relative;
  overflow: hidden;
}
.teeth-legend-color.color-missing::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, transparent 40%, #EF4444 40%, #EF4444 60%, transparent 60%);
}
.teeth-legend-color.color-crown { background: #FEF3C7; border-color: #F59E0B; }
.teeth-legend-color.color-implant { background: #F3E8FF; border-color: #A855F7; }
.teeth-legend-color.color-healthy { background: var(--panel); border-color: var(--primary); }

/* Compact Treatment Modal Overrides */
.compact-treatment-modal .tooth-card {
  width: 36px;
  height: 46px;
  padding: 0.2rem;
}
.compact-treatment-modal .tooth-card i {
  width: 18px;
  height: 18px;
  margin-bottom: 0.1rem;
}
.compact-treatment-modal .tooth-card-number {
  font-size: 0.65rem;
}
.compact-treatment-modal .teeth-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}
.compact-treatment-modal .teeth-btn i {
  width: 14px;
  height: 14px;
}
.compact-treatment-modal .teeth-legend-item {
  font-size: 0.75rem;
}
.compact-treatment-modal .teeth-legend-color {
  width: 12px;
  height: 12px;
}


/* --- MODERN ROLE RIGHTS MODAL --- */
.role-modal-container {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-family, system-ui, -apple-system, sans-serif);
  color: #1e293b;
  padding: 0.5rem;
}
.role-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.role-card {
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.02);
}
.role-card-header {
  margin-bottom: 0.75rem;
}
.role-card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}
.role-card-title .badge {
  background: #eff6ff;
  color: #2563eb;
  padding: 0.125rem 0.625rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}
.role-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.role-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.role-input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}
.role-input-group label .required {
  color: #ef4444;
}
.role-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.role-input-wrapper input, .role-input-wrapper select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #334155;
  background: #f8fafc;
  transition: all 0.2s;
}
.role-input-wrapper input:focus, .role-input-wrapper select:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.role-input-wrapper > i {
  position: absolute;
  right: 1rem;
  color: #94a3b8;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}
.role-blue-info-box {
  background: #eff6ff;
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.875rem;
  color: #2563eb;
}
.role-blue-info-box i {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.role-mapped-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.role-mapped-actions-area {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.role-action-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}
.role-action-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
.role-action-btn i { width: 1rem; height: 1rem; }
.role-primary-btn {
  background: #2563eb;
  border: none;
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.role-primary-btn:hover { background: #1d4ed8; }
.role-primary-btn i { width: 1rem; height: 1rem; }
.role-table {
  border: 1px solid #f1f5f9;
  border-radius: 0.5rem;
  overflow: hidden;
}
.role-table-header {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-table-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  transition: background 0.2s;
}
.role-table-row:last-child {
  border-bottom: none;
}
.role-table-row:hover {
  background: #f8fafc;
}
.role-table-col-drag { width: 3rem; color: #cbd5e1; display: flex; align-items: center; justify-content: center; }
.role-table-col-drag i { width: 1rem; height: 1rem; cursor: grab; }
.role-table-col-sort { width: 7rem; display: flex; align-items: center; }
.role-table-col-name { flex: 1; font-size: 0.875rem; font-weight: 500; color: #334155; }
.role-table-col-icon { width: 8rem; display: flex; align-items: center; }
.role-table-col-actions { width: 5rem; display: flex; align-items: center; justify-content: center; }
.role-menu-sort {
  width: 4rem;
  text-align: center;
  padding: 0.375rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: #ffffff;
  transition: all 0.2s;
}
.role-menu-sort:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}
.role-icon-box {
  background: #f1f5f9;
  border-radius: 0.375rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.role-icon-box i { width: 1rem; height: 1rem; color: #64748b; }
.role-menu-remove {
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.role-menu-remove:hover { background: #fef2f2; }
.role-menu-remove i { width: 1.125rem; height: 1.125rem; }
.role-empty-state {
  text-align: center;
  padding: 2.5rem 0;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Change Password Modal Styling Fix */
.change-pwd-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  padding: 24px !important;
  width: 100% !important;
}

.change-pwd-form label.vertical-field {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
  width: 100% !important;
  grid-template-columns: none !important;
  margin: 0 !important;
}

.change-pwd-form label.vertical-field span {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  margin: 0 !important;
}

.change-pwd-form label.vertical-field input {
  width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 8px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
  border: 1px solid var(--line) !important;
  background: var(--input-bg) !important;
  color: var(--ink) !important;
  outline: none !important;
}

.change-pwd-form label.vertical-field input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* --- LOG TREATMENT SUMMARY RESPONSIVE STYLING --- */
.compact-treatment-modal .modal-panel {
  width: min(98%, 950px);
  max-height: 95vh;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 0.75rem;
}

.treatment-modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  gap: 0.75rem;
}

.treatment-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.treatment-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Desktop Medicine Row & Procedure Row */
.medicine-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr 1fr 32px;
  gap: 0.5rem;
  align-items: center;
}

.med-field {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.med-field .form-input, .med-field input, .med-field select {
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

.med-mobile-label, .proc-mobile-label {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.25rem;
}

.procedure-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

.proc-field {
  flex: 1;
  position: relative;
}

.proc-field-action {
  flex: 0 0 auto;
}

/* Mobile Responsive Adjustments (<= 640px) */
@media (max-width: 640px) {
  .compact-treatment-modal .modal-panel {
    width: 98% !important;
    max-height: 96vh !important;
    margin: 0.5rem auto !important;
  }

  .treatment-modal-header {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.75rem !important;
    gap: 0.6rem !important;
  }

  .treatment-header-top h2 {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
  }

  .treatment-header-actions {
    width: 100% !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
  }

  .treatment-header-actions button {
    flex: 1 !important;
    padding: 0.5rem 0.6rem !important;
    font-size: 0.8125rem !important;
    justify-content: center !important;
    font-weight: 600 !important;
  }

  /* Patient Info Banner on Mobile */
  .patient-info-banner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.35rem !important;
    padding: 0.75rem 1rem !important;
  }

  #treatPatientName {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    word-break: break-word !important;
  }

  #treatTokenNumber {
    font-size: 0.8125rem !important;
    color: var(--text-2) !important;
    font-weight: 500 !important;
    word-break: break-word !important;
  }

  /* Procedure Row Card on Mobile */
  .procedure-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    padding: 0.85rem !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: 0.6rem !important;
    position: relative !important;
  }

  .proc-field {
    width: 100% !important;
    flex: none !important;
  }

  .proc-field select, .proc-field input {
    width: 100% !important;
    height: 42px !important;
    font-size: 0.875rem !important;
    padding: 0.5rem 2.25rem 0.5rem 0.65rem !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
  }

  .proc-field-action {
    display: flex !important;
    justify-content: flex-end !important;
  }

  .proc-mobile-label {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: var(--text-2) !important;
    margin-bottom: 0.25rem !important;
  }

  /* Medicine Section Card on Mobile */
  #medicinesHeader {
    display: none !important;
  }

  .medicine-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
    padding: 0.85rem !important;
    padding-top: 0.85rem !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 0.6rem !important;
    position: relative !important;
    margin-bottom: 0.35rem !important;
  }

  .med-field {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .med-field-name {
    padding-right: 2.25rem !important; /* Reserve space so input doesn't overlap delete button */
  }

  .med-field-action {
    position: absolute !important;
    top: 0.65rem !important;
    right: 0.65rem !important;
    width: auto !important;
    z-index: 5 !important;
  }

  .med-field-action .js-remove-med-row {
    width: 32px !important;
    height: 32px !important;
  }

  .med-mobile-label {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: var(--text-2) !important;
    margin-bottom: 0.25rem !important;
  }

  .medicine-row input, .medicine-row select {
    font-size: 0.875rem !important;
    padding: 0.45rem 0.65rem !important;
    height: 42px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Next Visit Card on Mobile */
  .next-visit-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    padding: 0.85rem !important;
    width: 100% !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: 0.6rem !important;
    box-sizing: border-box !important;
  }

  .next-visit-check-label {
    width: 100% !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--text) !important;
  }

  .next-visit-date-container {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.35rem !important;
    width: 100% !important;
    padding-top: 0.5rem !important;
    border-top: 1px dashed var(--border) !important;
  }

  .next-visit-date-input {
    width: 100% !important;
    max-width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    font-size: 0.875rem !important;
    padding: 0.45rem 0.65rem !important;
    border: 1px solid var(--border) !important;
    border-radius: 0.375rem !important;
    background: var(--input) !important;
    color: var(--text) !important;
    box-sizing: border-box !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
}


