/* ==========================================================================
   MINHA AGENDA (v1) - estilos isolados com prefixo ma-
   Claro por padrão; escuro quando <html> tem a classe "dark".
   ========================================================================== */
#r-screen-agenda, #ma-layer {
    --ma-bg: #ffffff;
    --ma-bg2: #f4f4f5;
    --ma-bg3: #e4e4e7;
    --ma-line: #e4e4e7;
    --ma-text: #18181b;
    --ma-muted: #71717a;
    --ma-accent: #dc2626;
    --ma-accent-soft: #fee2e2;
    --ma-ok: #16a34a;
    --ma-ok-soft: #dcfce7;
    --ma-warn: #d97706;
    --ma-warn-soft: #fef3c7;
    --ma-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
    --ma-lembrete: #7c3aed;
    --ma-follow: #2563eb;
    --ma-agend: #0d9488;
    --ma-tarefa: #ea580c;
    --ma-radius: 14px;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
html.dark #r-screen-agenda, html.dark #ma-layer {
    --ma-bg: #18181b;
    --ma-bg2: #111113;
    --ma-bg3: #27272a;
    --ma-line: #2e2e33;
    --ma-text: #f4f4f5;
    --ma-muted: #a1a1aa;
    --ma-accent-soft: rgba(220,38,38,.16);
    --ma-ok-soft: rgba(22,163,74,.18);
    --ma-warn-soft: rgba(217,119,6,.18);
    --ma-shadow: 0 1px 2px rgba(0,0,0,.4);
    --ma-lembrete: #a78bfa;
    --ma-follow: #60a5fa;
    --ma-agend: #2dd4bf;
    --ma-tarefa: #fb923c;
}

.ma-shell { color: var(--ma-text); padding: 4px 0 40px; max-width: 1400px; margin: 0 auto; }
.ma-shell *, #ma-layer * { box-sizing: border-box; }
.ma-shell svg.lucide, #ma-layer svg.lucide { width: 16px; height: 16px; flex-shrink: 0; }
.ma-i-sm { width: 12px !important; height: 12px !important; vertical-align: -1px; }
.ma-muted { color: var(--ma-muted); font-size: 13px; }
.ma-red { color: var(--ma-accent); font-weight: 700; }
.ma-pad { padding: 8px 4px; }
.ma-center { text-align: center; }
.ma-label { font-size: 12px; color: var(--ma-muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ma-h3 { font-size: 15px; font-weight: 800; margin: 0 0 12px; display: flex; gap: 8px; align-items: baseline; }

/* menu */
.ma-nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.ma-nav-badge[hidden] { display: none; }
.ma-nav-badge-mobile { position: absolute; top: -6px; right: 2px; min-width: 16px; height: 16px; font-size: 9px; padding: 0 4px; margin: 0; }

/* botões */
.ma-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--ma-line); background: var(--ma-bg); color: var(--ma-text); font-weight: 700; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.ma-btn:hover { background: var(--ma-bg3); }
.ma-btn:active { transform: scale(.98); }
.ma-btn:disabled { opacity: .55; cursor: default; }
.ma-btn-primary { background: var(--ma-accent); border-color: var(--ma-accent); color: #fff; }
.ma-btn-primary:hover { background: #b91c1c; border-color: #b91c1c; }
.ma-btn-ghost { background: transparent; }
.ma-shell button:focus-visible, .ma-shell [role="button"]:focus-visible, #ma-layer button:focus-visible, #ma-layer input:focus-visible, #ma-layer select:focus-visible, #ma-layer textarea:focus-visible, .ma-shell select:focus-visible, .ma-medal:focus-visible { outline: 2px solid var(--ma-accent); outline-offset: 2px; }

/* ajuda ⓘ */
.ma-help { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ma-muted); cursor: help; vertical-align: middle; flex-shrink: 0; }
.ma-help:hover, .ma-help:focus-visible { color: var(--ma-accent); background: var(--ma-accent-soft); }
.ma-help svg.lucide { width: 14px !important; height: 14px !important; }
.ma-tip { position: fixed; z-index: 10060; background: #18181b; color: #f4f4f5; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0,0,0,.25); pointer-events: auto; }
html.dark .ma-tip { background: #f4f4f5; color: #18181b; }
.ma-tip strong { display: block; margin-bottom: 4px; font-size: 13.5px; }
.ma-tip p { margin: 0 0 6px; }
.ma-tip p:last-child { margin: 0; }
.ma-tip-uso { opacity: .85; }

/* cabeçalho */
.ma-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ma-titlebox { display: flex; gap: 12px; align-items: center; }
.ma-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--ma-accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.ma-icon svg.lucide { width: 24px !important; height: 24px !important; }
.ma-head h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.ma-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ma-muted); display: flex; align-items: center; gap: 4px; }
.ma-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ma-owner { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--ma-muted); font-weight: 700; }
.ma-owner span { display: flex; align-items: center; gap: 2px; }
.ma-owner select, #ma-layer select, #ma-layer input, #ma-layer textarea { background: var(--ma-bg); color: var(--ma-text); border: 1px solid var(--ma-line); border-radius: 10px; padding: 8px 10px; font-size: 14px; font-family: inherit; width: 100%; }
.ma-owner select { min-width: 180px; padding: 7px 10px; font-size: 13px; }
.ma-readonly { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--ma-warn-soft); color: var(--ma-text); font-size: 13px; margin-bottom: 12px; border: 1px solid rgba(217,119,6,.35); }
.ma-warn { padding: 10px 14px; border-radius: 12px; background: var(--ma-accent-soft); font-size: 13px; margin-bottom: 12px; }

/* cartões */
.ma-card { background: var(--ma-bg); border: 1px solid var(--ma-line); border-radius: var(--ma-radius); padding: 14px; box-shadow: var(--ma-shadow); }

.ma-off { filter: grayscale(1); opacity: .45; }

/* contadores */
.ma-counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ma-counter { text-align: left; background: var(--ma-bg); border: 1px solid var(--ma-line); border-radius: var(--ma-radius); padding: 12px 14px; cursor: pointer; color: var(--ma-text); box-shadow: var(--ma-shadow); font: inherit; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .1s; }
.ma-counter:hover { border-color: var(--ma-accent); }
.ma-counter-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--ma-muted); }
.ma-counter-num { font-size: 28px; font-weight: 900; line-height: 1; }
.ma-c-late:not(.ma-zero) { border-color: rgba(220,38,38,.5); background: var(--ma-accent-soft); }
.ma-c-late:not(.ma-zero) .ma-counter-num { color: var(--ma-accent); }
.ma-c-wait:not(.ma-zero) .ma-counter-num { color: var(--ma-warn); }
.ma-zero .ma-counter-num { opacity: .45; }

/* abas e filtros */
.ma-tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.ma-tabs::-webkit-scrollbar { display: none; }
.ma-tab-wrap { display: inline-flex; align-items: center; gap: 1px; flex-shrink: 0; }
.ma-tab { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--ma-line); background: var(--ma-bg); color: var(--ma-text); font-weight: 800; font-size: 13px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.ma-tab.active { background: var(--ma-text); color: var(--ma-bg); border-color: var(--ma-text); }
.ma-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ma-filter { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--ma-line); background: transparent; color: var(--ma-text); font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.ma-filter.active { background: var(--ma-accent); color: #fff; border-color: var(--ma-accent); }

/* lista */
.ma-section { margin-bottom: 18px; scroll-margin-top: 80px; }
.ma-section h3 { font-size: 14px; font-weight: 900; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.ma-count { font-size: 11px; background: var(--ma-bg3); color: var(--ma-muted); border-radius: 999px; padding: 2px 8px; font-weight: 800; }
.ma-sec-late h3 { color: var(--ma-accent); }
.ma-list { display: flex; flex-direction: column; gap: 8px; }
.ma-item { display: flex; gap: 12px; align-items: flex-start; background: var(--ma-bg); border: 1px solid var(--ma-line); border-left: 4px solid var(--ma-tc, var(--ma-line)); border-radius: 12px; padding: 12px; box-shadow: var(--ma-shadow); }
.ma-item.ma-late { background: var(--ma-accent-soft); border-color: rgba(220,38,38,.4); border-left-color: var(--ma-accent); }
.ma-item.ma-done { opacity: .6; }
.ma-item.ma-done .ma-item-title { text-decoration: line-through; }
.ma-item-emoji { font-size: 22px; line-height: 1.2; }
.ma-item-body { flex: 1; min-width: 0; }
.ma-item-title { font-weight: 800; font-size: 14.5px; overflow-wrap: anywhere; }
.ma-flag { margin-right: 4px; }
.ma-item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ma-muted); margin-top: 4px; }
.ma-item-desc { font-size: 13px; color: var(--ma-muted); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ma-chip { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2px 8px; background: var(--ma-bg3); color: var(--ma-muted); }
.ma-chip.ma-t-lembrete, .ma-chip.ma-t-follow, .ma-chip.ma-t-agend, .ma-chip.ma-t-tarefa { color: var(--ma-tc); background: color-mix(in srgb, var(--ma-tc) 14%, transparent); }
.ma-chip-ok { background: var(--ma-ok-soft); color: var(--ma-ok); }
.ma-chip-wait { background: var(--ma-warn-soft); color: var(--ma-warn); }
.ma-chip-warn { background: var(--ma-accent-soft); color: var(--ma-accent); }
.ma-t-lembrete { --ma-tc: var(--ma-lembrete); }
.ma-t-follow { --ma-tc: var(--ma-follow); }
.ma-t-agend { --ma-tc: var(--ma-agend); }
.ma-t-tarefa { --ma-tc: var(--ma-tarefa); }
.ma-item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.ma-act { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--ma-line); background: var(--ma-bg); color: var(--ma-text); font-size: 12.5px; font-weight: 800; cursor: pointer; font-family: inherit; }
.ma-act:hover { background: var(--ma-bg3); }
.ma-act:disabled { opacity: .5; cursor: default; }
.ma-act-done { background: var(--ma-ok); border-color: var(--ma-ok); color: #fff; }
.ma-act-done:hover { background: #15803d; }
.ma-act-confirm { color: var(--ma-agend); border-color: color-mix(in srgb, var(--ma-agend) 45%, transparent); }
.ma-act-wa { color: #16a34a; }
.ma-act-more { padding: 7px 8px; }
.ma-done-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; color: var(--ma-muted); font-weight: 800; font-size: 14px; cursor: pointer; font-family: inherit; margin-bottom: 8px; }

/* vazio e carregando */
.ma-empty { text-align: center; padding: 40px 20px; background: var(--ma-bg); border: 1px dashed var(--ma-line); border-radius: var(--ma-radius); }
.ma-empty-emoji { font-size: 44px; margin-bottom: 8px; }
.ma-empty h3 { margin: 0 0 6px; font-size: 17px; font-weight: 900; }
.ma-empty p { margin: 0 auto 14px; max-width: 440px; color: var(--ma-muted); font-size: 14px; }
.ma-loading { text-align: center; padding: 60px 20px; color: var(--ma-muted); }
.ma-spinner { width: 34px; height: 34px; border: 3px solid var(--ma-bg3); border-top-color: var(--ma-accent); border-radius: 50%; margin: 0 auto 12px; animation: ma-spin .8s linear infinite; }
@keyframes ma-spin { to { transform: rotate(360deg); } }

/* calendário */
.ma-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ma-cal-wk { text-align: center; font-size: 11px; font-weight: 800; color: var(--ma-muted); text-transform: uppercase; padding: 4px 0; }
.ma-cal-day { min-height: 92px; display: flex; flex-direction: column; gap: 3px; align-items: stretch; text-align: left; padding: 5px; border-radius: 10px; border: 1px solid var(--ma-line); background: var(--ma-bg); color: var(--ma-text); cursor: pointer; font-family: inherit; overflow: hidden; min-width: 0; }
.ma-cal-day:hover { border-color: var(--ma-accent); }
.ma-cal-day.ma-out { opacity: .4; }
.ma-cal-day.ma-today .ma-cal-num { background: var(--ma-accent); color: #fff; }
.ma-cal-num { font-size: 12px; font-weight: 900; width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.ma-cal-ev { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 5px; padding: 1px 4px; background: color-mix(in srgb, var(--ma-tc) 15%, transparent); color: var(--ma-text); border-left: 3px solid var(--ma-tc); }
.ma-cal-ev.ma-late { border-left-color: var(--ma-accent); background: var(--ma-accent-soft); }
.ma-cal-ev.ma-done { opacity: .5; text-decoration: line-through; }
.ma-cal-more { font-size: 10.5px; color: var(--ma-muted); font-weight: 800; }
.ma-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--ma-muted); }
.ma-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ma-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--ma-tc); display: inline-block; }
.ma-dot-late { background: var(--ma-accent); }

/* anotações */
.ma-notes-head { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.ma-notes { columns: 3 260px; column-gap: 12px; }
.ma-note { break-inside: avoid; margin: 0 0 12px; border-radius: var(--ma-radius); padding: 14px; border: 1px solid var(--ma-line); background: var(--ma-nc, var(--ma-bg)); box-shadow: var(--ma-shadow); color: var(--ma-text); }
.ma-note-padrao { --ma-nc: var(--ma-bg); }
.ma-note-amarelo { --ma-nc: #fef9c3; }
.ma-note-verde { --ma-nc: #dcfce7; }
.ma-note-azul { --ma-nc: #dbeafe; }
.ma-note-rosa { --ma-nc: #fce7f3; }
.ma-note-roxo { --ma-nc: #ede9fe; }
html.dark .ma-note-amarelo { --ma-nc: #3a3417; }
html.dark .ma-note-verde { --ma-nc: #15301f; }
html.dark .ma-note-azul { --ma-nc: #172a45; }
html.dark .ma-note-rosa { --ma-nc: #3b1a2e; }
html.dark .ma-note-roxo { --ma-nc: #2a2045; }
.ma-note-top { display: flex; gap: 6px; align-items: baseline; font-size: 14.5px; margin-bottom: 4px; overflow-wrap: anywhere; }
.ma-note-client { font-size: 12px; color: var(--ma-muted); margin-bottom: 6px; }
.ma-note-body { font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ma-note-body p { margin: 0; }
.ma-note-body .ma-gap { height: 8px; }
.ma-check { display: flex; gap: 8px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 2px 0; color: var(--ma-text); font: inherit; cursor: pointer; }
.ma-check[data-act=""] { cursor: default; }
.ma-box { width: 17px; height: 17px; border-radius: 5px; border: 2px solid var(--ma-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; margin-top: 2px; color: #fff; }
.ma-check.on .ma-box { background: var(--ma-ok); border-color: var(--ma-ok); }
.ma-check.on span:last-child { text-decoration: line-through; color: var(--ma-muted); }
.ma-note-actions { display: flex; gap: 4px; justify-content: flex-end; margin-top: 10px; }
.ma-note-actions button { background: transparent; border: 0; border-radius: 8px; padding: 6px; color: var(--ma-muted); cursor: pointer; }
.ma-note-actions button:hover { background: rgba(127,127,127,.15); color: var(--ma-text); }


/* modais */
.ma-no-scroll { overflow: hidden; }
.ma-modal-bg { position: fixed; inset: 0; z-index: 10040; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.ma-modal-bg[hidden] { display: none; }
.ma-modal { width: 100%; max-width: 540px; background: var(--ma-bg); color: var(--ma-text); border-radius: 18px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 12px; }
.ma-modal-sm { max-width: 400px; }
.ma-modal-lg { max-width: 680px; }
.ma-modal-head { display: flex; justify-content: space-between; align-items: center; }
.ma-modal-head h3 { margin: 0; font-size: 17px; font-weight: 900; }
.ma-modal-head button { background: none; border: 0; font-size: 18px; color: var(--ma-muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.ma-modal-head button:hover { background: var(--ma-bg3); }
.ma-modal p { margin: 0; }
.ma-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.ma-field > label { font-size: 12.5px; font-weight: 800; color: var(--ma-muted); display: flex; align-items: center; gap: 4px; }
.ma-row { display: flex; gap: 10px; }
.ma-row[hidden] { display: none; }
.ma-checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
#ma-layer .ma-checkline input { width: auto; }
#ma-layer textarea { resize: vertical; min-height: 70px; }
#ma-layer input:disabled { opacity: .5; }
.ma-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ma-type input, .ma-color input { position: absolute; opacity: 0; pointer-events: none; }
.ma-type span { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; border-radius: 12px; border: 2px solid var(--ma-line); cursor: pointer; font-size: 20px; }
.ma-type b { font-size: 11.5px; font-weight: 800; }
.ma-type input:checked + span { border-color: var(--ma-tc); background: color-mix(in srgb, var(--ma-tc) 12%, transparent); }
.ma-type input:focus-visible + span, .ma-color input:focus-visible + span { outline: 2px solid var(--ma-accent); outline-offset: 2px; }
.ma-colors { display: flex; gap: 8px; }
.ma-color span { display: block; width: 30px; height: 30px; border-radius: 999px; background: var(--ma-nc); border: 2px solid var(--ma-line); cursor: pointer; }
.ma-color input:checked + span { border-color: var(--ma-accent); box-shadow: 0 0 0 2px var(--ma-accent-soft); }
.ma-picked { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--ma-ok-soft); font-size: 13.5px; font-weight: 700; }
.ma-picked button { background: none; border: 0; cursor: pointer; color: var(--ma-muted); font-size: 15px; }
.ma-pick-results { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; max-height: 220px; overflow-y: auto; }
.ma-pick-results button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: var(--ma-bg2); color: var(--ma-text); cursor: pointer; font: inherit; font-size: 13.5px; }
.ma-pick-results button:hover { background: var(--ma-bg3); }
.ma-form-error { color: var(--ma-accent); font-size: 13px; font-weight: 700; min-height: 0; }
.ma-form-error:empty { display: none; }
.ma-modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ma-postpone { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ma-menu { display: flex; flex-direction: column; gap: 4px; }
.ma-menu button { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 0; background: var(--ma-bg2); color: var(--ma-text); cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; text-align: left; }
.ma-menu button:hover { background: var(--ma-bg3); }
.ma-menu .ma-danger { color: var(--ma-accent); }
.ma-how { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; }
.ma-how h4 { margin: 0 0 3px; font-size: 14.5px; font-weight: 900; }
.ma-how p { font-size: 13.5px; color: var(--ma-muted); line-height: 1.5; }

.ma-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 10070; overflow: hidden; }
.ma-confetti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: ma-fall linear forwards; }
@keyframes ma-fall { to { top: 105vh; transform: translateX(40px) rotate(720deg); opacity: .8; } }

/* aviso (popup) */
.ma-popup { position: fixed; right: 18px; bottom: 18px; z-index: 10050; width: min(360px, calc(100vw - 24px)); background: var(--ma-bg); color: var(--ma-text); border: 1px solid var(--ma-line); border-left: 5px solid var(--ma-accent); border-radius: 14px; padding: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.25); animation: ma-slide .35s ease; }
.ma-popup[hidden] { display: none; }
@keyframes ma-slide { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.ma-popup-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ma-popup-head span:first-child { font-size: 20px; }
.ma-popup-count { margin-left: auto; font-size: 11px; font-weight: 800; background: var(--ma-accent-soft); color: var(--ma-accent); border-radius: 999px; padding: 2px 8px; }
.ma-popup-title { margin: 8px 0 2px; font-weight: 900; font-size: 15px; overflow-wrap: anywhere; }
.ma-popup-time { margin: 0 0 10px; font-size: 12.5px; color: var(--ma-muted); }
.ma-popup-actions { display: flex; gap: 6px; align-items: center; }
.ma-popup-actions button { padding: 7px 11px; border-radius: 9px; border: 1px solid var(--ma-line); background: var(--ma-bg); color: var(--ma-text); font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.ma-popup-actions button:first-child { background: var(--ma-accent); border-color: var(--ma-accent); color: #fff; }
.ma-popup-actions .ma-popup-close { margin-left: auto; border: 0; color: var(--ma-muted); }

/* tour */
#ma-tour[hidden] { display: none; }
.ma-tour-card { position: fixed; z-index: 10055; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); background: #18181b; color: #f4f4f5; border-radius: 16px; padding: 16px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
html.dark .ma-tour-card { background: #f4f4f5; color: #18181b; }
.ma-tour-step { font-size: 11px; font-weight: 800; text-transform: uppercase; opacity: .7; letter-spacing: .04em; }
.ma-tour-card h4 { margin: 4px 0 6px; font-size: 16px; font-weight: 900; }
.ma-tour-card p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; opacity: .9; }
.ma-tour-actions { display: flex; justify-content: flex-end; gap: 6px; }
.ma-tour-actions button { padding: 8px 12px; border-radius: 9px; border: 1px solid rgba(127,127,127,.4); background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.ma-tour-actions .ma-btn-primary { background: #dc2626; border-color: #dc2626; color: #fff; }
.ma-tour-focus { position: relative; z-index: 3; outline: 3px solid #dc2626 !important; outline-offset: 4px; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }

/* calendário estilo Google Agenda */
.ma-gcal { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: start; }
.ma-gcal-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 12px; min-width: 0; }
.ma-gcal-create { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding: 12px 22px 12px 16px; border-radius: 16px; border: 1px solid var(--ma-line); background: var(--ma-bg); color: var(--ma-text); font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.06); transition: box-shadow .15s; }
.ma-gcal-create:hover { box-shadow: 0 2px 6px rgba(0,0,0,.18), 0 8px 18px rgba(0,0,0,.08); }
.ma-gcal-create span { font-size: 22px; line-height: 1; color: var(--ma-accent); }
.ma-mm { background: var(--ma-bg); border: 1px solid var(--ma-line); border-radius: var(--ma-radius); padding: 10px; }
.ma-mm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13.5px; text-transform: capitalize; }
.ma-mm-head button { background: none; border: 0; padding: 4px; border-radius: 999px; cursor: pointer; color: var(--ma-text); display: inline-flex; }
.ma-mm-head button:hover { background: var(--ma-bg3); }
.ma-mm-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.ma-mm-grid > span { font-size: 10.5px; font-weight: 800; color: var(--ma-muted); padding: 2px 0; }
.ma-mm-d { position: relative; width: 100%; aspect-ratio: 1; border: 0; background: none; border-radius: 999px; font: inherit; font-size: 12px; color: var(--ma-text); cursor: pointer; padding: 0; }
.ma-mm-d:hover { background: var(--ma-bg3); }
.ma-mm-d.ma-out { color: var(--ma-muted); opacity: .6; }
.ma-mm-d.ma-insel { background: var(--ma-accent-soft); font-weight: 800; }
.ma-mm-d.ma-today { background: var(--ma-accent); color: #fff; font-weight: 900; opacity: 1; }
.ma-mm-d i { position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 99px; background: var(--ma-accent); }
.ma-mm-d.ma-today i { background: #fff; }
.ma-legend-col { flex-direction: column; gap: 6px; margin: 0; padding: 0 4px; }
.ma-gcal-nodate { text-align: left; background: var(--ma-bg2); border: 1px dashed var(--ma-line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ma-text); cursor: pointer; }
.ma-gcal-main { min-width: 0; background: var(--ma-bg); border: 1px solid var(--ma-line); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow); overflow: hidden; }
.ma-gcal-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--ma-line); flex-wrap: wrap; }
.ma-gcal-arrows { display: inline-flex; }
.ma-gcal-arrows .ma-btn { padding: 8px; border: 0; border-radius: 999px; }
.ma-gcal-title { margin: 0; font-size: 18px; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-seg { display: inline-flex; border: 1px solid var(--ma-line); border-radius: 10px; overflow: hidden; }
.ma-seg button { border: 0; background: var(--ma-bg); color: var(--ma-text); font: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px; cursor: pointer; }
.ma-seg button + button { border-left: 1px solid var(--ma-line); }
.ma-seg button.active { background: var(--ma-accent-soft); color: var(--ma-accent); }
.ma-gcal-hint { padding: 8px 12px; margin: 0; border-top: 1px solid var(--ma-line); font-size: 12px; }

.ma-tg-row { display: grid; grid-template-columns: 56px repeat(var(--ma-cols), minmax(0, 1fr)); }
.ma-tg-gutter { border-right: 1px solid var(--ma-line); }
.ma-tg-headrow { border-bottom: 1px solid var(--ma-line); }
.ma-tg-dayhead { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; background: none; border: 0; border-left: 1px solid var(--ma-line); cursor: pointer; color: var(--ma-text); font: inherit; }
.ma-tg-dayhead:first-of-type { border-left: 0; }
.ma-tg-wd { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--ma-muted); letter-spacing: .04em; }
.ma-tg-num { font-size: 22px; font-weight: 600; width: 40px; height: 40px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.ma-tg-dayhead:hover .ma-tg-num { background: var(--ma-bg3); }
.ma-tg-dayhead.ma-today .ma-tg-wd { color: var(--ma-accent); }
.ma-tg-dayhead.ma-today .ma-tg-num { background: var(--ma-accent); color: #fff; font-weight: 800; }
.ma-tg-adrow { border-bottom: 2px solid var(--ma-line); min-height: 26px; }
.ma-tg-adrow-empty { min-height: 10px; }
.ma-tg-adlabel { font-size: 10px; color: var(--ma-muted); text-align: right; padding: 5px 6px 0 0; }
.ma-tg-adrow-empty .ma-tg-adlabel { visibility: hidden; }
.ma-tg-adcell { border-left: 1px solid var(--ma-line); padding: 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ma-tg-adcell:first-of-type { border-left: 0; }
.ma-tg-chip { display: block; width: 100%; text-align: left; font: inherit; font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; border-radius: 6px; padding: 3px 6px; cursor: pointer; background: var(--ma-tc); color: #fff; }
.ma-tg-scroll { height: min(66vh, 680px); overflow-y: auto; position: relative; overscroll-behavior: contain; }
.ma-tg-hours { position: relative; border-right: 1px solid var(--ma-line); }
.ma-tg-hour { height: var(--ma-hour); position: relative; }
.ma-tg-hour span { position: absolute; top: -7px; right: 8px; font-size: 10.5px; color: var(--ma-muted); background: var(--ma-bg); padding: 0 2px; }
.ma-tg-col { position: relative; height: calc(var(--ma-hour) * 24); border-left: 1px solid var(--ma-line); cursor: cell;
    background-image: linear-gradient(to bottom, var(--ma-line) 1px, transparent 1px), linear-gradient(to bottom, transparent calc(var(--ma-hour) / 2), color-mix(in srgb, var(--ma-line) 45%, transparent) calc(var(--ma-hour) / 2), color-mix(in srgb, var(--ma-line) 45%, transparent) calc(var(--ma-hour) / 2 + 1px), transparent calc(var(--ma-hour) / 2 + 1px));
    background-size: 100% var(--ma-hour); }
.ma-tg-hours + .ma-tg-col { border-left: 0; }
.ma-tg-col.ma-ro { cursor: default; }
.ma-tg-col.ma-today { background-color: color-mix(in srgb, var(--ma-accent) 4%, transparent); }
.ma-tg-ev { position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; text-align: left; font: inherit; border: 1px solid var(--ma-bg); border-radius: 7px; padding: 3px 6px; cursor: pointer; background: var(--ma-tc); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.ma-tg-ev:hover { z-index: 3; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.ma-tg-ev-t { font-size: 12px; font-weight: 800; line-height: 1.25; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-tg-ev-s { font-size: 11px; opacity: .92; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-tg-ev.ma-late, .ma-tg-chip.ma-late { background: var(--ma-accent); }
.ma-tg-ev.ma-done, .ma-tg-chip.ma-done { opacity: .5; }
.ma-tg-ev.ma-done .ma-tg-ev-t, .ma-tg-chip.ma-done { text-decoration: line-through; }
.ma-tg-ev.ma-conf .ma-tg-ev-t::after { content: ' ✓'; }
html.dark .ma-tg-ev:not(.ma-late), html.dark .ma-tg-chip:not(.ma-late) { background: color-mix(in srgb, var(--ma-tc) 58%, #111113); border-color: #111113; }
/* aviso de novidade */
.ma-novidade { max-width: 460px; text-align: center; }
.ma-novidade .ma-modal-head { justify-content: space-between; }
.ma-novidade-tag { font-size: 11.5px; font-weight: 800; color: var(--ma-accent); background: var(--ma-accent-soft); padding: 4px 10px; border-radius: 999px; }
.ma-novidade-hero { font-size: 52px; line-height: 1; margin: 2px 0 0; animation: ma-novidade-pop .5s ease; }
.ma-novidade h3 { margin: 0; font-size: 21px; font-weight: 900; }
.ma-novidade-sub { margin: 0; color: var(--ma-muted); font-size: 14px; line-height: 1.45; }
.ma-novidade-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ma-novidade-list li { display: flex; gap: 12px; align-items: flex-start; background: var(--ma-bg2); border: 1px solid var(--ma-line); border-radius: 12px; padding: 10px 12px; }
.ma-novidade-list li > span { font-size: 20px; line-height: 1.2; }
.ma-novidade-list strong { display: block; font-size: 13.5px; }
.ma-novidade-list small { display: block; color: var(--ma-muted); font-size: 12.5px; line-height: 1.4; }
.ma-novidade-where { margin: 0; font-size: 12.5px; color: var(--ma-muted); }
.ma-novidade .ma-modal-actions { justify-content: center; }
.ma-novidade-foot { margin: 0; font-size: 11.5px; color: var(--ma-muted); }
@keyframes ma-novidade-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* O CSS global do sistema (visual-scale.css) força min-height: 40px e font-size !important
   em todo botão de #r-main-container. Dentro do calendário isso deforma o mini-calendário
   e estica eventos curtos; aqui devolvemos as medidas do calendário. */
#r-main-container #ma-root :is(.ma-mm-d, .ma-mm-head button, .ma-tg-ev, .ma-tg-chip, .ma-tg-dayhead, .ma-gcal-nodate) { min-height: 0; }
#r-main-container #ma-root .ma-mm-d { font-size: 12px !important; }
#r-main-container #ma-root .ma-tg-chip { font-size: 11.5px !important; }
#r-main-container #ma-root .ma-gcal-nodate { font-size: 12.5px !important; }
#r-main-container #ma-root .ma-gcal-main .ma-cal-day { min-height: 110px; }
@media (max-width: 640px) { #r-main-container #ma-root .ma-gcal-main .ma-cal-day { min-height: 58px; } }
.ma-tg-now { position: absolute; left: -1px; right: 0; height: 2px; background: #ea4335; z-index: 2; pointer-events: none; }
.ma-tg-now::before { content: ''; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 99px; background: #ea4335; }

/* mês */
.ma-gcal-main .ma-cal-grid { gap: 0; }
.ma-gcal-main .ma-cal-wk { border-bottom: 1px solid var(--ma-line); padding: 8px 0; }
.ma-gcal-main .ma-cal-day { border-radius: 0; border: 0; border-right: 1px solid var(--ma-line); border-bottom: 1px solid var(--ma-line); min-height: 110px; }
.ma-gcal-main .ma-cal-day:nth-child(7n) { border-right: 0; }
.ma-gcal-main .ma-cal-day:hover { background: var(--ma-bg2); }
.ma-gcal-main .ma-cal-day .ma-cal-num { align-self: center; }
.ma-cal-ev small { font-weight: 600; opacity: .8; }

/* detalhes do item */
.ma-detail .ma-modal-head span { display: inline-flex; gap: 2px; }
.ma-detail-title { margin: 2px 0 0; font-size: 19px; font-weight: 900; overflow-wrap: anywhere; }
.ma-detail-line { font-size: 13.5px; color: var(--ma-muted); }
.ma-detail-desc { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--ma-bg2); border-radius: 10px; padding: 10px 12px; max-height: 220px; overflow-y: auto; }
.ma-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }

/* celular */
@media (max-width: 900px) {
    .ma-gcal { grid-template-columns: minmax(0, 1fr); }
    .ma-gcal-side { display: none; }
    }
/* Quando a área da agenda fica estreita (notebook, zoom alto), a barra lateral some
   para a semana ter espaço — igual ao Google Agenda. "Novo item" e clique no horário continuam. */
#ma-root { container-type: inline-size; container-name: ma; }
@container ma (max-width: 1000px) {
    .ma-gcal { grid-template-columns: minmax(0, 1fr); }
    .ma-gcal-side { display: none; }
}
@media (max-width: 640px) {
    .ma-gcal-bar { gap: 6px; padding: 8px; }
    .ma-gcal-title { order: 5; flex-basis: 100%; font-size: 16px; }
    .ma-seg { margin-left: auto; }
    .ma-seg button { padding: 7px 10px; }
    .ma-tg-row { grid-template-columns: 44px repeat(var(--ma-cols), minmax(0, 1fr)); }
    .ma-tg-num { font-size: 16px; width: 30px; height: 30px; }
    .ma-tg-wd { font-size: 9.5px; }
    .ma-tg-ev { padding: 2px 4px; }
    .ma-tg-ev-t { font-size: 11px; }
    .ma-tg-scroll { height: 62vh; }
    .ma-gcal-main .ma-cal-day { min-height: 58px; }
    .ma-head h2 { font-size: 19px; }
    .ma-head-actions { width: 100%; }
    .ma-head-actions .ma-btn-primary { flex: 1; }
    .ma-owner { width: 100%; }
    .ma-owner select { min-width: 0; }
            .ma-counter-num { font-size: 24px; }
    .ma-item { flex-wrap: wrap; }
    .ma-item-body { flex-basis: calc(100% - 40px); }
    .ma-item-actions { width: 100%; justify-content: flex-start; }
    .ma-act { padding: 9px 11px; }
        .ma-cal-grid { gap: 2px; }
    .ma-cal-day { min-height: 58px; padding: 3px; }
    .ma-cal-ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; border-radius: 3px; background: var(--ma-tc); }
    .ma-cal-ev.ma-late { background: var(--ma-accent); }
    .ma-cal-more { font-size: 9.5px; }
    .ma-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ma-row { flex-direction: column; }
    .ma-modal-bg { padding: 12px 8px; }
    .ma-modal { padding: 14px; }
    .ma-popup { right: 12px; bottom: 76px; }
    .ma-tour-card { bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) {
    .ma-bar > div, }
