* { box-sizing: border-box; }
html { min-width: 320px; color: var(--rotina-text); background: var(--rotina-bg); }
body { margin: 0; min-height: 100vh; color: var(--rotina-text); background: var(--rotina-bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
.ui-icon { width: 1.08em; height: 1.08em; fill: currentColor; flex: 0 0 auto; }

.button {
  min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 800; text-decoration: none; cursor: pointer; transition: .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .nav-link:focus-visible, .mobile-menu-button:focus-visible { outline: 3px solid rgba(79,70,229,.22); outline-offset: 2px; }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--rotina-primary), var(--rotina-primary-dark)); box-shadow: 0 9px 20px rgba(79,70,229,.2); }
.button-secondary { color: #334155; background: #fff; border-color: var(--rotina-line); }
.button-quiet { color: var(--rotina-primary-dark); background: var(--rotina-primary-soft); border-color: #dce2ff; }
.button-danger { color: var(--rotina-danger); background: var(--rotina-danger-soft); border-color: #ffd4ce; }
.button-full { width: 100%; }
.button[disabled] { opacity: .58; cursor: not-allowed; transform: none; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1, .page-heading h2 { margin: 0 0 7px; font-size: clamp(1.75rem, 3vw, 2.25rem); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--rotina-text-soft); line-height: 1.55; }
.page-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { margin: 0 0 7px; color: var(--rotina-primary); font-size: .72rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }

.card, .panel {
  border: 1px solid var(--rotina-line); border-radius: var(--rotina-radius-lg); background: var(--rotina-surface); box-shadow: var(--rotina-shadow-card);
}
.card { padding: 21px; }
.panel { padding: 24px; margin-top: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.panel-heading h2, .panel-heading h3 { margin: 0; }
.panel-heading p { margin: 6px 0 0; color: var(--rotina-text-soft); line-height: 1.5; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.metric-card { position: relative; min-width: 0; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: -28px; bottom: -38px; width: 100px; height: 100px; border-radius: 50%; background: var(--metric-glow, rgba(79,70,229,.07)); }
.metric-card > * { position: relative; z-index: 1; }
.metric-card .metric-icon { width: 42px; height: 42px; margin-bottom: 18px; border-radius: 13px; display: grid; place-items: center; color: var(--metric-color, var(--rotina-primary)); background: var(--metric-bg, var(--rotina-primary-soft)); }
.metric-card .metric-icon .ui-icon { width: 20px; height: 20px; }
.metric-card span { color: var(--rotina-text-soft); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 8px; font-size: 2rem; letter-spacing: -.04em; }
.metric-card strong.metric-label { font-size: 1.22rem; line-height: 1.35; }
.metric-card small { display: block; margin-top: 7px; color: var(--rotina-text-muted); }

.alert { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 13px; line-height: 1.5; }
.alert-error { color: #8a1c13; background: var(--rotina-danger-soft); border-color: #ffc9c4; }
.alert-success { color: #11603f; background: var(--rotina-success-soft); border-color: #b9e6d2; }
.alert-warning { color: #805512; background: var(--rotina-warning-soft); border-color: #f0d49a; }
.alert-info { color: #164b88; background: var(--rotina-info-soft); border-color: #cfe0fb; }

.field { display: grid; gap: 7px; margin-bottom: 16px; min-width: 0; }
.field label { color: #344054; font-size: .82rem; font-weight: 780; }
.field label small { color: var(--rotina-text-soft); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid var(--rotina-line-strong); border-radius: 11px;
  color: var(--rotina-text); background: #fff; outline: none; transition: .18s;
}
.field textarea { min-height: 105px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #7583ed; box-shadow: 0 0 0 4px rgba(79,70,229,.1); }
.field-row { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }
.field-row.equal { grid-template-columns: 1fr 1fr; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.help-text, .block-muted { color: var(--rotina-text-soft); font-size: .78rem; line-height: 1.45; }
.block-muted { display: block; margin-top: 4px; }

.status-badge, .module-status {
  display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 4px 9px; border-radius: var(--rotina-radius-pill);
  font-size: .7rem; font-weight: 850; white-space: nowrap;
}
.status-badge::before, .module-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .76; }
.status-active, .invitation-active, .module-status-active { color: #08705a; background: #e7f8f1; }
.status-pending, .module-status-migrating { color: #a45b0b; background: #fff1d7; }
.status-suspended, .status-rejected, .status-disabled, .invitation-revoked { color: #b42318; background: #feeceb; }
.invitation-expired, .invitation-consumed { color: #536176; background: #eef1f5; }
.status-badge.large { min-height: 32px; padding: 7px 12px; font-size: .78rem; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--rotina-line); border-radius: 15px; background: #fff; }
.admin-table { width: 100%; min-width: 780px; border-collapse: collapse; }
.admin-table th { padding: 12px 14px; color: #64748b; background: #f8fafc; border-bottom: 1px solid var(--rotina-line); font-size: .7rem; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.admin-table td { padding: 14px; border-bottom: 1px solid #edf1f6; vertical-align: middle; color: #334155; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #fbfcff; }
.identity-cell { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 11px; align-items: center; }
.identity-cell > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #3347b0; background: var(--rotina-primary-soft); font-weight: 850; }
.identity-cell > div { min-width: 0; }
.identity-cell strong, .identity-cell small { display: block; overflow: hidden; text-overflow: ellipsis; }
.identity-cell small { margin-top: 3px; color: var(--rotina-text-soft); }
.table-action { padding: 7px 10px; border: 0; border-radius: 9px; color: var(--rotina-primary-dark); background: var(--rotina-primary-soft); font-weight: 800; text-decoration: none; cursor: pointer; }
.table-action.danger { color: var(--rotina-danger); background: var(--rotina-danger-soft); }

.filter-bar { display: grid; grid-template-columns: minmax(220px,1.4fr) minmax(150px,.7fr) minmax(150px,.7fr) auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.filter-bar .field { margin: 0; }

.empty-state { min-height: 250px; padding: 34px 20px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-state.compact { min-height: 190px; }
.empty-state .icon { width: 62px; height: 62px; margin-bottom: 15px; border-radius: 19px; display: grid; place-items: center; color: var(--rotina-primary); background: var(--rotina-primary-soft); }
.empty-state .icon .ui-icon { width: 28px; height: 28px; }
.empty-state h3 { margin: 0 0 7px; }
.empty-state p { max-width: 540px; margin: 0; color: var(--rotina-text-soft); line-height: 1.6; }

.module-unavailable-card { max-width: 780px; margin: 54px auto 0; padding: clamp(26px,5vw,48px); text-align: center; }
.module-unavailable-icon { width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 26px; display: grid; place-items: center; color: var(--rotina-primary); background: var(--rotina-primary-soft); }
.module-unavailable-icon .ui-icon { width: 36px; height: 36px; }
.module-unavailable-card h2 { margin: 0 0 12px; font-size: clamp(1.8rem,4vw,2.55rem); letter-spacing: -.045em; }
.module-unavailable-card p { max-width: 610px; margin: 0 auto; color: var(--rotina-text-soft); line-height: 1.7; }
.module-unavailable-card .module-status { margin-bottom: 16px; }
.module-unavailable-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 25px; }

.state-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.state-option { position: relative; }
.state-option input { position: absolute; opacity: 0; pointer-events: none; }
.state-option label { min-height: 165px; padding: 19px; display: block; border: 1px solid var(--rotina-line); border-radius: 17px; background: #fbfcff; cursor: pointer; transition: .18s; }
.state-option label strong, .state-option label span { display: block; }
.state-option label span { margin-top: 8px; color: var(--rotina-text-soft); font-size: .86rem; line-height: 1.55; }
.state-option input:checked + label { border-color: #7786f8; background: #f2f4ff; box-shadow: 0 0 0 4px rgba(79,70,229,.08); }
.state-dot { display: block; width: 13px; height: 13px; margin-bottom: 14px; border-radius: 50%; background: #6374ed; box-shadow: 0 0 0 6px rgba(99,116,237,.12); }
.state-option.maintenance .state-dot, .state-option.closed .state-dot { background: #e7a438; box-shadow: 0 0 0 6px rgba(231,164,56,.13); }
.state-option.construction .state-dot, .state-option.invitation .state-dot { background: #8a69df; box-shadow: 0 0 0 6px rgba(138,105,223,.13); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 3000; width: min(390px, calc(100vw - 32px)); padding: 15px 17px; border: 1px solid #d9e0eb; border-radius: 15px; color: #334155; background: #fff; box-shadow: 0 22px 60px rgba(15,23,42,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast strong { display: block; margin-bottom: 4px; }
.toast span { color: var(--rotina-text-soft); font-size: .86rem; line-height: 1.45; }

.mobile-menu-button, .sidebar-close, .sidebar-backdrop { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 1490; border: 0; background: rgba(15,23,42,.48); backdrop-filter: blur(3px); }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar .button { width: 100%; }
  .state-options { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading-actions, .page-heading-actions .button { width: 100%; }
  .metrics-grid, .field-row, .field-row.equal, .filter-bar { grid-template-columns: 1fr; }
  .panel, .card { border-radius: 18px; }
  .panel { padding: 18px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .admin-table { min-width: 0; display: block; }
  .admin-table thead { display: none; }
  .admin-table tbody { display: grid; gap: 12px; }
  .admin-table tr { display: grid; padding: 15px; border: 1px solid var(--rotina-line); border-radius: 15px; background: #fff; box-shadow: var(--rotina-shadow-card); }
  .admin-table td { display: grid; grid-template-columns: minmax(100px,.7fr) minmax(0,1.3fr); align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f6; }
  .admin-table td::before { content: attr(data-label); color: var(--rotina-text-soft); font-size: .68rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
  .admin-table td:first-child { grid-template-columns: 1fr; }
  .admin-table td:first-child::before { display: none; }
  .admin-table td:last-child { border-bottom: 0; }
  .admin-table td:last-child .table-action, .admin-table td:last-child form, .admin-table td:last-child form .table-action { width: 100%; }
  .toast { right: 16px; bottom: 16px; }
}

/* ROTINA 3.0.0-beta.5.9.12.3 — feedback fora do fluxo da página. */
.toast[data-type="success"] { border-color: #b9e6d2; }
.toast[data-type="success"] strong { color: #11603f; }
.toast[data-type="error"] { border-color: #ffc9c4; }
.toast[data-type="error"] strong { color: #9f263d; }
.toast[data-type="warning"] { border-color: #f0d49a; }
.toast[data-type="warning"] strong { color: #805512; }
.toast[data-type="info"] { border-color: #cfe0fb; }
.toast[data-type="info"] strong { color: #164b88; }
@media (prefers-reduced-motion: reduce) {
  .today-task-item.task-row-updated,
  button.is-submitting::after { animation: none !important; }
}

/* ROTINA 3.0.0-beta.5.1 — toast com ação opcional para atualizações do aplicativo. */
.toast.has-action{pointer-events:auto}.toast-action{display:inline-flex!important;align-items:center;justify-content:center;margin-top:10px;min-height:34px;padding:0 12px;border:1px solid #c7d4f2;border-radius:9px;background:#f6f8ff;color:#2f4f9d!important;font-size:.78rem!important;font-weight:800;text-decoration:none}.toast-action:hover{border-color:#9caeff;background:#eef2ff;color:#4338ca!important}.toast-action[hidden]{display:none!important}

/* ROTINA 3.0.0-beta.5.2 — ação do toast em linha própria. */
.toast.has-action{width:min(430px,calc(100vw - 32px));padding:18px 20px;pointer-events:auto}.toast.has-action>span{display:block;line-height:1.55}.toast.has-action .toast-action{display:flex!important;width:max-content;min-width:154px;max-width:100%;margin:14px auto 0;min-height:38px;padding:0 16px;text-align:center}.toast.has-action strong{margin-bottom:6px;font-size:1rem}
