@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('/fonts/poppins-300.woff2') format('woff2');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/poppins-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/poppins-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/poppins-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/poppins-700.woff2') format('woff2');
}

html,
body {
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

input[type='date'] { cursor: pointer; }
[data-new-category-field][hidden] { display: none; }

h1,
h2,
h3,
h4,
h5,
h6,
strong,
b { font-weight: 600; }

.primary,
.secondary,
.danger,
.button-link { font-weight: 500; }

.page-header h1 { font-size: 28px; font-weight: 600; line-height: 1.2; }
.login-card h1 { font-size: 24px; font-weight: 600; line-height: 1.2; }
.modal-header h2 { font-weight: 600; }
.timeline-section header h2 { font-size: 20px; font-weight: 600; line-height: 1.2; }
.task-form > label,
.form-grid label { font-size: 14px; font-weight: 400; }
legend { font-size: 14px; font-weight: 600; }
.task-title { font-weight: 400; }
.subtask-row .task-title { font-weight: 300; }
.task-client { font-size: 13px; }
.task-client strong { font-weight: 600; }
.subtasks { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sidebar nav small { font-size: 11px; font-weight: 600; }
.sidebar nav a.active { font-weight: 600; }
.sidebar nav .nav-project { font-size: 15px; }
.profile strong { font-size: 15px; font-weight: 500; }
.sort-heading { font-weight: 600; }

.avatar {
    display: inline-grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-content: center;
    border-radius: 50%;
    background: var(--avatar-color, var(--green));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
}

.avatar.tiny {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
    font-size: 8px;
}

.assignees { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.assignee-person { display: inline-flex; align-items: center; gap: 6px; color: #374151; white-space: nowrap; }
.unassigned { color: #9ca3af; }

/* Project navigation */
/* Consistent dropdown arrow and alignment */
.select-wrap {
    position: relative;
    display: inline-flex;
    width: 100%;
    min-width: 0;
    vertical-align: middle;
}

.select-wrap select {
    width: 100%;
    padding-right: 42px !important;
    background-image: none !important;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.select-wrap select:focus {
    border-color: #d1d5db;
    outline: none;
    box-shadow: none;
}

.select-wrap select:focus-visible {
    outline: 2px solid rgba(216, 53, 42, .28);
    outline-offset: 1px;
}

.select-wrap select:open {
    border-color: var(--red);
}

.select-arrow {
    position: absolute;
    top: 50%;
    right: 15px;
    width: 8px;
    height: 8px;
    border-right: 1.7px solid #6b7280;
    border-bottom: 1.7px solid #6b7280;
    pointer-events: none;
    transform: translateY(-68%) rotate(45deg);
    transform-origin: 62% 62%;
    transition: transform .18s ease, border-color .18s ease;
}

.select-wrap select:open + .select-arrow {
    border-color: var(--red);
    transform: translateY(-28%) rotate(225deg);
}

.filters .select-wrap {
    width: auto;
    min-width: 190px;
}

.filters .select-wrap select {
    min-width: 190px;
}

.form-grid label > .select-wrap,
.task-form label > .select-wrap,
.project-mode-field label > .select-wrap {
    margin-top: 0;
}

.subtask-adder .select-wrap {
    width: auto;
    min-width: 150px;
    flex: 1;
}

.subtask-adder .select-wrap select {
    min-width: 150px;
}

.sidebar { z-index: 40; transition: width .2s ease, padding .2s ease; }
.sidebar-logo-frame { display: block; width: 190px; max-width: 100%; }

.sidebar-toggle {
    position: absolute;
    z-index: 41;
    top: 34px;
    right: -16px;
    display: grid;
    width: 32px;
    height: 32px;
    place-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .1);
    color: #374151;
    cursor: pointer;
}

.sidebar-toggle:hover { border-color: var(--red); color: var(--red); }
.sidebar-toggle-icon {
    width: 8px;
    height: 8px;
    border-bottom: 1.8px solid currentColor;
    border-left: 1.8px solid currentColor;
    transform: translateX(2px) rotate(45deg);
    transition: transform .2s ease;
}
.sidebar.collapsed .sidebar-toggle-icon { transform: translateX(-2px) rotate(225deg); }
.sidebar.collapsed { width: 76px; padding: 24px 12px; }
.sidebar.collapsed .sidebar-logo-frame {
    width: 48px;
    height: 48px;
    overflow: hidden;
}
.sidebar.collapsed .sidebar-logo {
    width: 144px;
    max-width: none;
    height: auto;
    transform: translateY(-2px);
}
.sidebar.collapsed nav { align-items: center; width: 100%; }
.sidebar.collapsed nav small,
.sidebar.collapsed .nav-client-name,
.sidebar.collapsed .nav-more,
.sidebar.collapsed .profile div,
.sidebar.collapsed .profile form { display: none; }
.sidebar.collapsed .nav-client { margin: 0; }
.sidebar.collapsed nav a {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    place-content: center;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    text-align: center;
}
.sidebar.collapsed nav a::after { content: attr(data-short); font-size: 12px; font-weight: 750; text-transform: uppercase; }
.sidebar.collapsed nav a[data-label]::before {
    position: absolute;
    z-index: 42;
    top: 50%;
    left: 52px;
    display: block;
    width: max-content;
    max-width: 280px;
    padding: 8px 11px;
    border-radius: 8px;
    background: var(--ink);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .2);
    color: #fff;
    content: attr(data-label);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    text-transform: none;
    transform: translate(5px, -50%);
    transition: opacity .12s ease, transform .12s ease;
    white-space: nowrap;
}
.sidebar.collapsed nav a[data-label]:hover::before,
.sidebar.collapsed nav a[data-label]:focus-visible::before {
    opacity: 1;
    transform: translate(0, -50%);
}
.sidebar.collapsed nav > a:first-child::after,
.sidebar.collapsed .new-project-link::after { font-size: 18px; }
.sidebar.collapsed .nav-project::before { border: 0; }
.sidebar.collapsed .profile { display: flex; justify-content: center; width: 100%; }
.project-kicker { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.nav-client {
    display: grid;
    gap: 2px;
    margin-top: 7px;
}

.nav-client-name {
    padding: 6px 9px 2px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.nav-client-header,
.nav-project-row {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.nav-client-header .nav-client-name,
.nav-project-row .nav-project { flex: 1; min-width: 0; }

.nav-more { position: relative; flex: 0 0 auto; }
.nav-more summary {
    display: grid;
    width: 28px;
    height: 28px;
    place-content: center;
    border-radius: 50%;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    list-style: none;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary:hover,
.nav-more[open] summary { background: #f3f4f6; color: var(--ink); }
.nav-more-menu {
    position: absolute;
    z-index: 8;
    top: 30px;
    right: 0;
    width: 150px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .13);
}
.sidebar nav .nav-more-menu a {
    display: block;
    margin: 0;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--ink);
    font-size: 12px;
    text-decoration: none;
}
.sidebar nav .nav-more-menu a:hover { background: #f8eeee; color: var(--red); }

.sidebar nav .nav-project {
    position: relative;
    margin-left: 8px;
    padding: 7px 9px 7px 18px;
    color: #4b5563;
    font-size: 15px;
}

.entity-edit-modal { width: min(620px, 100%); }

.sidebar nav .nav-project::before {
    position: absolute;
    top: 50%;
    left: 7px;
    width: 5px;
    border-top: 1px solid #d1d5db;
    content: '';
}

.sidebar nav .new-project-link {
    margin: 12px 9px 0;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    color: var(--ink);
    font-weight: 650;
    text-align: center;
}

.sidebar nav .new-project-link:hover {
    border-color: var(--red);
    color: var(--red);
}

/* Sortable task table */
.task-head,
.task {
    grid-template-columns: 24px minmax(125px, .8fr) minmax(260px, 2.3fr) minmax(130px, .9fr) 125px 80px 80px 34px;
}

.task-head {
    display: grid;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    background: #fafbfc;
}

.sort-heading {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-decoration: none;
    text-transform: uppercase;
}

.sort-heading span {
    opacity: .45;
    font-size: 9px;
}

.sort-heading:hover,
.sort-heading.active {
    color: var(--ink);
}

.sort-heading.active span {
    color: var(--red);
    opacity: 1;
}

.task {
    align-items: center;
}

.task-client {
    display: grid;
    min-width: 0;
    gap: 2px;
    font-size: 13px;
}

.task-client strong,
.task-client > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-client > span {
    color: var(--muted);
}

.task-client .brand-pill {
    justify-self: start;
    margin-top: 2px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-weight: 650;
    white-space: nowrap;
}

.completed-label {
    color: #9ca3af;
    font-size: 12px;
}

.modal-subtasks {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.subtask-edit-modal { width: min(650px, 100%); }
.compact-subtask-form { gap: 18px; }
.subtask-parent-context {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border-left: 3px solid var(--red);
    border-radius: 0 8px 8px 0;
    background: #f8fafc;
}
.subtask-parent-context span { color: var(--muted); font-size: 12px; }

.modal-subtasks-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.modal-subtasks-heading h3,
.modal-subtasks-heading p { margin: 0; }
.modal-subtasks-heading h3 { font-size: 15px; }
.modal-subtasks-heading p,
.modal-subtasks-empty { color: var(--muted); font-size: 13px; }
.modal-subtasks-empty { margin: 0; }
.modal-subtasks-heading .secondary { padding: 8px 14px; }
.modal-subtask-list { display: grid; gap: 8px; }

.modal-subtask-row {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(155px, .42fr) 145px auto 34px;
    align-items: center;
    gap: 8px;
    padding: 9px;
    border-radius: 9px;
    background: #f8fafc;
}

.modal-subtask-row .select-wrap { min-width: 0; }
.modal-subtask-row input[type='text'],
.modal-subtask-row input[type='date'],
.modal-subtask-row select { padding: 9px 11px; }
.subtask-done { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.subtask-remove { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #9ca3af; font-size: 22px; cursor: pointer; }
.subtask-remove:hover { background: #fee2e2; color: var(--red); }

@media (max-width: 760px) {
    .modal-subtasks-heading { align-items: flex-start; flex-direction: column; }
    .modal-subtask-row { grid-template-columns: 1fr 34px; }
    .modal-subtask-row .subtask-title-input,
    .modal-subtask-row .select-wrap,
    .modal-subtask-row input[type='date'] { grid-column: 1 / -1; }
}

.form-grid.three { grid-template-columns: repeat(3, 1fr); }

.access-scope-options { display: grid; gap: 9px; }
.access-scope-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
}
.access-scope-choice:has(input:checked) { border-color: var(--red); background: #fdf4f3; }
.access-scope-choice input { margin-top: 4px; }
.access-scope-choice span { display: grid; gap: 2px; }
.access-scope-choice small { color: var(--muted); font-weight: 400; }

@media (max-width: 720px) {
    .form-grid.three { grid-template-columns: 1fr; }
}

.task-category {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
}

.category-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--category-color, #9ca3af);
}

.task .priority {
    padding: 0;
    background: none;
}

.task-delete-form { display: grid; place-content: center; }
.task-delete {
    display: grid;
    width: 30px;
    height: 30px;
    place-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
}
.task-delete:hover,
.task-delete:focus-visible { background: #fee2e2; color: var(--red); }

.priority.high { color: var(--red); font-weight: 700; }
.priority.normal { color: #4b5563; }
.priority.low { color: #9ca3af; }
.task time.overdue { color: var(--red); font-weight: 700; }
.check.readonly { cursor: default; }

.subtask-row {
    grid-template-columns: 24px minmax(125px, .8fr) minmax(260px, 2.3fr) minmax(130px, .9fr) 125px 80px 80px 34px;
}

.subtask-nest-control {
    display: flex;
    grid-column: 2;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding-left: 0;
}

.subtask-branch {
    color: #cbd5e1;
}

.subtask-main { grid-column: 3; padding-left: 0; }
.subtask-row .assignees { font-size: 12px; }

/* New project modal */
.project-modal { width: min(760px, 100%); }
.project-mode-options { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.project-mode-field label { display: grid; gap: 6px; font-size: 14px; font-weight: 400; }
.project-mode-field input,
.project-mode-field select { width: 100%; padding: 12px 13px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.project-mode-field[hidden] { display: none; }

.project-clients li > span:first-child { display: grid; min-width: 0; }
.access-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.access-actions form { margin: 0; }
.access-actions button { padding: 0; border: 0; background: none; color: var(--red); font-size: 12px; cursor: pointer; }
.access-status { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.access-status.active { background: #e6efef; color: var(--green); }
.access-status.pending { background: #fef3c7; color: #92400e; }

/* Project timeline */
.timeline-section {
    display: grid;
    gap: 20px;
    margin-top: 42px;
    scroll-margin-top: 20px;
}

.timeline-section header h2 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.2; }
.timeline-section header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.timeline-compose { display: flex; align-items: flex-start; gap: 14px; }

.timeline-compose > div {
    display: grid;
    flex: 1;
    justify-items: end;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.timeline-compose textarea { width: 100%; padding: 4px 2px; border: 0; outline: 0; background: transparent; line-height: 1.5; resize: vertical; }
.timeline-compose .primary { padding: 7px 16px; }
.timeline-list { position: relative; display: grid; gap: 18px; padding-left: 48px; }

.timeline-list::before {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 19px;
    border-left: 2px dashed #d1d5db;
    content: '';
}

.timeline-entry { position: relative; }
.timeline-marker { position: absolute; top: 0; left: -48px; display: flex; width: 40px; justify-content: center; }
.avatar.small { width: 28px; height: 28px; flex-basis: 28px; font-size: 9px; }
.system-dot { width: 12px; height: 12px; margin-top: 7px; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 4px var(--bg); }
.timeline-card { display: grid; gap: 5px; padding: 13px 16px; border-radius: 12px; line-height: 1.55; }
.timeline-entry.note .timeline-card { border: 1px solid var(--line); background: #fff; }
.timeline-entry.system .timeline-card { padding-top: 2px; padding-bottom: 2px; color: #374151; }
.timeline-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.role-pill { padding: 1px 8px; border-radius: 999px; background: #f3f4f6; color: #374151; font-size: 11px; font-weight: 650; }
.timeline-empty { padding: 18px 0; color: var(--muted); }

@media (max-width: 1200px) {
    .task-list { overflow-x: auto; }
    .task-head,
    .task,
    .subtask-row { min-width: 980px; }
}

@media (max-width: 720px) {
    .filters .select-wrap { width: 100%; }
    .sidebar-toggle { display: none; }
    .sidebar.collapsed { width: 100%; padding: 28px 20px; }
    .sidebar.collapsed .sidebar-logo-frame { width: 150px; height: auto; overflow: visible; }
    .sidebar.collapsed .sidebar-logo { width: 150px; height: auto; transform: none; }
    .sidebar.collapsed .profile { display: grid; }
    .sidebar.collapsed .profile div,
    .sidebar.collapsed .profile form { display: grid; }
    .nav-client,
    .new-project-link { display: none; }
    .task-head { display: none; }
    .task-list { overflow: visible; }
    .task,
    .subtask-row { min-width: 0; grid-template-columns: 24px 1fr; padding: 16px; }
    .subtask-row { grid-template-columns: 52px 1fr; }
    .task-client,
    .task-main,
    .assignees,
    .task-category,
    .priority,
    .task time,
    .subtask-branch { grid-column: 2; }
    .subtask-nest-control {
        grid-column: 1 / 2;
        justify-content: flex-end;
        gap: 6px;
        padding-right: 0;
        padding-left: 0;
    }
    .subtask-main { grid-column: 2; }
    .subtask-row > span:empty { display: none; }
    .task-delete-form { grid-column: 2; justify-self: end; }
    .timeline-list { padding-left: 42px; }
    .timeline-marker { left: -42px; }
}
