:root {
    --color-bg: #f6f7f8;
    --color-surface: #ffffff;
    --color-surface-muted: #f1f2f3;
    --color-border: #d8dee4;
    --color-border-strong: #afb8c1;
    --color-text: #1f2328;
    --color-text-muted: #59636e;
    --color-green: #006b54;
    --color-green-hover: #005742;
    --color-orange: #f28c28;
    --color-danger: #cf222e;
    --radius-sm: 6px;
    --radius-md: 10px;
    --workspace-width: 1280px;
    --shadow-floating: 0 12px 28px rgba(31, 35, 40, 0.14);
    --shadow-message: 0 8px 24px rgba(31, 35, 40, 0.16);
}

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

html {
    color: var(--color-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body {
    margin: 0;
    background: var(--color-bg);
}

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

a {
    color: var(--color-green);
}

:focus-visible {
    outline: 3px solid rgba(242, 140, 40, 0.42);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.app-header-inner {
    display: flex;
    width: min(100%, var(--workspace-width));
    min-height: 64px;
    align-items: center;
    gap: 24px;
    margin: 0 auto;
    padding: 0 24px;
}

.app-logo {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--color-text);
    font-family: "Archivo Black", Inter, sans-serif;
    font-size: 20px;
    letter-spacing: -0.1em;
    line-height: 1;
    text-decoration: none;
}

.app-nav {
    display: flex;
    min-width: 0;
    align-self: stretch;
    gap: 4px;
}

.app-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.app-nav-link:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.app-nav-link-active {
    color: var(--color-text);
}

.app-nav-link-active::after {
    position: absolute;
    right: 12px;
    bottom: -1px;
    left: 12px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--color-orange);
    content: "";
}

.button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

.button-primary {
    border-color: var(--color-green);
    background: var(--color-green);
    color: #ffffff;
}

.button-primary:hover {
    border-color: var(--color-green-hover);
    background: var(--color-green-hover);
}

.button-secondary {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.button-secondary:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-muted);
}

.button-danger {
    border-color: var(--color-danger);
    background: var(--color-danger);
    color: #ffffff;
}

.button-danger:hover {
    border-color: #a40e26;
    background: #a40e26;
}

.app-profile {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
}

.profile-trigger {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface-muted);
    color: var(--color-green);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
}

.profile-trigger:hover {
    background: var(--color-border);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(300px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-floating);
}

.profile-menu[hidden] {
    display: none;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid var(--color-border);
}

.profile-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--color-surface-muted);
    color: var(--color-green);
    font-size: 14px;
    font-weight: 700;
}

.profile-identity {
    min-width: 0;
}

.profile-name,
.profile-email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-name {
    overflow-wrap: anywhere;
}

.profile-name {
    font-size: 14px;
    font-weight: 650;
}

.profile-email {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 12px;
}

.profile-actions {
    display: grid;
    gap: 4px;
    padding-top: 8px;
}

.profile-action {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
}

.profile-action:hover {
    background: var(--color-surface-muted);
}

.profile-action:disabled {
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.profile-action:disabled:hover {
    background: transparent;
}

.profile-action-note {
    display: none;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
}

.profile-logout-form {
    margin: 0;
}

.app-content {
    width: min(100%, var(--workspace-width));
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.team-context {
    position: relative;
    isolation: isolate;
    margin: -28px 0 28px;
    border-bottom: 1px solid var(--color-border);
}

.team-context::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--color-surface);
    box-shadow: 0 0 0 100vmax var(--color-surface);
    clip-path: inset(0 -100vmax);
    content: "";
}

.team-context-inner {
    display: flex;
    min-height: 64px;
    align-items: center;
    gap: 4px;
    width: min(100%, var(--workspace-width));
    margin: 0 auto;
    padding: 0;
}

.team-identity {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
}

.team-name-link {
    max-width: 220px;
    padding: 10px 4px 10px 11px;
    overflow: hidden;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 550;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-name-link:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.team-switcher {
    position: static;
}

.team-switcher summary {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    list-style: none;
}

.team-switcher summary:hover,
.team-switcher[open] summary {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.team-switcher summary::-webkit-details-marker {
    display: none;
}

.team-switcher-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    display: grid;
    width: min(280px, calc(100vw - 32px));
    max-height: 320px;
    gap: 3px;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-floating);
}

.team-switcher-menu a {
    padding: 8px 9px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 13px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-switcher-menu a:hover,
.team-switcher-menu a[aria-current="page"] {
    background: var(--color-surface-muted);
}

.team-switcher-menu .team-switcher-all {
    margin-top: 3px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.team-tabs {
    display: flex;
    align-self: stretch;
    gap: 4px;
}

.team-tab {
    position: relative;
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 6px;
    padding: 10px 11px;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 550;
    text-decoration: none;
}

.team-tab:hover,
.team-tab-active {
    color: var(--color-text);
}

.team-tab-active::after {
    position: absolute;
    right: 9px;
    bottom: -1px;
    left: 9px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--color-orange);
    content: "";
}

.nav-count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 650;
    text-align: center;
}

.team-invite-action {
    min-height: 34px;
    margin-left: auto;
}

.team-invite-disabled {
    margin-left: auto;
}

.team-settings-action {
    cursor: not-allowed;
    opacity: 0.62;
}

.workspace-page {
    width: 100%;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.page-actions {
    display: flex;
    margin-bottom: 20px;
}

.page-header-compact {
    max-width: 820px;
}

.form-page,
.destructive-page {
    width: min(100%, 820px);
    margin-right: auto;
    margin-left: auto;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(26px, 3vw, 34px);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.page-header p {
    max-width: 65ch;
    margin: 8px 0 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--color-text-muted);
    font-size: 13px;
    text-decoration: none;
}

.back-link:hover {
    color: var(--color-green);
}

.local-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 22px;
    overflow: visible;
    border-bottom: 1px solid var(--color-border);
}

.local-tabs a {
    position: relative;
    flex: 0 0 auto;
    padding: 10px 12px;
    color: var(--color-text-muted);
    font-size: 14px;
    text-decoration: none;
}

.local-tabs a:hover {
    color: var(--color-text);
}

.local-tab-active {
    color: var(--color-text);
}

.local-tab-active::after {
    position: absolute;
    right: 10px;
    bottom: -1px;
    left: 10px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--color-orange);
    content: "";
}

.disabled-action {
    color: var(--color-text-muted);
    font-size: 13px;
}

.page-summary {
    margin: 20px 0 10px;
    font-size: 15px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 6px 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 13px;
    white-space: nowrap;
}

.filter-bar-wide {
    flex-wrap: wrap;
    overflow: visible;
    white-space: normal;
}

.filter-bar > span {
    color: var(--color-text-muted);
    font-weight: 600;
}

.filter-bar a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.filter-bar a:hover,
.filter-bar a:has(strong) {
    color: var(--color-green);
}

.team-grid,
.task-grid {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.team-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    gap: 14px;
}

.team-card,
.task-card {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.team-card:hover,
.task-card:hover {
    border-color: var(--color-border-strong);
}

.team-card-link {
    display: flex;
    min-height: 92px;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: inherit;
    color: var(--color-text);
    text-decoration: none;
}

.team-card-link:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.team-card-link:hover .team-card-mark {
    background: var(--color-border);
    color: var(--color-green);
}

.team-card-link:hover .team-card-arrow {
    color: var(--color-text);
}

.team-card-mark {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-green);
    font-weight: 700;
}

.team-card-link > span:nth-child(2) {
    min-width: 0;
}

.team-card-link strong,
.team-card-link small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-card-link small {
    margin-top: 4px;
    color: var(--color-text-muted);
    font-size: 12px;
}

.team-card-arrow {
    margin-left: auto;
    color: var(--color-text-muted);
}

.task-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 14px;
    margin-top: 18px;
}

.task-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 12px;
}

.task-toolbar > strong {
    margin-right: auto;
    font-size: 15px;
}

.team-details-page .task-toolbar {
    justify-content: flex-end;
}

.toolbar-popover {
    position: relative;
}

.toolbar-popover summary {
    min-height: 34px;
    list-style: none;
}

.toolbar-popover .toolbar-icon-button {
    width: 34px;
    padding: 0;
    border-radius: 50%;
    font-size: 17px;
}

.toolbar-popover summary::-webkit-details-marker {
    display: none;
}

.toolbar-popover[open] summary {
    border-color: var(--color-border-strong);
    background: var(--color-surface-muted);
}

.toolbar-popover-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: min(320px, calc(100vw - 32px));
    max-height: min(420px, calc(100vh - 120px));
    gap: 4px;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-floating);
}

.toolbar-popover-panel a {
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 13px;
    text-decoration: none;
}

.toolbar-popover-panel a:hover {
    background: var(--color-surface-muted);
}

.toolbar-popover-title {
    padding: 4px 8px 7px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 650;
}

.task-card {
    padding: 14px;
}

.task-card h3 {
    margin: 0 0 14px;
    font-size: 17px;
    line-height: 1.35;
}

.task-card h3 a {
    color: var(--color-text);
    text-decoration: none;
}

.task-card h3 a:hover {
    color: var(--color-green);
}

.task-card > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.task-card form {
    color: var(--color-text);
}

.task-card select,
.workspace-page input,
.workspace-page select,
.workspace-page textarea {
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.task-card select:hover,
.task-metadata-panel select:hover {
    background: var(--color-surface-muted);
}

.task-card select:focus-visible,
.task-metadata-panel select:focus-visible {
    outline: 2px solid rgba(0, 107, 84, 0.35);
    outline-offset: 1px;
}

.task-card button:not(.button),
.workspace-page button:not(.button) {
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.task-card button:not(.button):hover,
.workspace-page button:not(.button):hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-muted);
}

.empty-state {
    display: grid;
    max-width: 680px;
    min-height: 220px;
    place-items: center;
    align-content: center;
    padding: 36px 24px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    text-align: center;
}

.empty-state-compact {
    min-height: 150px;
    margin-bottom: 18px;
}

.empty-state h2 {
    margin: 0;
    font-size: 20px;
}

.empty-state p {
    max-width: 52ch;
    margin: 8px 0 18px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.form-card {
    display: grid;
    width: min(100%, 680px);
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.form-card-compact {
    margin-bottom: 28px;
}

.form-card h2 {
    margin: 0;
    font-size: 20px;
}

.form-field {
    display: grid;
    gap: 7px;
}

.form-field label {
    font-size: 14px;
    font-weight: 600;
}

.form-field > input {
    width: 100%;
    min-height: 42px;
}

.field-with-action {
    display: flex;
    gap: 8px;
}

.field-with-action input {
    min-width: 0;
    flex: 1;
}

.form-help {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 12px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 7px 5px 10px;
    border-radius: 999px;
    background: var(--color-surface-muted);
    font-size: 13px;
}

.tag-chip-remove {
    min-height: 24px !important;
    padding: 0 5px !important;
    border: 0 !important;
    background: transparent !important;
}

.table-card {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: var(--color-surface-muted);
}

.invite-form {
    display: flex;
    max-width: 720px;
    align-items: end;
    gap: 10px;
    margin-bottom: 24px;
}

.invite-form .form-field {
    min-width: 0;
    flex: 1;
    margin: 0;
}

.destructive-page {
    display: grid;
    min-height: calc(100vh - 150px);
    place-items: center;
}

.destructive-card {
    width: min(100%, 560px);
    padding: 28px;
    border: 1px solid rgba(207, 34, 46, 0.42);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.destructive-card h1 {
    margin: 8px 0 12px;
    font-size: 24px;
}

.destructive-step {
    color: var(--color-danger);
    font-size: 13px;
    font-weight: 650;
}

.task-detail-layout {
    display: grid;
    width: min(100%, 960px);
    gap: 28px;
    margin: 0 auto;
}

.task-detail-main,
.task-description-section,
.comments-section {
    min-width: 0;
}

.task-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.task-title-row h1 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.2;
}

.text-action {
    flex: 0 0 auto;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--color-green);
    cursor: pointer;
    font-size: 13px;
}

.text-action:hover {
    text-decoration: underline;
}

.task-metadata-panel {
    display: flex;
    align-items: center;
    gap: 12px 20px;
    padding: 16px;
    flex-wrap: wrap;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: 13px;
}

.task-description-section h2,
.comments-section h2 {
    margin: 0 0 12px;
    font-size: 20px;
}

.task-description-panel {
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow-wrap: anywhere;
}

.task-description-panel p {
    margin: 0;
    white-space: pre-wrap;
}

.comment-timeline {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.comment-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
}

.comment-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: #59636e;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.comment-card {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.comment-header {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-muted);
}

.comment-header small,
.comment-edited {
    margin-left: 6px;
    color: var(--color-text-muted);
    font-size: 12px;
}

.comment-body {
    min-height: 64px;
    padding: 16px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.comment-menu {
    position: relative;
}

.comment-menu summary {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    list-style: none;
}

.comment-menu summary:hover {
    background: var(--color-border);
}

.comment-menu-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    width: 170px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-floating);
}

.comment-menu-panel button {
    width: 100%;
    padding: 8px 9px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.comment-menu-panel button:hover {
    background: var(--color-surface-muted);
}

.comment-menu-panel .comment-delete-action {
    color: var(--color-danger);
}

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

.comment-edit-form textarea,
.comment-create-form textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
}

.comment-create-form {
    width: calc(100% - 48px);
    margin: 20px 0 0 48px;
}

.destructive-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 36px 20px;
    background: var(--color-bg);
}

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

.invitation-panel {
    width: min(100%, 440px);
    padding: 26px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.invitation-panel h1 {
    margin: 0;
    font-size: 24px;
}

.invitation-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.auth-shell {
    width: min(100%, 420px);
}

.auth-logo {
    display: flex;
    width: 100%;
    min-height: 88px;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: var(--color-text);
    font-family: "Archivo Black", Inter, sans-serif;
    font-size: clamp(38px, 10vw, 52px);
    letter-spacing: -0.11em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.auth-tagline {
    max-width: 36ch;
    margin: 4px auto 24px;
    color: var(--color-text-muted);
    font-size: 14px;
    text-align: center;
}

.auth-panel {
    padding: 26px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.auth-panel h1 {
    margin: 0 0 20px;
    font-size: 24px;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.auth-panel > p {
    color: var(--color-text-muted);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: -6px 0 24px;
    border-bottom: 1px solid var(--color-border);
}

.auth-tab {
    position: relative;
    padding: 10px 0;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.auth-tab:hover {
    color: var(--color-text);
}

.auth-tab-active {
    color: var(--color-text);
}

.auth-tab span {
    position: relative;
    display: inline-block;
}

.auth-tab-active span::after {
    position: absolute;
    right: 0;
    bottom: -11px;
    left: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--color-orange);
    content: "";
}

.auth-field {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.auth-field label,
.auth-panel form > label {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
}

.auth-field input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.auth-field input:hover {
    border-color: #7d8590;
}

.auth-field input:focus {
    border-color: var(--color-green);
    outline: 3px solid rgba(0, 107, 84, 0.18);
}

.auth-submit {
    display: inline-flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    padding: 9px 14px;
    border: 1px solid var(--color-green);
    border-radius: var(--radius-sm);
    background: var(--color-green);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.auth-submit:hover:not(:disabled) {
    border-color: var(--color-green-hover);
    background: var(--color-green-hover);
}

.auth-submit:disabled {
    border-color: #9ca3a9;
    background: #9ca3a9;
    cursor: not-allowed;
}

.auth-invite {
    margin-bottom: 20px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    font-size: 14px;
}

.auth-invite p {
    margin: 8px 0 0;
}

.auth-back-link {
    display: inline-block;
    margin-top: 22px;
    font-size: 14px;
    text-decoration: none;
}

.auth-panel details {
    margin-top: 20px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.auth-attempts {
    margin: 12px 0 0;
    color: var(--color-text-muted);
    font-size: 13px;
}

.auth-panel summary {
    cursor: pointer;
    color: var(--color-text-muted);
    font-weight: 500;
}

.auth-panel [data-request-countdown],
.auth-panel [data-resend-countdown] {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-size: 13px;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.48);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spinner-rotate 0.7s linear infinite;
}

.button-secondary .auth-spinner {
    border-color: rgba(0, 107, 84, 0.28);
    border-top-color: var(--color-green);
}

@keyframes auth-spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

.flash-stack {
    position: fixed;
    z-index: 1000;
    top: 20px;
    right: 20px;
    display: grid;
    width: min(400px, calc(100vw - 32px));
    gap: 10px;
    pointer-events: none;
}

.flash-message {
    display: flex;
    min-height: 48px;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 12px 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-message);
    color: var(--color-text);
    font-size: 14px;
    pointer-events: auto;
}

.flash-message-success {
    border-color: rgba(0, 107, 84, 0.42);
}

.flash-message-error {
    border-color: rgba(207, 34, 46, 0.42);
}

.flash-message-warning {
    border-color: rgba(191, 113, 0, 0.48);
}

.flash-message-text {
    flex: 1;
    padding-top: 2px;
}

.flash-close {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.flash-close:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.ui-tooltip {
    position: fixed;
    z-index: 1200;
    max-width: min(280px, calc(100vw - 24px));
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: #24292f;
    color: #ffffff;
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
}

.ui-tooltip[hidden] {
    display: none;
}

@media (max-width: 760px) {
    .auth-page {
        align-items: start;
        padding: 20px 16px 32px;
    }

    .auth-logo {
        min-height: 72px;
        font-size: clamp(34px, 10.5vw, 46px);
    }

    .auth-panel {
        padding: 22px 18px;
    }

    .auth-submit,
    .auth-field input {
        min-height: 44px;
    }

    .flash-stack {
        top: 12px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

    .page-header > .button {
        align-self: flex-start;
    }

    .filter-bar-wide {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }

    .local-tabs {
        overflow-x: auto;
    }

    .task-toolbar {
        flex-wrap: wrap;
    }

    .task-toolbar > strong {
        width: 100%;
    }

    .toolbar-popover {
        position: static;
    }

    .toolbar-popover-panel {
        right: 16px;
        left: 16px;
        width: auto;
    }

    .task-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .text-action {
        align-self: flex-start;
    }

    .comment-item {
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 8px;
    }

    .comment-avatar {
        width: 30px;
        height: 30px;
    }

    .comment-header {
        align-items: flex-start;
    }

    .comment-header small,
    .comment-edited {
        display: block;
        margin: 2px 0 0;
    }

    .comment-create-form {
        width: 100%;
        margin-left: 0;
    }

    .task-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .form-card,
    .destructive-card {
        padding: 20px 16px;
    }

    .field-with-action {
        align-items: stretch;
        flex-direction: column;
    }

    .invite-form {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-action-note {
        display: block;
    }

    .destructive-actions {
        flex-direction: column;
    }

    .app-logo {
        min-height: 44px;
        font-size: 16px;
    }

    .app-header-inner {
        min-height: 58px;
        gap: 8px;
        padding: 0 16px;
    }

    .app-nav {
        overflow-x: auto;
    }

    .app-nav-link {
        flex: 0 0 auto;
        padding-right: 9px;
        padding-left: 9px;
        font-size: 13px;
    }

    .button,
    .profile-trigger,
    .profile-action {
        min-height: 44px;
    }

    .profile-trigger {
        width: 44px;
        height: 44px;
    }

    .app-content {
        padding: 20px 16px;
    }

    .team-context {
        margin: -20px 0 22px;
    }

    .team-context-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0 8px;
        padding: 10px 0 0;
    }

    .team-identity {
        grid-column: 1;
        min-height: 44px;
    }

    .team-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
        overflow-x: auto;
    }

    .team-invite-action,
    .team-invite-disabled {
        grid-column: 2;
        grid-row: 1;
        margin-left: 0;
    }

    .toolbar-popover .toolbar-icon-button,
    .comment-menu summary {
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner {
        animation: none;
        border-color: rgba(255, 255, 255, 0.72);
    }
}
