:root {
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --bg: #FAFAFB;
  --surface: #FFFFFF;
  --ink: #1A1B1E;
  --ink-secondary: #6B6F76;
  --ink-muted: #9CA0A8;
  --line: #E6E7EB;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-bg: rgba(79, 70, 229, 0.08);
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --info: #2563EB;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 2.5rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --text-xs: .75rem;
  --text-sm: .875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;
  --ease: cubic-bezier(.4,0,.1,1);
  --shadow-sm: 0 1px 2px rgba(26, 27, 30, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 27, 30, 0.08);
  --shadow-lg: 0 12px 40px rgba(26, 27, 30, 0.12);
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- layout ---- */
.app-layout { display: grid; grid-template-columns: 340px 1fr; flex: 1; gap: var(--space-2); background: transparent; }
.sidebar { background: var(--bg); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); border-right: 1px solid var(--line); }
.main { background: var(--bg); padding: var(--space-3); overflow-y: auto; }

/* ---- header ---- */
.topo { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); padding: var(--space-2) var(--space-3); }
.topo h1 { font-family: var(--font-display); font-size: var(--text-base); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.nav-month { display: flex; align-items: center; gap: var(--space-1); }
.nav-month button { background: none; border: 1px solid var(--line); border-radius: var(--radius-md); padding: .5rem .75rem; cursor: pointer; color: var(--ink-secondary); font-size: var(--text-xs); transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); min-height: 36px; }
.nav-month button:hover { background: var(--surface); color: var(--ink); border-color: var(--ink-muted); }
.nav-month button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-month .label { font-size: var(--text-sm); font-weight: 600; min-width: 130px; text-align: center; color: var(--ink); }
.btn-hoje { background: var(--accent); color: #F8F9FF; border: none; border-radius: var(--radius-md); padding: .5rem 1rem; font-size: var(--text-xs); font-weight: 600; cursor: pointer; transition: background .15s var(--ease), transform .1s var(--ease); min-height: 36px; }
.btn-hoje:hover { background: var(--accent-hover); }
.btn-hoje:active { transform: scale(.96); }
.btn-hoje:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-admin { background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 1.25rem; padding: .25rem .5rem; border-radius: var(--radius-md); transition: color .15s var(--ease), background .15s var(--ease); line-height: 1; min-height: 36px; min-width: 36px; display: flex; align-items: center; justify-content: center; }
.btn-admin:hover { color: var(--ink); background: var(--accent-bg); }
.btn-admin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- calendário mensal ---- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: var(--text-xs); color: var(--ink-muted); font-weight: 600; margin-bottom: var(--space-2); letter-spacing: .02em; text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius-md); cursor: pointer; font-size: var(--text-sm); font-weight: 500; position: relative; transition: background .12s var(--ease), transform .1s var(--ease), box-shadow .12s var(--ease); height: 40px; }
.cal-cell:hover { background: var(--line); transform: translateY(-1px); }
.cal-cell:active { transform: scale(.94); }
.cal-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-cell.other { color: var(--ink-muted); opacity: .35; }
.cal-cell.hoje { background: var(--accent); color: #F8F9FF; font-weight: 700; }
.cal-cell.hoje:hover { background: var(--accent-hover); }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.hoje.sel { box-shadow: inset 0 0 0 2px #F8F9FF; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-muted); margin-top: 2px; }
.cal-cell.hoje .cal-dot { background: rgba(248, 249, 255, 0.8); }

/* ---- agenda ---- */
.agenda-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.agenda-header h2 { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.btn-add { background: var(--accent); color: #F8F9FF; border: none; border-radius: var(--radius-md); padding: .5rem 1rem; font-size: var(--text-xs); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: .5em; transition: background .15s var(--ease), transform .1s var(--ease); min-height: 40px; }
.btn-add:hover { background: var(--accent-hover); }
.btn-add:active { transform: scale(.96); }
.btn-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-list { display: flex; flex-direction: column; gap: var(--space-1); }
.task-item { display: flex; align-items: center; gap: var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-2); transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
.task-item:hover { border-color: var(--ink-muted); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.task-time { font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 48px; letter-spacing: -.01em; }
.task-title { font-size: var(--text-sm); color: var(--ink); flex: 1; line-height: 1.5; }
.task-del { background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: var(--text-sm); padding: .25rem .5rem; border-radius: var(--radius-sm); opacity: 0; transition: opacity .15s var(--ease), color .15s var(--ease), background .15s var(--ease); min-height: 32px; min-width: 32px; }
.task-item:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--danger); background: var(--danger-bg); }
.task-del:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); text-align: center; color: var(--ink-muted); padding: var(--space-6) var(--space-3); font-size: var(--text-sm); }
.empty-state-icon { font-size: var(--text-2xl); opacity: .4; }
.empty-state-title { font-weight: 600; color: var(--ink-secondary); }
.loading-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; color: var(--ink-muted); padding: var(--space-6) var(--space-3); font-size: var(--text-sm); }
.skeleton { background: var(--line); border-radius: var(--radius-sm); animation: pulse 1.5s var(--ease) infinite; }
.skeleton-line { height: 16px; width: 100%; margin-bottom: 8px; }
.skeleton-line:last-child { width: 70%; }
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: .25; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.task-item, .note-item { animation: fadeIn .25s var(--ease) both; }
.task-item:nth-child(2) { animation-delay: 30ms; }
.task-item:nth-child(3) { animation-delay: 60ms; }
.task-item:nth-child(4) { animation-delay: 90ms; }
.task-item:nth-child(5) { animation-delay: 120ms; }
.note-item:nth-child(2) { animation-delay: 30ms; }
.note-item:nth-child(3) { animation-delay: 60ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .cal-cell:hover { transform: none; }
  .task-item:hover { transform: none; }
}

/* ---- modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(14, 15, 26, .45); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-5); width: min(420px, 92vw); box-shadow: var(--shadow-lg); }
.modal h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; letter-spacing: -.02em; margin-bottom: var(--space-3); color: var(--ink); }
.modal label { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--ink-secondary); margin-bottom: .25rem; }
.modal input { width: 100%; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); background: var(--bg); color: var(--ink); margin-bottom: var(--space-2); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.modal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.modal input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }
.btn-cancel { background: var(--surface); border: 1px solid var(--line); color: var(--ink); padding: .5rem 1rem; border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 500; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease); min-height: 40px; }
.btn-cancel:hover { background: var(--bg); border-color: var(--ink-muted); }
.btn-cancel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-save { background: var(--accent); color: #F8F9FF; border: none; padding: .5rem 1.25rem; border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 600; cursor: pointer; transition: background .15s var(--ease), transform .1s var(--ease); min-height: 40px; }
.btn-save:hover { background: var(--accent-hover); }
.btn-save:active { transform: scale(.96); }
.btn-save:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- month picker ---- */
.month-picker-overlay { position: fixed; inset: 0; background: rgba(14, 15, 26, .35); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 110; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
.month-picker-overlay.open { opacity: 1; pointer-events: auto; }
.month-picker { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-4); width: min(320px, 88vw); box-shadow: var(--shadow-lg); }
.month-picker-header { text-align: center; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--ink); margin-bottom: var(--space-3); }
.month-picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.month-picker-item { padding: .625rem 0; text-align: center; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; color: var(--ink-secondary); cursor: pointer; transition: background .12s var(--ease), color .12s var(--ease), transform .1s var(--ease); }
.month-picker-item:hover { background: var(--accent-bg); color: var(--accent); }
.month-picker-item:active { transform: scale(.94); }
.month-picker-item.active { background: var(--accent); color: #F8F9FF; font-weight: 600; }
.month-picker-item.active:hover { background: var(--accent-hover); }
.month-picker-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- abas ---- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--line); margin-bottom: var(--space-3); }
.tab { background: none; border: none; padding: .5rem 1rem; font-size: var(--text-sm); font-weight: 500; color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .2s var(--ease), border-color .2s var(--ease); min-height: 40px; }
.tab:hover { color: var(--ink-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }

/* ---- anotações ---- */
.notes-area { display: flex; flex-direction: column; gap: var(--space-3); }
.note-list { display: flex; flex-direction: column; gap: var(--space-1); }
.note-item { display: flex; align-items: flex-start; gap: var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-2); transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
.note-item:hover { border-color: var(--ink-muted); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.note-item:hover .task-del { opacity: 1; }
.note-content { flex: 1; font-size: var(--text-sm); color: var(--ink); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.note-meta { font-size: var(--text-xs); color: var(--ink-muted); white-space: nowrap; min-width: 42px; text-align: right; }
.note-form { display: flex; gap: var(--space-2); align-items: flex-start; }
.note-form textarea { flex: 1; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); resize: vertical; min-height: 52px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); background: var(--surface); color: var(--ink); }
.note-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.note-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-form .btn-save { flex-shrink: 0; align-self: stretch; }

/* ---- admin MCP ---- */
.admin-panel { display: flex; flex-direction: column; gap: var(--space-3); }
.admin-panel h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.admin-desc { font-size: var(--text-sm); color: var(--ink-secondary); line-height: 1.5; }
.admin-field { display: flex; flex-direction: column; gap: .25rem; }
.admin-field label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-secondary); }
.admin-copy { display: flex; align-items: center; gap: var(--space-1); }
.admin-copy code { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: .5rem .75rem; font: .8125rem/1.5 ui-monospace, monospace; word-break: break-all; color: var(--ink); }
.admin-copy button { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: .5rem .75rem; font-size: var(--text-xs); font-weight: 500; cursor: pointer; color: var(--ink-secondary); transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); flex-shrink: 0; min-height: 36px; }
.admin-copy button:hover { background: var(--line); color: var(--ink); border-color: var(--ink-muted); }
.admin-copy button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.admin-pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-2); font: .75rem/1.5 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow-y: auto; color: var(--ink); }

/* ---- login ---- */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100dvh; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-6); width: min(380px, 92vw); box-shadow: var(--shadow-lg); text-align: center; }
.login-logo { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin-bottom: .25rem; }
.login-sub { font-size: var(--text-sm); color: var(--ink-muted); margin-bottom: var(--space-4); }
.login-form { display: flex; flex-direction: column; gap: var(--space-1); text-align: left; }
.login-form label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-secondary); }
.login-form input { width: 100%; padding: .625rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); background: var(--bg); color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.btn-login { background: var(--accent); color: #F8F9FF; border: none; border-radius: var(--radius-md); padding: .625rem 1rem; font-size: var(--text-sm); font-weight: 600; cursor: pointer; margin-top: var(--space-2); transition: background .15s var(--ease), transform .1s var(--ease); min-height: 44px; }
.btn-login:hover { background: var(--accent-hover); }
.btn-login:active { transform: scale(.96); }
.btn-login:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-erro { font-size: var(--text-xs); color: var(--danger); min-height: 1rem; margin-top: .25rem; text-align: center; }

/* ---- admin toggle button (painel admin como aba) ---- */
.admin-panel .btn-cancel { margin-top: var(--space-1); align-self: flex-start; }

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { border-bottom: 1px solid var(--line); padding: var(--space-2); }
  .main { padding: var(--space-2); }
  .cal-cell { font-size: var(--text-xs); height: 36px; }
  .topo { padding: var(--space-1) var(--space-2); flex-wrap: wrap; gap: var(--space-1); }
  .topo h1 { font-size: var(--text-sm); }
  .nav-month .label { min-width: 100px; font-size: var(--text-xs); }
  .btn-add { min-height: 44px; }
  .btn-hoje { min-height: 44px; }
  .btn-cancel, .btn-save { min-height: 44px; }
  .tab { min-height: 44px; padding: .5rem .75rem; }
}