/* Área de gestão AISP Agenda. Mobile primeiro; sem fontes nem recursos externos (CSP restrita). */
:root {
	--navy: #010624;
	--navy-2: #0a1128;
	--cyan: #1cdaff;
	--bg: #f4f6f9;
	--surface: #fff;
	--border: #e3e7ee;
	--text: #010624;
	--muted: #4a5778;
	--accent: #0a5c82;
	--danger: #b3261e;
	--danger-bg: #fdecea;
	--warn: #8a5a00;
	--warn-bg: #fff4d6;
	--ok: #1b6b3a;
	--ok-bg: #e4f6ea;
	--info-bg: #eafaff;
	--radius: 12px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
body.tm-lock { overflow: hidden; }
h1, h2, h3, h4, p, dl, dd, ul, ol { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.tm-boot { padding: 32px 20px; color: var(--muted); }

/* Topo */
.tm-top { background: var(--navy); color: #fff; padding: 12px 16px calc(12px) 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.tm-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tm-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--cyan); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }
.tm-brand h1 { font-size: 18px; line-height: 1.2; }
.tm-brand p { font-size: 13px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-menu { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.tm-top .tm-link { color: #fff; font-size: 14px; padding: 8px 0; min-height: 44px; display: inline-flex; align-items: center; }
.tm-top .tm-btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .4); background: transparent; }

/* Estrutura */
.tm-main { max-width: 1040px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 14px; }

/* Botões */
.tm-btn { appearance: none; border: 1px solid var(--navy); background: var(--navy); color: #fff; border-radius: 10px; padding: 10px 16px; min-height: 44px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; }
.tm-btn:hover { background: var(--navy-2); }
.tm-btn[disabled] { opacity: .5; cursor: not-allowed; }
.tm-btn--ghost { background: transparent; color: var(--navy); border-color: var(--border); border-width: 1px; }
.tm-btn--ghost:hover { background: var(--bg); }
.tm-btn--primary { background: var(--accent); border-color: var(--accent); }
.tm-btn--primary:hover { background: #084a69; }
.tm-btn--danger { background: var(--danger); border-color: var(--danger); }
.tm-btn--danger:hover { background: #8f1e18; }
.tm-btn--small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.tm-linkbtn { appearance: none; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 600; text-align: left; }

/* Alertas */
.tm-alerts { display: grid; gap: 8px; }
.tm-alert { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 10px; border: 1px solid; font-size: 15px; }
.tm-alert--danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(179, 38, 30, .3); }
.tm-alert--warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(138, 90, 0, .3); }
.tm-alert .tm-btn { background: transparent; color: inherit; border-color: currentColor; flex: none; }

/* Resumo */
.tm-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tm-tile { appearance: none; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; align-content: start; min-height: 88px; }
.tm-tile:hover { border-color: var(--accent); }
.tm-tile-l { font-size: 13px; color: var(--muted); }
.tm-tile-v { font-size: 28px; font-weight: 800; line-height: 1.1; }
.tm-tile-v--sm { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.tm-tile-s { font-size: 13px; color: var(--muted); }
.tm-tile--warn { background: var(--warn-bg); border-color: rgba(138, 90, 0, .35); }
.tm-tile--warn .tm-tile-v { color: var(--warn); }
.tm-tile--next { background: var(--info-bg); border-color: rgba(10, 92, 130, .3); grid-column: span 2; }

/* Pesquisa e separadores */
.tm-bar { display: grid; gap: 10px; }
.tm-search { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.tm-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tm-tab { appearance: none; flex: none; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tm-tab.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tm-count { background: var(--bg); color: var(--navy); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 700; min-width: 22px; text-align: center; }
.tm-tab.is-on .tm-count { background: var(--cyan); }

/* Lista */
.tm-list { display: grid; gap: 10px; }
.tm-day { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.tm-day::first-letter { text-transform: uppercase; }
.tm-empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.tm-card { appearance: none; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: start; }
.tm-card:hover { border-color: var(--accent); }
.tm-card-time { display: grid; font-size: 13px; color: var(--muted); }
.tm-card-time strong { font-size: 20px; color: var(--text); line-height: 1.2; }
.tm-card-body { display: grid; gap: 3px; min-width: 0; }
.tm-card-company { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.tm-card-meta { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.tm-card-obj { font-size: 14px; overflow-wrap: anywhere; }
.tm-chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tm-chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--navy); border: 1px solid var(--border); }
.tm-st-pending_review { background: var(--warn-bg); color: var(--warn); border-color: rgba(138, 90, 0, .3); }
.tm-st-confirmed { background: var(--ok-bg); color: var(--ok); border-color: rgba(27, 107, 58, .3); }
.tm-st-declined, .tm-st-cancelled, .tm-st-spam { background: var(--danger-bg); color: var(--danger); border-color: rgba(179, 38, 30, .25); }
.tm-chip--danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(179, 38, 30, .3); }
.tm-chip--warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(138, 90, 0, .3); }
.tm-chip--info { background: var(--info-bg); color: var(--accent); border-color: rgba(10, 92, 130, .25); }
.tm-chip--ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(27, 107, 58, .3); }

.tm-pager { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; color: var(--muted); }

/* Ficha (gaveta) */
.tm-drawer { position: fixed; inset: 0; z-index: 50; background: rgba(1, 6, 36, .55); display: flex; justify-content: flex-end; }
.tm-panel { background: var(--bg); width: 100%; max-width: 720px; height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.tm-panel-top { position: sticky; top: 0; background: var(--bg); padding: 14px 0 10px; display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; z-index: 2; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tm-panel-top h2 { font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.tm-ref { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tm-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-hero { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px; display: grid; gap: 6px; margin-bottom: 14px; }
.tm-when { font-size: 20px; font-weight: 700; line-height: 1.3; }
.tm-when::first-letter { text-transform: uppercase; }
.tm-when-c, .tm-hero .tm-muted { font-size: 14px; opacity: .85; }
.tm-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; display: grid; gap: 10px; }
.tm-sec h3 { font-size: 16px; }
.tm-sec h4 { font-size: 14px; color: var(--muted); margin-top: 4px; }
.tm-dl { display: grid; gap: 8px; }
.tm-kv { display: grid; grid-template-columns: 1fr; gap: 0; }
.tm-kv dt { font-size: 13px; color: var(--muted); }
.tm-kv dd { overflow-wrap: anywhere; font-weight: 500; }
.tm-obj { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.tm-muted { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.tm-hist { list-style: none; padding: 0; display: grid; gap: 10px; }
.tm-hist li { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.tm-hist-o { flex-basis: 100%; font-size: 14px; color: var(--muted); }
.tm-foot { font-size: 12px; color: var(--muted); padding: 4px 2px; }

/* Formulários na ficha */
.tm-field { display: grid; gap: 4px; font-size: 14px; }
.tm-field > span { color: var(--muted); }
.tm-field input, .tm-field textarea, .tm-sec textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; resize: vertical; }
.tm-check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.tm-check input { width: 22px; height: 22px; flex: none; }
.tm-acts { display: grid; gap: 14px; }
.tm-act { display: grid; gap: 10px; }
.tm-steps { padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.tm-arm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--warn-bg); border-radius: 10px; }
.tm-arm > span { flex-basis: 100%; font-weight: 600; color: var(--warn); }
.tm-more { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 12px; }
.tm-more > summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.tm-more[open] > summary { margin-bottom: 8px; }
.tm-more .tm-act + .tm-act { border-top: 1px solid var(--border); padding-top: 12px; }

/* Aviso temporário */
.tm-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
.tm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) {
	.tm-tiles { grid-template-columns: repeat(4, 1fr); }
	.tm-tile--next { grid-column: auto; }
	.tm-bar { grid-template-columns: 1fr; }
	.tm-kv { grid-template-columns: 170px 1fr; gap: 12px; }
	.tm-card { grid-template-columns: 96px 1fr; }
	.tm-panel { padding-left: 24px; padding-right: 24px; }
}


/* Modos (Pedidos / Disponibilidade) */
.tm-modes { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-mode { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--navy); border-radius: 999px; padding: 8px 16px; min-height: 44px; font-weight: 600; cursor: pointer; }
.tm-mode.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tm-reqwrap, .tm-avail { display: grid; gap: 14px; }

/* Disponibilidade */
.tm-calnav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.tm-calnav h2 { font-size: 18px; grid-column: 1 / -1; text-align: center; }
.tm-calnav .tm-nav-r { justify-self: end; }
.tm-calnav .tm-btn:first-of-type { justify-self: start; }
.tm-calnav h2::first-letter { text-transform: uppercase; }
.tm-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.tm-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.tm-dayx { min-height: 0; }
.tm-day-cell { appearance: none; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; min-height: 64px; padding: 4px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; cursor: pointer; text-align: left; overflow: hidden; }
.tm-day-cell[disabled] { opacity: .4; cursor: not-allowed; }
.tm-day-cell.is-off { background: var(--bg); color: var(--muted); }
.tm-day-cell.is-blocked { background: var(--danger-bg); border-color: rgba(179, 38, 30, .5); color: var(--danger); }
.tm-day-cell.is-partial { background: var(--warn-bg); border-color: rgba(138, 90, 0, .45); color: var(--warn); }
.tm-day-cell.is-extra { background: var(--ok-bg); border-color: rgba(27, 107, 58, .45); color: var(--ok); }
.tm-day-cell.is-today .tm-dn { text-decoration: underline; }
.tm-day-cell.is-sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.tm-dn { font-weight: 700; font-size: 15px; }
.tm-dt, .tm-db { font-size: 10.5px; line-height: 1.15; font-weight: 600; overflow-wrap: anywhere; }
.tm-db { color: var(--accent); }
.tm-more:not([open]) { gap: 0; }
.tm-l { display: none; }
.tm-legend { font-size: 13px; color: var(--muted); }
.tm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tm-acts-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-exl { list-style: none; padding: 0; display: grid; gap: 8px; }
.tm-exl li { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.tm-exl-t { flex: 1 1 220px; overflow-wrap: anywhere; font-size: 14px; }
.tm-pending { display: grid; gap: 10px; }
.tm-pending-b { display: grid; gap: 6px; }
.tm-pending .tm-btn--primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.tm-pending .tm-btn--ghost { background: #fff; color: var(--navy); border-color: var(--border); }
.tm-pending-a { display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 640px) {
	.tm-s { display: none; }
	.tm-l { display: inline; }
	.tm-day-cell { min-height: 84px; padding: 6px 8px; }
	.tm-dt, .tm-db { font-size: 12px; }
}
@media print { .tm-modes, .tm-avail { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
	.tm-toast { transition: none; }
}

/* Ficha de preparação para impressão (A4): só o conteúdo da ficha aberta */
@media print {
	body { background: #fff; font-size: 11pt; }
	body.tm-lock { overflow: visible; }
	.tm-top, .tm-main, .tm-toast, .tm-panel-actions, .tm-sec--act, .tm-sec--note textarea, .tm-sec--note button, .tm-sec--out button, .tm-more { display: none !important; }
	.tm-drawer { position: static; background: none; display: block; }
	.tm-panel { max-width: none; height: auto; overflow: visible; padding: 0; background: none; }
	.tm-panel-top { position: static; border: 0; }
	.tm-hero { background: none; color: #000; border: 1px solid #000; }
	.tm-sec { border: 1px solid #999; break-inside: avoid; }
	.tm-sec--note, .tm-sec--out { display: block !important; }
	.tm-sec--note textarea, .tm-sec--out textarea { display: block !important; border: 0; padding: 0; resize: none; min-height: 3em; }
	a { color: #000; text-decoration: none; }
}

/* Entrada na Área de gestão (email + código). Mobile primeiro. */
.tm-login-body { min-height: 100vh; background: var(--navy); }
.tm-login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
.tm-login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 24px 20px; display: grid; gap: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.tm-login-card .tm-brand h1 { color: var(--navy); }
.tm-login-card .tm-brand p { color: var(--muted); opacity: 1; }
.tm-login-lead { color: var(--muted); font-size: 15px; }
.tm-login-msg { background: var(--info-bg); border-left: 4px solid var(--cyan); border-radius: 8px; padding: 10px 12px; font-size: 14px; color: var(--navy); }
.tm-login-msg--err { background: var(--danger-bg); border-left-color: var(--danger); color: var(--danger); }
.tm-login-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.tm-login-input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #98a2b8; border-radius: 10px; background: #fff; font-size: 16px; }
.tm-login-code { text-align: center; letter-spacing: .5em; font-size: 24px; font-variant-numeric: tabular-nums; padding-left: calc(12px + .5em); }
.tm-login-help { font-size: 13px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.tm-login-btn { width: 100%; margin-top: 12px; }
.tm-login-again { font-size: 14px; text-align: center; }
.tm-login-foot { font-size: 12px; color: var(--muted); text-align: center; }

/* Horário semanal (v1.7.3) */
.tm-wk-wrap { overflow-x: auto; }
.tm-wk { width: 100%; border-collapse: collapse; font-size: 14px; }
.tm-wk th, .tm-wk td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tm-wk input[type=time] { padding: 8px 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; min-width: 108px; }
@media (max-width: 640px) {
	.tm-wk thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.tm-wk, .tm-wk tbody, .tm-wk tr, .tm-wk th, .tm-wk td { display: block; width: 100%; box-sizing: border-box; }
	.tm-wk tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
	.tm-wk th, .tm-wk td { border-bottom: 0; padding: 4px 0; }
}
.tm-alert > div { width: 100%; }
