/* Proplytix Data Solutions - Professional Minimalist Design */
:root {
  /* Colors */
  --primary: #3f51b5;
  --primary-dark: #2c3e91;
  --primary-light: #e8eaf6;
  
  --black: #000000;
  --gray-900: #1a1a1a;
  --gray-800: #333333;
  --gray-700: #4d4d4d;
  --gray-600: #666666;
  --gray-500: #808080;
  --gray-400: #999999;
  --gray-300: #cccccc;
  --gray-200: #e6e6e6;
  --gray-100: #f5f5f5;
  --white: #ffffff;
  
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #2196f3;
  
  /* Typography */
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Spacing */
  --radius: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-system);
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.main-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  height: 40px;
  width: auto;
}

.brand-text {
  line-height: 1.3;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.app-name {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Navigation */
nav.tabs {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--gray-200);
}

nav.tabs a {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

nav.tabs a:hover {
  color: var(--primary);
  background: var(--gray-100);
}

nav.tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Container */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

/* Typography */
h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 8px;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 16px;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 12px;
}

.sub {
  font-size: 13px;
  color: var(--gray-600);
}

/* Buttons */
button, .btn {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-ghost:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #d32f2f;
}

.btn-icon {
  padding: 6px;
  border: none;
  background: transparent;
  color: var(--gray-600);
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* Forms */
input, select, textarea {
  font-family: var(--font-system);
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-900);
  transition: all 0.15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Stats Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}

.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gray-300);
}

.stat.overdue::before { background: var(--danger); }
.stat.today::before { background: var(--warning); }
.stat.upcoming::before { background: var(--primary); }
.stat.positive::before { background: var(--success); }

.stat .n {
  font-size: 32px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 4px;
}

.stat .l {
  font-size: 12px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge.priority-low { background: #e8f5e9; color: #2e7d32; }
.badge.priority-medium { background: #fff3e0; color: #e65100; }
.badge.priority-high { background: #ffe0b2; color: #e65100; }
.badge.priority-critical { background: #ffebee; color: #c62828; }

.badge.outcome-positive { background: #e8f5e9; color: #2e7d32; }
.badge.outcome-neutral { background: #e3f2fd; color: #1565c0; }
.badge.outcome-negative { background: #ffebee; color: #c62828; }
.badge.outcome-pending { background: #fff3e0; color: #e65100; }

.badge.status-open { background: #e3f2fd; color: #1565c0; }
.badge.status-done { background: #e8f5e9; color: #2e7d32; }
.badge.status-cancelled { background: var(--gray-200); color: var(--gray-700); }

/* Tables */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 16px 0;
  flex-wrap: wrap;
}

.toolbar input[type=search] {
  flex: 1;
  min-width: 200px;
}

.status-indicator {
  font-size: 12px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.status-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-indicator.saving .dot { background: var(--warning); }
.status-indicator.err .dot { background: var(--danger); }

.grid-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--gray-100);
  position: sticky;
  top: 0;
}

th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover {
  background: var(--gray-200);
}

th.active {
  color: var(--primary);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--gray-100);
}

tr.flagged {
  background: #fff8f8;
}

tr.urgent {
  background: #fffbf0;
}

tr.overdue td:first-child {
  border-left: 3px solid var(--danger);
}

tr.today td:first-child {
  border-left: 3px solid var(--warning);
}

.cell-edit {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  width: 100%;
  font-size: 13px;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.cell-edit:hover {
  background: var(--gray-100);
}

.cell-edit:focus {
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Pills */
.fu-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 2px;
  display: inline-block;
  font-weight: 500;
}

.fu-pill.overdue { background: #ffebee; color: #c62828; }
.fu-pill.today { background: #fff3e0; color: #e65100; }
.fu-pill.upcoming { background: #e3f2fd; color: #1565c0; }
.fu-pill.done { background: #e8f5e9; color: #2e7d32; }
.fu-pill.none { background: var(--gray-200); color: var(--gray-600); }

/* Flag/Urgent Icons */
.flag-icon, .urgent-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.flag-icon {
  color: var(--gray-400);
}

.flag-icon:hover {
  color: var(--danger);
  background: #ffebee;
}

.flag-icon.flagged {
  color: var(--danger);
  background: #ffebee;
}

.urgent-marker {
  background: var(--danger);
  color: var(--white);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Client Blocks */
.client-block {
  border-bottom: 1px solid var(--gray-200);
}

.client-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.client-head:hover {
  background: var(--gray-100);
}

.client-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.client-meta {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
  display: flex;
  gap: 12px;
}

.client-visits {
  display: none;
  padding: 0 16px 16px;
  background: var(--gray-100);
}

.client-visits.open {
  display: block;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  font-size: 24px;
  color: var(--gray-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gray-900);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border-left: 3px solid;
  background: var(--gray-100);
}

.alert.danger {
  background: #ffebee;
  border-left-color: var(--danger);
  color: #c62828;
}

.alert.warning {
  background: #fff3e0;
  border-left-color: var(--warning);
  color: #e65100;
}

.alert.success {
  background: #e8f5e9;
  border-left-color: var(--success);
  color: #2e7d32;
}

.alert.info {
  background: #e3f2fd;
  border-left-color: var(--info);
  color: #1565c0;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
}

/* Loading */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Voice Recording */
.recording-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 60px;
  margin: 20px 0;
}

.bar {
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.bar:nth-child(1) { animation-delay: 0s; height: 20px; }
.bar:nth-child(2) { animation-delay: 0.1s; height: 30px; }
.bar:nth-child(3) { animation-delay: 0.2s; height: 40px; }
.bar:nth-child(4) { animation-delay: 0.3s; height: 30px; }
.bar:nth-child(5) { animation-delay: 0.4s; height: 20px; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.5); }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  
  .logo {
    height: 32px;
  }
  
  .brand-name {
    font-size: 14px;
  }
  
  .app-name {
    font-size: 11px;
  }
  
  .header-actions {
    width: 100%;
    margin-top: 12px;
    justify-content: space-between;
  }
  
  .wrap, nav.tabs {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  nav.tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  nav.tabs a {
    padding: 12px 16px;
    font-size: 13px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  h2 {
    font-size: 16px;
  }
  
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .stat {
    padding: 16px;
  }
  
  .stat .n {
    font-size: 24px;
  }
  
  .stat .l {
    font-size: 11px;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
  }
  
  .status-indicator {
    margin-left: 0;
    margin-top: 8px;
  }
  
  .grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    font-size: 12px;
    min-width: 600px;
  }
  
  th, td {
    padding: 8px 6px;
  }
  
  .card {
    padding: 16px;
  }
  
  .modal-content {
    width: 95%;
    padding: 24px;
    max-height: 85vh;
  }
  
  .btn-primary, .btn-ghost, .btn {
    font-size: 13px;
    padding: 10px 14px;
  }
  
  .client-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .client-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 10px 12px;
  }
  
  .logo {
    height: 28px;
  }
  
  .stats {
    grid-template-columns: 1fr;
  }
  
  nav.tabs a {
    font-size: 12px;
    padding: 10px 12px;
  }
  
  h1 {
    font-size: 18px;
  }
  
  .card {
    padding: 12px;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.flex { display: flex; }
.gap-2 { gap: 16px; }
.hidden { display: none; }
