:root {
  --green: #4caf50;
  --green-dark: #2e7d32;
  --green-soft: #e8f5e9;
  --bg: #ffffff;
  --surface: #f5f5f5;
  --card: #ffffff;
  --text: #333333;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #d32f2f;
  --danger-soft: #fdecea;
  --warn: #b58105;
  --warn-soft: #fff4d6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 28px rgba(15, 23, 42, 0.12);
  --radius: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--green-dark);
  text-decoration: none;
  cursor: pointer;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
}

/* ---------- Buttons ---------- */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--green);
  color: white;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  min-height: 44px;
}
button:hover,
.btn:hover {
  background: var(--green-dark);
}
button:active {
  transform: translateY(1px);
}
button.secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
button.secondary:hover {
  background: var(--surface);
  border-color: #d1d5db;
}
button.danger {
  background: var(--card);
  color: var(--danger);
  border-color: var(--border);
}
button.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}
button.ghost {
  background: transparent;
  color: var(--green-dark);
  border-color: transparent;
}
button.ghost:hover {
  background: var(--green-soft);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Inputs ---------- */
input,
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.18);
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
}
.success {
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 15px;
}
.empty .empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.6;
}
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 15px;
}
.loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(140deg, var(--green-soft) 0%, var(--bg) 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.auth-card .logo-img {
  width: 72px;
  height: 72px;
}
.brand h1 {
  font-size: 22px;
  margin: 0;
  color: var(--green-dark);
}
.auth-subtitle {
  margin: 6px 0 22px;
  color: var(--muted);
  font-size: 14px;
}
.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-top: 18px;
}
.auth-switch a {
  font-weight: 600;
}

.company-picker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.company-picker-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.company-picker-item:hover:not([disabled]) {
  border-color: var(--green);
  background: var(--green-soft);
}
.company-picker-item.selected {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 1px var(--green);
}
.company-picker-item[disabled] {
  cursor: not-allowed;
}
.company-picker-name {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.company-picker-role {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Shell ---------- */
.shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 248px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  padding: 0 6px;
}
.sidebar .brand .logo-img {
  width: 48px;
  height: 48px;
}
.sidebar .company-name {
  font-size: 13px;
  color: var(--muted);
  padding: 0 6px;
  margin-bottom: 22px;
  word-break: break-word;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-right: 2px;
}
.sidebar nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.sidebar .spacer {
  display: none;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar nav a:hover {
  background: var(--surface);
}
.sidebar nav a.active {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
}
.sidebar nav a .nav-ico {
  width: 18px;
  text-align: center;
  font-size: 14px;
}
.spacer {
  flex: 1;
}
.user-box {
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 10px;
}
.user-box .name {
  font-weight: 600;
  font-size: 14px;
}
.user-box .role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  text-transform: capitalize;
}
.logout {
  width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.logout:hover {
  background: var(--surface);
}
.main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Mobile header ---------- */
.mobile-header {
  display: none;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.mobile-header .brand h1 {
  font-size: 17px;
}
.menu-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 14px;
  min-height: 0;
}

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 24px;
  margin: 0 0 4px;
}
.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Cards ---------- */
.section-card {
  background: var(--card);
  padding: 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.section-card h3 {
  font-size: 16px;
  margin: 0 0 14px;
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--green);
}
.stat-card .label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.stat-card .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--green-dark);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: center;
}
.filters input,
.filters select {
  flex: 1 1 180px;
  min-width: 140px;
}
.filters button {
  flex: 0 0 auto;
}

/* ---------- Item cards (animals/crops) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.item-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}
.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--green-soft);
}
.item-card .item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.item-card .item-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.item-card .item-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
}
.item-card .item-meta span strong {
  color: var(--text);
  font-weight: 600;
}
.item-card .actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.item-card .actions button {
  flex: 1;
  padding: 9px 12px;
  font-size: 14px;
  min-height: 0;
}
.item-notes {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  padding: 6px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  line-height: 1.5;
}
.ver-mas,
.ver-menos {
  color: var(--green);
  font-style: normal;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.ver-mas:hover,
.ver-menos:hover {
  text-decoration: underline;
}
.ok-btn {
  flex: 1;
  padding: 9px 12px;
  font-size: 14px;
  min-height: 0;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.ok-btn:hover {
  background: var(--green-dark);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge.ok {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: transparent;
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.badge.info {
  background: #e0f2fe;
  color: #0369a1;
  border-color: transparent;
}
.badge.muted {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
  opacity: 0.7;
}
.stat-card.stat-danger {
  border-left-color: var(--danger, #c62828);
}
.stat-card.stat-warn {
  border-left-color: var(--warn, #d97706);
}
.stat-card .stat-sub {
  font-size: 12px;
  margin-top: 4px;
  color: var(--muted);
}
.stat-card.stat-danger .stat-sub {
  color: var(--danger, #c62828);
}
.stat-card.stat-warn .stat-sub {
  color: var(--warn, #d97706);
}
.event-item.task-done {
  opacity: 0.6;
}
.event-item.task-done .title {
  text-decoration: line-through;
}

/* ---------- Registros de Campo — Timeline ---------- */
.record-timeline {
  position: relative;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.record-timeline::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: var(--border, #e0e0e0);
  z-index: 0;
}
.record-entry {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  padding-bottom: 14px;
}
.record-entry:last-child {
  padding-bottom: 0;
}
.record-dot {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  z-index: 1;
  position: relative;
  box-shadow: 0 0 0 3px var(--bg, #fff);
}
.record-body {
  flex: 1;
  min-width: 0;
}
.record-body.section-card {
  padding: 12px 14px;
  transition: box-shadow .15s, transform .1s;
}
.record-body.section-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  transform: translateY(-1px);
}

/* ---------- Location Card ---------- */
.location-card {
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
  background: var(--card-bg, #fff);
}
.location-card-header {
  padding: 10px 14px 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #1a2e1a);
}
.location-map-preview {
  padding: 0 14px;
  line-height: 0;
}
.location-map-preview iframe {
  display: block;
  border-radius: 6px;
}
.location-card-actions {
  display: flex;
  gap: 10px;
  padding: 10px 14px 12px;
  flex-wrap: wrap;
}
.location-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border, #e0e0e0);
  background: var(--surface, #f5f7f5);
  color: var(--text, #1a2e1a);
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.location-btn:hover {
  background: var(--bg, #ecf5ec);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.location-btn-dir {
  background: var(--primary, #2e7d32);
  color: #fff;
  border-color: transparent;
}
.location-btn-dir:hover {
  background: var(--primary-dark, #1b5e20);
}

/* ---------- Activity / alert lists ---------- */
.activity-list,
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--green);
}
.activity-item .who {
  font-weight: 600;
  font-size: 13px;
  color: var(--green-dark);
}
.activity-item .what {
  font-size: 14px;
  color: var(--text);
  margin-top: 2px;
}
.activity-item .time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--warn-soft);
  border-radius: var(--radius);
  border-left: 3px solid var(--warn);
}
.alert-item .msg {
  font-size: 14px;
  color: var(--text);
}
.alert-item .time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Deadline alerts (from planner) ---------- */
.card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head-row h3 {
  margin: 0;
}
.link-btn {
  background: transparent;
  color: var(--green-dark);
  border: none;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 0;
  width: auto;
}
.link-btn:hover {
  text-decoration: underline;
  background: transparent;
}
.deadline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deadline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
}
.deadline-item .dot {
  font-size: 14px;
  line-height: 1;
}
.deadline-item .d-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.deadline-item .d-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.deadline-item.status-overdue {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}
.deadline-item.status-overdue .d-status {
  color: var(--danger);
  font-weight: 600;
}
.deadline-item.status-today {
  background: var(--warn-soft);
  border-left-color: #e8830c;
}
.deadline-item.status-today .d-status {
  color: #b85c00;
  font-weight: 600;
}
.deadline-item.status-tomorrow {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}
.deadline-item.status-upcoming {
  background: var(--green-soft);
  border-left-color: var(--green);
}
.deadline-item.status-future {
  background: #e8f0fe;
  border-left-color: #3b82f6;
}

/* ---------- Notification banner ---------- */
.notif-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--green-soft);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--green-dark);
  font-weight: 500;
}
.notif-banner .notif-actions {
  display: flex;
  gap: 8px;
}
.notif-banner button {
  padding: 6px 14px;
  font-size: 13px;
  min-height: 0;
  width: auto;
}

/* ---------- Charts ---------- */
.pie-wrap {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 140px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.legend .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ---------- Planificador ---------- */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.event-item .title {
  font-weight: 600;
  flex: 1;
  font-size: 14px;
  min-width: 120px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.report-header {
  margin-bottom: 18px;
}
.report-header h2 {
  margin: 0;
  color: var(--green-dark);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 {
  margin: 0 0 18px;
  font-size: 19px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .mobile-header {
    display: flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
    box-shadow: var(--shadow-lg);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    padding: 20px 16px;
  }
  .page-header h2 {
    font-size: 20px;
  }
  .item-card .actions button {
    min-height: 40px;
  }
  .stat-card .value {
    font-size: 26px;
  }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions button {
    width: 100%;
  }
}

/* ---------- Print (Reports) ---------- */
@media print {
  .sidebar,
  .mobile-header,
  .page-header button,
  .header-actions,
  button {
    display: none !important;
  }
  body,
  .shell {
    background: white;
  }
  .main {
    padding: 0;
    max-width: none;
  }
  .section-card,
  .stat-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --green: #4caf50;
  --green-dark: #6cc070;
  --green-soft: #1c3a20;
  --bg: #0f1411;
  --surface: #161b18;
  --card: #1e2622;
  --text: #e7eae7;
  --muted: #9aa3a0;
  --border: #2e3733;
  --danger: #ef5350;
  --danger-soft: #3a1f1f;
  --warn: #e0a92a;
  --warn-soft: #3a3216;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] button.secondary:hover {
  border-color: var(--border);
}

/* ---------- Settings: appearance ---------- */
.theme-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.theme-opt {
  flex: 1;
  min-width: 110px;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border);
  font-weight: 600;
}
.theme-opt:hover {
  background: var(--surface);
  border-color: var(--green);
}
.theme-opt.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}
.theme-opt-ico {
  font-size: 22px;
}

/* ---------- Settings: recycle bin ---------- */
.trash-group {
  margin-top: 14px;
}
.trash-group:first-child {
  margin-top: 0;
}
.trash-group-title {
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--muted);
}
.trash-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.trash-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trash-item-name {
  font-weight: 600;
  font-size: 14px;
}
.trash-item-meta {
  font-size: 12px;
}
.trash-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.trash-item-actions button {
  padding: 7px 12px;
  font-size: 13px;
  min-height: 0;
}

/* ---------- Settings: notifications ---------- */
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.switch-label {
  font-weight: 600;
  font-size: 15px;
}
.switch-row input[type="checkbox"],
.check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex-shrink: 0;
  accent-color: var(--green);
  cursor: pointer;
}
.notif-intervals {
  margin-top: 16px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 15px;
}

/* ---------- Trazabilidad: detalle ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dt-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dt-val {
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
.dt-notas {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.detail-actions h3 {
  margin: 0;
}
.detail-actions .spacer {
  flex: 1;
}

/* ---------- Trazabilidad: timeline ---------- */
.timeline {
  position: relative;
  margin: 4px 0 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}
.tl-item {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 18px 0;
}
.tl-item:last-child {
  padding-bottom: 0;
}
.tl-marker {
  position: relative;
  z-index: 1;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 2px solid var(--border);
  font-size: 16px;
}
.tl-card {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.tl-title {
  font-weight: 700;
  color: var(--text);
}
.tl-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.tl-card .item-notes {
  margin-top: 6px;
}
.tl-user {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.tl-thumb {
  display: inline-block;
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 220px;
}
.tl-thumb img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: cover;
}
.tl-item.ev-created .tl-marker { border-color: #2e7d32; color: #2e7d32; }
.tl-item.ev-updated .tl-marker { border-color: #1565c0; color: #1565c0; }
.tl-item.ev-status .tl-marker { border-color: #b58105; color: #b58105; }
.tl-item.ev-vacc .tl-marker { border-color: #6a1b9a; color: #6a1b9a; }
.tl-item.ev-obs .tl-marker { border-color: #00838f; color: #00838f; }
.tl-item.ev-image .tl-marker { border-color: #ad1457; color: #ad1457; }
.tl-item.ev-harvest .tl-marker { border-color: #ef6c00; color: #ef6c00; }

/* ---------- Almacenamiento: barra de progreso ---------- */
.storage-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}
.progress {
  height: 12px;
  border-radius: 8px;
  background: var(--border);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 8px;
  background: #2e7d32;
  transition: width 0.3s ease;
}
.progress-bar.warn { background: var(--warn); }
.progress-bar.danger { background: var(--danger); }

/* ---------- Comunicados: tabs ---------- */
.com-tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.com-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.com-tab:hover {
  color: var(--text);
  background: var(--border);
}
.com-tab.active {
  color: #2e7d32;
  border-bottom-color: #2e7d32;
  background: none;
  font-weight: 700;
}

/* ---------- Feedback: admin response block ---------- */
.fb-response {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f8e9;
  border: 1px solid #c8e6c9;
}
.fb-response-label {
  font-size: 12px;
  color: #2e7d32;
}
[data-theme="dark"] .fb-response {
  background: rgba(46, 125, 50, 0.15);
  border-color: rgba(46, 125, 50, 0.35);
}
[data-theme="dark"] .fb-response-label {
  color: #81c784;
}

/* ── Settings layout ─────────────────────────────────────────────────────── */
.settings-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.settings-nav {
  flex-shrink: 0;
  width: 196px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 10px;
  border: 1px solid var(--border);
  position: sticky;
  top: 20px;
}
.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  width: 100%;
  transition: background 0.14s;
}
.settings-nav-btn:hover {
  background: var(--surface);
}
.settings-nav-btn.active {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
}
.settings-body {
  flex: 1;
  min-width: 0;
}
@media (max-width: 720px) {
  .settings-layout { flex-direction: column; }
  .settings-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    gap: 4px;
  }
  .settings-nav-btn { flex-shrink: 0; padding: 7px 10px; font-size: 12px; }
}

/* ── Interface size variants ─────────────────────────────────────────────── */
[data-size="compact"] { font-size: 13px; }
[data-size="compact"] .section-card { padding: 14px 16px; }
[data-size="large"] { font-size: 16px; }
[data-size="large"] .section-card { padding: 24px 28px; }

/* ── Storage breakdown ───────────────────────────────────────────────────── */
.storage-cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.storage-cat-row:last-child { border-bottom: none; }
.storage-cat-ico { font-size: 20px; width: 28px; text-align: center; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.stat-card {
  flex: 1;
  min-width: 80px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.stat-num {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.2;
}
.stat-lbl {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}

/* ── Team member row ─────────────────────────────────────────────────────── */
.team-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.team-member-row:last-child { border-bottom: none; }
.team-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

/* ── Alert boxes ─────────────────────────────────────────────────────────── */
.alert-box {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}
.alert-box.danger {
  background: var(--danger-soft);
  color: #b71c1c;
  border: 1px solid #ef9a9a;
}
.alert-box.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #ffe082;
}

/* ── Interface size picker ───────────────────────────────────────────────── */
.size-options { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.size-opt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
  min-width: 120px;
  transition: border-color 0.15s;
}
.size-opt:hover { border-color: var(--green-dark); }
.size-opt.active { border-color: var(--green-dark); background: var(--green-soft); }

/* ── Info grid (account/company info display) ────────────────────────────── */
.info-grid { display: flex; flex-direction: column; gap: 0; margin-top: 12px; }
.info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }

/* ── About platform fields ───────────────────────────────────────────────── */
.about-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.about-field:last-child { border-bottom: none; }
.about-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}
.about-field span,
.about-field p { font-size: 14px; margin: 0; }

/* dark mode adjustments */
[data-theme="dark"] .settings-nav { background: #1e1e1e; }
[data-theme="dark"] .settings-nav-btn.active { background: rgba(76,175,80,0.15); }
[data-theme="dark"] .size-opt.active { background: rgba(76,175,80,0.12); }
[data-theme="dark"] .stat-card { background: #1e1e1e; }
[data-theme="dark"] .alert-box.danger { background: rgba(211,47,47,0.12); color: #ef9a9a; border-color: rgba(211,47,47,0.3); }
[data-theme="dark"] .alert-box.warn { background: rgba(181,128,5,0.12); color: #ffe082; border-color: rgba(181,128,5,0.3); }
