* {
  box-sizing: border-box;
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #120A07;
  --surface: #1A0F0B;
  --surface-2: #22140F;
  --text: #F3EDE6;
  --muted: rgba(243, 237, 230, 0.62);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 26px 64px rgba(0, 0, 0, 0.46);
  --shadow-soft: 0 16px 42px rgba(0, 0, 0, 0.28);
  --shadow-sidebar: 18px 0 40px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --radius-sm: 14px;
  --header-h: 64px;
  --sidebar-w: 286px;
  --surface-glass: rgba(26, 15, 11, 0.68);
  --surface-glass-strong: rgba(26, 15, 11, 0.86);
  --ms-panel-bg: rgba(26, 15, 11, 0.97);
  --card-border: rgba(255, 255, 255, 0.09);
  --card-highlight: rgba(255, 255, 255, 0.05);
  --card-blur: 22px;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-display: 'Manrope', var(--font-body);
  --accent: #B88A4E;
  --accent-hover: #C79A5B;
  --on-accent: #1D120C;
  --danger: #FF6B7A;
  --ok: #34D399;
  --focus-ring: rgba(184, 138, 78, 0.35);
  --overlay-weak: rgba(255, 255, 255, 0.04);
  --overlay-medium: rgba(255, 255, 255, 0.07);
  --overlay-strong: rgba(255, 255, 255, 0.10);
  --scrim: rgba(0, 0, 0, 0.68);
  --chevron-color: rgba(255, 255, 255, 0.55);
  --surface-translucent: rgba(26, 15, 11, 0.92);
  --surface-translucent-strong: rgba(26, 15, 11, 0.96);
  --accent-tint-weak: rgba(184, 138, 78, 0.14);
  --accent-tint-strong: rgba(184, 138, 78, 0.55);
  --danger-tint: rgba(255, 107, 122, 0.14);
  --danger-tint-strong: rgba(255, 107, 122, 0.45);
  --ok-tint: rgba(52, 211, 153, 0.14);
  --ok-tint-strong: rgba(52, 211, 153, 0.45);
  --bg-glow-1: rgba(184, 138, 78, 0.16);
  --bg-glow-2: rgba(124, 74, 42, 0.14);
  --logo-gradient-start: rgba(184, 138, 78, 1);
  --logo-gradient-end: rgba(122, 75, 44, 0.85);
  --logo-shadow: 0 12px 26px rgba(184, 138, 78, 0.18);
  --ico-logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3.5c-3.8 0-6.8 3.8-6.8 8.5s3 8.5 6.8 8.5 6.8-3.8 6.8-8.5-3-8.5-6.8-8.5Zm0 1.8c2.7 0 5 3 5 6.7s-2.3 6.7-5 6.7-5-3-5-6.7 2.3-6.7 5-6.7Z'/%3E%3Cpath fill='black' d='M12.1 6.2c-.5 0-.9.4-.9.9 0 1.8-.6 3.3-1.7 4.6-1.1 1.3-1.7 2.9-1.7 4.6 0 .5.4.9.9.9s.9-.4.9-.9c0-1.3.4-2.4 1.3-3.5 1.4-1.6 2.1-3.5 2.1-5.7 0-.5-.4-.9-.9-.9Z'/%3E%3C/svg%3E");
  --ico-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7'/%3E%3Cpath d='M5 10v11a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1V10'/%3E%3C/svg%3E");
  --ico-folder: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z'/%3E%3C/svg%3E");
  --ico-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8'/%3E%3Cpath d='M8 12h8'/%3E%3C/svg%3E");
  --ico-list: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='4' cy='6' r='1'/%3E%3Ccircle cx='4' cy='12' r='1'/%3E%3Ccircle cx='4' cy='18' r='1'/%3E%3Cpath d='M8 6h13'/%3E%3Cpath d='M8 12h13'/%3E%3Cpath d='M8 18h13'/%3E%3C/svg%3E");
  --ico-chart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19V5'/%3E%3Cpath d='M4 19h16'/%3E%3Cpath d='M8 17v-6'/%3E%3Cpath d='M12 17V9'/%3E%3Cpath d='M16 17v-3'/%3E%3C/svg%3E");
  --ico-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s7-5.2 7-12a7 7 0 0 0-14 0c0 6.8 7 12 7 12z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E");
  --ico-leaf: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 4c-7 1-12 4-14 9-1 3-1 5-1 8 3 0 6-1 9-3 4-3 6-8 6-14z'/%3E%3Cpath d='M9 15c2-2 6-4 10-5'/%3E%3C/svg%3E");
  --ico-basket: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10h16l-1.5 11H5.5L4 10z'/%3E%3Cpath d='M9 10l-2-4'/%3E%3Cpath d='M15 10l2-4'/%3E%3Cpath d='M10 14v4'/%3E%3Cpath d='M14 14v4'/%3E%3C/svg%3E");
  --ico-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M12 20v2'/%3E%3Cpath d='M4.9 4.9l1.4 1.4'/%3E%3Cpath d='M17.7 17.7l1.4 1.4'/%3E%3Cpath d='M2 12h2'/%3E%3Cpath d='M20 12h2'/%3E%3Cpath d='M4.9 19.1l1.4-1.4'/%3E%3Cpath d='M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
  --ico-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z'/%3E%3C/svg%3E");
  --ico-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --ico-eye-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.94 10.94 0 0 1 12 19c-7 0-11-7-11-7a18.5 18.5 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A10.94 10.94 0 0 1 12 5c7 0 11 7 11 7a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cpath d='M1 1l22 22'/%3E%3C/svg%3E");
  --ico-tool: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/%3E%3C/svg%3E");
  --ico-person: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8'/%3E%3C/svg%3E");
  --ico-flask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3h6'/%3E%3Cpath d='M10 3v6.2L4.7 18a2 2 0 0 0 1.7 3h11.2a2 2 0 0 0 1.7-3L14 9.2V3'/%3E%3Cpath d='M8 15h8'/%3E%3C/svg%3E");
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FBF3E7;
  --surface: #FFFFFF;
  --surface-2: #F3E8D8;
  --text: #2B1B10;
  --muted: rgba(43, 27, 16, 0.66);
  --border: rgba(43, 27, 16, 0.14);
  --shadow: 0 26px 54px rgba(43, 27, 16, 0.14);
  --shadow-soft: 0 14px 30px rgba(43, 27, 16, 0.09);
  --shadow-sidebar: 18px 0 30px rgba(43, 27, 16, 0.12);
  --surface-glass: rgba(255, 255, 255, 0.66);
  --surface-glass-strong: rgba(255, 255, 255, 0.86);
  --ms-panel-bg: rgba(255, 255, 255, 0.97);
  --card-border: rgba(43, 27, 16, 0.08);
  --card-highlight: rgba(255, 255, 255, 0.5);
  --accent: #8A5A2B;
  --accent-hover: #74491F;
  --danger: #C63C4C;
  --ok: #1E8E63;
  --focus-ring: rgba(138, 90, 43, 0.35);
  --overlay-weak: rgba(43, 27, 16, 0.04);
  --overlay-medium: rgba(43, 27, 16, 0.07);
  --overlay-strong: rgba(43, 27, 16, 0.12);
  --scrim: rgba(43, 27, 16, 0.45);
  --chevron-color: rgba(43, 27, 16, 0.55);
  --surface-translucent: rgba(255, 255, 255, 0.92);
  --surface-translucent-strong: rgba(255, 255, 255, 0.96);
  --accent-tint-weak: rgba(138, 90, 43, 0.12);
  --accent-tint-strong: rgba(138, 90, 43, 0.50);
  --danger-tint: rgba(198, 60, 76, 0.12);
  --danger-tint-strong: rgba(198, 60, 76, 0.40);
  --ok-tint: rgba(30, 142, 99, 0.12);
  --ok-tint-strong: rgba(30, 142, 99, 0.40);
  --bg-glow-1: rgba(138, 90, 43, 0.10);
  --bg-glow-2: rgba(138, 90, 43, 0.08);
  --logo-gradient-start: rgba(138, 90, 43, 1);
  --logo-gradient-end: rgba(116, 73, 31, 0.85);
  --logo-shadow: 0 12px 22px rgba(138, 90, 43, 0.16);
}

html,
body {
  height: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 520px at 18% -10%, var(--bg-glow-1), transparent 62%),
    radial-gradient(900px 520px at 92% 0%, var(--bg-glow-2), transparent 58%),
    var(--bg);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
}

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--surface-translucent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 1px 0 var(--border);
  min-width: 0;
}

.header-greeting {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
  text-overflow: ellipsis;
  max-width: 140px;
}

.logo-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.logo-btn:hover {
  opacity: 0.92;
}

.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: linear-gradient(145deg, var(--logo-gradient-start), var(--logo-gradient-end));
  box-shadow: var(--logo-shadow);
  -webkit-mask-image: var(--ico-logo);
  mask-image: var(--ico-logo);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.logo-text,
.sidebar-title,
.modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.4px;
}

.logout-btn,
.btn,
.btn-mini,
.action-btn,
.sidebar-close,
.modal-close {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logout-form {
  display: contents;
}

.theme-toggle-btn {
  padding: 0;
  width: 44px;
  height: 44px;
  justify-content: center;
  cursor: pointer;
}

.theme-icon {
  width: 18px;
  height: 18px;
  background: var(--text);
  -webkit-mask-image: var(--ico-sun);
  mask-image: var(--ico-sun);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

:root[data-theme="light"] .theme-icon {
  -webkit-mask-image: var(--ico-moon);
  mask-image: var(--ico-moon);
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.password-toggle-icon {
  width: 18px;
  height: 18px;
  background: var(--muted);
  -webkit-mask-image: var(--ico-eye);
  mask-image: var(--ico-eye);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.password-toggle-btn[aria-pressed="true"] .password-toggle-icon {
  background: var(--text);
  -webkit-mask-image: var(--ico-eye-off);
  mask-image: var(--ico-eye-off);
}

.content {
  padding: 28px 14px 40px;
  max-width: 1100px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.3px;
  margin: 14px 0 24px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 24px;
}

.title-row .title {
  margin: 0;
  flex: 0 0 auto;
}

.title-divider {
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
  opacity: 0.35;
  min-width: 24px;
}

.page-subtitle {
  margin: -16px 0 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.title-print-btn {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .title-row {
    flex-wrap: wrap;
  }

  .title-divider {
    order: 3;
    flex-basis: 100%;
    height: 0;
    margin: 0;
  }

  .title-print-btn {
    order: 2;
    margin-left: auto;
  }
}

.card,
.panel {
  border: 1px solid var(--card-border);
  background: var(--surface-glass);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft), inset 0 1px 0 var(--card-highlight);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.card {
  padding: 24px;
}

.panel {
  overflow: hidden;
}

.panel-body {
  padding: 20px;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field-flush {
  margin-bottom: 0;
}

.label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.input,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="tel"],
input[type="email"],
select,
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input {
  height: 48px;
  padding: 0 14px;
  outline: none;
  text-transform: uppercase;
}

.input[type="email"] {
  text-transform: none;
}

.input:read-only,
.input:disabled,
input[readonly],
textarea[readonly] {
  opacity: 0.85;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  cursor: not-allowed;
  background: var(--overlay-weak);
}

.is-invalid,
.input.is-invalid,
select.is-invalid,
textarea.is-invalid,
.ms-control.is-invalid {
  border-color: var(--danger) !important;
}

.row,
.row-2,
.row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.consulta-filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  width: 100%;
}

.consulta-filtros .field {
  margin-bottom: 0;
}

.consulta-filtros-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--overlay-weak);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.consulta-filtros-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent-tint-strong);
}

.consulta-filtros-toggle[aria-expanded="true"] .chev {
  transform: rotate(45deg);
}

@media (max-width: 768px) {
  .consulta-filtros-toggle {
    display: flex;
  }

  .consulta-filtros {
    margin-top: 14px;
  }

  .consulta-filtros.is-collapsed {
    display: none;
  }
}

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

.consulta-pagination-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.consulta-pagination .btn-mini:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

tbody tr {
  transition: background-color 140ms ease;
}

tbody tr:hover {
  background: var(--overlay-weak);
}

.row-muted {
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.status-badge--ok {
  color: var(--ok);
  background: var(--ok-tint);
  border: 1px solid var(--ok-tint-strong);
}

.status-badge--danger {
  color: var(--danger);
  background: var(--danger-tint);
  border: 1px solid var(--danger-tint-strong);
}

.status-badge--neutral {
  color: var(--muted);
  background: var(--overlay-weak);
  border: 1px solid var(--border);
}

.name-badge {
  margin-left: 8px;
}

.empty-state {
  color: var(--muted);
  padding: 16px 4px;
  line-height: 1.5;
}

.card-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.card-subtitle {
  color: var(--muted);
  line-height: 1.4;
}

.section-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.table-total-cell {
  font-weight: 700;
}

.rateio-error {
  color: #b91c1c;
}

.empty-state--error {
  color: var(--danger);
}

.ms {
  position: relative;
}

.ms-control {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.ms-control.open {
  border-color: var(--accent-tint-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ms-placeholder {
  color: var(--muted);
}

.ms-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--overlay-medium);
  font-size: 12px;
  cursor: pointer;
}

.ms-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  border: 1px solid var(--card-border);
  background: var(--ms-panel-bg);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* .card/.panel usam backdrop-filter, o que cria um contexto de empilhamento isolado por
   elemento mesmo sendo position:static — na ordem de pintura isso conta como "z-index:0",
   empatando por ordem no DOM. Sem isto, um .ms-panel (z-index:20) só vence outros elementos
   DENTRO do próprio .card/.panel; qualquer .card/.panel IRMÃO que venha depois no DOM pinta
   por cima dele inteiro, escondendo o dropdown em vez de sobrepor. Eleva o card/panel que
   contém o dropdown aberto pra cima de todos os irmãos.
   overflow:visible tambem entra aqui por um motivo diferente: .panel (usado como secao de
   accordion, ex. dentro de modais como "GERENCIAR" de Custos Gerais) tem overflow:hidden pra
   conter o proprio conteudo — isso corta fisicamente qualquer .ms-panel/.cs-panel que se estenda
   além do accordion (nao é so questao de z-index, overflow:hidden recorta o desenho). Sem isto o
   dropdown aberto perto do fim de um accordion fica com metade (ou tudo) invisivel. */
.card:has(> .ms .ms-control.open),
.card:has(.field > .ms .ms-control.open),
.card:has(> .cs .cs-control.open),
.card:has(.field > .cs .cs-control.open),
.panel:has(> .ms .ms-control.open),
.panel:has(.field > .ms .ms-control.open),
.panel:has(> .cs .cs-control.open),
.panel:has(.field > .cs .cs-control.open) {
  position: relative;
  z-index: 30;
  overflow: visible;
}

.ms-search {
  width: 100%;
  height: 48px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  outline: none;
  text-transform: uppercase;
}

/* Dropdown de selecao unica que substitui visualmente o <select> nativo — a lista de opcoes
   de um <select> real e desenhada pelo navegador/SO e nenhum CSS alcanca ela, entao ficava
   sempre no estilo padrao do sistema operacional (fundo branco, sem cantos), destoando do
   tema escuro do resto do app. Mesmo visual do .ms (multi-selecao), so que de escolha unica. */
.cs {
  position: relative;
}

.cs-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cs-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.cs-control:focus-visible,
.cs-control:focus {
  border-color: var(--accent-tint-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.cs-control[disabled] {
  opacity: 0.85;
  color: var(--muted);
  cursor: not-allowed;
  background: var(--overlay-weak);
}

.cs-control-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.cs-control-label.is-placeholder {
  color: var(--muted);
}

.cs-control .chev {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--chevron-color);
  border-bottom: 2px solid var(--chevron-color);
  transform: rotate(45deg);
  margin-top: -4px;
  transition: transform 140ms ease, margin-top 140ms ease;
}

.cs-control.open .chev {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.cs-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--ms-panel-bg);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow);
}

.cs-panel[hidden] {
  display: none;
}

.cs-option {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-transform: uppercase;
}

.cs-option:hover,
.cs-option.is-focused {
  background: var(--overlay-weak);
}

.cs-option.is-selected {
  border-color: var(--accent-tint-strong);
  background: var(--accent-tint-weak);
}

.cs-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.ms-options {
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.ms-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--overlay-weak);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.ms-option.selected {
  border-color: var(--accent-tint-strong);
  box-shadow: inset 0 0 0 1px var(--focus-ring);
}

.ms-option:hover {
  background: var(--overlay-medium);
}

.btn {
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.btn:not(.btn-disabled):not(.btn-blocked):not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.btn-mini:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--accent-tint-strong);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 10px 24px var(--accent-tint-weak);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 14px 30px var(--accent-tint-strong);
}

.btn-danger {
  background: var(--danger-tint);
  border-color: var(--danger-tint-strong);
  color: var(--danger);
}

.btn-full {
  width: 100%;
}

.login-bloqueado-btn {
  height: auto;
  min-height: 34px;
  padding: 10px 12px;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  margin-top: 10px;
}

.btn-disabled,
.btn-blocked {
  opacity: 0.62;
  filter: saturate(0.85);
  cursor: not-allowed;
}

.actions,
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.actions {
  margin-top: 16px;
}

.actions-tight {
  margin-top: 14px;
}

.modal-actions {
  padding: 18px;
  border-top: 1px solid var(--border);
}

.expand-btn,
.action-btn,
.menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.expand-btn,
.action-btn {
  gap: 10px;
}

.expand-btn {
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--overlay-weak);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.expand-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent-tint-strong);
}

.expand-btn[aria-expanded="true"] .chev {
  transform: rotate(45deg);
}

.expand-btn-spaced {
  margin-top: 12px;
}

.rateio-preview {
  margin-top: 12px;
}

.action-btn {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--surface-glass);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent-tint-strong);
}

.action-btn--locked {
  font: inherit;
  text-align: left;
  width: 100%;
  opacity: 0.6;
  cursor: not-allowed;
}

.action-btn--locked::before {
  content: none;
}

.action-btn--locked:hover {
  transform: none;
  border-color: var(--card-border);
}

.menu-link {
  justify-content: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.menu-link[aria-current="page"] {
  background: var(--accent-tint-weak);
  border-color: var(--accent-tint-strong);
}

.menu-link .menu-badge,
.action-btn .chev {
  margin-left: auto;
}

.menu-link::before,
.action-btn::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  background: var(--accent);
  opacity: 0.88;
  -webkit-mask-image: var(--icon);
  mask-image: var(--icon);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Menu lateral (sidebar) */

.menu-link[href="/dashboard"] {
  --icon: var(--ico-home);
}

.menu-link[href="/cadastros"] {
  --icon: var(--ico-folder);
}

.menu-link[href="/registrar-custos"] {
  --icon: var(--ico-plus);
}

.menu-link[href="/consultar-registros"] {
  --icon: var(--ico-list);
}

.menu-link[href="/relatorios"] {
  --icon: var(--ico-chart);
}

.menu-link[href="/ferramentas"] {
  --icon: var(--ico-tool);
}

/* Cadastros */

.action-btn[href="/cadastros/propriedade"] {
  --icon: var(--ico-pin);
}

.action-btn[href="/cadastros/lavoura"] {
  --icon: var(--ico-leaf);
}

#productionSummary {
  --icon: var(--ico-basket);
}

/* Registrar custos */

.action-btn[href="/registrar-custos/custos-gerais"] {
  --icon: var(--ico-plus);
}

.action-btn[href="/registrar-custos/custos-adubo-calagem"],
.action-btn[href="/registrar-custos/custos-pulverizacao-aplicacao"] {
  --icon: var(--ico-leaf);
}

.action-btn[href="/registrar-custos/custo-mao-de-obra"] {
  --icon: var(--ico-person);
}

.action-btn[href="/registrar-custos/custo-colheita"] {
  --icon: var(--ico-basket);
}

/* Consultar registros — mesma família de 5 tipos de custo, ícone de lista em todos
   (o objetivo aqui é navegar uma lista de registros já lançados) */

.action-btn[href^="/consultar-registros/"] {
  --icon: var(--ico-list);
}

/* Relatórios — hub e sub-páginas por categoria (prefixo com barra final evita
   colisão entre "/relatorios/custo" e "/relatorios/custos-gerais") */

.action-btn[href="/relatorios"] {
  --icon: var(--ico-chart);
}

.action-btn[href="/relatorios/custo"],
.action-btn[href^="/relatorios/custo/"] {
  --icon: var(--ico-chart);
}

.action-btn[href="/relatorios/insumo"],
.action-btn[href^="/relatorios/insumo/"] {
  --icon: var(--ico-leaf);
}

.action-btn[href="/relatorios/custos-gerais"] {
  --icon: var(--ico-plus);
}

.action-btn[href="/relatorios/mao-de-obra"],
.action-btn[href^="/relatorios/mao-de-obra/"] {
  --icon: var(--ico-person);
}

.action-btn[href="/relatorios/colheita"],
.action-btn[href^="/relatorios/colheita/"] {
  --icon: var(--ico-basket);
}

/* Ferramentas — hub e sub-páginas por categoria */

.action-btn[href="/ferramentas/analise-solo"],
.action-btn[href^="/ferramentas/analise-solo/"] {
  --icon: var(--ico-flask);
}

.action-btn[href="/ferramentas/analise-folha"],
.action-btn[href^="/ferramentas/analise-folha/"] {
  --icon: var(--ico-leaf);
}

.chev {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-right: 2px solid var(--chevron-color);
  border-bottom: 2px solid var(--chevron-color);
  transform: rotate(-45deg);
  margin-left: 12px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 40;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-w);
  background: var(--surface-translucent-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  box-shadow: var(--shadow-sidebar);
  transform: translateX(-102%);
  transition: transform 220ms ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-close,
.modal-close {
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 140ms ease;
}

.sidebar-body {
  padding: 16px;
  display: grid;
  gap: 4px;
}

.menu-link:hover {
  background: var(--overlay-weak);
  border-color: var(--overlay-strong);
}

.menu-badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--focus-ring);
  color: var(--text);
  background: var(--accent-tint-weak);
}

dialog {
  width: min(720px, calc(100vw - 24px));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--surface-glass-strong);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

dialog::backdrop {
  background: var(--scrim);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
}

.modal-title {
  font-size: 16px;
}

.modal-body {
  padding: 18px;
}

.toast,
#toast {
  background: var(--surface-glass-strong);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.toast.error,
#toast.error {
  border-color: var(--danger-tint-strong);
}

.logo-btn:focus-visible,
.logout-btn:focus-visible,
.btn:focus-visible,
.expand-btn:focus-visible,
.sidebar-close:focus-visible,
button:focus-visible,
a:focus-visible,
input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
input[type="date"]:focus-visible,
input[type="search"]:focus-visible,
input[type="tel"]:focus-visible,
input[type="email"]:focus-visible,
select:focus-visible,
textarea:focus-visible,
.input:focus {
  outline: none;
  border-color: var(--accent-tint-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 720px) {
  .row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 920px) {
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }

}

@media (max-width: 600px) {
  .content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sidebar {
    width: min(var(--sidebar-w), 86vw);
  }

  .menu-link::before,
  .action-btn::before {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .header-greeting {
    display: none;
  }
}
