* {
  box-sizing: border-box;
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #120A07;
  --surface: #1A0F0B;
  --surface-2: #22140F;
  --text: #F3EDE6;
  --muted: #B8ADA5;
  --border: #3B2A22;
  --accent: #B88A4E;
  --accent-hover: #C79A5B;
  --on-accent: #1D120C;
  --danger: #FF6B7A;
  --ok: #34D399;
  --warn: #E6B85C;
  --info: #73A7D8;
  --focus-ring: rgba(184, 138, 78, .42);
  --scrim: rgba(0, 0, 0, .68);
  --overlay-weak: rgba(255, 255, 255, 0.04);
  --overlay-medium: rgba(255, 255, 255, 0.07);
  --overlay-strong: rgba(255, 255, 255, 0.10);
  --chevron-color: rgba(255, 255, 255, 0.55);
  --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);
  --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");
  --ico-bell: 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='M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9'/%3E%3Cpath d='M10 21h4'/%3E%3C/svg%3E");
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FBF3E7;
  --surface: #FFFFFF;
  --surface-2: #F3E8D8;
  --text: #2B1B10;
  --muted: #6C5A4D;
  --border: #D9CBB9;
  --accent: #8A5A2B;
  --accent-hover: #74491F;
  --on-accent: #FFFFFF;
  --danger: #C63C4C;
  --ok: #1E8E63;
  --warn: #8A6418;
  --info: #326B8E;
  --focus-ring: rgba(138, 90, 43, .28);
  --scrim: rgba(43, 27, 16, .45);
  --overlay-weak: rgba(43, 27, 16, 0.04);
  --overlay-medium: rgba(43, 27, 16, 0.07);
  --overlay-strong: rgba(43, 27, 16, 0.12);
  --chevron-color: rgba(43, 27, 16, 0.55);
  --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);
  --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);
}

/* ==========================================================================
   Redesign UI/UX (fonte da verdade v3.0.0) — tokens canônicos e aliases.
   Os nomes antigos (--radius, --radius-sm, --surface-glass, --card-border...)
   continuam existindo como aliases porque CSS de features e JS ainda os usam.
   ========================================================================== */

:root {
  --radius-control: 12px;
  --radius-card: 16px;
  --radius-dialog: 18px;
  --radius-compact: 10px;
  --radius-pill: 999px;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, .12);
  --shadow-overlay: 0 20px 50px rgba(0, 0, 0, .28);
  --header-height: 64px;
  --sidebar-width: 286px;
  --content-max: 1100px;
  --content-wide-max: 1440px;
  --form-max: 880px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: Manrope, Inter, system-ui, sans-serif;
  --text-caption: 12px;
  --text-small: 14px;
  --text-body: 16px;
  --text-h3: 18px;
  --text-h2: 22px;
  --text-h1: 28px;
  --text-display: 32px;

  /* aliases legados */
  --radius: var(--radius-card);
  --radius-sm: var(--radius-control);
  --header-h: var(--header-height);
  --sidebar-w: var(--sidebar-width);
  --shadow: var(--shadow-overlay);
  --shadow-soft: var(--shadow-card);
  --shadow-sidebar: none;
  --surface-glass: var(--surface);
  --surface-glass-strong: var(--surface);
  --surface-translucent: var(--surface);
  --surface-translucent-strong: var(--surface);
  --ms-panel-bg: var(--surface);
  --card-border: var(--border);
  --card-highlight: transparent;
  --card-blur: 0px;
  --warn-tint: color-mix(in srgb, var(--warn) 14%, transparent);
  --warn-border: color-mix(in srgb, var(--warn) 42%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 14%, transparent);
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

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

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: calc(var(--header-height) + env(safe-area-inset-top, 0px)) 1fr;
}

/* ----- Header ------------------------------------------------------------ */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) calc(12px + env(safe-area-inset-right, 0px)) 0
    calc(12px + env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.header-greeting {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
  max-width: 220px;
}

.logo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.logo-btn:hover {
  background: var(--overlay-weak);
}

.logo-mark {
  width: 28px;
  height: 28px;
  display: block;
  background: center / contain no-repeat url('/assets/img/brand/planejacafe-mark.png');
}

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

.logo-text {
  font-size: var(--text-h3);
}

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

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-control);
  font-size: var(--text-small);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}

.logout-btn:hover {
  border-color: var(--accent);
}

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

.logout-form {
  display: contents;
}

.theme-toggle-btn {
  padding: 0;
  width: 44px;
  height: 44px;
  flex: 0 0 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);
}

.notification-bell {
  position: relative;
  padding: 0;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  justify-content: center;
}

.notification-bell-icon {
  width: 19px;
  height: 19px;
  background: var(--text);
  -webkit-mask: var(--ico-bell) no-repeat center / contain;
  mask: var(--ico-bell) no-repeat center / contain;
}

.profile-icon {
  width: 18px;
  height: 18px;
  display: none;
  flex: 0 0 18px;
  background: var(--text);
  -webkit-mask-image: var(--ico-person);
  mask-image: var(--ico-person);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  font-weight: 800;
  text-align: center;
}

.notifications-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 90px));
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .28);
}

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

.notifications-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 10px;
  color: var(--text);
  font-size: var(--text-small);
}

.notifications-mark-all {
  border: 0;
  padding: 4px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 700;
  cursor: pointer;
}

.notifications-list { display: grid; gap: 6px; }

.notification-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.notification-item:hover { background: var(--overlay-medium); }
.notification-item.is-unread { border-color: var(--accent); background: var(--accent-tint-weak); }
.notification-item-title { font-size: var(--text-small); }
.notification-item-message {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.notification-item-date { color: var(--muted); font-size: 11px; }
.notifications-empty { margin: 6px 4px; color: var(--muted); font-size: var(--text-small); }
.notification-modal {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.notification-modal-body { display: grid; gap: 14px; }
.notification-modal-date { color: var(--muted); font-size: var(--text-caption); }
.notification-modal-message { margin: 0; color: var(--text); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

.password-field {
  position: relative;
}

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

.password-toggle-btn {
  position: absolute;
  right: 2px;
  top: 2px;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-compact);
  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);
}

/* ----- Conteúdo e PageHeader ------------------------------------------- */

.content {
  padding: 20px 12px 40px;
  max-width: var(--content-max);
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  box-sizing: border-box;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-h1);
  line-height: 1.2;
  letter-spacing: 0;
  margin: 4px 0 24px;
}

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

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

.title-divider {
  display: none;
}

.page-subtitle {
  margin: -16px 0 24px;
  color: var(--muted);
  font-size: var(--text-small);
  font-weight: 500;
  max-width: 72ch;
}

.title-print-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pc-page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin: 4px 0 24px;
}

.pc-page-header h1,
.pc-page-header .title {
  margin: 0;
}

.pc-page-header-text {
  color: var(--muted);
  font-size: var(--text-small);
  max-width: 72ch;
  margin-top: 6px;
}

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

  .title-row .title {
    flex: 1 1 100%;
  }

  .title-print-btn {
    width: 100%;
  }

  .pc-page-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pc-page-header-actions > * {
    width: 100%;
  }
}

/* ----- Card / Panel ------------------------------------------------------ */

.card,
.panel,
.pc-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card,
.pc-card {
  padding: 24px;
}

.card + .card,
.pc-card + .pc-card {
  margin-top: 16px;
}

.panel {
  overflow: hidden;
}

.panel-body {
  padding: 20px;
}

.pc-section {
  display: grid;
  gap: 16px;
}

.pc-section + .pc-section {
  margin-top: 24px;
}

.pc-section-title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.pc-section-text {
  color: var(--muted);
  font-size: var(--text-small);
  max-width: 72ch;
  margin: 0;
}

/* ----- Grade de ações (ActionCard) --------------------------------------- */

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

/* ----- Campos ------------------------------------------------------------ */

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

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

.label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

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

.input {
  height: 48px;
  padding: 0 14px;
  font-size: var(--text-body);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

textarea.input {
  height: auto;
  min-height: 112px;
  padding: 12px 14px;
  resize: vertical;
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.input:read-only,
input[readonly],
textarea[readonly] {
  background: var(--surface);
  opacity: 0.82;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  cursor: default;
}

.input:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

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

.hint {
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: 1.4;
}

.hint.error,
.hint.is-error {
  color: var(--danger);
}

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

/* [hidden] tem a mesma especificidade de .row/.row-2/.row-3 (0-1-0) — sem isso "display:grid"
   vence a regra default do navegador e o elemento continua visível com hidden=true. */
.row[hidden],
.row-2[hidden],
.row-3[hidden] {
  display: none;
}

/* FormGrid (12 colunas >= 720px; 1 coluna abaixo). Spans aplicados por tela via .pc-span-N. */
.pc-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 16px;
}

.pc-form-grid > .field,
.pc-form-grid > .pc-field-group {
  margin-bottom: 0;
}

.pc-form-grid > [hidden] {
  display: none !important;
}

/* ----- Barra de filtros e paginação -------------------------------------- */

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

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

.consulta-filtros-toggle {
  display: none;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: var(--text-small);
  cursor: pointer;
  transition: border-color 160ms ease;
}

.consulta-filtros-toggle:hover {
  border-color: var(--accent);
}

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

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

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

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

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

.consulta-pagination-info {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 600;
}

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

/* ----- Tabela (DataTable) ------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}

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

th,
td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  height: 40px;
  padding-top: 10px;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 600;
  background: var(--surface-2);
}

tbody tr,
tfoot tr {
  border-top: 1px solid var(--border);
  transition: background-color 140ms ease;
}

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

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

/* ----- Badges ------------------------------------------------------------ */

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-sizing: border-box;
}

.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;
}

/* ----- Estados (vazio / erro / carregamento) ----------------------------- */

.empty-state {
  color: var(--muted);
  padding: 32px 20px;
  text-align: center;
  font-size: var(--text-small);
  line-height: 1.5;
}

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

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

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 700;
  margin: 0 0 12px;
}

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

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

.consulta-row-action { cursor: pointer; }
.consulta-row-action:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }

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

.pc-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 14px 16px;
}

.pc-summary-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--muted);
}

.pc-summary-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ----- Multi-select (.ms) ------------------------------------------------ */

.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-control);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

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

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

.ms-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--overlay-medium);
  font-size: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
}

.ms-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-overlay);
  overflow: hidden;
}

/* Eleva o card/panel que contém o dropdown aberto acima dos irmãos e libera o overflow
   para o painel não ser recortado por um .panel (overflow:hidden). */
.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;
  box-sizing: border-box;
}

/* ----- Select customizado (.cs) — o <select> nativo continua fonte da verdade ----- */

.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-control);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--text-body);
  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);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.cs-control[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
}

.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: -4px 0 0;
  transition: transform 160ms ease, margin-top 160ms 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-control);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
}

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

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

.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: var(--text-small);
}

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

.ms-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 12px;
  box-sizing: border-box;
  border-radius: var(--radius-compact);
  border: 1px solid transparent;
  background: transparent;
  font-size: var(--text-small);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

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

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

/* ----- Botões ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  font-size: var(--text-small);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms, border-color 160ms, color 160ms, transform 160ms;
}

.btn:not(.btn-disabled):not(.btn-blocked):not(:disabled):hover {
  border-color: var(--accent);
}

.btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-compact);
  font-size: var(--text-caption);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}

.btn-mini:hover {
  border-color: var(--accent);
}

.btn-primary,
.btn-mini.btn-primary {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover,
.btn.btn-primary:not(.btn-disabled):not(.btn-blocked):not(:disabled):hover,
.btn-mini.btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
}

.btn-danger,
.btn-mini.btn-danger {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 42%, transparent);
}

.btn-danger:hover,
.btn.btn-danger:not(.btn-disabled):not(.btn-blocked):not(:disabled):hover,
.btn-mini.btn-danger:hover {
  border-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.58;
  cursor: not-allowed;
}

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

.actions {
  margin-top: 16px;
}

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

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

/* ----- Expansível / ActionCard / item de menu ---------------------------- */

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

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

.expand-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 16px;
  box-sizing: border-box;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-small);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.expand-btn:hover {
  border-color: var(--accent);
}

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

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

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

.action-btn {
  min-height: 112px;
  padding: 18px;
  box-sizing: border-box;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: var(--shadow-card);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.action-btn:hover {
  border-color: var(--accent);
}

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

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

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

.menu-link {
  justify-content: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  box-sizing: border-box;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  background: transparent;
  font-size: var(--text-small);
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms 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);
  -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;
}

/* ActionCard: caixa de ícone de 40x40 com o ícone centralizado */
.action-btn::before {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  -webkit-mask-size: 22px 22px;
  mask-size: 22px 22px;
}

/* 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);
}

/* Painel de suporte — antes sem regra de ícone (máscara ausente). Reutiliza ícones existentes. */

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

.menu-link[href="/suporte/usuarios"] {
  --icon: var(--ico-person);
}

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

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

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

/* 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 */

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

/* Relatórios (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);
}

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

/* Ferramentas */

.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: 10px;
  height: 10px;
  flex: 0 0 auto;
  display: inline-block;
  border-right: 2px solid var(--chevron-color);
  border-bottom: 2px solid var(--chevron-color);
  transform: rotate(-45deg);
  margin-left: 12px;
  transition: transform 160ms ease;
}

/* ----- Sidebar ----------------------------------------------------------- */

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

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: min(calc(var(--sidebar-width) + env(safe-area-inset-left, 0px)), 86vw);
  box-sizing: border-box;
  padding-left: env(safe-area-inset-left, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-overlay);
  transform: translateX(-100%);
  /* Fechado: fora da ordem de foco (visibility) — o atraso mantém a animação de saída. */
  visibility: hidden;
  transition: transform 220ms ease, visibility 0s linear 220ms;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-head {
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-close,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: var(--radius-compact);
  padding: 0 12px;
  font-size: var(--text-caption);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease;
}

.sidebar-close:hover,
.modal-close:hover {
  border-color: var(--accent);
}

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

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

.menu-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
}

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

/* ----- Dialog ------------------------------------------------------------ */

dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-dialog);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-overlay);
  padding: 0;
}

dialog[id*="onfirmModal"],
dialog#ferramentaBloqueadaModal {
  width: min(440px, calc(100vw - 24px));
}

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

dialog.push-invite-modal {
  width: min(440px, calc(100vw - 32px));
  text-align: center;
}

.push-invite-content {
  padding: 28px 24px 24px;
}

.push-invite-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-tint-weak);
  font-size: 24px;
}

.push-invite-content h2 {
  margin: 0;
  font-size: var(--text-h3);
}

.push-invite-content p:not(.hint) {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.push-invite-content .hint {
  min-height: 20px;
  margin: 12px 0 0;
}

.push-invite-actions {
  justify-content: center;
  margin-top: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.modal-title {
  font-size: var(--text-h3);
  line-height: 1.3;
}

.modal-body {
  padding: 18px;
}

/* ----- Toast (overlay) --------------------------------------------------- */

.toast,
#toast {
  position: fixed;
  top: 80px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  z-index: 90;
  box-sizing: border-box;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-overlay);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.4;
}

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

.toast[hidden],
#toast[hidden] {
  display: none;
}

@media (max-width: 599px) {
  .toast,
  #toast {
    top: auto;
    left: 12px;
    right: 12px;
    width: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* ----- Foco -------------------------------------------------------------- */

.logo-btn:focus-visible,
.logout-btn:focus-visible,
.btn:focus-visible,
.btn-mini: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,
input[type="password"]:focus-visible,
select:focus-visible,
textarea:focus-visible,
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

body.sidebar-open .sidebar {
  transform: translateX(0);
  visibility: visible;
  transition: transform 220ms ease, visibility 0s linear 0s;
}

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

/* ----- Responsivo -------------------------------------------------------- */

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

  .actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pc-form-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .pc-form-grid > * {
    grid-column: span 12;
  }

  .pc-form-grid > .pc-span-2,
  .pc-form-grid > .pc-contents > .pc-span-2 { grid-column: span 2; }
  .pc-form-grid > .pc-span-3,
  .pc-form-grid > .pc-contents > .pc-span-3 { grid-column: span 3; }
  .pc-form-grid > .pc-span-4,
  .pc-form-grid > .pc-contents > .pc-span-4 { grid-column: span 4; }
  .pc-form-grid > .pc-span-5,
  .pc-form-grid > .pc-contents > .pc-span-5 { grid-column: span 5; }
  .pc-form-grid > .pc-span-6,
  .pc-form-grid > .pc-contents > .pc-span-6 { grid-column: span 6; }
  .pc-form-grid > .pc-span-8,
  .pc-form-grid > .pc-contents > .pc-span-8 { grid-column: span 8; }
  .pc-form-grid > .pc-span-12,
  .pc-form-grid > .pc-contents > .pc-span-12 { grid-column: span 12; }
}

/* Desktop amplo: menu lateral persistente (mesmos itens, destinos e permissões). */
@media (min-width: 920px) {
  .header {
    padding-left: calc(18px + env(safe-area-inset-left, 0px));
    padding-right: calc(18px + env(safe-area-inset-right, 0px));
  }

  .content {
    padding: 24px 18px 48px;
  }

  .actions-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar {
    top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    bottom: 0;
    height: auto;
    width: calc(var(--sidebar-width) + env(safe-area-inset-left, 0px));
    transform: none;
    visibility: visible;
    box-shadow: none;
    transition: none;
    z-index: 35;
  }

  .sidebar-head {
    display: none;
  }

  .sidebar-overlay {
    display: none;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 0;
    pointer-events: none;
  }

  .sidebar ~ .app {
    padding-left: calc(var(--sidebar-width) + env(safe-area-inset-left, 0px));
  }

  .sidebar ~ .app .header {
    margin-left: calc(-1 * (var(--sidebar-width) + env(safe-area-inset-left, 0px)));
  }
}

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

  .card,
  .pc-card {
    padding: 16px;
  }

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

  .header-greeting {
    display: none;
  }

  .actions > .btn-primary {
    width: 100%;
  }
}

/* ----- ARC10_COST_ENTRY (telas de lançamento de custo) --------------------- */

.content:has(.pc-cost-entry) {
  max-width: calc(920px + 36px);
}

.pc-cost-entry > .pc-section-title {
  margin-bottom: 16px;
}

/* Campo de catálogo + botão GERENCIAR/CADASTRAR: ao lado do campo >= 720px, abaixo < 720px. */
.pc-catalog-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 12px;
  align-items: end;
  margin-bottom: 0;
}

.pc-catalog-row > .field {
  margin-bottom: 0;
}

.pc-catalog-row > .btn {
  justify-self: start;
}

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

  .pc-catalog-row > .btn {
    justify-self: stretch;
  }
}

/* Totais já calculados pela tela (CalculatedSummary), imediatamente antes do submit. */
.pc-summary-field .input[readonly] {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  opacity: 1;
}

.pc-submit-row {
  margin-top: 20px;
}

/* ----- ARC11_QUERY_TABLE (consultas) ------------------------------------- */

.card.pc-filter-bar {
  padding: 16px;
}

.card.pc-table-card {
  padding: 16px;
}

.pc-table-card td .btn-mini {
  white-space: nowrap;
}

.pc-table-card :where(tbody td[colspan]) {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-small);
}

@media (max-width: 480px) {
  .card.pc-filter-bar,
  .card.pc-table-card {
    padding: 12px;
  }
}

/* Header em telas muito estreitas (320–360px): logo encolhe com reticências em vez de
   espremer os alvos de toque das ações. */
@media (max-width: 360px) {
  .header {
    gap: 4px;
    padding-left: calc(8px + env(safe-area-inset-left, 0px));
    padding-right: calc(8px + env(safe-area-inset-right, 0px));
  }

  .logo-btn {
    min-width: 0;
    flex: 0 0 auto;
    gap: 4px;
    padding: 8px 4px;
  }

  .logout-btn {
    padding: 0 8px !important;
  }

  .logo-mark {
    width: 18px;
    height: 18px;
  }

  .logo-text {
    font-size: 16px;
  }

  .header-actions {
    gap: 4px !important;
  }
}

/* Header compacto em telas estreitas: mantém todas as ações visíveis sem estourar a largura. */
@media (max-width: 480px) {
  .header {
    gap: 6px;
  }

  .logo-btn {
    padding: 8px;
  }

  .header-actions {
    gap: 6px;
  }

  .logout-btn {
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .profile-btn {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .profile-icon {
    display: block;
  }

  .profile-label {
    display: none;
  }

  .theme-toggle-btn {
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.notification-modal-image {
  display: block;
  width: 100%;
  max-height: min(62vh, 720px);
  margin-top: 16px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface-2);
}
