.icon {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--control-height);
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
}

.btn-ghost {
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-danger {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-soft);
}

.btn-icon {
    width: var(--control-height);
    padding: 0;
}

.btn-block {
    width: 100%;
}

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.field-label {
    font-size: var(--text-sm);
    font-weight: 500;
}

.field-hint {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.field-error {
    font-size: var(--text-xs);
    color: var(--danger);
}

.input,
.select,
.textarea {
    width: 100%;
    height: var(--control-height);
    padding: 0 var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.textarea {
    height: auto;
    min-height: 88px;
    padding: var(--space-2) var(--space-3);
    resize: vertical;
}

.select {
    appearance: none;
    padding-right: var(--space-6);
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%), linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-tertiary);
}

.input:disabled,
.select:disabled {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.search {
    position: relative;
    flex: 1 1 240px;
    max-width: 340px;
}

.search .icon {
    position: absolute;
    top: 10px;
    left: 12px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search .input {
    padding-left: 34px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: relative;
    flex: none;
    width: 38px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--border-strong);
    transition: background var(--transition);
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition);
}

.switch input:checked + .switch-track {
    background: var(--accent);
}

.switch input:checked + .switch-track::after {
    transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.segmented {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border-radius: var(--radius-md);
    background: var(--neutral-soft);
}

.segmented button {
    height: 30px;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.segmented button[aria-pressed="true"] {
    background: var(--surface-raised);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5) 0;
}

.card-subtitle {
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.card-body {
    padding: var(--space-4) var(--space-5) var(--space-5);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

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

.table tbody tr.is-clickable {
    cursor: pointer;
}

.table tbody tr.is-clickable:hover td {
    background: var(--surface-hover);
}

.table .align-right {
    text-align: right;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-small {
    font-size: var(--text-sm);
}

.text-strong {
    font-weight: 500;
}

.nowrap {
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
}

.badge-neutral {
    background: var(--neutral-soft);
    color: var(--text-secondary);
}

.badge-accent {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-8) var(--space-5);
    text-align: center;
}

.empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-lg);
    background: var(--neutral-soft);
    color: var(--text-secondary);
}

.empty-state-icon .icon {
    width: 20px;
    height: 20px;
}

.empty-state p {
    max-width: 380px;
    color: var(--text-secondary);
}

.empty-state .btn {
    margin-top: var(--space-3);
}

.modal {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface-raised);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.modal::backdrop {
    background: var(--overlay);
}

.modal-wide {
    width: min(720px, calc(100vw - 32px));
}

.modal-header {
    padding: var(--space-5) var(--space-5) 0;
}

.modal-body {
    padding: var(--space-4) var(--space-5);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: 0 var(--space-5) var(--space-5);
}

.toast-region {
    position: fixed;
    inset: auto var(--space-5) var(--space-5) auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

.toast-region:popover-open {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    max-width: 360px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    box-shadow: var(--shadow-lg);
}

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

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--neutral-soft);
    font-size: var(--text-sm);
}

pre.alert {
    margin: 0;
    overflow: auto;
}

.alert-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.loading {
    display: flex;
    justify-content: center;
    padding: var(--space-8);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-4);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.pagination-controls {
    display: flex;
    gap: var(--space-2);
}

.secret {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--neutral-soft);
}

.secret code {
    font-size: var(--text-md);
    word-break: break-all;
}

.description-list {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: var(--space-2) var(--space-4);
    margin: 0;
}

.description-list dt {
    color: var(--text-secondary);
}

.description-list dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.picker {
    position: relative;
}

.picker-results {
    position: absolute;
    top: calc(100% + var(--space-1));
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 240px;
    padding: var(--space-1);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    box-shadow: var(--shadow-lg);
}

.picker-option {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.picker-option:hover,
.picker-option:focus-visible {
    background: var(--surface-hover);
}

.picker-empty {
    padding: var(--space-2) var(--space-3);
    color: var(--text-secondary);
}

.items-editor {
    overflow-x: auto;
}

.items-editor table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.items-editor th {
    padding: 0 var(--space-1) var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.items-editor td {
    padding: var(--space-1);
    vertical-align: top;
}

.items-editor .textarea {
    min-height: var(--control-height);
    height: var(--control-height);
    padding-top: 7px;
}

.items-editor .col-quantity {
    width: 84px;
}

.items-editor .col-unit {
    width: 116px;
}

.items-editor .col-price {
    width: 110px;
}

.items-editor .col-vat {
    width: 88px;
}

.items-editor .col-total {
    width: 104px;
    text-align: right;
}

.items-editor .col-remove {
    width: 44px;
}

.items-editor .line-total {
    display: block;
    padding-top: 8px;
    text-align: right;
    white-space: nowrap;
}

.totals {
    margin: var(--space-4) 0 0 auto;
    width: min(320px, 100%);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-1) 0;
    color: var(--text-secondary);
}

.totals-row.is-grand {
    margin-top: var(--space-1);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    font-size: var(--text-lg);
}

.pre-line {
    white-space: pre-line;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.stat-grid .card-body {
    padding: var(--space-4) var(--space-5);
}

.stat-value {
    margin-top: var(--space-1);
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 600;
}

.summary-row {
    margin-bottom: var(--space-4);
}

.preview-sheet {
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    overflow-wrap: anywhere;
}

.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.check-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.check-row input {
    accent-color: var(--accent);
}

.cal-month,
.cal-time {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.cal-month-head {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 500;
}

.cal-month-head div {
    padding: var(--space-2) var(--space-3);
}

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

.cal-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    min-height: 112px;
    padding: var(--space-1);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.cal-cell:nth-child(7n) {
    border-right: 0;
}

.cal-cell:nth-last-child(-n + 7) {
    border-bottom: 0;
}

.cal-cell.is-outside {
    background: var(--bg);
}

.cal-cell.is-outside .cal-day-number {
    color: var(--text-tertiary);
}

.cal-day-number {
    align-self: flex-start;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--space-1);
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
}

.cal-day-number:hover {
    background: var(--surface-hover);
}

.cal-cell.is-today .cal-day-number {
    background: var(--accent);
    color: var(--on-accent);
}

.cal-item {
    display: flex;
    gap: var(--space-1);
    width: 100%;
    min-width: 0;
    padding: 2px var(--space-1);
    border: 0;
    border-radius: 6px;
    font-size: var(--text-xs);
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.cal-item-event {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.cal-item-auto {
    background: var(--neutral-soft);
    color: var(--text-secondary);
}

.cal-item-time {
    flex: none;
    font-weight: 500;
}

.cal-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-more {
    padding: 0 var(--space-1);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-align: left;
    cursor: pointer;
}

.cal-time-head,
.cal-all-day,
.cal-time-grid {
    display: grid;
}

.cal-time-head,
.cal-all-day {
    border-bottom: 1px solid var(--border);
}

.cal-time-day {
    padding: var(--space-2) var(--space-1);
    border: 0;
    border-left: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
}

.cal-time-day.is-today {
    color: var(--accent-text);
}

.cal-hour-label {
    padding: var(--space-1);
    color: var(--text-tertiary);
    font-size: 11px;
    text-align: right;
}

.cal-all-day-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    min-height: 32px;
    padding: 2px;
    border-left: 1px solid var(--border);
    cursor: pointer;
}

.cal-time-scroll {
    max-height: 560px;
    overflow-y: auto;
}

.cal-hour {
    height: 44px;
}

.cal-time-column {
    position: relative;
    min-width: 0;
    border-left: 1px solid var(--border);
}

.cal-hour-slot {
    height: 44px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.cal-hour-slot:hover {
    background: var(--surface-hover);
}

.cal-event {
    position: absolute;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 2px var(--space-1);
    border: 1px solid var(--surface);
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent) 22%, var(--surface));
    color: var(--text);
    font-size: var(--text-xs);
    text-align: left;
    cursor: pointer;
}

.comment {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--neutral-soft);
    overflow-wrap: anywhere;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2);
}

.list-with-aside {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
    gap: var(--space-4);
}

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

.folder-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
}

.folder-link:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.folder-link[aria-current="true"] {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.folder-link span:first-of-type {
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-frame {
    display: block;
    width: 100%;
    height: 640px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.preview-image {
    display: block;
    max-width: 100%;
    max-height: 640px;
    margin: 0 auto;
    border-radius: var(--radius-md);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

@media (max-width: 820px) {
    .list-with-aside {
        grid-template-columns: minmax(0, 1fr);
    }
}

.board-toolbar {
    margin-bottom: var(--space-4);
}

.board {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
    overflow-x: auto;
}

.board-column {
    display: flex;
    flex: 0 0 280px;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 280px;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.board-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.board-column-title {
    overflow: hidden;
    font-family: var(--font-heading);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-column-tools {
    display: flex;
    flex: none;
}

.board-column-tools .btn-icon {
    width: 28px;
    height: 28px;
}

.board-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 48px;
    border-radius: var(--radius-md);
}

.board-cards.is-drop-target {
    outline: 2px dashed var(--focus-ring);
    outline-offset: 2px;
}

.task-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}

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

.task-card.is-dragging {
    opacity: 0.4;
}

.task-card.is-completed .task-title {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.task-title {
    font-weight: 500;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

.task-meta .is-overdue {
    color: var(--danger);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    padding: 0 var(--space-1);
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--on-accent);
    font-size: 11px;
    font-weight: 600;
}

.chat-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    height: calc(100dvh - 180px);
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.chat-sidebar {
    min-width: 0;
    padding: var(--space-3);
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.chat-channel-group + .chat-channel-group {
    margin-top: var(--space-4);
}

.chat-channel-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.chat-channel-link:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.chat-channel-link[aria-current="true"] {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.chat-channel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.chat-main-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 56px;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border);
}

.chat-scroll {
    flex: 1;
    min-height: 0;
    padding: var(--space-4);
    overflow-y: auto;
}

.chat-older {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-2);
}

.chat-empty {
    padding: var(--space-5);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-wrap: anywhere;
}

.chat-message-meta {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.chat-image-link {
    align-self: flex-start;
    margin-top: var(--space-1);
}

.chat-image {
    display: block;
    max-width: min(320px, 100%);
    max-height: 240px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.chat-file {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--neutral-soft);
}

.chat-composer {
    display: flex;
    flex: none;
    align-items: flex-end;
    gap: var(--space-2);
    padding: var(--space-3);
    border-top: 1px solid var(--border);
}

.chat-input {
    min-height: var(--control-height);
    height: var(--control-height);
    max-height: 160px;
    padding-top: 7px;
    resize: none;
    field-sizing: content;
}

@media (max-width: 820px) {
    .chat-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }

    .chat-sidebar {
        max-height: 160px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
}

.stat-link {
    display: block;
    color: inherit;
    min-width: 0;
}

.stat-link:hover {
    text-decoration: none;
}

.stat-link:hover .card {
    border-color: var(--border-strong);
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--space-4);
}

.dash-list {
    display: flex;
    flex-direction: column;
}

.dash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
}

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

.dash-row:hover {
    text-decoration: none;
}

.dash-row:hover .dash-row-title {
    color: var(--accent-text);
}

.dash-row-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-row-title {
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-row-end {
    flex: none;
    white-space: nowrap;
}

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