

:root {
  
  --primary: #8100B6;
  --primary-light: #F3E5F9;
  --primary-dark: #6A0096;
  --primary-hover: #6A0096;
  --primary-50: #FAF0FF;

  --accent-pink: #CA1B84;
  --accent-yellow: #E5A923;
  --accent-orange: #FF6D00;

  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  --bg: #FFFFFF;
  --surface: #F6F6F6;
  --surface-hover: #EDEDEE;

  --border: #E2E8F0;
  --border-focus: #8100B6;

  --text: #23283D;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --sidebar-bg: #23283D;
  --sidebar-text: #CBD5E1;
  --sidebar-active: #8100B6;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --font-heading: 'Montserrat', 'Aptos', system-ui, -apple-system, sans-serif;
  --font-body: 'Montserrat', 'Aptos', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
}

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

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  list-style: none;
}

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  padding: 16px 12px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
}

.sidebar-item .icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-item svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  opacity: 0.85;
  flex-shrink: 0;
}
.sidebar-item:hover svg { opacity: 1; }
.sidebar-item.active svg { opacity: 1; }

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.logo-sm { height: 36px; width: auto; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #A855F7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; color: rgba(255, 255, 255, 0.45); }

.sidebar-collapse-btn {
  position: absolute;
  top: 28px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  z-index: 101;
  transition: all 0.2s;
}
.sidebar-collapse-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.sidebar.collapsed { width: 60px !important; overflow: hidden; }
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-client-section,
.sidebar.collapsed .nav-property-section { display: none; }
.sidebar.collapsed .sidebar-collapse-btn {
  
  top: 14px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-size: 16px;
}

.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-nav { padding: 60px 6px 12px; }
.sidebar.collapsed .sidebar-section { padding: 4px 0; }
.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 10px;
  gap: 0;
}
.sidebar.collapsed .sidebar-item svg {
  width: 22px;
  height: 22px;
  opacity: 0.85;
}
.sidebar.collapsed .sidebar-footer { padding: 8px 6px; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-bottom { padding: 8px 6px; }
.sidebar.collapsed .sidebar-bottom .sidebar-item span { display: none; }
.sidebar-collapsed { margin-left: 60px !important; }

.nav-client-section,
.nav-property-section {
  margin: 2px 0;
  padding-left: 12px;
}
.nav-client-header,
.nav-property-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #A855F7;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-client-header:hover,
.nav-property-header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.nav-client-header svg,
.nav-property-header svg {
  transition: transform 200ms;
  flex-shrink: 0;
}
.nav-client-section.expanded .nav-client-header svg,
.nav-property-section.expanded .nav-property-header svg {
  transform: rotate(90deg);
}
.nav-client-section:not(.expanded) .nav-sub-items,
.nav-property-section:not(.expanded) .nav-sub-items {
  display: none;
}
.nav-sub-items {
  padding: 2px 0 2px 20px;
}
.nav-sub-item {
  display: block;
  padding: 5px 12px;
  font-size: 12px;
  color: #94A3B8;
  text-decoration: none;
  border-radius: 4px;
  margin: 1px 0;
  transition: all 0.15s;
}
.nav-sub-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}
.nav-sub-item.active {
  background: rgba(129, 0, 182, 0.15);
  color: #A855F7;
  font-weight: 600;
}

.main-content {
  flex: 1;
  min-width: 0; 
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex: 1;
  margin-bottom: 4px;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
  line-height: 1.3;
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#menuBtn {
  display: none;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.content {
  padding: 24px;
  flex: 1;
  min-width: 0; 
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.page-header-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--error);
  color: #FFFFFF;
  border-color: var(--error);
}

.btn-danger:hover {
  background: #DC2626;
  border-color: #DC2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success { background: var(--success-light); color: #047857; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger  { background: var(--error-light);   color: #B91C1C; }
.badge-info    { background: var(--info-light);     color: #1D4ED8; }
.badge-active  { background: var(--success-light); color: #047857; }
.badge-pending { background: var(--warning-light); color: #92400E; }
.badge-critical { background: var(--error-light); color: #B91C1C; }
.badge-overdue  { background: #FEE2E2; color: #991B1B; }
.badge-completed  { background: var(--success-light); color: #065F46; }
.badge-in-progress { background: var(--info-light); color: #1E40AF; }

.tab-count, .count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--border); color: var(--text-muted);
  font-size: 11px; font-weight: 700; line-height: 1; vertical-align: middle;
}
.tab-btn.active .tab-count, .tab-item.active .tab-count,
.tab-btn.active .count-badge, .tab-item.active .count-badge { background: var(--primary); color: #fff; }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-header a {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--primary-50);
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.stat-card .stat-trend {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card .stat-trend.up   { color: var(--success); }
.stat-card .stat-trend.down { color: var(--error); }

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  height: 52px;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--surface-hover);
}

.data-table .row-link {
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input::placeholder {
  color: var(--text-light);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.modal-content {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease-out;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--error); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info    { border-left: 4px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab-item:hover {
  color: var(--text);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  margin-bottom: 12px;
}

.alert-urgent {
  border-left-color: var(--error);
  background: var(--error-light);
}

.alert-warning {
  border-left-color: var(--warning);
  background: var(--warning-light);
}

.alert-info {
  border-left-color: var(--info);
  background: var(--info-light);
}

.search-bar {
  position: relative;
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-bar input::placeholder {
  color: var(--text-light);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
}

.pagination button,
.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.pagination button:hover,
.pagination a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.pagination .active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 40px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state .empty-text {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kanban-column {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 300px;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.kanban-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.kanban-header .count {
  font-size: 12px;
  font-weight: 500;
  background: var(--border);
  color: var(--text-secondary);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.kanban-card:hover {
  box-shadow: var(--shadow-sm);
}

.kanban-card-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 2fr minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.task-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #8100B6, #CA1B84, #FF6D00, #E5A923);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.login-card .login-subtitle {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-card .form-group {
  margin-bottom: 14px;
}

.login-card .btn-primary {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
}

.text-muted    { color: var(--text-muted) !important; }
.text-success  { color: var(--success) !important; }
.text-error    { color: var(--error) !important; }
.text-warning  { color: var(--warning) !important; }

.flex          { display: flex; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.gap-2         { gap: 8px; }
.gap-4         { gap: 16px; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

.hidden { display: none !important; }

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  position: relative;
  border: none;
  padding: 0;
  font-family: inherit;
  flex-shrink: 0;
}
.tooltip-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  white-space: normal;
  width: max-content;
  max-width: 260px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}
.tooltip-icon:hover::after,
.tooltip-icon:focus::after,
.tooltip-icon:focus-visible::after { opacity: 1; }

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .sidebar-collapse-btn { display: none !important; }
  .sidebar.collapsed { width: 240px !important; }
  .sidebar-collapsed { margin-left: 0 !important; }

  .main-content {
    margin-left: 0;
  }

  .header {
    height: auto;
    min-height: 48px;
    padding: 8px 12px;
    gap: 8px;
  }

  .header-title-row {
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap; 
  }

  .header-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .header-title-row > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .header-title-row > div:last-child { flex-shrink: 0; }
  .header-title-row .btn.btn-primary,
  .header-title-row .btn.btn-secondary {
    padding: 6px 10px;
    font-size: 12px;
  }

  .header-left {
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .header-left .breadcrumb {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  .header-right {
    gap: 8px;
    flex-shrink: 0;
  }

  .header-right .search-bar,
  .header-right input.search-bar,
  input.search-bar {
    display: none !important;
  }

  #menuBtn {
    display: inline-flex !important;
    flex-shrink: 0;
  }

  .sidebar.open {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 260px !important;
    height: 100vh !important;
    z-index: 200 !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.2s ease-out;
  }

  @keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
  }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .stat-card .stat-trend {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanban-board,
  .task-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header-actions {
    flex-wrap: wrap;
  }

  .form-grid > *,
  .two-col > *,
  .detail-grid > *,
  .meta-grid > *,
  .form-row > *,
  .form-row2 > * {
    min-width: 0;
  }

  .content {
    padding: 16px;
  }

  .modal-content {
    margin: 16px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .roster-grid {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .roster-grid th,
  .roster-grid td {
    white-space: nowrap;
    min-width: 60px;
  }

  .roster-grid .staff-cell {
    min-width: 140px;
    position: sticky;
    left: 0;
    background: var(--bg);
    z-index: 2;
  }

  .stepper {
    gap: 4px;
  }

  .stepper .step-label {
    font-size: 11px;
  }

  .property-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .week-label {
    font-size: 14px;
  }

  .login-page {
    padding: 16px;
    align-items: flex-start;
    padding-top: 10vh;
  }

  .login-card {
    padding: 24px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin: 0 auto;
    max-width: 100%;
  }

  .login-card h1 {
    font-size: 20px;
  }
}

.bell-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-icon { position: relative; }

.notif-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.notif-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(129,0,182,0.08); }
.notif-card.unread { background: #faf5ff; border-color: rgba(129,0,182,0.25); }
.notif-card-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.notif-card.unread .notif-card-dot { background: var(--primary); }
.notif-card:not(.unread) .notif-card-dot { background: var(--border); }
.notif-card-body { flex: 1; }
.notif-card-text { font-size: 14px; color: var(--text); }
.notif-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.notif-card-id { font-family: monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

.config-row {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 100px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
}
.config-row-label { font-weight: 600; font-size: 14px; color: var(--text); }
.config-row-input { font-size: 14px; color: var(--text); }
.config-row-unit { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
@media (max-width: 768px) {
  .config-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

.message-thread {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.message-thread-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.message-thread-subject { font-weight: 600; font-size: 14px; color: var(--text); }
.message-thread-meta { font-size: 12px; color: var(--text-muted); }
.message-thread-context { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); margin-right: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.message-bubble { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.message-bubble:last-child { border-bottom: none; }
.message-bubble-author { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.message-bubble-body { font-size: 14px; color: var(--text); line-height: 1.5; }
.message-bubble-time { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.message-composer { padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--border); display: flex; gap: 8px; }
.message-composer textarea { flex: 1; min-height: 60px; }

@media print {
  .sidebar, .sidebar-overlay, .header, .toast-container,
  .modal, .modal-overlay, .cc-modal-overlay,
  .btn, .btn-icon, .page-header-actions, .tab-buttons, .no-print { display: none !important; }
  .app-layout { display: block !important; min-height: 0 !important; }
  .main-content { margin-left: 0 !important; min-height: 0 !important; display: block !important; flex: none !important; }
  .content { padding: 0 !important; overflow: visible !important; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; margin: 0 !important; }
  a[href]::after { content: "" !important; }   
  .card, .panel, .form-card, table, .data-table-wrap { box-shadow: none !important; page-break-inside: avoid; }
}
