*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --surface-muted: #f3f4f6;
    --text: #111827;
    --text-soft: #374151;
    --muted: #6b7280;
    --muted-soft: #9ca3af;
    --line: #e9eaec;
    --line-strong: #d1d5db;
    --primary: #3b5bdb;
    --primary-hover: #2f4fc7;
    --primary-soft: #eff3ff;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    --radius: 10px;
    --control-height: 2.65rem;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family:
        "Figtree",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-color: #d1d5db transparent;
    scrollbar-width: thin;
}

* {
    scrollbar-color: #d1d5db transparent;
    scrollbar-width: thin;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
    background: none;
    cursor: pointer;
}

input,
textarea,
select {
    min-width: 0;
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 2px;
    height: 2px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

.sidebar {
    z-index: 100;
    display: flex;
    width: 248px;
    min-width: 248px;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--surface);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.brand-icon {
    display: flex;
    align-items: center;
}

.brand-name {
    color: var(--text);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.sidebar-close-btn,
.hamburger-btn,
.nav-btn,
.theme-toggle-btn,
.mini-cal-nav,
.day-panel-add,
.modal-close,
.filter-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-soft);
    border-radius: 6px;
    transition:
        background 0.15s,
        color 0.15s,
        transform 0.12s;
}

.sidebar-close-btn:hover,
.hamburger-btn:hover,
.theme-toggle-btn:hover,
.mini-cal-nav:hover,
.day-panel-add:hover,
.modal-close:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.nav-btn:hover {
    background: #ffffff;
    color: var(--text);
}

.sidebar-close-btn {
    display: none;
    padding: 0.25rem;
}

.sidebar-new-btn-wrap {
    padding: 1rem 1.25rem 0.5rem;
}

.btn-new-task,
.btn-save,
.btn-empty-add,
.fab {
    background: var(--primary);
    color: #ffffff;
    transition:
        background 0.18s,
        transform 0.12s;
}

.btn-new-task:hover,
.btn-save:hover,
.btn-empty-add:hover,
.fab:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-new-task {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-section {
    padding: 1rem 1.25rem 0;
}

.sidebar-section-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--muted-soft);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-mobile-views {
    display: none;
}

.mini-calendar {
    padding: 0.75rem 1.25rem 0;
}

.mini-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}

.mini-cal-title {
    color: var(--text-soft);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-transform: capitalize;
}

.mini-cal-nav {
    padding: 0.25rem;
}

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.mini-cal-day-name {
    padding: 0.25rem 0;
    color: var(--muted-soft);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.mini-cal-day {
    position: relative;
    padding: 0.3rem 0.1rem;
    border-radius: 6px;
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    transition:
        background 0.12s,
        color 0.12s;
}

.mini-cal-day:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.mini-cal-day.other-month {
    color: var(--line-strong);
}

.mini-cal-day.today {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.mini-cal-day.selected {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.mini-cal-day.has-tasks::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
    transform: translateX(-50%);
}

.mini-cal-day.selected.has-tasks::after {
    background: rgba(255, 255, 255, 0.75);
}

.sidebar-view-toggle,
.view-toggle {
    display: flex;
    gap: 0.125rem;
    padding: 0.25rem;
    border-radius: 9px;
    background: var(--surface-muted);
    min-height: var(--control-height);
}

.sidebar-view-toggle {
    width: 100%;
}

.sidebar-view-toggle .view-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 0.45rem;
}

.view-btn {
    min-width: 4.2rem;
    min-height: calc(var(--control-height) - 0.5rem);
    padding: 0 0.7rem;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 600;
    transition:
        background 0.12s,
        color 0.12s;
}

.view-btn:hover:not(.active) {
    background: #ffffff;
    color: var(--text);
}

.view-btn.active {
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.type-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.type-filter-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.55rem;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    transition:
        background 0.12s,
        color 0.12s;
}

.type-filter-item:hover {
    background: var(--surface-soft);
    color: var(--text-soft);
}

.type-filter-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.type-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
}

.dot-all {
    background: #3b5bdb;
}
.dot-prova {
    background: #ef4444;
}
.dot-trabalho {
    background: #f97316;
}
.dot-estudo {
    background: #3b82f6;
}
.dot-aula {
    background: #22c55e;
}
.dot-reuniao {
    background: #f59e0b;
}
.dot-pessoal {
    background: #8b5cf6;
}
.dot-outro {
    background: #9ca3af;
}

.sidebar-upcoming {
    flex: 1;
    margin-bottom: 0.5rem;
}

.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upcoming-item {
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr);
    align-items: center;
    gap: 0.7rem;
    min-height: 4rem;
    padding: 0.65rem 0.8rem;
    border-radius: 9px;
    background: var(--surface-soft);
    text-align: left;
    transition: background 0.12s;
}

.upcoming-item:hover {
    background: var(--surface-muted);
}

.upcoming-color {
    width: 3px;
    height: 2.4rem;
    border-radius: 2px;
}

.upcoming-content {
    min-width: 0;
}

.upcoming-item-title {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upcoming-item-meta,
.upcoming-empty {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted-soft);
    font-size: 0.8125rem;
    font-weight: 400;
}

.sidebar-data {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: auto;
    padding: 1.7rem 1.25rem 1.25rem;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        var(--surface) 22%
    );
}

.data-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.data-btn {
    min-height: 2.125rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dde3ea;
    border-radius: var(--radius);
    background: #f8fafc;
    color: #4b5563;
    font-size: 0.8125rem;
    font-weight: 600;
    transition:
        background 0.18s,
        color 0.18s,
        transform 0.12s;
}

.data-btn.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.data-btn:hover {
    transform: translateY(-1px);
}

.data-btn.primary:hover {
    background: var(--primary-hover);
}

.main-area {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.topbar-left,
.topbar-right {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.75rem;
}

.topbar-right {
    justify-content: flex-end;
}

.hamburger-btn {
    display: none;
    padding: 0.45rem;
}

.nav-controls {
    display: flex;
    align-items: center;
    border-radius: 9px;
    background: var(--surface-muted);
    padding: 0.25rem;
    min-height: var(--control-height);
}

.nav-btn {
    min-height: calc(var(--control-height) - 0.5rem);
    min-width: calc(var(--control-height) - 0.5rem);
    padding: 0 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.today-btn {
    min-width: 4.2rem;
}

.topbar-title {
    overflow: hidden;
    color: var(--text);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    text-transform: capitalize;
    white-space: nowrap;
}

.search-wrap {
    display: flex;
    width: min(15rem, 22vw);
    min-height: var(--control-height);
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--muted-soft);
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.search-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.12);
}

.search-input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.875rem;
}

.search-input::placeholder {
    color: var(--muted-soft);
}

.theme-toggle-btn {
    width: var(--control-height);
    height: var(--control-height);
}

.topbar-new-btn {
    width: auto;
    min-height: var(--control-height);
    padding: 0 1rem;
    font-size: 0.875rem;
}

.filters-bar {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.filters-inner {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 0.625rem;
    padding: 0 1.5rem;
}

.filters-label {
    color: var(--muted-soft);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filter-select {
    min-height: 2.35rem;
    padding: 0 2.75rem 0 0.9rem;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: 0;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 0.8125rem;
    font-weight: 600;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 5.25L7 8.75L10.5 5.25' stroke='%236b7280' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: calc(100% - 1rem) 50%;
    background-size: 0.875rem 0.875rem;
    background-repeat: no-repeat;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select::-ms-expand {
    display: none;
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.12);
}

.filter-clear-btn {
    gap: 0.35rem;
    min-width: 4.5rem;
    min-height: 2.35rem;
    padding: 0 0.55rem;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    font-size: 0.8125rem;
    font-weight: 600;
}

.filter-select:hover,
.filter-clear-btn:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.content-area {
    display: flex;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.calendar-panel {
    min-width: 0;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem;
    scrollbar-width: thin;
}

.sidebar,
.calendar-panel,
.timeline-track,
.timeline-cards,
.day-tasks-list,
.modal-form {
    scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar,
.calendar-panel::-webkit-scrollbar,
.timeline-track::-webkit-scrollbar,
.timeline-cards::-webkit-scrollbar,
.day-tasks-list::-webkit-scrollbar,
.modal-form::-webkit-scrollbar {
    width: 2px;
    height: 2px;
}

.calendar-month,
.calendar-agenda,
.calendar-timeline {
    height: 100%;
}

.calendar-month {
    padding-top: 1rem;
}

.month-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    padding: 0 0.25rem 0.55rem;
}

.weekday-header {
    color: var(--muted-soft);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.month-day {
    position: relative;
    min-height: 112px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 0.65rem;
    text-align: left;
    transition:
        border-color 0.15s,
        box-shadow 0.15s,
        transform 0.12s;
}

.month-day:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.month-day.other-month {
    background: #f2f4f7;
    opacity: 0.72;
}

.month-day.selected {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.month-day.today .day-number {
    background: var(--primary);
    color: #ffffff;
}

.day-number {
    display: grid;
    width: 1.7rem;
    height: 1.7rem;
    place-items: center;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.month-task-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.45rem;
}

.month-task-pill {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    padding: 0.2rem 0.35rem 0.2rem 0.8rem;
    font-size: 0.72rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.month-task-pill::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.34rem;
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 999px;
    background: currentColor;
    transform: translateY(-50%);
}

.month-task-pill.type-prova,
.week-task-pill.type-prova {
    background: #fef2f2;
    color: #dc2626;
}

.month-task-pill.type-trabalho,
.week-task-pill.type-trabalho {
    background: #fff7ed;
    color: #ea580c;
}

.month-task-pill.type-estudo,
.week-task-pill.type-estudo {
    background: #eff6ff;
    color: #2563eb;
}

.month-task-pill.type-aula,
.week-task-pill.type-aula {
    background: #ecfdf5;
    color: #16a34a;
}

.month-task-pill.type-reuniao,
.week-task-pill.type-reuniao {
    background: #fffbeb;
    color: #d97706;
}

.month-task-pill.type-pessoal,
.week-task-pill.type-pessoal {
    background: #f5f3ff;
    color: #7c3aed;
}

.month-task-pill.type-outro,
.week-task-pill.type-outro {
    background: #f3f4f6;
    color: #6b7280;
}

.month-task-pill.completed,
.week-task-pill.completed {
    background: #eef0f4;
    color: #9aa3b2;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: currentColor;
}

.tasks-more {
    margin-top: 0.1rem;
    color: var(--muted-soft);
    font-size: 0.72rem;
    font-weight: 500;
}

.calendar-week {
    height: auto;
    min-height: 0;
    padding-top: 1rem;
    overflow: visible;
}

.week-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 6px;
}

.week-header-day {
    min-height: 4.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 0.65rem;
    text-align: center;
}

.week-header-day.today-header {
    background: var(--primary-soft);
    color: var(--primary);
}

.week-header-day.selected-header {
    background: var(--primary);
    color: #ffffff;
}

.week-day-name {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.week-day-num {
    font-size: 1.25rem;
    font-weight: 600;
}

.week-body {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
    min-height: 13.5rem;
}

.week-day-col {
    min-height: 13.5rem;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 0.85rem;
}

.week-day-col.today-col {
    border-color: rgba(59, 91, 219, 0.35);
}

.week-day-col.selected-col {
    border-color: var(--primary);
}

.week-day-empty {
    padding: 0.65rem 0.25rem;
    color: var(--muted-soft);
    font-size: 0.78rem;
    font-style: italic;
    font-weight: 400;
    text-align: center;
}

.week-task-pill {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    border-radius: 7px;
    background: #eef5ff;
    color: var(--primary);
    padding: 0.45rem 0.55rem;
    text-align: left;
}

.week-task-pill + .week-task-pill {
    margin-top: 0.45rem;
}

.week-task-title {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.week-task-pill.completed .week-task-title {
    color: inherit;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.calendar-agenda,
.calendar-timeline {
    padding-top: 1rem;
}

.agenda-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-width: none;
    padding-bottom: 6rem;
}

.agenda-day-group {
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--surface);
}

.agenda-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.agenda-day-label {
    color: var(--text);
    font-size: 0.98rem;
    font-weight: 600;
    text-transform: capitalize;
}

.agenda-day-count {
    color: var(--muted-soft);
    font-size: 0.78rem;
    font-weight: 500;
}

.agenda-task-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: start;
    column-gap: 0.9rem;
    row-gap: 0.45rem;
    min-height: 5.5rem;
    padding: 1rem 1.25rem;
    transition: background 0.12s;
}

.agenda-task-row + .agenda-task-row {
    border-top: 1px solid var(--line);
}

.agenda-task-row:hover {
    background: var(--surface-soft);
}

.agenda-task-row.completed {
    background: #f7f8fa;
    filter: grayscale(0.55);
}

.agenda-task-row.completed .task-type-badge,
.agenda-task-row.completed .task-priority {
    background: #eef0f4;
    color: #8b95a5;
}

.agenda-task-check {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    margin-top: 0.1rem;
}

.agenda-task-title {
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
}

.agenda-task-title.done-title {
    color: var(--muted-soft);
    text-decoration: line-through;
}

.agenda-task-meta,
.agenda-task-time {
    color: var(--muted);
    font-size: 0.75rem;
}

.agenda-task-main {
    display: flex;
    width: 100%;
    min-width: 0;
    grid-column: 1;
    grid-row: 1 / span 2;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.agenda-task-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.agenda-task-done {
    display: none;
}

.agenda-task-title-wrap::before {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--task-color, var(--primary));
}

.agenda-task-row.completed .agenda-task-title-wrap::before {
    background: var(--muted-soft);
}

.agenda-task-bar {
    display: none;
}

.agenda-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.agenda-task-time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: end;
    color: var(--muted-soft);
    font-size: 0.85rem;
    font-weight: 400;
}

.agenda-empty,
.timeline-empty {
    padding: 4rem 1rem;
    color: var(--muted-soft);
    font-size: 0.95rem;
    text-align: center;
}

.timeline-track {
    display: flex;
    height: 100%;
    min-height: 34rem;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: default;
    scroll-behavior: smooth;
}

.timeline-track.is-panning,
.timeline-track.is-panning * {
    cursor: grabbing !important;
    user-select: none !important;
}

.timeline-day {
    display: flex;
    min-width: 270px;
    flex: 0 0 min(280px, 28vw);
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--surface);
}

.timeline-day.today {
    background: var(--surface);
}

.timeline-day.selected {
    background: var(--primary-soft);
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.timeline-day.drop-target {
    background: rgba(59, 91, 219, 0.12);
}

.timeline-day-header {
    padding: 0.8rem;
    border-bottom: 1px solid var(--line);
}

.timeline-weekday {
    color: var(--muted-soft);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.timeline-date {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    text-transform: capitalize;
}

.timeline-cards {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    padding: 0.7rem;
}

.task-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    padding: 0.82rem 0.9rem 0.82rem 1rem;
    text-align: left;
    transition:
        border-color 0.15s,
        transform 0.12s,
        opacity 0.12s;
}

.task-card::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--task-color, #9ca3af);
}

.task-card:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.task-card.completed {
    background: #f1f3f6;
    border-color: #d8dde5;
    opacity: 1;
    filter: grayscale(0.45);
}

.task-card.completed::before {
    background: #b8c0cc;
}

.task-card.dragging {
    opacity: 0.45;
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.task-checkbox {
    display: grid;
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 1.15rem;
    place-items: center;
    border: 2px solid var(--line-strong);
    border-radius: 5px;
    margin-top: 0.02rem;
    background: var(--surface);
    color: #ffffff;
}

.task-checkbox.checked {
    border-color: var(--success);
    background: var(--success);
}

.task-checkbox.checked::after {
    content: "";
    width: 0.28rem;
    height: 0.5rem;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.task-card-body {
    min-width: 0;
    flex: 1;
    text-align: left;
}

.task-card-title {
    overflow: hidden;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.28;
    text-overflow: ellipsis;
}

.task-card.completed .task-card-title {
    color: var(--muted-soft);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: currentColor;
}

.task-card.completed .task-type-badge,
.task-card.completed .task-priority {
    background: #e5e8ee;
    color: #8b95a5;
}

.task-card.completed .task-time-badge {
    background: transparent;
    color: #8b95a5;
}

.task-card-edit-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 6px;
    color: var(--line-strong);
    transition:
        background 0.12s,
        color 0.12s;
}

.task-card-edit-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.task-card-meta {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.32rem;
    margin-top: 0.62rem;
    min-width: 0;
    overflow: hidden;
}

.task-time-badge,
.task-type-badge,
.task-priority,
.task-discipline-tag {
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 500;
    line-height: 1;
    max-width: 7.2rem;
    overflow: hidden;
    padding: 0.24rem 0.4rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-type-badge,
.task-priority {
    flex: 0 0 auto;
}

.task-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
    max-width: none;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    color: var(--muted-soft);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 0;
    text-overflow: clip;
}

.task-time-badge::before {
    content: "◷";
    margin-right: 0.2rem;
    color: var(--muted-soft);
}

.task-discipline-tag {
    flex: 1 1 auto;
    min-width: 0;
}

.task-time-badge::before {
    content: "";
    width: 0.72rem;
    height: 0.72rem;
    margin-right: 0;
    border: 0;
    border-radius: 0;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='7' cy='7' r='5.25' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M7 3.9V7l2.2 1.35' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='7' cy='7' r='5.25' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M7 3.9V7l2.2 1.35' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;
    opacity: 0.55;
}

.task-type-badge.type-prova {
    background: #fef2f2;
    color: #dc2626;
}

.task-type-badge.type-trabalho {
    background: #fff7ed;
    color: #ea580c;
}

.task-type-badge.type-estudo {
    background: #eff6ff;
    color: #2563eb;
}

.task-type-badge.type-aula {
    background: #ecfdf5;
    color: #16a34a;
}

.task-type-badge.type-reuniao {
    background: #fffbeb;
    color: #d97706;
}

.task-type-badge.type-pessoal {
    background: #f5f3ff;
    color: #7c3aed;
}

.task-type-badge.type-outro {
    background: #f3f4f6;
    color: #6b7280;
}

.task-priority.alta {
    background: #fef2f2;
    color: #dc2626;
}

.task-priority.media {
    background: #fff7ed;
    color: #ea580c;
}

.task-priority.baixa {
    background: #ecfdf5;
    color: #16a34a;
}

.day-panel {
    display: flex;
    width: 280px;
    min-width: 280px;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background: var(--surface);
}

.day-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0.75rem;
}

.day-panel-date {
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
    text-transform: capitalize;
}

.day-panel-add {
    flex: 0 0 auto;
    padding: 0.35rem;
}

.day-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 1.25rem 0.8rem;
}

.summary-chip {
    border-radius: 9px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.38rem 0.55rem;
}

.chip-done {
    background: #ecfdf5;
    color: #16a34a;
}

.chip-pending {
    background: #fff7ed;
    color: #ea580c;
}

.day-tasks-list {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 0.55rem;
    overflow-y: auto;
    padding: 0 1.25rem 1.25rem;
}

.day-empty-state {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    text-align: center;
}

.day-panel.is-empty .day-tasks-list {
    display: none;
}

.day-panel.is-empty .day-empty-state {
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-top: 4rem;
}

.empty-icon {
    margin-bottom: 1rem;
}

.empty-message {
    color: var(--text-soft);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
}

.empty-sub {
    margin-top: 0.4rem;
    color: var(--muted-soft);
    font-size: 0.8125rem;
}

.btn-empty-add {
    margin-top: 1rem;
    padding: 0.52rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 80;
    display: none;
    width: 3.35rem;
    height: 3.35rem;
    place-items: center;
    border-radius: 999px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(8px);
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 240;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(6px);
}

.confirm-modal {
    display: grid;
    width: min(100%, 380px);
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
    padding: 1.1rem;
}

.confirm-icon {
    display: grid;
    width: 2.45rem;
    height: 2.45rem;
    place-items: center;
    border-radius: 10px;
    background: #fef2f2;
    color: #dc2626;
}

.confirm-content {
    min-width: 0;
}

.confirm-title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

.confirm-text {
    margin-top: 0.3rem;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.confirm-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.2rem;
}

.modal {
    width: min(100%, 560px);
    max-height: min(90vh, 760px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.modal:has(.custom-picker-popover:not([hidden])),
.modal-form:has(.custom-picker-popover:not([hidden])) {
    overflow: visible;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--line);
}

.modal-title {
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    padding: 0.35rem;
}

.modal-form {
    display: flex;
    max-height: calc(90vh - 4rem);
    flex-direction: column;
    gap: 0.9rem;
    overflow-y: auto;
    padding: 1rem 1.1rem 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.form-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.35rem;
}

.form-full {
    grid-column: 1 / -1;
}

.form-label {
    color: var(--text-soft);
    font-size: 0.8125rem;
    font-weight: 600;
}

.required {
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border: 1px solid #dbe1ea;
    border-radius: var(--radius);
    outline: 0;
    background: #ffffff;
    color: var(--text);
    font-size: 0.9rem;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.form-input,
.form-select {
    min-height: 2.7rem;
    padding: 0 0.75rem;
}

.form-textarea {
    min-height: 5rem;
    resize: vertical;
    padding: 0.75rem;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.12);
}

.native-control-proxy {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-control {
    position: relative;
    width: 100%;
    color: var(--text);
    font: inherit;
}

.custom-select-filter {
    flex: 0 0 auto;
    width: auto;
    min-width: 7.35rem;
}

.custom-select-form,
.custom-date,
.custom-time {
    min-width: 0;
}

.custom-select-trigger,
.custom-date-trigger,
.custom-time-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid #dbe1ea;
    outline: 0;
    background: #ffffff;
    color: var(--text);
    font-weight: 500;
    transition:
        border-color 0.15s,
        background 0.15s,
        box-shadow 0.15s,
        transform 0.12s;
}

.custom-select-filter .custom-select-trigger {
    min-height: 2.35rem;
    border-color: transparent;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-soft);
    padding: 0 0.8rem 0 0.9rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.custom-select-form .custom-select-trigger,
.custom-date-trigger,
.custom-time-trigger {
    min-height: 2.7rem;
    border-radius: var(--radius);
    padding: 0 0.75rem;
    font-size: 0.9rem;
}

.custom-time-trigger {
    padding-right: 0.5rem;
}

.custom-select-trigger:hover,
.custom-date-trigger:hover,
.custom-time-trigger:hover {
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

.custom-select.open .custom-select-trigger,
.custom-date.open .custom-date-trigger,
.custom-time.open .custom-time-trigger,
.custom-time-trigger:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.12);
}

.custom-select-filter.open .custom-select-trigger {
    background: var(--surface);
}

.custom-select-value,
.custom-date-value,
.custom-time-input {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-time-input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
}

.custom-time-input::placeholder {
    color: var(--muted-soft);
}

.custom-time-toggle {
    display: inline-flex;
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 1.8rem;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--muted);
}

.custom-time-toggle:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.custom-caret {
    width: 0.45rem;
    height: 0.45rem;
    flex: 0 0 0.45rem;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    opacity: 0.78;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.15s ease;
}

.custom-select.open .custom-caret,
.custom-date.open .custom-caret,
.custom-time.open .custom-caret {
    transform: translateY(2px) rotate(225deg);
}

.custom-select-list,
.custom-picker-popover {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}

.custom-select-list {
    position: fixed;
    top: var(--select-top, 0);
    left: var(--select-left, 0);
    z-index: 310;
    width: var(--select-width, 12rem);
    max-height: min(16.25rem, calc(100vh - 1rem));
    overflow-y: auto;
    padding: 0.35rem;
    border-radius: 10px;
    scrollbar-width: none;
}

.custom-select-list::-webkit-scrollbar,
.custom-time-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.custom-select-option {
    display: flex;
    width: 100%;
    min-height: 2.2rem;
    align-items: center;
    border-radius: 7px;
    padding: 0 0.7rem;
    color: var(--text-soft);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    transition:
        background 0.12s,
        color 0.12s;
}

.custom-select-filter .custom-select-option {
    font-size: 0.8125rem;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
    background: var(--surface-muted);
    color: var(--text);
    outline: 0;
}

.custom-select-option.selected {
    background: var(--primary);
    color: #ffffff;
}

.custom-picker-popover {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 260;
    width: min(20rem, calc(100vw - 2rem));
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 14px;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.custom-picker-popover::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.custom-picker-popover::-webkit-scrollbar-track {
    background: transparent;
}

.custom-picker-popover::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.3);
}

.custom-picker-popover::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.48);
}

.custom-picker-scrollbar {
    position: fixed;
    z-index: 340;
    width: 4px;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.3);
    pointer-events: auto;
    touch-action: none;
    user-select: none;
}

.custom-picker-scrollbar:hover {
    background: rgba(107, 114, 128, 0.48);
}

.custom-picker-scrollbar:active {
    cursor: grabbing;
}

.custom-time-popover {
    width: min(17rem, calc(100vw - 2rem));
}

.custom-picker-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 2.15rem minmax(0, 1fr) 2.15rem;
    align-items: center;
    gap: 0.75rem;
    min-height: 4rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.custom-picker-nav {
    display: inline-flex;
    width: 2.15rem;
    height: 2.15rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    transition:
        border-color 0.12s,
        background 0.12s,
        color 0.12s;
}

.custom-picker-nav::before {
    content: "";
    width: 0.48rem;
    height: 0.48rem;
    border-top: 1.8px solid currentColor;
    border-left: 1.8px solid currentColor;
}

.custom-picker-prev::before {
    transform: translateX(1px) rotate(-45deg);
}

.custom-picker-next::before {
    transform: translateX(-1px) rotate(135deg);
}

.custom-picker-nav:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
    color: var(--text);
}

.custom-picker-title {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

.custom-picker-label,
.custom-picker-range {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.custom-picker-label {
    min-height: 1.85rem;
    border-radius: 7px;
    padding: 0 0.35rem;
}

.custom-picker-label:hover {
    background: var(--surface-muted);
}

.custom-date-weekdays,
.custom-date-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.custom-date-weekdays {
    padding: 0.85rem 1rem 0.35rem;
    border-bottom: 1px solid transparent;
}

.custom-date-weekdays span {
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
}

.custom-date-grid {
    gap: 0.18rem;
    padding: 0.35rem 1rem 1rem;
}

.custom-date-day,
.custom-month-cell,
.custom-year-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text);
    font-weight: 600;
    transition:
        background 0.12s,
        color 0.12s,
        box-shadow 0.12s;
}

.custom-date-day {
    aspect-ratio: 1;
    min-width: 0;
    font-size: 0.8125rem;
}

.custom-date-day:hover,
.custom-month-cell:hover,
.custom-year-cell:hover {
    background: var(--surface-muted);
}

.custom-date-day.muted {
    color: var(--muted-soft);
    font-weight: 500;
}

.custom-date-day.today {
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(59, 91, 219, 0.25);
}

.custom-date-day.selected,
.custom-month-cell.selected,
.custom-year-cell.selected {
    background: var(--primary);
    color: #ffffff;
    box-shadow: none;
}

.custom-month-grid,
.custom-year-grid {
    display: grid;
    gap: 0.65rem;
    padding: 1.35rem 1.15rem;
}

.custom-month-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.custom-year-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.custom-month-cell,
.custom-year-cell {
    min-height: 2.75rem;
    font-size: 0.875rem;
}

.custom-month-cell.current:not(.selected),
.custom-year-cell.current:not(.selected) {
    background: var(--primary-soft);
    color: var(--primary);
}

.custom-picker-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.custom-picker-footer-btn {
    min-height: 2rem;
    border-radius: 7px;
    padding: 0 0.45rem;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.custom-picker-footer-btn:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.custom-picker-footer-btn.accent {
    color: var(--primary);
}

.custom-time-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.85rem;
}

.custom-time-column {
    min-width: 0;
}

.custom-time-title {
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.custom-time-list {
    max-height: 12.8rem;
    overflow-y: auto;
    padding-right: 0.2rem;
    scrollbar-width: none;
}

.custom-time-separator {
    background: var(--line);
}

.custom-time-option {
    display: flex;
    width: 100%;
    min-height: 2.15rem;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
}

.custom-time-option:hover {
    background: var(--surface-muted);
}

.custom-time-option.selected {
    background: var(--primary);
    color: #ffffff;
}

.form-error {
    min-height: 0.8rem;
    color: var(--danger);
    font-size: 0.75rem;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.2rem;
}

.form-actions-left,
.form-actions-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-cancel,
.btn-delete,
.btn-duplicate,
.btn-save {
    display: inline-flex;
    min-height: 2.45rem;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 9px;
    padding: 0 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-cancel,
.btn-duplicate {
    background: var(--surface-muted);
    color: var(--muted);
}

.btn-cancel:hover,
.btn-duplicate:hover {
    background: #e5e7eb;
    color: var(--text);
}

.btn-delete {
    background: #fef2f2;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fee2e2;
}

.toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 260;
    display: flex;
    width: min(360px, calc(100vw - 2rem));
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.85rem 1rem 0.85rem 1.15rem;
}

.toast::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--primary);
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.32);
    box-shadow: 0 10px 26px rgba(34, 197, 94, 0.08);
}

.toast.success::before {
    background: var(--success);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.32);
    box-shadow: 0 10px 26px rgba(239, 68, 68, 0.08);
}

.toast.error::before {
    background: var(--danger);
}

body.dark-mode {
    --bg: #0f1117;
    --surface: #171b24;
    --surface-soft: #1e2330;
    --surface-muted: #252a38;
    --text: #f0f2f7;
    --text-soft: #d8deea;
    --muted: #8b92a5;
    --muted-soft: #555d70;
    --line: #2a2f3d;
    --line-strong: #394154;
    --primary: #4c6ef5;
    --primary-hover: #5b7cfa;
    --primary-soft: rgba(76, 110, 245, 0.18);
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
    scrollbar-color: #394154 #171b24;
}

body.dark-mode * {
    scrollbar-color: #394154 #171b24;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #171b24;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #394154;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #555d70;
}

body.dark-mode .sidebar-data {
    background: linear-gradient(
        180deg,
        rgba(23, 27, 36, 0) 0%,
        var(--surface) 22%
    );
}

body.dark-mode .view-btn.active,
body.dark-mode .view-btn:hover:not(.active),
body.dark-mode .nav-btn:hover {
    background: var(--surface-soft);
}

body.dark-mode .sidebar-close-btn:hover,
body.dark-mode .hamburger-btn:hover,
body.dark-mode .theme-toggle-btn:hover,
body.dark-mode .mini-cal-nav:hover,
body.dark-mode .day-panel-add:hover,
body.dark-mode .modal-close:hover {
    background: #2d3444;
    color: var(--text);
}

body.dark-mode .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 5.25L7 8.75L10.5 5.25' stroke='%23d8deea' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.dark-mode .filter-clear-btn {
    background: transparent;
    color: var(--text-soft);
}

body.dark-mode .filter-select:hover,
body.dark-mode .filter-clear-btn:hover {
    background: #303747;
    color: var(--text);
}

body.dark-mode .btn-cancel,
body.dark-mode .btn-duplicate {
    background: var(--surface-muted);
    color: var(--muted);
}

body.dark-mode .btn-cancel:hover,
body.dark-mode .btn-duplicate:hover {
    background: #303747;
    color: var(--text);
}

body.dark-mode .btn-save:hover,
body.dark-mode .btn-new-task:hover,
body.dark-mode .btn-empty-add:hover,
body.dark-mode .fab:hover {
    background: var(--primary-hover);
}

body.dark-mode .month-task-pill.type-prova,
body.dark-mode .week-task-pill.type-prova {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}

body.dark-mode .month-task-pill.type-trabalho,
body.dark-mode .week-task-pill.type-trabalho {
    background: rgba(249, 115, 22, 0.16);
    color: #fdba74;
}

body.dark-mode .month-task-pill.type-estudo,
body.dark-mode .week-task-pill.type-estudo {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

body.dark-mode .month-task-pill.type-aula,
body.dark-mode .week-task-pill.type-aula {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
}

body.dark-mode .month-task-pill.type-reuniao,
body.dark-mode .week-task-pill.type-reuniao {
    background: rgba(245, 158, 11, 0.17);
    color: #fcd34d;
}

body.dark-mode .month-task-pill.type-pessoal,
body.dark-mode .week-task-pill.type-pessoal {
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
}

body.dark-mode .month-task-pill.type-outro,
body.dark-mode .week-task-pill.type-outro {
    background: #252a38;
    color: #aeb6c8;
}

body.dark-mode .month-task-pill.completed,
body.dark-mode .week-task-pill.completed {
    background: #252a38;
    color: #6f788a;
}

body.dark-mode .data-btn,
body.dark-mode .form-input,
body.dark-mode .form-select,
body.dark-mode .form-textarea {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--text);
}

body.dark-mode .custom-select-trigger,
body.dark-mode .custom-date-trigger,
body.dark-mode .custom-time-trigger {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--text);
}

body.dark-mode .custom-select-filter .custom-select-trigger {
    border-color: transparent;
    background: var(--surface-muted);
    color: var(--text-soft);
}

body.dark-mode .custom-select-trigger:hover,
body.dark-mode .custom-date-trigger:hover,
body.dark-mode .custom-time-trigger:hover,
body.dark-mode .custom-select-filter.open .custom-select-trigger {
    background: #303747;
    color: var(--text);
}

body.dark-mode .custom-select-list,
body.dark-mode .custom-picker-popover {
    border-color: #303747;
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

body.dark-mode .custom-picker-footer {
    background: var(--surface);
}

body.dark-mode .custom-picker-header {
    background: var(--surface);
}

body.dark-mode .custom-select-option {
    color: var(--text-soft);
}

body.dark-mode .custom-select-option:hover,
body.dark-mode .custom-select-option:focus-visible,
body.dark-mode .custom-picker-label:hover,
body.dark-mode .custom-picker-nav:hover,
body.dark-mode .custom-date-day:hover,
body.dark-mode .custom-month-cell:hover,
body.dark-mode .custom-year-cell:hover,
body.dark-mode .custom-time-toggle:hover,
body.dark-mode .custom-time-option:hover,
body.dark-mode .custom-picker-footer-btn:hover {
    background: var(--surface-muted);
    color: var(--text);
}

body.dark-mode .custom-picker-nav {
    border-color: var(--line);
    color: var(--muted);
}

body.dark-mode .custom-date-day,
body.dark-mode .custom-month-cell,
body.dark-mode .custom-year-cell,
body.dark-mode .custom-time-option {
    color: var(--text);
}

body.dark-mode .custom-date-day.muted {
    color: var(--muted-soft);
}

body.dark-mode .custom-date-day.today {
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(76, 110, 245, 0.35);
}

body.dark-mode .custom-month-cell.current:not(.selected),
body.dark-mode .custom-year-cell.current:not(.selected) {
    background: var(--primary-soft);
    color: #9fb1ff;
}

body.dark-mode .custom-date-day.selected,
body.dark-mode .custom-date-day.selected:hover,
body.dark-mode .custom-month-cell.selected,
body.dark-mode .custom-month-cell.selected:hover,
body.dark-mode .custom-year-cell.selected,
body.dark-mode .custom-year-cell.selected:hover,
body.dark-mode .custom-time-option.selected,
body.dark-mode .custom-time-option.selected:hover {
    background: var(--primary);
    color: #ffffff;
}

body.dark-mode .custom-time-separator {
    background: var(--line);
}

body.dark-mode .modal {
    border-color: #303747;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
}

body.dark-mode .confirm-modal {
    border-color: #303747;
    background: var(--surface-soft);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
}

body.dark-mode .confirm-icon {
    background: rgba(239, 68, 68, 0.13);
    color: #f87171;
}

body.dark-mode .btn-delete {
    background: rgba(239, 68, 68, 0.13);
    color: #f87171;
}

body.dark-mode .btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .month-day,
body.dark-mode .week-header-day,
body.dark-mode .week-day-col,
body.dark-mode .agenda-day-group,
body.dark-mode .modal,
body.dark-mode .task-checkbox,
body.dark-mode .toast {
    background: var(--surface-soft);
}

body.dark-mode .toast {
    border-color: #344057;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

body.dark-mode .toast.success {
    border-color: rgba(34, 197, 94, 0.42);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

body.dark-mode .toast.error {
    border-color: rgba(239, 68, 68, 0.42);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

body.dark-mode .timeline-track {
    background: var(--surface);
}

body.dark-mode .month-day.other-month,
body.dark-mode .timeline-day {
    background: var(--surface-soft);
}

body.dark-mode .timeline-day.today {
    background: var(--surface-soft);
}

body.dark-mode .timeline-day.selected {
    background: rgba(76, 110, 245, 0.14);
}

body.dark-mode .week-header-day {
    color: var(--text);
}

body.dark-mode .week-header-day.today-header {
    background: rgba(76, 110, 245, 0.18);
    color: var(--primary);
}

body.dark-mode .week-header-day.selected-header {
    background: var(--primary);
    color: #ffffff;
}

body.dark-mode .week-day-name,
body.dark-mode .week-day-num {
    color: inherit;
}

body.dark-mode .task-priority.alta {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}

body.dark-mode .task-priority.media {
    background: rgba(249, 115, 22, 0.16);
    color: #fdba74;
}

body.dark-mode .task-priority.baixa {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
}

body.dark-mode .task-card.completed {
    background: #202633;
    border-color: #343b4d;
    filter: grayscale(0.55);
}

body.dark-mode .task-card.completed::before {
    background: #5c6475;
}

body.dark-mode .task-card.completed .task-type-badge,
body.dark-mode .task-card.completed .task-priority {
    background: #2b3140;
    color: #7c8495;
}

body.dark-mode .task-card.completed .task-time-badge {
    background: transparent;
    color: #7c8495;
}

body.dark-mode .agenda-task-row.completed {
    background: #1b202b;
    filter: grayscale(0.55);
}

body.dark-mode .agenda-task-row.completed .agenda-task-bar {
    background: #5c6475 !important;
}

body.dark-mode .task-type-badge.type-prova {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}

body.dark-mode .task-type-badge.type-trabalho {
    background: rgba(249, 115, 22, 0.16);
    color: #fdba74;
}

body.dark-mode .task-type-badge.type-estudo {
    background: rgba(59, 130, 246, 0.17);
    color: #93c5fd;
}

body.dark-mode .task-type-badge.type-aula {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
}

body.dark-mode .task-type-badge.type-reuniao {
    background: rgba(245, 158, 11, 0.17);
    color: #fcd34d;
}

body.dark-mode .task-type-badge.type-pessoal {
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
}

body.dark-mode .task-type-badge.type-outro,
body.dark-mode .task-discipline-tag,
body.dark-mode .summary-chip {
    background: #252a38;
    color: #aeb6c8;
}

body.dark-mode .task-time-badge {
    background: transparent;
    color: #6f788a;
}

body.dark-mode .agenda-task-done {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

body.dark-mode .chip-done {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

body.dark-mode .chip-pending {
    background: rgba(249, 115, 22, 0.15);
    color: #fdba74;
}

body.dark-mode .icon-moon {
    display: none;
}

body.dark-mode .icon-sun {
    display: block !important;
}

@media (max-width: 1180px) {
    .topbar {
        min-height: 64px;
        padding: 0 1rem;
    }

    .topbar-left,
    .topbar-right {
        min-width: 0;
    }

    .topbar-right {
        flex: 0 0 auto;
    }

    .search-wrap {
        width: min(22rem, 100%);
    }
}

@media (max-width: 980px) {
    body {
        overflow: hidden;
    }

    .app-shell {
        min-height: 100dvh;
        height: 100dvh;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 90;
        display: none;
        background: rgba(15, 23, 42, 0.35);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .sidebar-close-btn,
    .hamburger-btn {
        display: inline-flex;
    }

    .sidebar-mobile-views {
        display: block;
    }

    .view-toggle {
        display: none;
    }

    .view-btn[data-view="week"] {
        display: none;
    }

    .content-area {
        position: relative;
        flex: 1;
        flex-direction: column;
        overflow: hidden;
    }

    .calendar-panel {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 0 1rem 8rem;
    }

    .day-panel {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: 100%;
        min-width: 0;
        height: 3.75rem;
        min-height: 3.75rem;
        max-height: 3.75rem;
        border-top: 1px solid var(--line);
        border-left: 0;
        box-shadow: 0 -10px 32px rgba(15, 23, 42, 0.08);
        transition:
            height 0.18s ease,
            max-height 0.18s ease;
    }

    .day-panel.mobile-collapsed {
        height: 3.75rem;
        max-height: 3.75rem;
    }

    .day-panel.mobile-collapsed .day-summary,
    .day-panel.mobile-collapsed .day-tasks-list,
    .day-panel.mobile-collapsed .day-empty-state {
        display: none !important;
    }

    .day-panel.mobile-expanded {
        height: 20.5rem;
        max-height: 20.5rem;
    }

    body.dark-mode .day-panel {
        background: var(--surface);
    }

    .day-panel-header {
        align-items: center;
        padding: 1rem 1rem 0.8rem;
    }

    .day-panel-header {
        cursor: pointer;
    }

    .day-panel-date {
        font-size: 0.98rem;
    }

    .day-panel-add {
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 9px;
        background: var(--surface-muted);
        color: var(--muted);
    }

    .day-panel-add svg {
        display: none;
    }

    .day-panel-add::before {
        content: "";
        width: 0.42rem;
        height: 0.42rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(225deg);
        transition: transform 0.15s ease;
    }

    .day-panel.mobile-expanded .day-panel-add::before {
        transform: rotate(45deg);
    }

    .day-tasks-list {
        max-height: 25rem;
    }

    .day-empty-state {
        min-height: 15rem;
        justify-content: flex-start;
        padding-top: 2.6rem;
    }

    .day-panel.is-empty .day-empty-state {
        padding-top: 2.6rem;
    }
}

@media (max-width: 767px) {
    .main-area {
        overflow: hidden;
    }

    .modal-overlay {
        align-items: flex-start;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .modal {
        width: 100%;
        max-height: none;
        overflow: visible;
        margin: 2.25rem 0;
    }

    .modal-form {
        max-height: none;
        overflow: visible;
    }

    .topbar {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.45rem;
        min-height: 70px;
        padding: 0 0.75rem;
    }

    .topbar-title {
        flex: 1 1 auto;
        max-width: none;
        font-size: 0.98rem;
    }

    .topbar-left {
        flex: 1 1 auto;
        width: auto;
        gap: 0.42rem;
        overflow: hidden;
    }

    .topbar-right {
        width: auto;
        gap: 0;
    }

    .hamburger-btn {
        flex: 0 0 2.1rem;
        width: 2.1rem;
        height: 2.35rem;
    }

    .nav-controls {
        flex: 0 0 auto;
        min-height: 2.65rem;
        padding: 0.22rem;
    }

    .today-btn {
        min-width: 3.4rem;
        font-size: 0.8rem;
    }

    .nav-btn {
        min-width: 1.8rem;
        padding: 0 0.3rem;
    }

    .search-wrap,
    .view-toggle,
    .topbar-new-btn {
        display: none;
    }

    .theme-toggle-btn {
        flex: 0 0 2.35rem;
        width: 2.35rem;
        height: 2.35rem;
    }

    .filters-inner {
        min-height: 48px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0.95rem;
        scrollbar-width: thin;
    }

    .filter-select {
        flex: 0 0 7.15rem;
        min-height: 2.35rem;
        padding-right: 2.1rem;
        background-position: calc(100% - 0.82rem) 50%;
    }

    .custom-select-filter {
        flex: 0 0 7.15rem;
        min-width: 7.15rem;
    }

    .custom-select-filter .custom-select-trigger {
        min-height: 2.35rem;
        padding-right: 0.72rem;
    }

    .custom-picker-popover {
        width: min(20rem, calc(100vw - 2rem));
        scrollbar-color: auto;
        scrollbar-width: auto;
    }

    .custom-select-list,
    .custom-time-list {
        scrollbar-color: auto;
        scrollbar-width: auto;
    }

    .custom-picker-popover::-webkit-scrollbar,
    .custom-select-list::-webkit-scrollbar,
    .custom-time-list::-webkit-scrollbar {
        width: initial;
        height: initial;
    }

    .custom-picker-popover::-webkit-scrollbar-track,
    .custom-picker-popover::-webkit-scrollbar-thumb,
    .custom-picker-popover::-webkit-scrollbar-thumb:hover,
    .custom-select-list::-webkit-scrollbar,
    .custom-time-list::-webkit-scrollbar {
        background: initial;
    }

    .filter-clear-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .topbar-new-btn {
        display: none;
    }

    .fab {
        display: grid;
        bottom: 4.85rem;
    }

    body.mobile-day-panel-expanded .fab {
        display: none;
    }

    .month-grid,
    .month-weekdays {
        gap: 4px;
    }

    .calendar-month {
        padding-top: 1rem;
    }

    .month-weekdays {
        padding-right: 0;
        padding-left: 0;
    }

    .month-day {
        min-height: clamp(4.65rem, 14dvh, 5.15rem);
        padding: 0.34rem;
    }

    .day-number {
        width: 1.45rem;
        height: 1.45rem;
        font-size: 0.78rem;
    }

    .month-task-list {
        display: flex;
        gap: 0.18rem;
        margin-top: 0.28rem;
    }

    .month-task-pill {
        padding: 0.12rem 0.28rem 0.12rem 0.72rem;
        font-size: 0.62rem;
        line-height: 1.2;
    }

    .month-task-pill::before {
        left: 0.3rem;
        width: 0.26rem;
        height: 0.26rem;
    }

    .calendar-week {
        overflow: visible;
    }

    .agenda-task-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: flex-start;
        column-gap: 0.75rem;
        row-gap: 0.4rem;
        min-height: 4.75rem;
        padding: 0.95rem 0.95rem;
    }

    .agenda-task-main {
        gap: 0.35rem;
    }

    .agenda-task-title-wrap {
        gap: 0.4rem;
    }

    .agenda-task-time {
        justify-self: end;
        align-self: end;
        grid-column: 2;
        grid-row: 2;
        padding-left: 0;
        margin-top: 0;
    }

    .agenda-list {
        padding-bottom: 22rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-actions-left,
    .form-actions-right {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: initial;
        gap: 0.65rem;
        width: 100%;
    }

    .btn-cancel,
    .btn-delete,
    .btn-duplicate,
    .btn-save {
        width: 100%;
        padding: 0 0.65rem;
    }

    .confirm-modal {
        width: min(100%, 22rem);
        padding: 1rem;
    }

    .confirm-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .confirm-actions .btn-cancel,
    .confirm-actions .btn-delete {
        width: 100%;
    }
}
