:root {
  /* Milk & Modern Palette */
  --wf-bg: #FDFBF7; /* Off-white/Cream */
  --wf-surface: #FFFFFF;
  --wf-border: #E5E1DA;
  --wf-accent: #A1C4FD; /* Soft Blue */
  --wf-accent-foreground: #FFFFFF;
  --wf-text-main: #334155; /* Slate Grey */
  --wf-text-muted: #64748b;
  --wf-primary: #3b82f6;
  
  /* Shadcn UI Variables */
  --radius: 0.75rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  
  /* Status Colors */
  --status-milking: #22c55e;
  --status-dry: #f59e0b;
  --status-sick: #ef4444;
  --status-deceased: #1e293b;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--wf-bg);
  color: var(--wf-text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background: var(--wf-surface);
  border-right: 1px solid var(--wf-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 50;
}

.sidebar-header {
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--wf-border);
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--wf-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  text-decoration: none;
  color: var(--wf-text-muted);
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  background: rgba(161, 196, 253, 0.2);
  color: #2563eb;
}

.nav-item.active {
  background: var(--wf-accent);
  color: white;
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Bar */
.top-bar {
  height: 64px;
  background: var(--wf-surface);
  border-bottom: 1px solid var(--wf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 40;
}

.search-container {
  position: relative;
  width: 300px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border-radius: var(--radius);
  border: 1px solid var(--wf-border);
  background: var(--wf-bg);
  font-size: 0.875rem;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wf-text-muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.tenant-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 12px;
  border: 1px solid var(--wf-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Dashboard / Grid Layout */
.page-header {
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.page-title h1 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--wf-text-muted);
}

.content-body {
  padding: 0 var(--space-lg) var(--space-xl);
}

/* Shadcn Components */
.card {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-weight: 600;
  margin: 0;
}

.card-content {
  padding: var(--space-md);
}

/* Data Table */
.data-table-container {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--wf-border);
  color: var(--wf-text-muted);
  font-weight: 500;
}

.data-table td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--wf-border);
}

.data-table tr:hover {
  background: rgba(161, 196, 253, 0.05);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-milking { background: rgba(34, 197, 94, 0.1); color: var(--status-milking); }
.badge-dry { background: rgba(245, 158, 11, 0.1); color: var(--status-dry); }
.badge-sick { background: rgba(239, 68, 68, 0.1); color: var(--status-sick); }
.badge-deceased { background: rgba(30, 41, 59, 0.1); color: var(--status-deceased); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: var(--wf-accent);
  color: white;
}

.btn-primary:hover {
  background: #89b1f5;
}

.btn-outline {
  border-color: var(--wf-border);
  background: transparent;
  color: var(--wf-text-main);
}

.btn-outline:hover {
  background: var(--wf-bg);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
  margin-bottom: var(--space-md);
}

.tab {
  padding: 6px 12px;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--wf-text-muted);
  text-decoration: none;
}

.tab.active {
  background: white;
  color: var(--wf-text-main);
  box-shadow: var(--shadow-sm);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--wf-border);
  font-size: 0.875rem;
  background: white;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* Switches (Shadcn Style) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--wf-accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.mt-xl { margin-top: var(--space-xl); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-lg); }

/* Profile View Specifics */
.cow-profile-header {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  margin-bottom: var(--space-xl);
}

.cow-avatar {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid white;
  box-shadow: var(--shadow);
}

.cow-details h2 { margin: 0; font-size: 2rem; }

/* Modal/Dialog Backdrop (Static Wireframe Style) */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  padding: var(--space-lg);
  box-shadow: var(--shadow);
}
