/* Hub — folha única. Especificação em docs/DESIGN.md.
   Ordem: tokens → base → layout → componentes → páginas → responsivo → movimento reduzido.
   Não acrescente camadas de sobrescrita no fim: altere a regra no lugar dela. */

/* ============================== Tokens ============================== */
:root {
  color-scheme: light;
  --background: #FAFAFA;
  --sidebar: #F4F4F4;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-hover: #F0F0F0;
  --border: #DEDEDE;
  --border-strong: #C8C8C8;
  --foreground: #0B0B0D;
  --muted: #5C5C63;
  --tertiary: #686870;
  --primary: #0B0B0D;
  --primary-hover: #2A2A2E;
  --on-primary: #FFFFFF;
  --primary-soft: #ECECEC;
  --destructive: #9B3B3B;
  --destructive-soft: #F6ECEC;
  --skeleton: #ECECEC;
  --chart-bar: #8A8A90;
  --overlay: rgb(10 10 12 / 32%);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 6%);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 8%);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / 14%);
  --focus-ring: color-mix(in srgb, var(--foreground) 55%, transparent);

  --kind-0: #5D7BAA; --kind-1: #9A814B; --kind-2: #4F8A72; --kind-3: #7D6DB0; --kind-4: #A87053; --kind-5: #767C84;

  --text-xs: .75rem;      /* 12 */
  --text-sm: .8125rem;    /* 13 */
  --text-md: .875rem;     /* 14 */
  --text-lg: 1rem;        /* 16 */
  --text-xl: 1.25rem;     /* 20 */
  --text-2xl: 1.75rem;    /* 28 */
  --text-3xl: 2.125rem;   /* 34 */

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

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

  --control-h: 36px;
  --field-h: 38px;
  --sidebar-width: 240px;
  --header-h: 56px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --duration: 160ms;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #09090B;
  --sidebar: #0C0C0E;
  --surface: #141417;
  --surface-elevated: #1D1D21;
  --surface-hover: #1A1A1E;
  --border: #303036;
  --border-strong: #45454C;
  --foreground: #F4F4F4;
  --muted: #A5A5AB;
  --tertiary: #92929A;
  --primary: #F4F4F4;
  --primary-hover: #DCDCDC;
  --on-primary: #09090B;
  --primary-soft: #222226;
  --destructive: #E5A3A3;
  --destructive-soft: #2A1C1D;
  --skeleton: #1D1D21;
  --chart-bar: #8A8A90;
  --overlay: rgb(0 0 0 / 62%);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 6px 20px rgb(0 0 0 / 40%);
  --shadow-lg: 0 20px 56px rgb(0 0 0 / 55%);

  --kind-0: #7F9AC4; --kind-1: #B59E6B; --kind-2: #6FA48F; --kind-3: #9C8CCB; --kind-4: #C08F72; --kind-5: #8F959C;
}

@theme inline {
  --color-background: var(--background);
  --color-surface: var(--surface);
  --color-foreground: var(--foreground);
  --color-muted: var(--muted);
  --color-primary: var(--primary);
  --color-border: var(--border);
  --font-sans: var(--font-inter);
}

/* ============================== Base ============================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--font-inter), Arial, sans-serif; font-size: var(--text-md); line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--text-2xl); font-weight: 600; line-height: 1.2; letter-spacing: -.022em; }
h2 { font-size: var(--text-xl); font-weight: 600; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: var(--text-lg); font-weight: 600; line-height: 1.4; letter-spacing: -.01em; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--foreground) 18%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: var(--space-4); left: var(--space-4); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); color: var(--on-primary); background: var(--primary); transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
.eyebrow { font-size: var(--text-sm); font-weight: 500; color: var(--muted); }
.secondary-text { font-size: var(--text-sm); color: var(--muted); }
kbd { font-family: var(--font-inter), Arial, sans-serif; font-size: var(--text-xs); line-height: 1.4; color: var(--tertiary); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0 5px; background: var(--background); }

/* ============================== Layout ============================== */
.desktop-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--sidebar); border-right: 1px solid var(--border); z-index: 20; }
.sidebar-content { display: flex; flex-direction: column; height: 100%; overflow-y: auto; padding: var(--space-4) var(--space-3); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 var(--space-2); color: var(--foreground); font-size: var(--text-md); font-weight: 600; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-xs); background: var(--primary); color: var(--on-primary); font-size: var(--text-xs); font-weight: 700; line-height: 1; }
.sidebar-search { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 34px; margin-top: var(--space-4); padding: 0 var(--space-2) 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--tertiary); font-size: var(--text-sm); transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease); }
.sidebar-search:hover { border-color: var(--border-strong); color: var(--muted); }
.sidebar-search span { flex: 1; text-align: left; }
.sidebar-nav { display: grid; gap: 2px; margin-top: var(--space-4); }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; color: var(--muted); background: transparent; border: 0; border-radius: var(--radius-sm); font-size: var(--text-md); font-weight: 500; text-align: left; transition: background var(--duration) var(--ease), color var(--duration) var(--ease); }
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { color: var(--foreground); background: var(--surface-hover); }
.nav-item--active, .nav-item--active:hover { color: var(--foreground); background: var(--surface-hover); }
.nav-item--active svg { color: var(--foreground); }
.subnav { display: grid; gap: 1px; margin: 2px 0 var(--space-2) 18px; padding-left: var(--space-2); border-left: 1px solid var(--border); }
.subnav-item { display: flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: var(--radius-xs); color: var(--muted); font-size: var(--text-sm); transition: color var(--duration) var(--ease), background var(--duration) var(--ease); }
.subnav-item:hover { color: var(--foreground); background: var(--surface-hover); }
.subnav-item--active { color: var(--foreground); font-weight: 500; }
.sidebar-footer { display: grid; gap: 2px; margin-top: auto; padding-top: var(--space-4); }
.sidebar-divider { height: 1px; background: var(--border); margin: 0 var(--space-2) var(--space-3); }
.sidebar-profile { display: flex; align-items: center; gap: 10px; padding: var(--space-3) 10px var(--space-1); font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
.sidebar-profile small { display: block; color: var(--tertiary); font-size: var(--text-xs); font-weight: 400; }
.sidebar-profile > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--surface-elevated); border: 1px solid var(--border); font-size: 11px; font-weight: 600; color: var(--muted); }

.app-content { margin-left: var(--sidebar-width); min-height: 100dvh; }
.app-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); height: var(--header-h); padding: 0 var(--space-8); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 85%, transparent); backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px); }
.header-left { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.header-title { font-size: var(--text-sm); font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.menu-button { display: none !important; }
main:focus { outline: none; }
.page-container { max-width: 1120px; margin: 0 auto; padding: var(--space-10) var(--space-8) var(--space-16); }
.page-loading { display: grid; }

.page-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-8); }
.page-heading > div:first-child { min-width: 0; flex: 1 1 260px; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading .eyebrow { margin-bottom: var(--space-2); }
.page-subtitle { margin-top: 6px; font-size: var(--text-md); color: var(--muted); max-width: 64ch; }
.back-link, .detail-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--space-3); color: var(--muted); font-size: var(--text-sm); font-weight: 500; transition: color var(--duration) var(--ease); }
.back-link:hover, .detail-back:hover { color: var(--foreground); }

/* ============================== Componentes ============================== */

/* Botões */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-h); padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: var(--text-md); font-weight: 500; line-height: 1.2; text-align: center; white-space: nowrap; transition: background var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
.button svg { width: 16px; height: 16px; flex: 0 0 auto; }
.button--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.button--primary:hover { background: var(--primary-hover); }
.button--secondary { background: var(--surface); color: var(--foreground); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.button--secondary:hover { background: var(--surface-hover); }
.button--ghost { background: transparent; color: var(--muted); }
.button--ghost:hover { background: var(--surface-hover); color: var(--foreground); }
.button--destructive { background: transparent; color: var(--destructive); border-color: color-mix(in srgb, var(--destructive) 45%, transparent); }
.button--destructive:hover { background: var(--destructive-soft); }
.button--icon { width: var(--control-h); min-width: var(--control-h); padding: 0; }
.button--icon svg { width: 18px; height: 18px; }
.button:disabled, .button[data-disabled] { opacity: .45; box-shadow: none; }
.button--primary:disabled:hover { background: var(--primary); }

.text-link, .editorial-section-heading a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex-shrink: 0; border: 0; padding: 0; background: none; color: var(--muted); font-size: var(--text-sm); font-weight: 500; transition: color var(--duration) var(--ease); }
.text-link:hover, .editorial-section-heading a:hover { color: var(--foreground); }
.text-link:disabled { opacity: .5; }

/* Campos */
.field { min-width: 0; }
.field label, .field-label { display: block; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 500; color: var(--foreground); }
.input-wrap { position: relative; }
.input, .select { display: block; width: 100%; min-height: var(--field-h); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 12px; background: var(--surface); color: var(--foreground); font-size: var(--text-md); line-height: 1.5; box-shadow: var(--shadow-sm); transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease); }
.input::placeholder { color: var(--tertiary); opacity: 1; }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--foreground) 28%, var(--border-strong)); }
.input:focus-visible, .select:focus-visible { border-color: var(--foreground); outline: 3px solid color-mix(in srgb, var(--foreground) 14%, transparent); outline-offset: 0; }
.input:disabled, .select:disabled, .select[data-disabled] { opacity: .55; cursor: not-allowed; }
.input-wrap--error .input, .select--error { border-color: var(--destructive); }
.input-wrap--icon .input { padding-left: 36px; }
.input-icon { position: absolute; inset: 0 auto 0 12px; display: flex; align-items: center; color: var(--tertiary); pointer-events: none; }
textarea.input { resize: vertical; }
.field-hint { margin-top: 6px; font-size: var(--text-xs); color: var(--muted); }
.field-error { color: var(--destructive); }

/* Select (Radix) */
.select-trigger { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); text-align: left; cursor: pointer; }
.select-trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger > span:last-child { display: flex; flex-shrink: 0; color: var(--tertiary); }
.select-trigger[data-state="open"] { border-color: var(--foreground); }
.select-menu { z-index: 120; min-width: var(--radix-select-trigger-width); max-width: calc(100vw - 24px); max-height: var(--radix-select-content-available-height); overflow: hidden; background: var(--surface-elevated); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.select-menu-viewport { padding: var(--space-1); }
.select-option { position: relative; display: flex; align-items: center; min-height: 34px; padding: 0 32px 0 10px; border-radius: var(--radius-xs); font-size: var(--text-md); line-height: 1.3; outline: none; cursor: pointer; }
.select-option[data-highlighted] { background: var(--surface-hover); }
.select-option[data-state="checked"] { font-weight: 500; }
.select-option[data-disabled] { opacity: .5; cursor: not-allowed; }
.select-check { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; }
.select-scroll { display: flex; justify-content: center; padding: var(--space-1); color: var(--muted); }

/* Controle segmentado */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.segmented-item { min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--muted); font-size: var(--text-sm); font-weight: 500; transition: background var(--duration) var(--ease), color var(--duration) var(--ease); }
.segmented-item:hover { color: var(--foreground); }
.segmented-item--active, .segmented-item--active:hover { background: var(--surface-elevated); color: var(--foreground); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border-strong); }
:root:not([data-theme="dark"]) .segmented { background: var(--surface-hover); }
:root:not([data-theme="dark"]) .segmented-item--active { background: var(--surface); }

/* Chips e badges */
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 500; line-height: 1; }
.badge--neutral, .badge--green, .badge--burgundy { color: var(--muted); background: var(--surface-elevated); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 0 6px 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface); color: var(--foreground); font-size: var(--text-sm); overflow-wrap: anywhere; text-align: left; }
.filter-chip:hover { background: var(--surface-hover); }
.filter-chip span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: var(--radius-full); color: var(--muted); font-size: 15px; line-height: 1; }
.active-selection { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-6); }
.active-selection .button { min-height: 28px; padding: 0 10px; font-size: var(--text-sm); }

/* Cards e cabeçalhos de seção */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.section-header, .editorial-section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.section-header p, .section-description { margin-top: 2px; color: var(--muted); font-size: var(--text-sm); }
.editorial-section-heading .secondary-text { white-space: nowrap; }

/* Diálogos */
.dialog-overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); animation: fade-in var(--duration) var(--ease); }
.confirm-dialog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 51; width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-lg); animation: dialog-in 200ms var(--ease); }
.dialog-title { font-size: var(--text-xl); font-weight: 600; line-height: 1.3; letter-spacing: -.015em; }
.dialog-description { margin-top: var(--space-2); color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-6); }
.dialog-form { display: grid; gap: var(--space-4); margin-top: var(--space-5); }
.dialog-form .dialog-actions { margin-top: var(--space-2); }
.dialog-remove { margin-right: auto; color: var(--destructive); }
.dialog-remove:hover { color: var(--destructive); background: var(--destructive-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-save-error { color: var(--destructive); margin: var(--space-3) 0; font-size: var(--text-sm); }

.mobile-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 51; width: min(300px, calc(100vw - 48px)); height: 100dvh; background: var(--sidebar); border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: drawer-in 220ms var(--ease); }
.mobile-close { position: absolute; top: var(--space-4); right: var(--space-3); z-index: 1; }
.sidebar-content--mobile .brand { margin-right: var(--space-10); }

.filter-drawer { position: fixed; z-index: 51; inset: 8px 8px 8px auto; width: min(380px, calc(100% - 16px)); overflow-y: auto; padding: var(--space-6); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: drawer-right 220ms var(--ease); }
.filter-drawer-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.filter-drawer-fields { display: grid; gap: var(--space-4); margin-top: var(--space-6); }

/* Busca global */
.command-dialog { position: fixed; z-index: 51; left: 50%; top: 14vh; transform: translateX(-50%); width: min(600px, calc(100% - 32px)); max-height: 66vh; display: flex; flex-direction: column; overflow: hidden; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: fade-in var(--duration) var(--ease); }
.command-input { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); border-bottom: 1px solid var(--border); color: var(--tertiary); }
.command-input input { flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; background: transparent; color: var(--foreground); font-size: var(--text-lg); }
.command-input input::placeholder { color: var(--tertiary); }
.command-results { overflow-y: auto; padding: var(--space-2); }
.command-group { padding: var(--space-3) 10px var(--space-1); font-size: var(--text-xs); font-weight: 500; color: var(--tertiary); }
.command-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font-size: var(--text-md); text-align: left; }
.command-item svg:first-child { color: var(--muted); }
.command-item--active { background: var(--surface-hover); }
.command-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-hint { flex: 1; min-width: 0; color: var(--tertiary); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-item > svg:last-child:not(:first-child) { margin-left: auto; color: var(--tertiary); }
.command-empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--muted); }

/* Avisos */
[data-sonner-toaster] [data-sonner-toast].library-toast { font-family: var(--font-inter), Arial, sans-serif; background: var(--surface-elevated) !important; color: var(--foreground) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-md) !important; box-shadow: var(--shadow-lg) !important; font-size: var(--text-md); }
.library-toast-description { color: var(--muted) !important; }
.library-toast-close { background: var(--surface-elevated) !important; color: var(--muted) !important; border-color: var(--border) !important; }

/* Carregamento e vazio */
.skeleton { display: block; background: var(--skeleton); border-radius: var(--radius-sm); animation: skeleton-pulse 1.5s ease-in-out infinite; }
.skeleton-heading { width: min(280px, 75%); height: 32px; margin-bottom: var(--space-3); }
.skeleton-subtitle { width: min(380px, 90%); height: 18px; margin-bottom: var(--space-8); }
.skeleton-control { width: 100%; height: 44px; margin-bottom: var(--space-6); }
.skeleton-panel { width: 100%; height: 280px; border-radius: var(--radius-md); }
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); }
.empty-rule { display: none; }
.empty-state h3 { font-size: var(--text-lg); font-weight: 600; }
.empty-state p { color: var(--muted); max-width: 420px; margin: 6px auto 0; overflow-wrap: anywhere; }
.empty-action { margin-top: var(--space-5); }
.storage-note { margin-top: var(--space-10); font-size: var(--text-xs); color: var(--tertiary); }
.storage-error { display: grid; gap: var(--space-3); justify-items: start; padding: var(--space-4); margin-bottom: var(--space-6); border: 1px solid color-mix(in srgb, var(--destructive) 40%, transparent); border-radius: var(--radius-md); background: var(--destructive-soft); color: var(--destructive); }

/* Seletor de data */
.date-trigger { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); text-align: left; }
.date-trigger svg, .date-placeholder { color: var(--tertiary); }
.date-field--emphasis .date-trigger { border-color: color-mix(in srgb, var(--foreground) 30%, var(--border-strong)); }
.date-overlay { position: fixed; inset: 0; z-index: 100; background: transparent; }
.date-popover { position: fixed; z-index: 101; width: 320px; max-width: calc(100vw - 32px); padding: var(--space-3); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); animation: fade-in var(--duration) var(--ease); }
.date-popover-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-left: var(--space-1); }
.date-popover-title h2 { font-size: var(--text-sm); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.date-month-header { display: flex; align-items: center; justify-content: space-between; margin: var(--space-1) 0; }
.date-month-toggle { min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font-size: var(--text-md); font-weight: 600; }
.date-month-toggle:hover { background: var(--surface-hover); }
.date-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.date-week [role=columnheader] { text-align: center; font-size: var(--text-xs); color: var(--tertiary); padding: var(--space-1) 0; }
.date-day { display: block; width: 100%; height: 36px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.date-day:hover { background: var(--surface-hover); }
.date-day--outside { color: var(--tertiary); }
.date-day--today { border-color: var(--border-strong); }
.date-day--selected, .date-day--selected:hover { color: var(--on-primary); background: var(--primary); }
.date-day:disabled { opacity: .35; cursor: not-allowed; }
.date-footer { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.date-jump { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: var(--space-3); padding: var(--space-3) 0; }
.date-jump > .button { grid-column: 1 / -1; }

/* Avaliação */
.rating-control { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.rating-stars { display: flex; border-radius: var(--radius-sm); }
.rating-star { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--tertiary); }
.rating-star:hover { background: var(--surface-hover); }
.rating-star-icon { position: relative; display: block; width: 22px; height: 22px; }
.rating-star-icon svg { width: 22px; height: 22px; }
.rating-star-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--foreground); pointer-events: none; }
.rating-star-fill svg { max-width: none; }
.rating-value { font-size: var(--text-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.rating-clear { min-height: 28px !important; padding: 0 8px !important; margin-top: var(--space-1); font-size: var(--text-sm) !important; }
.editorial-rating { display: inline-block; color: var(--foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating-scale, .editorial-rating--empty { color: var(--tertiary); font-size: var(--text-sm); }

/* Ações do livro (menu ···) */
.book-actions { position: relative; width: fit-content; }
.book-actions summary { list-style: none; display: grid; place-items: center; width: var(--control-h); height: var(--control-h); border-radius: var(--radius-sm); color: var(--muted); font-size: 1.125rem; letter-spacing: .05em; cursor: pointer; transition: background var(--duration) var(--ease), color var(--duration) var(--ease); }
.book-actions summary::-webkit-details-marker { display: none; }
.book-actions summary:hover, .book-actions[open] summary { color: var(--foreground); background: var(--surface-hover); }
.book-actions-popover { position: absolute; z-index: 20; right: 0; top: calc(100% + 6px); min-width: 180px; padding: var(--space-1); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.book-actions-popover a, .book-actions-popover .button { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-xs); color: var(--foreground); font-size: var(--text-md); font-weight: 400; box-shadow: none; }
.book-actions-popover a:hover, .book-actions-popover .button:hover { background: var(--surface-hover); }
.book-actions-popover .delete-book-trigger { color: var(--destructive); }

/* ============================== Início ============================== */

.home-date { color: var(--muted); font-size: var(--text-sm); margin-bottom: 8px; }
.home-date::first-letter { text-transform: uppercase; }
.home-dashboard { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.home-task-panel, .home-side-panel { min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.home-task-panel { display: flex; flex-direction: column; }
.home-panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.home-panel-heading > div { min-width: 0; }
.home-panel-heading h2 { display: flex; align-items: center; gap: 8px; font-size: var(--text-lg); font-weight: 600; line-height: 1.4; }
.home-panel-heading h2 svg { width: 17px; height: 17px; color: var(--muted); }
.home-panel-heading p { color: var(--muted); font-size: var(--text-sm); margin-top: 4px; }
.home-panel-heading .text-link { min-height: 24px; }
.home-task-empty { flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; padding: 16px 0; min-height: 260px; }
.home-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); color: var(--muted); }
.home-task-empty h3 { max-width: 30ch; font-size: var(--text-xl); line-height: 1.35; }
.home-task-empty p { max-width: 38ch; font-size: var(--text-md); color: var(--muted); line-height: 1.65; }
.home-aside { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.home-session-time { color: var(--muted); font-size: var(--text-sm); margin-bottom: 8px; }
.home-side-panel h3 { font-size: var(--text-lg); overflow-wrap: anywhere; margin-bottom: 4px; }
.home-session-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.home-reading-pick { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.home-reading-pick:hover { background: var(--surface-hover); }
.home-resume { margin-top: 40px; }
.home-resume > ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.home-resume li { min-width: 0; }
.home-resume li > a { display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.home-resume li > a:hover { border-color: var(--border-strong); }
.home-resume li span { font-size: var(--text-sm); color: var(--muted); }
.home-resume li strong { font-size: var(--text-lg); line-height: 1.4; overflow-wrap: anywhere; }
.home-resume li small { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); padding-top: 12px; margin-top: auto; }

/* ============================== Tarefas ============================== */
.task-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.task-filters button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.task-filters button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.task-filters button span { font-size: var(--text-xs); font-variant-numeric: tabular-nums; opacity: .8; }
.task-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.task-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 16px; padding: 20px; min-width: 0; }
.task-row + .task-row { border-top: 1px solid var(--border); }
.task-check { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--foreground); }
.task-check:hover { border-color: var(--foreground); }
.task-check[aria-checked="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.task-open { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; min-width: 0; min-height: 36px; padding: 0; border: 0; background: transparent; text-align: left; }
.task-open strong { font-size: var(--text-md); font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.task-open span { font-size: var(--text-sm); color: var(--muted); }
.task-open .task-description { color: var(--muted); font-size: var(--text-md); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.task-open:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.task-row--done .task-open strong { text-decoration: line-through; color: var(--muted); }
.task-row-actions { display: flex; align-items: center; gap: 4px; }
.task-list--compact { border: 0; border-radius: 0; }
.task-list--compact .task-row { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 16px 0; }
.task-list--compact .task-row:first-child { padding-top: 0; }
.task-calendar-help { display: flex; align-items: flex-start; gap: 12px; padding: 20px 0; margin-top: 20px; color: var(--muted); }
.task-calendar-help > svg { margin-top: 2px; }
.task-calendar-help h2 { color: var(--foreground); font-size: var(--text-md); font-weight: 500; margin-bottom: 6px; }
.task-calendar-help p { max-width: 76ch; font-size: var(--text-sm); line-height: 1.6; }
.task-details { min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.6; }

.home-section { margin-top: var(--space-12); }
.now-card { position: relative; padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.now-card--live { border-color: var(--border-strong); }
.now-label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 500; color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--foreground); box-shadow: 0 0 0 3px color-mix(in srgb, var(--foreground) 18%, transparent); animation: skeleton-pulse 2s ease-in-out infinite; }
.now-card h2 { margin-top: 6px; max-width: 720px; font-size: 1.5rem; line-height: 1.25; letter-spacing: -.02em; }
.now-meta { margin-top: 4px; color: var(--muted); }
.now-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-5); }
.home-columns { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-12); }
.day-list, .reading-list, .shortcut-list, .cycle-groups ul, .feature-list, .discipline-grid, .area-list { list-style: none; margin: 0; padding: 0; }
.day-item { display: grid; grid-template-columns: 22px 44px minmax(0, 1fr); align-items: start; gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--border); }
.day-item:first-child { padding-top: 0; }
.day-item:last-child { border-bottom: 0; }
.check { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-xs); background: transparent; color: var(--on-primary); transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.check:hover { border-color: var(--foreground); }
.day-item--done .check { background: var(--primary); border-color: var(--primary); }
.day-time { padding-top: 1px; color: var(--muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.day-title { font-weight: 500; line-height: 1.45; }
.day-title small { display: block; margin-top: 1px; color: var(--tertiary); font-size: var(--text-xs); font-weight: 400; }
.day-item--done .day-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.day-item--past .day-time { color: var(--tertiary); }
.flexible-note { margin-top: var(--space-3); color: var(--tertiary); font-size: var(--text-sm); }
.reading-list { display: grid; gap: var(--space-3); }
.reading-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--space-3); align-items: center; }
.reading-item strong { display: block; font-weight: 500; line-height: 1.35; }
.reading-item small { display: block; color: var(--muted); font-size: var(--text-sm); }
.reading-item:hover strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.reading-cover .book-cover-image, .reading-cover .book-cover-placeholder { border-radius: var(--radius-xs); }
.reading-cover .book-cover-placeholder { padding: 4px; }
.reading-cover .cover-author { display: none; }
.reading-cover .cover-title { font-size: 8px; line-height: 1.25; }
.reading-empty { display: grid; gap: var(--space-2); justify-items: start; }
.progress { height: 4px; border-radius: var(--radius-full); background: var(--primary-soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--foreground); border-radius: inherit; }
.cycle-progress { display: grid; gap: var(--space-2); max-width: 520px; }
.cycle-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6) var(--space-8); margin-top: var(--space-6); }
.group-label { margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: 500; color: var(--muted); }
.cycle-groups ul { display: grid; gap: 6px; }
.cycle-groups li { line-height: 1.45; }
.shortcut-list { display: grid; grid-auto-rows: 1fr; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: var(--space-2); }
.shortcut { position: relative; display: flex; min-width: 0; }
.shortcut-link { width: 100%; min-width: 0; height: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: var(--space-3); padding: 10px 48px 10px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); transition: border-color var(--duration) var(--ease); }
.shortcut-link:hover { border-color: var(--border-strong); }
.shortcut-link > svg { display: none; }
.shortcut-initial { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface-elevated); font-weight: 600; font-size: var(--text-sm); color: var(--muted); }
.shortcut-text strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shortcut-text small { display: block; color: var(--tertiary); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shortcut-edit { position: absolute !important; right: 8px; top: 10px; opacity: 1; border: 1px solid var(--border-strong); background: var(--surface); }
.shortcut:hover .shortcut-edit, .shortcut-edit:focus-visible { opacity: 1; }
@media (hover: none) { .shortcut-edit { opacity: 1; } }

/* ============================== Agenda ============================== */
.calendar { --hour: 60px; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.calendar-nav, .calendar-actions { display: flex; align-items: center; gap: var(--space-1); }
.calendar-actions { gap: var(--space-2); }
.calendar-title { margin-left: var(--space-2); font-size: var(--text-xl); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.calendar-title::first-letter { text-transform: uppercase; }
.calendar-today { margin-right: var(--space-1); }
.calendar-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.chip { min-height: 24px; padding: 0 8px; border: 0; border-radius: var(--radius-xs); font-size: var(--text-xs); font-weight: 500; color: var(--foreground); background: color-mix(in srgb, var(--kind) 20%, var(--surface)); box-shadow: inset 2px 0 0 var(--kind); }
.chip:hover { background: color-mix(in srgb, var(--kind) 30%, var(--surface)); }
:where(.chip, .event, .month-chip, .event-swatch) { --kind: var(--kind-5); }
.kind-0 { --kind: var(--kind-0); } .kind-1 { --kind: var(--kind-1); } .kind-2 { --kind: var(--kind-2); }
.kind-3 { --kind: var(--kind-3); } .kind-4 { --kind: var(--kind-4); } .kind-5 { --kind: var(--kind-5); }

.time-grid { --hour: 60px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.time-head, .time-canvas { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); }
.time-head { border-bottom: 1px solid var(--border); }
.time-day-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; border-left: 1px solid var(--border); }
.time-weekday { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--tertiary); }
.time-date { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: var(--text-xl); font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.is-today .time-weekday { color: var(--foreground); }
.is-today .time-date { background: var(--foreground); color: var(--background); }
.time-body { max-height: min(68vh, calc(100dvh - 240px)); overflow-y: auto; scrollbar-width: thin; }
.time-canvas { position: relative; background-image: linear-gradient(var(--border) 1px, transparent 1px); background-size: 100% var(--hour); }
.time-gutter { position: relative; }
.time-canvas .time-gutter span { position: absolute; right: 8px; transform: translateY(-50%); padding: 0 2px; background: var(--surface); font-size: 11px; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.time-column { position: relative; border-left: 1px solid var(--border); cursor: cell; }
.time-column:hover { background: color-mix(in srgb, var(--foreground) 2%, transparent); }
.time-column.is-past .event { opacity: .6; }
.event { position: absolute; left: 3px; right: 4px; z-index: 1; display: flex; flex-direction: column; gap: 1px; padding: 4px 8px 4px 9px; overflow: hidden; border: 0; border-radius: var(--radius-xs); text-align: left; color: var(--foreground); background: color-mix(in srgb, var(--kind) 20%, var(--surface)); box-shadow: inset 3px 0 0 var(--kind); cursor: pointer; transition: background var(--duration) var(--ease); }
.event:hover { background: color-mix(in srgb, var(--kind) 30%, var(--surface)); }
.event-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: var(--text-xs); font-weight: 600; line-height: 1.3; }
.event-title svg { display: inline; vertical-align: -1px; margin-right: 3px; }
.event-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.event--compact { flex-direction: row; align-items: center; gap: 6px; padding-block: 2px; }
.event--compact .event-title { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event--compact .event-time { white-space: nowrap; }
.event--short .event-title { -webkit-line-clamp: 1; }
.event--done { background: color-mix(in srgb, var(--kind) 8%, var(--surface)); }
.event--done .event-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--tertiary); }
.now-line { position: absolute; left: -1px; right: 0; z-index: 2; height: 2px; background: var(--foreground); pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--foreground); }

.month { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head span { padding: 8px; text-align: center; font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--tertiary); border-bottom: 1px solid var(--border); }
.month-cell { display: flex; flex-direction: column; gap: 2px; min-height: 108px; padding: 6px; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: transparent; color: var(--foreground); text-align: left; overflow: hidden; }
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell:hover { background: color-mix(in srgb, var(--foreground) 3%, transparent); }
.month-cell.is-outside { color: var(--tertiary); }
.month-cell.is-outside .month-chip { opacity: .45; }
.month-date { align-self: center; display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 2px; border-radius: 50%; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.month-cell.is-today .month-date { background: var(--foreground); color: var(--background); }
.month-chip { display: flex; align-items: center; gap: 5px; font-size: 11px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--kind); flex-shrink: 0; }
.month-more { padding-left: 11px; font-size: 11px; color: var(--tertiary); }

.event-dialog { padding-top: var(--space-5); }
.event-dialog-tools { display: flex; justify-content: flex-end; gap: 2px; margin: -8px -10px var(--space-1) 0; }
.event-swatch { display: block; width: 12px; height: 12px; margin-bottom: var(--space-3); border-radius: 4px; background: var(--kind); }
.event-dialog-when { margin-top: var(--space-1); color: var(--muted); }
.event-dialog-when::first-letter { text-transform: uppercase; }
.event-dialog-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); color: var(--tertiary); font-size: var(--text-sm); }
.event-dialog-done { width: 100%; margin-top: var(--space-5); }

/* ============================== Estudos ============================== */
.area-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-12); padding: 0; }
.area-tile { position: relative; display: flex; flex-direction: column; gap: 4px; height: 100%; min-height: 132px; padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease); }
.area-tile:hover { border-color: var(--border-strong); background: color-mix(in srgb, var(--surface) 70%, var(--surface-elevated)); }
.area-number { margin-bottom: auto; padding-bottom: var(--space-4); font-size: var(--text-xs); font-weight: 500; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.area-tile strong { font-size: var(--text-lg); font-weight: 600; letter-spacing: -.01em; }
.area-tile-now { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; color: var(--muted); font-size: var(--text-sm); line-height: 1.45; }
.area-tile-arrow { position: absolute; top: var(--space-5); right: var(--space-5); color: var(--tertiary); transition: transform var(--duration) var(--ease), color var(--duration) var(--ease); }
.area-tile:hover .area-tile-arrow { color: var(--foreground); transform: translate(2px, -2px); }

.area-switcher { display: flex; gap: 2px; margin: 0 0 var(--space-8); padding: 2px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.area-switcher::-webkit-scrollbar { display: none; }
.area-switcher a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--radius-xs); color: var(--muted); font-size: var(--text-sm); font-weight: 500; white-space: nowrap; transition: color var(--duration) var(--ease), background var(--duration) var(--ease); }
.area-switcher a:hover { color: var(--foreground); }
.area-switcher a[aria-current="page"] { color: var(--foreground); background: var(--surface-elevated); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border-strong); }
:root:not([data-theme="dark"]) .area-switcher { background: var(--surface-hover); }
:root:not([data-theme="dark"]) .area-switcher a[aria-current="page"] { background: var(--surface); }

.timeline-section .editorial-section-heading { margin-bottom: var(--space-4); }
.timeline, .timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px; background: var(--border-strong); }
.timeline-group + .timeline-group { margin-top: var(--space-6); }
.timeline-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-1); padding-left: var(--space-3); font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
.timeline-label span { font-weight: 400; color: var(--tertiary); }
.timeline-item { position: relative; }
.timeline-node { position: absolute; left: -24px; top: 15px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--background); }
.timeline-group--estudando .timeline-node { background: var(--foreground); border-color: var(--foreground); }
.timeline-group--meta .timeline-node { border-style: dashed; border-color: var(--muted); }
.timeline-group--concluido .timeline-node { background: var(--tertiary); border-color: var(--tertiary); }
.timeline-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: var(--space-6); width: 100%; padding: 8px var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); text-align: left; transition: background var(--duration) var(--ease); }
.timeline-card:hover { background: var(--surface-hover); }
.timeline-main { display: grid; gap: 1px; min-width: 0; }
.timeline-card strong { font-size: var(--text-md); font-weight: 500; line-height: 1.45; }
.timeline-group--concluido .timeline-card strong { color: var(--muted); font-weight: 400; }
.timeline-note { color: var(--tertiary); font-size: var(--text-sm); }
.timeline-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); color: var(--tertiary); font-size: var(--text-sm); white-space: nowrap; }
.timeline-meta span + span::before { content: "·"; margin-right: var(--space-2); }

.discipline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: var(--space-2); }
.discipline-grid li { display: flex; }
.discipline { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--foreground); text-align: left; transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease); }
button.discipline { cursor: pointer; }
button.discipline:hover { border-color: var(--border-strong); }
.discipline strong { display: block; font-weight: 500; line-height: 1.4; }
.discipline small { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--tertiary); font-size: var(--text-xs); }
.discipline--active { border-color: var(--border-strong); }
.discipline--active small { color: var(--foreground); }
.discipline--active small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--foreground); }
.feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--space-2); }
.feature-list li { padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); color: var(--muted); }

/* ============================== Cadernos (temas e anotações) ============================== */
.themes { margin-bottom: var(--space-12); }
.radar { margin-bottom: var(--space-12); }
.radar-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.radar-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.radar-filter button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); color: var(--muted); background: var(--surface); font-size: var(--text-sm); cursor: pointer; }
.radar-filter button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.radar-filter button span { font-variant-numeric: tabular-nums; opacity: .8; }
.radar-group + .radar-group { margin-top: var(--space-6); }
.radar-group .group-label { margin-bottom: var(--space-3); }
.radar .shortcut-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--space-3); }
.radar .shortcut-link { align-items: start; min-height: 112px; padding: 16px; }
.radar .radar-group--organizing .shortcut-link { padding-right: 56px; }
.radar .shortcut-text { min-width: 0; }
.radar .shortcut-text strong { white-space: normal; overflow-wrap: anywhere; min-height: 2.8em; line-height: 1.4; }
.radar .shortcut-text small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; min-height: 2.9em; margin-top: 6px; }
.radar .shortcut-link > svg { margin-top: 3px; }
.theme-grid { grid-auto-rows: 1fr; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--space-4); }
.theme-card { min-width: 0; display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 148px; padding: var(--space-4) var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  transition: border-color var(--duration) var(--ease), transform var(--duration) var(--ease), background var(--duration) var(--ease); }
/* Subject cards: content and controls always stay inside their own grid cell. */
.theme-grid > li { min-width: 0; }
.theme-open { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; width: 100%; }
.theme-open strong { overflow-wrap: anywhere; }
.study-card-kind { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-sm); line-height: 1.4; }
.study-card-kind svg, .study-card-actions svg, .catalog-remove svg, .study-management svg { flex: 0 0 auto; width: 16px; height: 16px; }
.study-card-actions { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.study-card-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--background); color: var(--foreground); font-size: var(--text-sm); font-weight: 500; cursor: pointer; }
.study-card-actions button:hover { background: var(--surface-hover); }
.study-card-actions button.study-delete { color: var(--destructive); }
.study-card-actions button:focus-visible, .catalog-remove:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; }
.theme-card--subject { border-top: 3px solid var(--foreground); }
.theme-card--topic { border-top: 3px solid var(--border-strong); }
.study-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.study-breadcrumb a { text-decoration: underline; text-underline-offset: 3px; }
.study-eyebrow { margin-bottom: 8px; color: var(--muted); font-size: var(--text-sm); }
.study-management { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-shrink: 0; }
.study-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.study-empty > svg { width: 32px; height: 32px; color: var(--muted); }
.study-empty h3 { font-size: var(--text-lg); font-weight: 600; }
.study-empty p { max-width: 480px; color: var(--muted); font-size: var(--text-md); line-height: 1.6; }
.discipline-grid .catalog-item { display: grid; grid-template-columns: minmax(0, 1fr) 44px; min-width: 0; padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); align-items: center; gap: 4px; }
.catalog-item .discipline { border: 0; border-radius: var(--radius-sm); min-width: 0; height: 100%; padding: 10px; background: transparent; }
.catalog-item .discipline:hover { background: var(--surface-hover); }
.catalog-item .discipline strong { overflow-wrap: anywhere; }
.catalog-item .discipline small { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); margin-top: 8px; }
.catalog-remove { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--background); color: var(--destructive); cursor: pointer; }
.catalog-remove:hover { background: var(--destructive-soft); }
.theme-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.theme-card strong { font-size: var(--text-lg); font-weight: 600; letter-spacing: -.015em; line-height: 1.35; }
.theme-status { font-size: var(--text-xs); color: var(--muted); }
.theme-card--estudando .theme-status { color: var(--foreground); }
.theme-card--concluido { background: transparent; }
.theme-card--concluido strong { color: var(--muted); font-weight: 500; }
.theme-preview { color: var(--muted); font-size: var(--text-sm); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.theme-footer { width: 100%; flex-wrap: wrap; display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: var(--space-3); font-size: var(--text-sm); font-weight: 500; color: var(--foreground); }
.timeline-notes { display: inline-flex; align-items: center; gap: 4px; }

.notebook-header { margin-bottom: var(--space-6); }
.notebook-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-6); }
.notebook-heading h1 { font-size: var(--text-2xl); }
.notebook-note { margin-top: var(--space-2); color: var(--muted); font-size: var(--text-md); max-width: 640px; }
.notebook { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 560px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.note-list { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); border-right: 1px solid var(--border); background: var(--background); min-width: 0; }
.note-add { width: 100%; }
.note-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; overflow-y: auto; }
.note-item { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); text-align: left; transition: background var(--duration) var(--ease); }
.note-item:hover { background: var(--surface); }
.note-item--active, .note-item--active:hover { background: var(--surface-elevated); box-shadow: inset 0 0 0 1px var(--border); }
.note-item strong { font-size: var(--text-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-snippet { font-size: var(--text-sm); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-date { font-size: var(--text-xs); color: var(--tertiary); }
.note-pane { min-width: 0; display: flex; flex-direction: column; }
.note-back { display: none; }
.note-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.note-editor-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface); }
.note-toolbar { display: flex; flex-wrap: wrap; gap: 2px; min-height: 32px; }
.tool { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--muted); transition: background var(--duration) var(--ease), color var(--duration) var(--ease); }
.tool:hover { background: var(--surface-elevated); color: var(--foreground); }
.tool--active { background: var(--surface-elevated); color: var(--foreground); box-shadow: inset 0 0 0 1px var(--border-strong); }
.note-editor-status { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.save-state { font-size: var(--text-xs); color: var(--tertiary); min-width: 64px; text-align: right; }
.save-state--error { color: var(--destructive); }
.icon-action { display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 32px; justify-content: center; padding: 0 8px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
.icon-action:hover { background: var(--surface-elevated); color: var(--foreground); }
.icon-action--danger, .icon-action--danger:hover { color: var(--destructive); background: color-mix(in srgb, var(--destructive) 12%, transparent); }
.note-title { width: 100%; padding: var(--space-6) var(--space-8) var(--space-2); border: 0; outline: 0; background: transparent; color: var(--foreground); font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.025em; }
.note-title::placeholder { color: var(--tertiary); }
.note-content { flex: 1; padding: 0 var(--space-8) var(--space-10); cursor: text; }
.note-body { min-height: 360px; outline: none; font-size: var(--text-lg); line-height: 1.7; color: var(--foreground); }
.note-body > * + * { margin-top: .75em; }
.note-body p { margin: 0; }
.note-body h2 { margin-top: 1.4em; font-size: var(--text-xl); font-weight: 600; letter-spacing: -.02em; line-height: 1.35; }
.note-body h3 { margin-top: 1.2em; font-size: var(--text-lg); font-weight: 600; line-height: 1.4; }
.note-body ul, .note-body ol { margin: .5em 0 0; padding-left: 1.4em; }
.note-body ul { list-style: disc; }
.note-body ol { list-style: decimal; }
.note-body li::marker { color: var(--muted); }
.note-body li + li { margin-top: .25em; }
.note-body li p { margin: 0; }
.note-body blockquote { margin: 1em 0 0; padding: 2px 0 2px var(--space-4); border-left: 2px solid var(--border-strong); color: var(--muted); }
.note-body strong { font-weight: 600; }
.note-body code { font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--surface-elevated); }
.note-body p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; height: 0; color: var(--tertiary); pointer-events: none; }
.note-materials { padding: var(--space-5); border-bottom: 1px solid var(--border-strong); background: var(--background); }
.material-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.material-heading h2 { font-size: var(--text-lg); font-weight: 600; }
.material-heading h3 { font-size: var(--text-md); font-weight: 600; overflow-wrap: anywhere; }
.material-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.material-hint { margin-top: var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.material-status { margin-top: var(--space-3); font-size: var(--text-sm); overflow-wrap: anywhere; }
.material-status:empty { display: none; }
.material-form { display: grid; gap: var(--space-3); margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.material-form label { display: grid; gap: var(--space-2); font-size: var(--text-sm); font-weight: 500; }
.material-card { margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.material-summary { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.material-summary h4 { margin-bottom: var(--space-2); font-size: var(--text-md); }
.material-summary p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.material-summary small { display: block; margin-top: var(--space-3); color: var(--muted); }
.notebook-empty { border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }
@media (max-width: 767px) {
  .studies .editorial-section-heading { flex-wrap: wrap; align-items: flex-start; gap: 16px; }
  .studies .editorial-section-heading > div { min-width: 0; flex: 1 1 220px; }
  .studies .editorial-section-heading > .button { min-height: 44px; }
  .radar-actions { width: 100%; }
  .radar-actions > .button { flex: 1 1 auto; min-height: 44px; }
  .radar-filter { gap: 8px; }
  .radar-filter button { min-height: 44px; }
  .study-management { width: 100%; }
  .study-management .button { min-height: 44px; }
  .study-card-actions button { min-height: 44px; }
  .study-empty { padding: 32px 20px; }
  .study-empty .button { max-width: 100%; white-space: normal; height: auto; min-height: 44px; }
  .material-actions > .button { min-height: 44px; max-width: 100%; height: auto; white-space: normal; text-align: left; }
  .material-heading > div { min-width: 0; }
  .notebook-heading { flex-direction: column; gap: var(--space-4); }
  .notebook { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .note-list { border-right: 0; }
  .note-pane { display: none; }
  .notebook--editing .note-list { display: none; }
  .notebook--editing .note-pane { display: flex; }
  .note-back { display: inline-flex; margin: var(--space-3) var(--space-4) 0; }
  .note-editor-top { padding-inline: var(--space-2); }
  .note-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .note-toolbar::-webkit-scrollbar { display: none; }
  .tool { flex-shrink: 0; }
  .save-state { min-width: 0; }
  .note-title { padding: var(--space-4) var(--space-4) var(--space-2); font-size: var(--text-xl); }
  .note-content { padding: 0 var(--space-4) var(--space-8); }
  .note-body { min-height: 50vh; }
}

/* ============================== Biblioteca ============================== */
.library-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-8); border-bottom: 1px solid var(--border); }
.library-tabs { display: flex; gap: var(--space-5); overflow-x: auto; scrollbar-width: none; }
.library-tab, .year-item { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: var(--text-md); font-weight: 500; white-space: nowrap; transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.library-tab span { color: var(--tertiary); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.library-tab:hover, .year-item:hover { color: var(--foreground); }
.library-tab--active, .year-item--active { color: var(--foreground); border-bottom-color: var(--foreground); }
.library-tools { display: flex; align-items: center; gap: var(--space-2); padding-bottom: var(--space-2); }
.library-search-field { display: flex; align-items: center; gap: var(--space-2); width: 220px; height: var(--control-h); padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--tertiary); box-shadow: var(--shadow-sm); transition: border-color var(--duration) var(--ease); }
.library-search-field:focus-within { border-color: var(--foreground); }
.library-search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--foreground); font-size: var(--text-md); }
.library-search-field input::placeholder { color: var(--tertiary); }
.library-search-field input::-webkit-search-cancel-button { filter: grayscale(1); }
.library .active-selection { margin-top: calc(var(--space-4) * -1); }
.library-results { animation: results-enter 180ms ease-out; }
.year-group + .year-group { margin-top: var(--space-12); }
.year-group-title { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-5); font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.year-group-title small { font-size: var(--text-sm); font-weight: 400; color: var(--tertiary); letter-spacing: 0; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--space-8) var(--space-6); }
.book-card { height: 100%; display: flex; flex-direction: column; min-width: 0; }
.book-card-link { flex: 1; min-width: 0; display: flex; flex-direction: column; border-radius: var(--radius-sm); }
.book-card-cover { position: relative; display: block; }
.book-card h3 { min-height: 2.7em; margin-top: var(--space-3); font-size: var(--text-md); font-weight: 500; line-height: 1.35; letter-spacing: 0; overflow-wrap: anywhere; }
.book-card-author { margin-top: 2px; font-size: var(--text-sm); color: var(--muted); overflow-wrap: anywhere; }
.book-reading-status { position: absolute; left: 8px; top: 8px; z-index: 1; display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-full); background: color-mix(in srgb, var(--background) 82%, transparent); color: var(--foreground); font-size: var(--text-xs); font-weight: 500; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px var(--border); }
.book-cover-image, .book-cover-placeholder { border-radius: var(--radius-sm); transition: transform 300ms var(--ease), box-shadow 300ms var(--ease); }
.book-cover-image { position: relative; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; background: var(--surface-elevated); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.book-cover-image img { object-position: center; }
.book-cover-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 2 / 3; padding: var(--space-4) var(--space-3); overflow: hidden; background: linear-gradient(180deg, var(--surface-elevated), var(--surface)); border: 1px solid var(--border); text-align: center; overflow-wrap: anywhere; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--foreground) 6%, transparent); }
.cover-label, .cover-rule { display: none; }
.cover-title { font-size: var(--text-md); font-weight: 600; line-height: 1.3; letter-spacing: -.01em; color: var(--foreground); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cover-author { font-size: var(--text-xs); color: var(--muted); }
@media (hover: hover) {
  .book-card-link:hover .book-cover-image, .book-card-link:hover .book-cover-placeholder { transform: translateY(-2px); box-shadow: var(--shadow-md); }
}
.loading-cover { display: block; width: 100%; aspect-ratio: 2 / 3; border-radius: var(--radius-sm); }
.loading-title { height: 16px; width: 85%; margin-top: var(--space-3); }
.loading-author { height: 14px; width: 60%; margin-top: var(--space-2); }
.loading-line { height: 12px; width: 75%; margin-top: var(--space-3); }
.loading-list { display: grid; gap: var(--space-6); }
.loading-book--row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-4); }
.loading-book--row .loading-title { margin-top: 0; }

/* Detalhe do livro */
.detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-8); }
.detail-toolbar .detail-back { margin: 0; }
.detail-toolbar-actions { display: flex; align-items: center; gap: var(--space-2); }
.book-detail-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-12); align-items: start; }
.book-detail-layout > .loading-cover { max-width: 220px; }
.book-detail-layout .skeleton-panel { margin-top: var(--space-8); }
.detail-cover { max-width: 220px; }
.detail-cover .book-cover-image, .detail-cover .book-cover-placeholder { border-radius: var(--radius-md); }
.detail-cover .cover-title { font-size: var(--text-lg); }
.detail-cover .cover-author { font-size: var(--text-sm); }
.detail-information { min-width: 0; }
.detail-status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: var(--radius-full); background: var(--surface-elevated); border: 1px solid var(--border); color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
.book-detail h1 { margin-top: var(--space-3); font-size: var(--text-3xl); line-height: 1.15; letter-spacing: -.025em; overflow-wrap: anywhere; }
.detail-author { margin-top: 4px; font-size: var(--text-lg); color: var(--muted); }
.detail-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-4); margin-top: var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.detail-meta .editorial-rating { font-size: var(--text-lg); font-weight: 500; }
.detail-notes { max-width: 62ch; margin-top: var(--space-6); font-size: 0.9375rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-4) var(--space-6); margin: var(--space-8) 0 0; padding-top: var(--space-6); border-top: 1px solid var(--border); }
.detail-facts dt { font-size: var(--text-xs); color: var(--tertiary); }
.detail-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

/* Formulário do livro */
.book-form { max-width: 880px; }
.book-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.book-form legend { padding: 0; margin-bottom: var(--space-3); font-size: var(--text-lg); font-weight: 600; }
.book-form--compact > fieldset { margin-bottom: var(--space-8); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-5); }
.form-full { grid-column: 1 / -1; }
.compact-reading-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-10); margin-bottom: var(--space-8); }
.compact-cover-preview { width: 112px; }
.compact-cover-preview .cover-title { font-size: var(--text-sm); }
.compact-cover-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); margin-top: var(--space-3); }
.compact-cover-actions .button, .cover-methods .button { min-height: 32px; padding: 0 12px; font-size: var(--text-sm); }
.cover-options { display: grid; gap: var(--space-3); padding-top: var(--space-3); }
.cover-methods { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.form-more { border-top: 1px solid var(--border); padding-top: var(--space-2); margin-bottom: var(--space-2); }
.form-more > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; list-style: none; cursor: pointer; border-radius: var(--radius-sm); font-weight: 500; }
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary svg { color: var(--tertiary); transition: transform var(--duration) var(--ease); }
.form-more[open] > summary svg { transform: rotate(180deg); }
.form-more[open] > fieldset { padding: var(--space-3) 0 var(--space-4); animation: results-enter 180ms var(--ease); }
.book-notes { min-height: 104px; }
.year-auto-reset { align-self: end; justify-self: start; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.compact-storage-note .storage-note { margin-top: var(--space-6); }

/* Estatísticas */
.year-strip { margin-bottom: var(--space-8); border-bottom: 1px solid var(--border); }
.year-navigation { display: flex; }
.year-navigation--horizontal { gap: var(--space-5); overflow-x: auto; scrollbar-width: none; }
.year-navigation--vertical { flex-direction: column; gap: 2px; }
.year-navigation--vertical .year-item { border: 0; border-radius: var(--radius-sm); padding: 0 10px; margin: 0; }
.year-navigation--vertical .year-item--active { background: var(--surface-hover); }
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-3); }
.stat-tiles > div { min-width: 0; display: flex; flex-direction: column-reverse; gap: 2px; padding: var(--space-4) var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.stat-tiles dt { font-size: var(--text-sm); color: var(--muted); }
.stat-tiles dd { margin: 0; font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--tertiary); font-size: var(--text-sm); }
.stats-full { grid-column: 1 / -1; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-10) var(--space-12); margin-top: var(--space-10); }
.reading-distribution h2 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.status-statistics { margin: 0; }
.status-statistics > div { display: flex; justify-content: space-between; gap: var(--space-4); padding: 10px 0; border-bottom: 1px solid var(--border); }
.status-statistics > div:last-child { border-bottom: 0; }
.status-statistics dt a { transition: color var(--duration) var(--ease); }
.status-statistics dt a:hover { color: var(--muted); }
.status-statistics dt { min-width: 0; overflow-wrap: anywhere; }
.status-statistics dd { flex-shrink: 0; margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============================== Configurações ============================== */
.settings-list { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.settings-section { display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); padding: var(--space-5) var(--space-6); }
.settings-section + .settings-section { border-top: 1px solid var(--border); }
.settings-section h2 { font-size: var(--text-md); font-weight: 600; letter-spacing: 0; }
.settings-section > div { min-width: 0; }
.settings-section > .button { flex-shrink: 0; }
.settings-section .secondary-text { max-width: 560px; margin-top: 2px; }
.account-gate { width: min(100% - 32px, 480px); margin: 12vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; display: grid; gap: 16px; }
.auth-page { margin: 0; min-height: 100dvh; background: var(--background); color: var(--foreground); font-family: system-ui, sans-serif; }
.auth-page *, .auth-page *::before, .auth-page *::after { box-sizing: border-box; }
.auth-page .account-gate { margin: clamp(24px, 10vh, 120px) auto; gap: 24px; padding: clamp(20px, 5vw, 32px); box-shadow: var(--shadow-md); }
.auth-page h1 { font-size: clamp(24px, 6vw, 30px); line-height: 1.2; letter-spacing: -.035em; margin: 0 0 12px; }
.auth-page p { margin: 0; line-height: 1.6; }
.auth-form { display: grid; gap: 20px; }
.auth-form .input, .auth-form .button { min-height: 46px; width: 100%; }
.auth-link { color: var(--foreground); text-align: center; font-weight: 500; text-underline-offset: 4px; }
.auth-caption { font-size: var(--text-sm); color: var(--muted); }
.auth-error { color: var(--destructive); background: var(--destructive-soft); padding: 12px; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.account-settings { border-top: 1px solid var(--border); }
.account-management { padding: var(--space-6); display: grid; gap: 16px; }
.account-invite { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.account-invite > .field { flex: 1 1 220px; min-width: 0; }
.account-members { list-style: none; padding: 0; display: grid; gap: 12px; }
.account-members li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.account-members li > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; flex: 1 1 180px; }
.sync-status { font-size: var(--text-sm); color: var(--muted); margin-bottom: 12px; }
.theme-control { width: 180px; flex-shrink: 0; }
.theme-control label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ============================== Animações ============================== */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawer-in { from { transform: translateX(-16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes drawer-right { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes dialog-in { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes skeleton-pulse { 50% { opacity: .55; } }
@keyframes results-enter { from { opacity: .65; } to { opacity: 1; } }

/* ============================== Responsivo ============================== */
@media (pointer: coarse) {
  :root { --control-h: 44px; --field-h: 44px; }
  .nav-item { min-height: 44px; }
  .segmented-item, .area-switcher a { min-height: 44px; }
  .input, .select, textarea { font-size: 16px; }
}
@media (max-width: 1023px) {
  .desktop-sidebar { display: none; }
  .app-content { margin-left: 0; }
  .menu-button { display: inline-flex !important; }
  .app-header { padding: 0 var(--space-4) 0 var(--space-2); }
  .page-container { padding: var(--space-8) var(--space-6) var(--space-12); }
  .home-columns { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .home-dashboard { grid-template-columns: minmax(0, 1fr); }
  .home-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-detail-layout { grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-8); }
  .detail-cover, .book-detail-layout > .loading-cover { max-width: 180px; }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
  :root { --header-h: 52px; }
  h1 { font-size: 1.5rem; }
  .page-container { padding: var(--space-6) var(--space-4) var(--space-12); }
  .page-heading { flex-direction: column; align-items: stretch; gap: var(--space-4); margin-bottom: var(--space-6); }
  .page-heading > div:first-child { flex: none; width: 100%; }
  .page-heading > .button { align-self: flex-start; }
  .home-section { margin-top: var(--space-10); }
  .home-dashboard { gap: 16px; }
  .home-aside { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .home-task-panel, .home-side-panel { padding: 20px; }
  .home-task-empty { min-height: 0; padding: 8px 0; }
  .home-task-empty .button { max-width: 100%; min-height: 44px; white-space: normal; padding: 10px 12px; }
  .home-resume > ul { grid-template-columns: minmax(0, 1fr); }
  .home-session-actions > .button { min-height: 44px; }
  .task-row { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .task-check { width: 44px; height: 44px; }
  .task-row-actions { grid-column: 2; justify-content: flex-end; }
  .task-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-filters button { min-height: 44px; }
  .task-list--compact .task-row { grid-template-columns: 44px minmax(0, 1fr); }

  .now-card { padding: var(--space-5); }
  .now-card h2 { font-size: var(--text-xl); }
  .now-actions .button { flex: 1; }
  .cycle-groups { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .shortcut-list { grid-template-columns: minmax(0, 1fr); }

  .calendar-toolbar { flex-direction: column; align-items: stretch; }
  .calendar-actions { justify-content: space-between; }
  .calendar-title { font-size: var(--text-lg); }
  .time-head, .time-canvas { grid-template-columns: 40px repeat(var(--cols), minmax(0, 1fr)); }
  .time-canvas .time-gutter span { right: 4px; }
  .month-cell { min-height: 64px; padding: 4px 2px; }
  .month-chip { justify-content: center; gap: 0; font-size: 0; }
  .month-head span { padding: 6px 2px; letter-spacing: 0; }

  .area-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .area-tile { min-height: 0; padding: var(--space-4); }
  .area-number { padding-bottom: var(--space-2); }
  .area-tile-arrow { top: var(--space-4); right: var(--space-4); }
  .area-switcher { margin-bottom: var(--space-6); }
  .timeline { padding-left: 20px; }
  .timeline-node { left: -20px; }
  .timeline-label { padding-left: var(--space-2); }
  .timeline-card { grid-template-columns: minmax(0, 1fr); padding-inline: var(--space-2); }
  .timeline-card .timeline-meta { justify-content: flex-start; white-space: normal; font-size: var(--text-xs); }

  .library-toolbar { flex-direction: column-reverse; align-items: stretch; gap: var(--space-3); border-bottom: 0; }
  .library-tabs { border-bottom: 1px solid var(--border); }
  .library-tools { padding-bottom: 0; }
  .library-search-field { flex: 1; width: auto; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-4); }
  .detail-toolbar { margin-bottom: var(--space-6); }
  .book-detail-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .detail-cover, .book-detail-layout > .loading-cover { width: 160px; max-width: 160px; }
  .book-detail h1 { font-size: var(--text-2xl); }
  .form-grid, .form-row { grid-template-columns: minmax(0, 1fr); }
  .compact-reading-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .form-actions .button { flex: 1; }
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .settings-section { flex-direction: column; align-items: stretch; gap: var(--space-3); padding: var(--space-4); }
  .theme-control { width: 100%; }

  .confirm-dialog { padding: var(--space-5); }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .dialog-remove { margin-right: 0; }
  .filter-drawer { inset: auto 0 0 0; width: 100%; max-height: 90dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: fade-in var(--duration) var(--ease); }
  .command-dialog { top: 8vh; }
  .date-overlay { background: var(--overlay); }
  .date-popover { left: 16px !important; right: 16px; top: auto !important; bottom: 16px; width: auto; max-width: none; max-height: calc(100dvh - 32px); overflow-y: auto; }
}
@media (max-width: 340px) { .book-grid { grid-template-columns: minmax(0, 1fr); } }

/* ============================== Movimento reduzido ============================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
