:root {
    --ink: #17202a;
    --muted: #697386;
    --line: #d9e0ea;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --page: #eef3f7;
    --blue: #1f6feb;
    --cyan: #0e7490;
    --amber: #b45309;
    --green: #15803d;
    --red: #b42318;
    --shadow: 0 18px 48px rgba(23, 32, 42, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
}

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

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.brand,
.topbar-user,
.project-title-row,
.meta-row,
.feature-title,
.member-pills,
.admin-tools,
.inline-form,
.verification-actions,
.assign-checks {
    align-items: center;
    display: flex;
    gap: 10px;
}

.brand small,
.muted,
.project-header p,
.project-summary p,
.feature-main p,
.meta-row,
.log-item span,
.log-item small,
.demo-note {
    color: var(--muted);
}

.brand-mark {
    align-items: center;
    background: #12343b;
    border-radius: 8px;
    color: white;
    display: inline-flex;
    font-weight: 800;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.brand-mark.large {
    height: 52px;
    width: 52px;
}

.topbar-user {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.master-menu {
    position: relative;
}

.master-menu summary {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #14213d;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.88rem;
    font-weight: 800;
    min-height: 40px;
    padding: 9px 13px;
}

.topbar-link {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #14213d;
    display: inline-flex;
    font-size: 0.88rem;
    font-weight: 800;
    min-height: 40px;
    padding: 9px 13px;
}

.topbar-link:hover,
.topbar-link:focus-visible {
    border-color: var(--blue);
    color: var(--blue);
}

.master-menu summary::-webkit-details-marker {
    display: none;
}

.master-menu-links {
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    box-shadow: var(--shadow);
    display: grid;
    min-width: 176px;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 10;
}

.master-menu-links a {
    color: #344054;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 10px 12px;
}

.master-menu-links a:hover,
.master-menu-links a:focus-visible {
    background: var(--surface-soft);
    color: var(--blue);
}

.workspace {
    display: grid;
    gap: 20px;
    grid-template-columns: 300px minmax(0, 1fr) 330px;
    padding: 22px;
}

.dashboard-workspace,
.master-workspace {
    margin: 0 auto;
    max-width: 1540px;
    padding: 22px;
}

.master-workspace {
    display: grid;
    gap: 18px;
}

.master-grid {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1fr) minmax(280px, 0.9fr);
}

.sidebar,
.logs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.content,
.project-list {
    min-width: 0;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.project-list {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.project-panel,
.logs,
.login-panel,
.empty-state.large {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel,
.logs,
.login-panel,
.empty-state.large {
    padding: 18px;
}

.project-panel {
    container-type: inline-size;
    overflow: hidden;
    position: relative;
    width: 100%;
}

@container (max-width: 390px) {
    .project-header,
    .inline-form,
    .assign-form {
        align-items: stretch;
        flex-direction: column;
    }

    .member-pills,
    .verification-actions,
    .feature-actions {
        justify-content: flex-start;
    }

    .member-pills {
        min-width: 0;
    }

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

    .feature-list-row {
        align-items: start;
        grid-template-columns: 22px 20px minmax(0, 1fr);
    }

    .feature-updated,
    .feature-actions {
        grid-column: 3;
    }

    .reject-form {
        flex-direction: column;
        width: 100%;
    }
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: 2rem;
    line-height: 1.15;
}

h2 {
    font-size: 1.05rem;
    margin-bottom: 14px;
}

h3 {
    color: #344054;
    font-size: 0.94rem;
    margin-bottom: 10px;
}

.page-heading {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.page-heading p {
    color: var(--muted);
    margin-top: 4px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label,
.checkbox-group span,
.assign-form > span,
.inline-form label {
    color: #344054;
    display: flex;
    flex-direction: column;
    font-size: 0.88rem;
    font-weight: 700;
    gap: 6px;
}

input,
select,
textarea {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: var(--ink);
    min-height: 40px;
    padding: 9px 10px;
    width: 100%;
}

textarea {
    resize: vertical;
}

.button {
    align-items: center;
    background: #e6edf5;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #14213d;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 9px 13px;
    white-space: nowrap;
}

.button.primary {
    background: #12343b;
    color: white;
}

.button.ghost {
    background: white;
    border-color: var(--line);
}

.button.small {
    font-size: 0.88rem;
    min-height: 34px;
    padding: 7px 10px;
}

.button.verify {
    background: var(--green);
    color: white;
}

.button.danger {
    background: #fff1f0;
    color: var(--red);
}

.button.full {
    width: 100%;
}

.alert {
    border-radius: 8px;
    font-weight: 700;
    padding: 12px 14px;
}

.alert.success {
    background: #ecfdf3;
    color: #05603a;
}

.alert.error {
    background: #fff1f0;
    color: var(--red);
}

.status-grid {
    display: grid;
    gap: 10px;
}

.status-count {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    padding: 10px;
}

.status-count strong {
    font-size: 1.25rem;
}

.status-pill,
.time-chip,
.member-pills span {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    padding: 7px 10px;
}

.status-new {
    background: #e8f2ff;
    color: var(--blue);
}

.status-discussed {
    background: #ecfeff;
    color: var(--cyan);
}

.status-ongoing {
    background: transparent;
    color: var(--amber);
}

.status-completed {
    background: #ecfdf3;
    color: var(--green);
}

.status-pill.verified {
    background: #dcfce7;
    color: #166534;
}

.time-chip,
.member-pills span {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: #344054;
}

.project-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 58px 18px 18px;
}

.project-title-row {
    flex-wrap: wrap;
    margin-bottom: 0;
}

.project-title-row h2 {
    font-size: 1.25rem;
    margin: 0;
}

.project-link {
    color: var(--ink);
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.project-link:hover,
.project-link:focus-visible {
    color: var(--blue);
    text-decoration-color: currentColor;
}

.meta-row {
    flex-wrap: wrap;
    font-size: 0.82rem;
    margin-top: 9px;
}

.member-pills {
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 160px;
}

.project-editor {
    position: static;
}

.project-edit-button {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #344054;
    cursor: pointer;
    display: inline-flex;
    font-size: 1.15rem;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 18px;
    top: 17px;
    width: 34px;
}

.project-edit-button::-webkit-details-marker {
    display: none;
}

.project-edit-button:hover,
.project-edit-button:focus-visible {
    border-color: var(--blue);
    color: var(--blue);
}

.project-summary {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    padding: 16px 18px;
}

.project-summary p {
    color: var(--muted);
}

.project-summary .meta-row {
    margin-top: 0;
}

.project-summary .member-pills {
    justify-content: flex-start;
    margin-top: 2px;
    min-width: 0;
}

.admin-tools {
    align-items: flex-start;
    background: #f9fbfd;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 14px 18px;
}

.inline-form {
    align-items: end;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
}

.inline-form label {
    grid-column: 1 / -1;
}

.assign-form > span {
    margin-right: 2px;
}

.inline-form select {
    grid-column: 1;
    min-width: 0;
    width: 100%;
}

.inline-form .button {
    grid-column: 2;
    grid-row: 2;
}

.assign-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.assign-checks {
    flex-wrap: wrap;
}

.checkbox-group {
    display: grid;
    gap: 8px;
}

.check-row {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    display: flex;
    flex-direction: row;
    font-weight: 600;
    padding: 8px 10px;
}

.check-row.compact {
    padding: 6px 8px;
}

.check-row input {
    min-height: 0;
    width: auto;
}

.feature-form {
    background: #fcfdff;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
    padding: 14px 18px;
}

.feature-form textarea {
    grid-column: 1 / -1;
}

.feature-form .button {
    width: 100%;
}

.feature-section {
    padding: 18px;
}

.feature-board {
    padding: 0;
}

.feature-list {
    display: grid;
    gap: 10px;
}

.feature-caption {
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    color: #475467;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 10px 18px;
    text-transform: uppercase;
}

.feature-table {
    gap: 0;
}

.feature-row {
    align-items: flex-start;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.feature-row.completed {
    background: white;
}

.feature-list-row {
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    display: grid;
    gap: 10px;
    grid-template-columns: 24px 22px minmax(160px, 1fr) minmax(120px, auto) 34px;
    min-height: 52px;
    padding: 9px 18px;
    position: relative;
}

.feature-list-row:last-child {
    border-bottom: 0;
}

.feature-list-row.completed {
    background: #d4edda;
}

.feature-order {
    color: #344054;
    font-size: 0.82rem;
    font-weight: 800;
}

.feature-marker {
    color: #344054;
    font-size: 1.05rem;
    font-weight: 900;
    text-align: center;
}

.feature-main {
    min-width: 0;
}

.feature-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-title strong {
    overflow-wrap: anywhere;
}

.feature-link {
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
}

.feature-link:hover,
.feature-link:focus-visible {
    color: var(--blue);
    text-decoration-color: currentColor;
}

.feature-state {
    color: var(--muted);
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-left: 6px;
}

.feature-state.completed {
    color: #166534;
}

.due-chip {
    background: #eef2f6;
    border-radius: 999px;
    color: #475467;
    display: inline-flex;
    font-size: 0.75rem;
    gap: 4px;
    margin-top: 3px;
    padding: 2px 9px;
    white-space: nowrap;
}

.due-chip.overdue {
    background: #fee4e2;
    color: var(--red);
    font-weight: 800;
}

.page-heading-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.create-project-panel {
    margin-bottom: 16px;
}

.create-project-panel > summary {
    cursor: pointer;
    font-weight: 800;
}

.create-project-panel[open] > summary {
    margin-bottom: 14px;
}

.recipient-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.recipient-row {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 8px 12px;
}

.recipient-row span {
    overflow-wrap: anywhere;
}

.nav-badge {
    background: var(--red);
    border-radius: 999px;
    color: #fff;
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    margin-left: 4px;
    min-width: 20px;
    padding: 3px 6px;
    text-align: center;
}

.overdue-section .feature-caption {
    color: var(--red);
}

.overdue-section {
    border-left: 4px solid var(--red);
}

.due-field {
    align-items: center;
    display: flex;
    font-size: 0.85rem;
    gap: 8px;
}

.feature-return-note {
    color: #8a4b0d;
    display: block;
    font-size: 0.8rem;
    margin-top: 3px;
    overflow-wrap: anywhere;
}

.feature-updated {
    color: var(--muted);
    font-size: 0.7rem;
    grid-column: 4;
    white-space: nowrap;
}

.feature-verified-tick {
    font-size: 0.36rem;
    height: 10px;
    justify-self: center;
    width: 10px;
}

.feature-editor {
    grid-column: 5;
    position: static;
}

.feature-editor[open] {
    grid-column: 1 / -1;
}

.feature-edit-button {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #344054;
    cursor: pointer;
    display: flex;
    font-size: 1.05rem;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 9px;
    width: 34px;
}

.feature-edit-button::-webkit-details-marker {
    display: none;
}

.feature-edit-button:hover,
.feature-edit-button:focus-visible {
    border-color: var(--blue);
    color: var(--blue);
}

.feature-editor-content {
    border-top: 1px solid rgba(23, 32, 42, 0.12);
    display: grid;
    gap: 10px;
    padding-top: 12px;
}

.feature-editor-content .verification-actions {
    display: grid;
    gap: 10px;
    justify-content: stretch;
    max-width: 224px;
    width: 100%;
}

.feature-editor-content .verification-actions form,
.feature-editor-content .reject-form {
    width: 100%;
}

.feature-editor-content .verification-actions form:first-child .button {
    min-width: 96px;
}

.feature-editor-content .reject-form {
    flex-direction: column;
}

.feature-editor-content .reject-form input {
    min-width: 0;
    width: 100%;
}

.feature-editor-content .reject-form .button {
    width: 100%;
}

.feature-review-state {
    color: #166534;
    font-size: 0.85rem;
    font-weight: 700;
}

.feature-main p {
    margin-top: 7px;
}

.feature-main .note {
    background: #fff7ed;
    border-left: 3px solid var(--amber);
    color: #8a4b0d;
    padding: 8px 10px;
}

.verify-tick {
    align-items: center;
    background: var(--green);
    border-radius: 999px;
    color: white;
    display: inline-flex;
    font-weight: 900;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.verification-actions {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.reject-form {
    display: flex;
    gap: 8px;
}

.reject-form input {
    min-width: 150px;
}

@container (max-width: 390px) {
    .feature-list-row {
        align-items: start;
        grid-template-columns: 22px 20px minmax(0, 1fr);
        row-gap: 0;
    }

    .feature-title,
    .feature-updated {
        line-height: 1.1;
    }

    .feature-updated,
    .feature-editor {
        grid-column: 3;
        justify-self: start;
    }

    .feature-editor[open] {
        grid-column: 1 / -1;
        width: 100%;
    }
}

.logs {
    align-self: start;
    max-height: calc(100vh - 116px);
    overflow: auto;
    position: sticky;
    top: 94px;
}

.master-logs {
    max-height: none;
    position: static;
}

.log-list {
    display: grid;
    gap: 10px;
}

.log-item {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
    padding-bottom: 10px;
}

.log-item time {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.log-item strong {
    font-size: 0.9rem;
}

.log-list:has(.compact) {
    gap: 0;
}

.log-item.compact {
    gap: 1px;
    padding: 7px 0;
}

.log-item.compact .log-line {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.log-item.compact .log-line time {
    margin-left: auto;
}

.log-item.compact .log-line span,
.log-item.compact small {
    font-size: 0.8rem;
    line-height: 1.35;
}

.log-item.compact .log-detail {
    overflow-wrap: anywhere;
}

.log-item code {
    background: #0f172a;
    border-radius: 6px;
    color: #e2e8f0;
    display: block;
    font-size: 0.72rem;
    overflow: auto;
    padding: 8px;
    white-space: pre-wrap;
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    padding: 14px;
}

.empty-state.large {
    text-align: center;
}

.empty-state.large h2 {
    color: var(--ink);
}

.login-page {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    display: grid;
    gap: 18px;
    max-width: 430px;
    width: 100%;
}

.login-panel h1 {
    margin-top: 14px;
}

.login-panel p {
    color: var(--muted);
    margin-top: 6px;
}

.demo-note {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 12px;
}

.member-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 5px;
    margin-top: 12px;
    padding: 12px;
}

.team-members-panel {
    grid-column: 3;
    grid-row: 1;
}

.member-list {
    display: grid;
    gap: 10px;
}

.team-page {
    display: grid;
    gap: 16px;
}

.team-page .member-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.team-page .create-project-panel {
    margin-bottom: 0;
    max-width: 560px;
}

.member-card-heading .member-stats {
    border-top: 1px solid var(--line);
    font-size: 0.72rem;
    margin-top: 4px;
    overflow: hidden;
    padding-top: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-stats b {
    font-size: 0.82rem;
    font-weight: 800;
}

.member-stats .stat-projects {
    color: #1d4ed8;
}

.member-stats .stat-tasks {
    color: #b45309;
}

.member-stats .stat-overdue {
    color: #15803d;
}

.member-stats .stat-overdue.has-overdue {
    color: var(--red);
}

.role-pill {
    background: #eef2f6;
    border-radius: 999px;
    color: #475467 !important;
    display: inline-block;
    font-size: 0.7rem !important;
    font-weight: 800;
    margin-left: 6px;
    padding: 2px 8px;
    vertical-align: middle;
}

.role-pill.role-admin {
    background: #fee4e2;
    color: var(--red) !important;
}

.role-pill.role-superadmin {
    background: #12343b;
    color: #fff !important;
}

.role-pill.role-manager {
    background: #dbeafe;
    color: #1d4ed8 !important;
}

.member-card {
    margin-top: 0;
    position: relative;
}

.member-card-heading {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding-right: 42px;
}

.member-card-heading > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.member-card-heading strong,
.member-card-heading span {
    overflow-wrap: anywhere;
}

.member-card-heading span {
    color: var(--muted);
    font-size: 0.82rem;
}

.member-editor {
    display: block;
}

.member-edit-button {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #344054;
    cursor: pointer;
    display: flex;
    font-size: 1.05rem;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 12px;
    width: 34px;
}

.member-edit-button::-webkit-details-marker {
    display: none;
}

.member-edit-button:hover,
.member-edit-button:focus-visible {
    border-color: var(--blue);
    color: var(--blue);
}

.member-editor-content {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
}

.member-edit-form {
    display: grid;
    gap: 10px;
}

.member-delete-form {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.master-logs {
    grid-column: 1 / -1;
    grid-row: 2;
}

.log-pagination {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 14px;
}

.page-link,
.page-count {
    font-size: 0.82rem;
    font-weight: 700;
}

.page-link {
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #344054;
    padding: 7px 10px;
}

.page-link:hover,
.page-link:focus-visible {
    border-color: var(--blue);
    color: var(--blue);
}

.page-link.disabled {
    background: var(--surface-soft);
    color: var(--muted);
}

.page-count {
    color: var(--muted);
    text-align: center;
}

.feature-detail {
    margin: 22px auto;
    max-width: 980px;
    padding: 0 22px 22px;
}

.project-detail-workspace {
    margin: 22px auto;
    max-width: 1100px;
    padding: 0 22px 22px;
}

.completed-projects-workspace {
    margin: 22px auto;
    max-width: 1240px;
    padding: 0 22px 22px;
}

.account-workspace {
    margin: 22px auto;
    max-width: 560px;
    padding: 0 22px 22px;
}

.account-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
    padding: 24px;
}

.account-panel h1 {
    font-size: 1.45rem;
    margin: 0;
}

.account-panel p {
    color: var(--muted);
    margin-top: 6px;
}

.project-overview-heading,
.project-overview-row {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(180px, 1.3fr) 108px minmax(150px, 0.85fr) minmax(160px, 1fr) auto;
}

.project-overview-list {
    border-top: 1px solid var(--line);
}

.project-overview-heading {
    color: #475467;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 10px 16px;
    text-transform: uppercase;
}

.project-overview-row {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
}

.project-overview-name {
    min-width: 0;
}

.project-overview-name .project-link {
    font-size: 0.94rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.project-overview-updated {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.project-overview-assigned .member-pills {
    justify-content: flex-start;
    min-width: 0;
}

.project-overview-action {
    justify-self: end;
}

.project-detail-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.project-detail-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 24px;
}

.project-detail-header h1 {
    font-size: 1.7rem;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.project-detail-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.project-detail-summary {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    padding: 18px 24px;
}

.project-detail-summary > p {
    color: #344054;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.project-detail-summary .meta-row {
    margin-top: 0;
}

.project-detail-summary .member-pills {
    justify-content: flex-start;
    min-width: 0;
}

.back-link {
    color: var(--blue);
    display: inline-block;
    font-weight: 700;
    margin-bottom: 16px;
}

.detail-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.detail-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding-bottom: 20px;
}

.detail-header h1 {
    font-size: 1.7rem;
    overflow-wrap: anywhere;
}

.detail-statuses {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.feature-detail-editor {
    border-bottom: 1px solid var(--line);
}

.feature-detail-edit-button {
    align-items: center;
    color: #344054;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 7px;
    padding: 14px 0;
}

.feature-detail-edit-button::-webkit-details-marker {
    display: none;
}

.feature-detail-edit-button:hover,
.feature-detail-edit-button:focus-visible {
    color: var(--blue);
}

.feature-detail-edit-form {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 14px;
    padding: 18px 0 0;
}

.feature-detail-edit-form .button {
    justify-self: start;
}

.description-block,
.detail-history {
    padding-top: 22px;
}

.description-copy {
    color: #344054;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.detail-meta {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.detail-meta div {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 4px;
    padding: 12px;
}

.detail-meta span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.detail-meta strong {
    overflow-wrap: anywhere;
}

.detail-history h2 {
    margin-bottom: 10px;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 4px;
    padding: 12px;
}

.history-item time,
.history-item span {
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 1220px) {
    .workspace {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .logs {
        grid-column: 1 / -1;
        max-height: none;
        position: static;
    }

    .master-grid {
        grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1fr);
    }

    .master-logs {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .team-members-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1180px) {
    .project-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .workspace {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .dashboard-workspace,
    .master-workspace {
        padding: 14px;
    }

    .master-grid {
        grid-template-columns: 1fr;
    }

    .master-logs {
        grid-column: auto;
    }

    .topbar,
    .page-heading,
    .project-header,
    .feature-row,
    .detail-header,
    .project-detail-header {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        gap: 12px;
        min-height: 0;
        padding: 12px 14px;
    }

    .brand {
        width: 100%;
    }

    .brand small {
        display: block;
        margin-top: 2px;
    }

    .topbar-user {
        display: grid;
        gap: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .topbar-user > .topbar-link,
    .topbar-user > .master-menu,
    .topbar-user > form,
    .topbar-user > form .button {
        min-width: 0;
        width: 100%;
    }

    .topbar-user > .topbar-link,
    .topbar-user > .master-menu summary,
    .topbar-user > form .button {
        justify-content: center;
    }

    .topbar-user > .master-menu summary {
        width: 100%;
    }

    .topbar-user > span {
        color: var(--muted);
        font-size: 0.84rem;
        grid-column: 1 / -1;
        overflow-wrap: anywhere;
        text-align: center;
    }

    .master-menu-links {
        left: 0;
        min-width: 100%;
        right: auto;
    }

    .member-pills,
    .verification-actions {
        justify-content: flex-start;
    }

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

    .project-list {
        grid-template-columns: 1fr;
    }

    .feature-list-row {
        align-items: start;
        grid-template-columns: 22px 20px minmax(0, 1fr) 34px;
        row-gap: 4px;
    }

    .feature-title,
    .feature-updated {
        line-height: 1.1;
    }

    .feature-updated {
        grid-column: 3 / -1;
        white-space: normal;
    }

    .feature-editor {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
    }

    .feature-editor[open] {
        grid-column: 1 / -1;
        grid-row: auto;
        width: 100%;
    }

    .detail-meta {
        grid-template-columns: 1fr;
    }

    .feature-detail {
        margin-top: 14px;
        padding: 0 14px 14px;
    }

    .completed-projects-workspace {
        margin-top: 14px;
        padding: 0 14px 14px;
    }

    .account-workspace {
        margin-top: 14px;
        padding: 0 14px 14px;
    }

    .account-panel {
        padding: 18px;
    }

    .project-overview-heading {
        display: none;
    }

    .project-overview-row {
        align-items: center;
        column-gap: 12px;
        grid-template-areas:
            "name status"
            "updated updated"
            "assigned assigned"
            "action action";
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 14px;
        row-gap: 9px;
    }

    .project-overview-name {
        grid-area: name;
    }

    .project-overview-status {
        grid-area: status;
        justify-self: end;
    }

    .project-overview-updated {
        grid-area: updated;
    }

    .project-overview-assigned {
        grid-area: assigned;
        justify-self: start;
        min-width: 0;
    }

    .project-overview-action {
        grid-area: action;
        justify-self: start;
    }

    .project-detail-workspace {
        margin-top: 14px;
        padding: 0 14px 14px;
    }

    .project-detail-header,
    .project-detail-summary {
        padding: 18px;
    }

    .project-detail-actions {
        justify-content: flex-start;
    }

    .detail-panel {
        padding: 18px;
    }

    .feature-detail-edit-button {
        padding: 14px 0;
    }

    .feature-detail-edit-form {
        padding: 16px 0 0;
    }

    .feature-detail-edit-form .button {
        justify-self: stretch;
    }

    .reject-form {
        flex-direction: column;
        width: 100%;
    }
}

/* ---------- Dashboard: summary, attention, project cards ---------- */
.dash-stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dash-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    transition: box-shadow 0.15s, transform 0.15s;
}

.dash-stat:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.dash-stat span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.dash-stat strong {
    font-size: 2rem;
    line-height: 1;
}

.dash-stat.warn { border-left: 4px solid var(--amber); }
.dash-stat.warn strong { color: var(--amber); }
.dash-stat.danger { border-left: 4px solid var(--red); }
.dash-stat.danger strong { color: var(--red); }

.dash-attention {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
}

.dash-card h2,
.dash-section-title {
    font-size: 1rem;
    margin: 0 0 10px;
}

.dash-section-title {
    margin-top: 6px;
}

.dash-task {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;
}

.dash-task:first-of-type {
    border-top: 0;
}

.dash-task-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.dash-task-main a {
    font-weight: 700;
}

.dash-task-main a:hover {
    color: var(--blue);
}

.dash-task-main small {
    color: var(--muted);
}

.dash-task-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.dash-task-actions .reject-form {
    display: flex;
    gap: 6px;
}

.dash-task-actions input {
    border: 1px solid var(--line);
    border-radius: 6px;
    max-width: 140px;
    padding: 6px 8px;
}

.dash-projects {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.dash-project {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
}

.dash-project header {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.dash-project h3 {
    font-size: 1.05rem;
    margin: 0;
}

.dash-progress {
    background: var(--surface-soft);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.dash-progress span {
    background: var(--green);
    border-radius: 999px;
    display: block;
    height: 100%;
}

.dash-progress-label {
    color: var(--muted);
    display: flex;
    font-size: 0.8rem;
    font-weight: 700;
    justify-content: space-between;
}

.dash-mini-tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-mini-tasks li {
    align-items: center;
    display: flex;
    font-size: 0.9rem;
    gap: 8px;
}

.dash-mini-tasks a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-dot {
    background: #9aa3b2;
    border-radius: 50%;
    flex: none;
    height: 8px;
    width: 8px;
}

button.dash-dot {
    border: 0;
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: transform .12s, box-shadow .12s;
}

button.dash-dot::after {
    content: "";
    inset: -8px;
    position: absolute;
}

button.dash-dot:hover,
button.dash-dot:focus-visible {
    box-shadow: 0 0 0 4px rgba(105, 115, 134, .2);
    transform: scale(1.25);
}

.dash-mini-tasks li form { display: flex; margin: 0; }

.dash-mini-tasks a.is-done {
    color: var(--muted);
    text-decoration: line-through;
}

.dash-dot.wait { background: var(--green); }
.dash-dot.ret { background: var(--red); }

.dash-project footer {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
}

.dash-avatars {
    display: flex;
}

.dash-avatars span {
    align-items: center;
    background: #e0e7ff;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #3730a3;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 800;
    height: 28px;
    justify-content: center;
    margin-left: -6px;
    width: 28px;
}

.dash-avatars span:first-child {
    margin-left: 0;
}

.dash-view-all {
    color: var(--blue);
    font-size: 0.85rem;
    font-weight: 800;
}

.project-manage {
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 12px;
}

.project-manage h2 {
    font-size: 1rem;
    margin: 0 0 10px;
}

@media (max-width: 900px) {
    .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-task { align-items: flex-start; flex-direction: column; }
}

/* ---- Project detail: compact, modern ---- */
.project-detail-workspace { margin: 14px auto; }

.project-detail-panel { border-radius: 14px; }

.project-detail-header {
    align-items: center;
    padding: 14px 20px;
}

.project-detail-header .muted {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0;
    text-transform: uppercase;
}

.project-detail-header h1 { font-size: 1.3rem; margin-top: 2px; }

.project-detail-summary { gap: 8px; padding: 12px 20px; }
.project-detail-summary > p { color: #344054; font-size: 0.92rem; margin: 0; }

.summary-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    justify-content: space-between;
}

.summary-meta .member-pills { justify-content: flex-start; min-width: 0; gap: 6px; }
.summary-meta .member-pills span { font-size: 0.74rem; padding: 5px 9px; }
.summary-meta .meta-row { color: var(--muted); display: flex; gap: 6px; margin: 0; }

.feature-form {
    align-items: center;
    background: var(--surface);
    gap: 8px;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto;
    padding: 10px 20px;
}

.feature-form input { margin: 0; min-height: 38px; }
.feature-form .button { min-height: 38px; padding: 0 22px; width: auto; }

.project-manage { border-bottom: 1px solid var(--line); }

.project-manage > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-size: 0.85rem;
    font-weight: 800;
    gap: 10px;
    list-style: none;
    padding: 10px 20px;
}

.project-manage > summary::-webkit-details-marker { display: none; }

.project-manage > summary::before {
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    content: "";
    height: 6px;
    transform: rotate(-45deg);
    transition: transform .15s;
    width: 6px;
}

.project-manage[open] > summary::before { transform: rotate(45deg); }
.project-manage > summary small { color: var(--muted); font-weight: 600; }
.project-manage > summary:hover { background: var(--surface-soft); }

.project-manage .admin-tools {
    border-bottom: 0;
    border-top: 1px solid var(--line);
    gap: 12px 24px;
    padding: 12px 20px;
}

.project-manage .inline-form { max-width: 360px; width: auto; }

.feature-caption { padding: 8px 20px; }

.feature-list-row {
    gap: 8px;
    min-height: 40px;
    padding: 4px 20px;
    transition: background .12s;
}

.feature-list-row:hover { background: var(--surface-soft); }
.feature-list-row.completed:hover { background: #c8e6d0; }

@media (max-width: 720px) {
    .feature-form { grid-template-columns: 1fr auto; }
    .feature-form input[name="description"] { grid-column: 1 / -1; grid-row: 2; }
}

.project-manage { border-top: 0; margin-top: 0; padding-top: 0; }

.feature-list-row .feature-edit-button {
    font-size: 0.9rem;
    height: 28px;
    width: 28px;
}

/* ---- Feature row: inline action icons ---- */
.feature-list-row {
    grid-template-columns: 24px 22px minmax(160px, 1fr) auto auto;
}

.feature-list-row .feature-updated { grid-column: 4; }

.feature-actions {
    align-items: center;
    display: flex;
    gap: 6px;
    grid-column: 5;
    justify-content: flex-end;
    min-width: 62px;
}

.feature-actions form { display: flex; margin: 0; }

.row-icon {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #475467;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 800;
    height: 28px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
    width: 28px;
}

.row-icon:hover,
.row-icon:focus-visible { border-color: var(--blue); color: var(--blue); }

.row-icon.is-check:hover,
.row-icon.is-check:focus-visible { background: #e6f4ea; border-color: var(--green); color: var(--green); }

.row-icon.is-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.row-icon.is-check.on:hover { background: #166534; color: #fff; }

.row-icon.is-locked { cursor: default; font-size: 0.75rem; opacity: .7; }
.row-icon.is-locked:hover { border-color: var(--line); color: #475467; }

.feature-list-row .feature-editor { grid-column: 1 / -1; }
.feature-list-row .feature-editor:not([open]) { grid-column: 3 / 5; grid-row: 1; justify-self: end; margin-right: 8px; }
.feature-list-row .feature-updated { grid-row: 1; }

.review-toggle {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--amber);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
    list-style: none;
    padding: 5px 11px;
}

.review-toggle::-webkit-details-marker { display: none; }
.review-toggle:hover { border-color: var(--amber); }

/* ---- Feature detail: compact ---- */
.feature-detail { margin-top: 14px; }

.feature-detail .detail-panel { border-radius: 14px; overflow: hidden; padding: 0; }

.feature-detail .detail-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
}

.feature-detail .detail-header .muted {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0;
    text-transform: uppercase;
}

.feature-detail .detail-header h1 { font-size: 1.3rem; margin: 2px 0 0; }

.feature-detail .feature-detail-editor { border: 0; border-bottom: 1px solid var(--line); margin: 0; padding: 0; }

.feature-detail .feature-detail-edit-button {
    align-items: center;
    color: #344054;
    cursor: pointer;
    display: flex;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 8px;
    list-style: none;
    padding: 9px 20px;
}

.feature-detail .feature-detail-edit-button:hover { background: var(--surface-soft); color: var(--blue); }
.feature-detail .feature-detail-edit-button::-webkit-details-marker { display: none; }

.feature-detail .feature-detail-edit-form { gap: 10px; padding: 4px 20px 14px; }
.feature-detail .feature-detail-edit-form textarea { min-height: 0; }

.feature-detail .description-block { border: 0; padding: 12px 20px 4px; }

.feature-detail .description-block h2,
.feature-detail .detail-history h2 {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.feature-detail .description-copy { font-size: 0.92rem; line-height: 1.5; margin: 0; }

.feature-detail .detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 20px;
}

.feature-detail .detail-meta > div {
    align-items: baseline;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin: 0;
    padding: 5px 12px;
}

.feature-detail .detail-meta span { color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.feature-detail .detail-meta strong { font-size: 0.8rem; }

.feature-detail .detail-history { border-top: 1px solid var(--line); padding: 10px 20px 14px; }

.feature-detail .history-list { background: transparent; border: 0; gap: 0; padding: 0; }

.feature-detail .history-item {
    align-items: baseline;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    padding: 6px 0;
}

.feature-detail .history-item:last-child { border-bottom: 0; }
.feature-detail .history-item time { color: var(--muted); font-size: 0.74rem; min-width: 150px; }
.feature-detail .history-item strong { font-size: 0.82rem; }
.feature-detail .history-item span { color: var(--muted); font-size: 0.78rem; }
.feature-detail .history-item p { flex-basis: 100%; font-size: 0.8rem; margin: 0; }

.feature-dates {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: flex-end;
}

.feature-dates b { color: #344054; font-weight: 700; }
.feature-dates .is-completed, .feature-dates .is-completed b { color: #166534; }

@media (max-width: 720px) {
    .feature-dates { align-items: flex-end; flex-direction: column; gap: 2px; }
}

/* ======== Responsive pass: mobile / tablet / laptop ======== */
html { -webkit-text-size-adjust: 100%; }
img, svg, video { max-width: 100%; }
input, select, textarea { max-width: 100%; }

.nav-toggle { display: none; }

/* Laptop+ : keep content comfortable on very wide screens */
@media (min-width: 1400px) {
    .project-detail-workspace, .feature-detail { max-width: 1180px; }
}

/* Tablet */
@media (max-width: 1024px) {
    .topbar { padding: 12px 18px; }
    .topbar-user { gap: 8px; }
    .dash-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile + small tablet : collapsible nav */
@media (max-width: 860px) {
    .topbar {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0 12px;
        padding: 8px 14px;
    }

    .brand { flex: 1; min-width: 0; width: auto; }
    .brand small { margin-top: 0; font-size: 0.72rem; }
    .brand-mark { height: 34px; width: 34px; }

    .nav-toggle {
        align-items: center;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 8px;
        cursor: pointer;
        display: inline-flex;
        flex-direction: column;
        gap: 4px;
        height: 38px;
        justify-content: center;
        padding: 0;
        width: 42px;
    }

    .nav-toggle span {
        background: var(--ink);
        border-radius: 2px;
        height: 2px;
        transition: transform .15s, opacity .15s;
        width: 18px;
    }

    .topbar.open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .topbar.open .nav-toggle span:nth-child(2) { opacity: 0; }
    .topbar.open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .topbar-user { display: none; flex-basis: 100%; padding: 10px 0 4px; }
    .topbar.open .topbar-user { display: grid; }

    .topbar-user > .topbar-link,
    .topbar-user > .master-menu summary,
    .topbar-user > form .button { min-height: 42px; }

    .master-menu-links { left: 0; right: auto; width: 100%; }

    .dash-projects { grid-template-columns: 1fr; }
    .dash-stats { gap: 8px; }
    .dash-stat { padding: 10px 12px; }
}

/* Mobile */
@media (max-width: 600px) {
    .project-detail-workspace, .feature-detail, .dashboard-workspace, .master-workspace {
        padding-left: 10px;
        padding-right: 10px;
    }

    .project-detail-header, .feature-detail .detail-header { align-items: flex-start; flex-direction: row; padding: 12px 14px; }
    .project-detail-header h1, .feature-detail .detail-header h1 { font-size: 1.15rem; }
    .project-detail-actions { flex-direction: column; align-items: flex-end; gap: 6px; }

    .project-detail-summary, .feature-detail .description-block, .feature-detail .detail-meta,
    .feature-detail .detail-history { padding-left: 14px; padding-right: 14px; }

    .summary-meta { align-items: flex-start; flex-direction: column; }

    .feature-form { grid-template-columns: 1fr; padding: 10px 14px; }
    .feature-form input[name="description"] { grid-column: auto; grid-row: auto; }
    .feature-form .button { width: 100%; }

    .project-manage > summary, .project-manage .admin-tools { padding-left: 14px; padding-right: 14px; }
    .project-manage .inline-form { max-width: none; width: 100%; }
    .assign-form { align-items: flex-start; }
    .assign-checks { flex-wrap: wrap; }

    /* feature rows: title on top, dates + icons underneath */
    .feature-list-row {
        align-items: center;
        gap: 4px 8px;
        grid-template-columns: 22px 20px minmax(0, 1fr) auto;
        padding: 8px 14px;
    }

    .feature-list-row .feature-main { grid-column: 3; grid-row: 1; }
    .feature-list-row .feature-actions { grid-column: 4; grid-row: 1; }
    .feature-list-row .feature-updated,
    .feature-list-row .feature-dates {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px 12px;
        grid-column: 3 / -1;
        grid-row: 2;
        justify-content: flex-start;
    }

    .feature-list-row .feature-editor:not([open]) { grid-column: 3 / -1; grid-row: 3; justify-self: start; margin: 0; }
    .feature-list-row .feature-editor[open] { grid-column: 1 / -1; }

    .row-icon { height: 34px; width: 34px; } /* comfortable touch targets */
    .dash-dot { flex: none; }

    .feature-detail .history-item time { min-width: 0; flex-basis: 100%; }

    .button, button, .topbar-link { touch-action: manipulation; }
    input, select, textarea { font-size: 16px; } /* prevent iOS zoom on focus */
}

/* Tablet fixes */
@media (min-width: 601px) and (max-width: 860px) {
    .project-detail-header, .feature-detail .detail-header {
        align-items: center;
        flex-direction: row;
        text-align: left;
    }
    .project-detail-actions { flex-direction: row; justify-content: flex-end; }
    .dash-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .project-detail-header, .feature-detail .detail-header {
        align-items: center;
        flex-direction: row;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .dash-projects { grid-template-columns: 1fr; }
    .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ======== Compact navigation ======== */
.topbar {
    min-height: 56px;
    padding: 8px 20px;
}

.topbar-user {
    gap: 6px;
}

.topbar-link,
.master-menu summary,
.topbar-user .button {
    font-size: 0.84rem;
    min-height: 34px;
    padding: 6px 11px;
}

.topbar-user > span {
    font-size: 0.84rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-badge {
    font-size: 0.68rem;
    min-width: 18px;
    padding: 2px 5px;
}

@media (max-width: 1100px) {
    .topbar { padding: 8px 14px; }
    .topbar-link,
    .master-menu summary,
    .topbar-user .button {
        font-size: 0.8rem;
        padding: 6px 9px;
    }
}

@media (max-width: 860px) {
    .topbar {
        padding: 6px 12px;
    }

    .topbar.open {
        max-height: 100vh;
        overflow-y: auto;
    }

    .brand-mark { height: 30px; width: 30px; }
    .brand strong { font-size: 0.95rem; }

    .nav-toggle { height: 34px; width: 38px; }

    .topbar-user {
        border-top: 1px solid var(--line);
        gap: 6px;
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        margin-top: 6px;
        padding: 8px 0 6px;
    }

    .topbar-user > span {
        grid-column: 1 / -1;
        max-width: none;
        order: -1;
        padding: 0 2px 2px;
        text-align: left;
    }

    .topbar-user > .topbar-link,
    .topbar-user > .master-menu summary,
    .topbar-user > form .button {
        font-size: 0.84rem;
        min-height: 38px;
    }

    .topbar-user > .master-menu {
        grid-column: 1 / -1;
    }

    .master-menu-links {
        box-shadow: none;
        left: auto;
        margin-top: 6px;
        min-width: 0;
        position: static;
        width: 100%;
    }

    .master-menu-links a {
        padding: 9px 12px;
    }
}

/* ======== Installed app (PWA) ======== */
.topbar {
    /* Keep the header clear of the notch / status bar in the installed app. */
    padding-top: calc(6px + env(safe-area-inset-top));
}

body {
    padding-bottom: env(safe-area-inset-bottom);
}

.install-app[hidden] {
    display: none !important;
}

.login-note {
    font-size: 0.8rem;
    margin: 0;
    text-align: center;
}

.login-panel .install-app {
    justify-self: center;
}

/* Standalone window: no browser chrome, so avoid accidental pull-to-refresh bounce. */
@media (display-mode: standalone) {
    html, body { overscroll-behavior-y: none; }
}

/* ======== Help / FAQ ======== */
.help-workspace {
    display: grid;
    gap: 16px;
    margin: 0 auto;
    max-width: 880px;
    padding: 22px 18px 40px;
}

.help-workspace .page-heading {
    margin-bottom: 0;
}

.faq-search {
    display: grid;
    gap: 6px;
}

.faq-search input {
    width: 100%;
}

.faq-section-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.faq-section-heading h2 {
    margin: 0;
}

.faq-section-heading .role-pill {
    margin-left: 0;
}

.faq-item {
    border-top: 1px solid var(--line);
}

.faq-item[hidden],
.faq-section[hidden] {
    display: none;
}

.faq-item > summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    padding: 12px 28px 12px 0;
    position: relative;
}

.faq-item > summary::-webkit-details-marker {
    display: none;
}

.faq-item > summary::after {
    color: var(--muted);
    content: "+";
    font-size: 1.2rem;
    font-weight: 400;
    position: absolute;
    right: 4px;
    top: 9px;
}

.faq-item[open] > summary::after {
    content: "\2212";
}

.faq-answer {
    color: #344054;
    line-height: 1.55;
    padding: 0 0 14px;
}

.faq-answer strong {
    color: var(--ink);
}
