/* Sistema Poly Odonto — CSS v4 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --accent: #1E3A5F;
  --accent-hover: #162d4a;
  --accent-soft: #EBF0F7;
  --bg: #ffffff;
  --surface: #F7F7F7;
  --border: #E8E8E8;
  --border-strong: #D0D0D0;
  --text: #111111;
  --muted: #888888;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --success: #16A34A;
  --success-soft: #F0FDF4;
  --sidebar-width: 210px;
  --mobile-header: 50px;
  --radius: 7px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Login ─── */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: #F0F2F5; padding: 20px;
}
.login-card {
  background: #fff; border-radius: 12px;
  border: 1px solid var(--border);
  padding: 36px 32px; width: 100%; max-width: 340px; text-align: center;
}
.login-logo img { width: 50px; height: 50px; border-radius: 8px; margin-bottom: 16px; }
.login-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.login-subtitle { font-size: 12px; color: var(--muted); margin-bottom: 24px; }
.link-muted { font-size: 12px; color: var(--muted); text-decoration: none; }
.link-muted:hover { color: var(--accent); }

/* ─── App ─── */
#app { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: #F0F2F5;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform .2s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 9px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img { width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0; }
.sidebar-title { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-subtitle { font-size: 10px; color: var(--muted); margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 8px 6px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--muted);
  letter-spacing: .07em; text-transform: uppercase;
  padding: 14px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 6px;
  color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 400;
  margin-bottom: 1px; cursor: pointer;
  transition: background .1s, color .1s;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; stroke-width: 1.8; }
.nav-item:hover { background: #E4E7EC; color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 500; }
.nav-label { flex: 1; }
.badge-soon {
  font-size: 9px; font-weight: 500;
  background: rgba(0,0,0,.06); color: var(--muted);
  padding: 1px 6px; border-radius: 999px;
}
.sidebar-bottom {
  padding: 6px 6px 10px;
  border-top: 1px solid var(--border);
}
.nav-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; margin-top: 2px;
}
.nav-user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 11px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-user-info { flex: 1; min-width: 0; }
.nav-user-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-user-role { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* ─── Mobile header ─── */
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  height: var(--mobile-header); background: #F0F2F5;
  border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between;
  padding: 0 14px; z-index: 90;
}
.mobile-title { font-size: 14px; font-weight: 600; color: var(--text); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.25); z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ─── Main content ─── */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; background: var(--bg); }
.module-inner { padding: 28px 32px; max-width: 1060px; }

/* ─── Loading / Soon ─── */
.loading-module { padding: 80px; text-align: center; color: var(--muted); font-size: 13px; }
.module-soon {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; padding: 40px;
}
.soon-icon { font-size: 32px; margin-bottom: 12px; }
.soon-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.soon-text { color: var(--muted); font-size: 13px; }

/* ─── Module header ─── */
.module-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 10px;
}
.module-title { font-size: 18px; font-weight: 600; color: var(--text); }
.module-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─── Form elements ─── */
.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--muted); margin-bottom: 4px;
  letter-spacing: .04em; text-transform: uppercase;
}
.input, .select {
  width: 100%; border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 7px 10px;
  font-size: 13px; font-family: inherit;
  background: #fff; color: var(--text); height: 34px;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}
.select { cursor: pointer; }

/* ─── Buttons ─── */
.btn {
  border: none; border-radius: var(--radius);
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; white-space: nowrap;
  transition: opacity .1s, background .1s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-gold { background: var(--accent); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface); opacity: 1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; justify-content: center; height: 36px; }
.btn-sm { padding: 4px 10px; font-size: 12px; height: 26px; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: color .1s, background .1s;
}
.btn-icon:hover { color: var(--text); background: var(--surface); }

/* ─── Cards ─── */
.card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 12px;
}
.card-sm { padding: 11px 14px; }

/* ─── Layout ─── */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.form-row .input, .form-row .select { flex: 1; min-width: 110px; }

/* ─── List items ─── */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; margin-bottom: 5px; gap: 8px;
}
.list-item:last-child { margin-bottom: 0; }

/* ─── Empty states ─── */
.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); font-size: 13px;
}
.empty-icon { font-size: 24px; margin-bottom: 8px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ─── Tables ─── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--surface); }
th { text-align: left; padding: 8px 12px; color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
th.num, td.num { text-align: right; }
td { padding: 8px 12px; border-top: 1px solid var(--border); }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 18px; background: #fff; }

/* ─── Tags ─── */
.tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.tag-gold { background: var(--accent-soft); color: var(--accent); }
.tag-navy { background: var(--surface); color: var(--text); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-muted { background: var(--surface); color: var(--muted); }

/* ─── Feedback ─── */
.error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.success { color: var(--success); font-size: 12px; margin-top: 5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.h-title { font-size: 14px; font-weight: 600; color: var(--text); }
.diamond { display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); flex-shrink: 0; }

/* ─── Module tabs ─── */
.module-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.module-tab {
  padding: 9px 16px; font-size: 13px; font-weight: 500; color: var(--muted);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: inherit; transition: color .1s;
}
.module-tab:hover { color: var(--text); }
.module-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Pills ─── */
.pill {
  font-size: 12px; font-weight: 500; border: 1px solid var(--border-strong);
  background: #fff; color: var(--muted); border-radius: 999px;
  padding: 3px 11px; cursor: pointer; font-family: inherit; transition: all .1s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill-active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* ─── Divider ─── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ─── Day pills (tasks config) ─── */
.day-btn { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .1s; }
.day-btn-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; padding-top: var(--mobile-header); }
  .module-inner { padding: 18px 14px; }
}
@media (min-width: 769px) { .mobile-header { display: none !important; } }

/* ─── Mobile improvements ─── */
@media (max-width: 768px) {
  .module-inner { padding: 14px 12px; }
  .module-header { margin-bottom: 16px; }
  .module-title { font-size: 16px; }

  /* Tables scroll horizontally */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  /* Cards stack */
  .card { padding: 12px 14px; }

  /* Buttons smaller */
  .btn { height: 36px; padding: 6px 12px; }
  .btn-sm { height: 28px; padding: 4px 10px; font-size: 11px; }

  /* Form rows stack */
  .form-row { flex-direction: column; }
  .form-row .input, .form-row .select { width: 100%; }

  /* Fields full width */
  .field input, .field select, .field textarea { font-size: 16px; } /* prevent iOS zoom */

  /* Module tabs scroll */
  .module-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; flex-wrap: nowrap; }
  .module-tab { flex-shrink: 0; }

  /* Grid columns collapse */
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Dashboard stats */
  .dash-stats { grid-template-columns: repeat(2,1fr) !important; }

  /* Materials cards */
  .mat-card [style*="display:flex;align-items:center;gap:16px"] { flex-direction: column; align-items: flex-start !important; }
  .mat-vdiv { display: none !important; }

  /* Modal full screen */
  #mat-modal > div, #st-modal-wrap > div { width: 95vw !important; max-height: 85vh !important; padding: 16px !important; }

  /* CRM kanban scroll */
  .crm-board { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Nav user menu goes up properly */
  #nav-user-menu { left: 0 !important; right: 0 !important; }

  /* Report kpis */
  .rep-kpis { flex-direction: column; }
  .rep-kpi { min-width: unset !important; }
}

@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr !important; }
  .module-inner { padding: 10px 10px; }
}