.dashboard-project-tile.is-selected {
    outline: 3px solid #36c;
    outline-offset: -3px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75);
}

.dashboard-project-activity {
    --dashboard-feed-width: 50%;
    margin-top: 24px;
    scroll-margin-top: 20px;
}

.dashboard-project-activity[hidden] {
    display: none !important;
}

.dashboard-project-activity__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.dashboard-project-activity__filters button {
    border: 1px solid #a2a9b1;
    background: #fff;
    color: #202122;
    padding: 7px 10px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.dashboard-project-activity__filters button:hover {
    border-color: #72777d;
}

.dashboard-project-activity__filters button.is-active {
    border-color: #36c;
    background: #eaf3ff;
    color: #3056a9;
}

.dashboard-project-activity__filters button span {
    margin-left: 5px;
    color: #72777d;
    font-variant-numeric: tabular-nums;
}

.p2-app--dashboard-feed,
.dashboard-project-activity__more,
.dashboard-project-activity__status {
    display: block;
    position: relative;
    width: 100%;
    max-width: none;
    margin-left: 0;
    min-height: 0;
}

.dashboard-project-activity__workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, var(--dashboard-feed-width, 50%));
    gap: 18px;
    align-items: start;
}

.dashboard-project-activity__feed-col {
    position: relative;
    min-width: 0;
}

.dashboard-structure {
    --ds-line: #c5cad3;
    --ds-accent: #3056a9;
    --ds-indent: 18px;
    --ds-row: 26px;
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 24px);
    min-height: 0;
    background: transparent;
    overflow: hidden;
}

.dashboard-structure[hidden] {
    display: none !important;
}

.dashboard-structure__project {
    flex: 0 0 auto;
    margin: 0 0 2px;
    padding: 0 4px 6px 0;
    color: #202122;
    font-size: 21px;
    font-weight: 500;
    line-height: 1.25;
    position: relative;
}

.dashboard-structure__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0 4px 8px 0;
    color: #202122;
    font-size: 13px;
    line-height: 1.35;
}

/* —— Classic explorer tree —— */

.dashboard-structure__tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-structure__tree .dashboard-structure__tree {
    position: relative;
    margin: 0;
    padding: 0 0 0 var(--ds-indent);
}

.dashboard-structure__item {
    position: relative;
    min-width: 0;
}

/* vertical guide */
.dashboard-structure__tree .dashboard-structure__tree > .dashboard-structure__item::before {
    content: "";
    position: absolute;
    left: calc(var(--ds-indent) * -1 + 7px);
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--ds-line);
}

/* horizontal guide */
.dashboard-structure__tree .dashboard-structure__tree > .dashboard-structure__item::after {
    content: "";
    position: absolute;
    left: calc(var(--ds-indent) * -1 + 7px);
    top: 13px;
    width: 10px;
    border-top: 1px solid var(--ds-line);
}

.dashboard-structure__tree .dashboard-structure__tree > .dashboard-structure__item.is-last::before {
    bottom: auto;
    height: 13px;
}

.dashboard-structure__tree--root {
    position: relative;
    padding-left: var(--ds-indent);
}

/* vertical / horizontal guides for first level under project title */
.dashboard-structure__tree--root > .dashboard-structure__item::before {
    content: "";
    position: absolute;
    left: calc(var(--ds-indent) * -1 + 7px);
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--ds-line);
}

.dashboard-structure__tree--root > .dashboard-structure__item::after {
    content: "";
    position: absolute;
    left: calc(var(--ds-indent) * -1 + 7px);
    top: 13px;
    width: 10px;
    border-top: 1px solid var(--ds-line);
}

.dashboard-structure__tree--root > .dashboard-structure__item.is-last::before {
    bottom: auto;
    height: 13px;
}

/* join first vertical line up to the project title */
.dashboard-structure__tree--root > .dashboard-structure__item:first-child::before {
    top: -14px;
}

.dashboard-structure__tree--root > .dashboard-structure__item.is-last:first-child::before {
    height: 27px;
}

.dashboard-structure__details {
    margin: 0;
}

.dashboard-structure__summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.dashboard-structure__summary::-webkit-details-marker {
    display: none;
}

.dashboard-structure__summary::marker {
    content: "";
}

.dashboard-structure__summary,
.dashboard-structure__leaf-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    min-height: var(--ds-row);
    padding: 1px 4px 1px 0;
}

.dashboard-structure__summary:hover,
.dashboard-structure__leaf-row:hover {
    background: #f3f5f8;
    border-radius: 4px;
}

.dashboard-structure__leaf-row {
    cursor: default;
}

.dashboard-structure__twist {
    box-sizing: border-box;
    flex: 0 0 13px;
    width: 13px;
    height: 13px;
    margin-top: 6px;
    border: 1px solid #9aa3af;
    border-radius: 2px;
    background: #fff;
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
    line-height: 11px;
    text-align: center;
}

.dashboard-structure__twist::before {
    content: "+";
}

.dashboard-structure__details[open] > .dashboard-structure__summary > .dashboard-structure__twist::before {
    content: "−";
}

.dashboard-structure__twist--leaf {
    border-color: transparent;
    background: transparent;
}

.dashboard-structure__twist--leaf::before {
    content: "";
}

.dashboard-structure__node {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    flex: 1 1 auto;
    padding-top: 3px;
}

.dashboard-structure__icon {
    flex: 0 0 14px;
    width: 14px;
    height: 16px;
    margin-top: 1px;
    color: #6b8fc7;
}

.dashboard-structure__icon.is-folder {
    color: #5b7fbf;
}

.dashboard-structure__item.is-ird .dashboard-structure__icon.is-folder {
    color: #2f5fad;
}

.dashboard-structure__item.is-stage .dashboard-structure__icon.is-folder {
    color: #3d7a55;
}

.dashboard-structure__item.is-doc .dashboard-structure__icon.is-folder {
    color: #5b7fbf;
}

.dashboard-structure__item--branch > .dashboard-structure__details > .dashboard-structure__summary .dashboard-structure__label {
    font-weight: 600;
    color: #1f2937;
}

.dashboard-structure__item--leaf.is-empty .dashboard-structure__label,
.dashboard-structure__item--empty .dashboard-structure__label {
    color: #8b949e;
}

.dashboard-structure__label {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}

.dashboard-structure__muted {
    flex: 0 0 auto;
    margin-top: 1px;
    color: #9a6700;
    font-size: 11px;
}

.dashboard-structure__empty {
    margin: 0;
    padding: 16px 14px;
    color: #8b949e;
    font-size: 12px;
    line-height: 1.4;
}

.dashboard-feed-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -11px;
    width: 10px;
    z-index: 3;
    cursor: col-resize;
    touch-action: none;
}

.dashboard-feed-resizer::after {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 4px;
    width: 2px;
    border-radius: 1px;
    background: transparent;
    transition: background-color .15s;
}

.dashboard-feed-resizer:hover::after,
.dashboard-feed-resizer:focus-visible::after,
body.dashboard-feed-resizing .dashboard-feed-resizer::after {
    background: rgba(48, 86, 169, 0.45);
}

body.dashboard-feed-resizing {
    cursor: col-resize;
    user-select: none;
}

body.dashboard-feed-resizing iframe {
    pointer-events: none;
}

.dashboard-project-activity__posts {
    display: grid;
    gap: 12px;
    max-width: none;
}

.dashboard-activity-post {
    border: 1px solid #d8dde3;
    background: #fff;
    padding: 0;
    overflow: hidden;
    transition: border-color .15s, background-color .15s;
}

/* Статус только в заголовке — как кубики cool / attention_1 / action_1 */
.dashboard-activity-post.is-viewed,
.dashboard-activity-post.is-unread,
.dashboard-activity-post.needs-action {
    background: #fff;
}

.dashboard-activity-post.is-viewed {
    border-color: #c5ddd0;
}

.dashboard-activity-post.is-unread {
    border-color: #d8dde3;
}

.dashboard-activity-post.needs-action {
    border-color: #efc4c4;
}

.dashboard-activity-post__badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 3px;
    background: #eaf3ff;
    color: #3056a9;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.dashboard-activity-post__badge.is-action {
    background: #fdecec;
    color: #a40000;
}

.dashboard-activity-post__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 9px 14px;
    background: #eef1f4;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 13px;
    line-height: 1.4;
    color: #202122;
}

.dashboard-activity-post.is-viewed .dashboard-activity-post__header {
    background: #dff3e7;
    color: #24513a;
    border-bottom-color: #c5ddd0;
}

.dashboard-activity-post.is-unread .dashboard-activity-post__header {
    background: #eef1f4;
    color: #3a3d40;
    border-bottom-color: #d8dde3;
}

.dashboard-activity-post.needs-action .dashboard-activity-post__header {
    background: #fdecec;
    color: #6f2929;
    border-bottom-color: #efc4c4;
}

.dashboard-activity-post__header-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.dashboard-activity-post__body {
    padding: 10px 14px 14px;
    background: #fff;
}

.dashboard-activity-post__mark-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    color: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    min-width: 11.75rem;
    justify-content: center;
    cursor: pointer;
}

.dashboard-activity-post__mark-all:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.28);
}

.dashboard-activity-post__mark-all.is-armed {
    background: #fff;
    border-color: #c47a00;
    color: #7a4a00;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(238, 184, 78, 0.45);
}

.dashboard-activity-post__mark-all:disabled {
    opacity: 0.6;
    cursor: default;
}

.dashboard-activity-post__meta-more {
    display: block;
    box-sizing: border-box;
    width: max-content;
    min-width: 15.5rem;
    max-width: 100%;
    margin: 8px 0 0 auto;
    padding: 6px 16px;
    border: 1px dashed #c8ccd1;
    border-radius: 4px;
    background: #fff;
    color: #54595d;
    font: inherit;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
}

.dashboard-activity-post__meta-more:hover {
    border-color: #a2a9b1;
    color: #202122;
    background: #f8f9fa;
}

.dashboard-activity-post__chain,
.p2-doc-chain {
    min-width: 0;
    flex: 1 1 auto;
    color: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.dashboard-activity-post__sep,
.p2-doc-chain__sep {
    margin: 0 5px;
    color: inherit;
    opacity: 0.45;
}

.dashboard-activity-post__crumb-current,
.p2-doc-chain__current {
    color: inherit;
    font-weight: 600;
}

.dashboard-activity-post__count,
.dashboard-project-tile__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #d33;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    flex: 0 0 auto;
}

.dashboard-activity-post__count[hidden] {
    display: none !important;
}

.dashboard-activity-post__message {
    margin: 0;
    color: #202122;
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.dashboard-activity-post__context {
    margin: 10px 0 0;
}

.dashboard-activity-post__footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
}

.dashboard-activity-post__meta {
    display: block;
    margin: 8px 0 0;
    padding: 8px 10px;
    border: 1px solid #e3e8ee;
    border-radius: 4px;
    background: #fff;
}

.dashboard-activity-post__meta[hidden],
.dashboard-activity-post__meta.is-meta-collapsed {
    display: none !important;
}

.dashboard-activity-post__body > .dashboard-activity-post__meta:first-child {
    margin-top: 0;
}

.dashboard-activity-post__meta.is-awaiting-view {
    background: #fff9df;
    border-color: #e6d9a0;
    box-shadow: none;
}

.dashboard-activity-post__meta-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 22px;
}

.dashboard-activity-post__meta-actor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.dashboard-activity-post__meta-actor .user-avatar {
    flex-shrink: 0;
}

.dashboard-activity-post__meta-aside {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.dashboard-activity-post__meta-name {
    font-size: 13px;
    font-weight: 600;
    color: #202122;
    line-height: 1.35;
}

.dashboard-activity-post__meta-body {
    margin: 3px 0 0 24px;
    font-size: 13px;
    line-height: 1.45;
    color: #3a3d40;
}

.dashboard-activity-post__meta-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-activity-post__meta-lines li {
    position: relative;
    padding-left: 12px;
    margin: 1px 0 0;
}

.dashboard-activity-post__meta-lines li:first-child {
    margin-top: 0;
}

.dashboard-activity-post__meta-lines li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: #8c9196;
}

.dashboard-activity-post__meta-action {
    color: inherit;
    display: inline;
}

.dashboard-activity-post__meta-person {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    vertical-align: middle;
}

.dashboard-activity-post__meta-person .user-avatar {
    flex-shrink: 0;
}

.dashboard-activity-post__meta-person-name {
    font-weight: 500;
    line-height: 1.35;
}

.dashboard-activity-post__meta-role {
    color: #72777d;
    font-size: 12px;
    font-weight: 400;
}

.dashboard-activity-post__meta-sep {
    color: #54595d;
}

.dashboard-activity-post__meta-ago {
    flex-shrink: 0;
    color: #72777d;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    border-bottom: 1px dotted #c4c8cc;
    cursor: help;
}

.dashboard-activity-post__meta .comment-views {
    margin-left: 0;
}

.source-thread-history-item .comment-views {
    margin-left: auto;
    flex-shrink: 0;
}

.dashboard-activity-post__avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    background: #eaecf0;
    color: #54595d;
    font-weight: 600;
}

.dashboard-activity-post__header strong {
    display: inline;
    color: inherit;
    font-weight: 600;
}

.dashboard-activity-post__header strong + span {
    margin-left: 6px;
    color: inherit;
    opacity: 0.72;
}

.dashboard-activity-post__header time {
    color: inherit;
    opacity: 0.72;
    font-size: 12px;
    white-space: nowrap;
}

.dashboard-activity-post__path {
    display: none;
}

.dashboard-activity-post__body .dashboard-activity-post__message {
    margin: 0;
}

.dashboard-activity-post__body .dashboard-activity-post__context {
    margin-top: 10px;
}

.dashboard-activity-post__footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
}

.dashboard-activity-eye {
    border: 1px solid #c8ccd1;
    background: #fff;
    color: #36c;
    padding: 4px 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.dashboard-activity-eye:hover {
    border-color: #36c;
    background: #eaf3ff;
}

.dashboard-activity-eye:disabled,
.dashboard-activity-eye.is-viewed {
    color: #72777d;
    cursor: default;
    border-color: #c8ccd1;
    background: #f8f9fa;
}

.dashboard-activity-eye small {
    margin-left: 3px;
    color: inherit;
}

.dashboard-activity-post__context {
    margin: 12px 0 0;
}

.dashboard-activity-post__context:empty {
    margin: 0;
}

.dashboard-activity-post__context .p2-version,
.dashboard-activity-post__context .p2-source-file-block {
    margin: 0;
    box-shadow: none;
}

.dashboard-activity-card-loading,
.dashboard-activity-empty {
    border: 1px dashed #a2a9b1;
    padding: 18px;
    color: #54595d;
    text-align: center;
}

.dashboard-project-activity__more {
    margin-top: 14px;
}

.dashboard-project-activity__more[hidden],
body.portal-mail .dashboard-project-activity__more[hidden] {
    display: none !important;
}

.dashboard-project-activity__status {
    min-height: 20px;
    margin-top: 8px;
    color: #54595d;
    font-size: 13px;
}

.dashboard-project-activity__status.is-error,
.dashboard-project-activity__error {
    color: #b32424;
}

@media (max-width: 760px) {
    .dashboard-project-activity__workspace {
        grid-template-columns: 1fr;
    }

    .dashboard-structure {
        position: static;
        max-height: 360px;
        min-height: 0;
    }

    .p2-app--dashboard-feed,
    .dashboard-project-activity__more,
    .dashboard-project-activity__status {
        width: 100%;
        max-width: 100%;
    }

    .dashboard-feed-resizer {
        display: none;
    }

    .dashboard-project-activity__filters {
        display: grid;
        grid-template-columns: 1fr;
    }

    .dashboard-activity-post {
        padding: 12px;
    }

    .dashboard-activity-post__header {
        flex-wrap: wrap;
    }

    .dashboard-activity-post__path,
    .dashboard-activity-post__message,
    .dashboard-activity-post__footer,
    .dashboard-activity-post__meta {
        margin-left: 0;
    }

    .dashboard-activity-post__context {
        margin-left: 0;
    }
}
/* style.css - Базовые стили workspace; тема Mail.ru — body.portal-mail */

/* Reset & Base */
html {
    overflow-y: scroll;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f6f6f6;
    color: #222;
    line-height: 1.6;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 0;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f6f6f6;
}

.login-box {
    background: white;
    padding: 40px 50px;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 100%;
}

.login-box.setup-box {
    max-width: 560px;
}

.login-box h1 {
    font-size: 28px;
    font-weight: normal;
    text-align: center;
    margin-bottom: 5px;
}

.login-box .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-hint {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    text-align: center;
}

.login-hint strong {
    color: #222;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h1 {
    font-size: 24px;
    font-weight: normal;
    color: #222;
    margin: 0;
}

.header-left h1 .portal-title-link,
.header-left h1 .portal-title-link:visited {
    color: inherit;
    text-decoration: none;
}

.header-left h1 .portal-title-link:hover {
    text-decoration: underline;
    cursor: pointer;
}

.header-left .version {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 10px;
    border-radius: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.portal-footer {
    margin-top: auto;
    padding: 10px 0 2px;
    font-size: 12px;
    line-height: 1.4;
    color: #777;
}

.portal-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
}

.portal-footer-version {
    color: #666;
    font-weight: 600;
}

.portal-footer-actions {
    margin-left: auto;
    min-height: 1px;
}

.portal-area-switch {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.portal-area-switch-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.2;
    color: #555;
    text-decoration: none;
    background: transparent;
    white-space: nowrap;
}

a.portal-area-switch-item:hover {
    background: #f5f5f5;
    color: #005ff9;
}

.portal-area-switch-item.is-active {
    background: #ebf3ff;
    color: #005ff9;
    font-weight: 600;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
    color: #222;
}

.user-role {
    font-size: 12px;
    padding: 1px 12px;
    border-radius: 12px;
}

.role-admin {
    background: #ebf3ff;
    color: #005ff9;
}

.role-user {
    background: #f0f0f0;
    color: #666;
}

/* Navigation */
.nav {
    display: flex;
    gap: 5px;
    padding: 5px 0 15px 0;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 20px;
}

.nav a {
    padding: 5px 15px;
    color: #005ff9;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
}

.nav a:hover {
    background: #f0f0f0;
}

.nav a.active {
    background: #ebf3ff;
    color: #005ff9;
}

/* Headings */
h2 {
    font-size: 20px;
    font-weight: normal;
    margin: 20px 0 15px 0;
    color: #222;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 8px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 16px;
    background: #f8f9fa;
    color: #222;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #d0d0d0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

.btn:hover {
    background: #e8e8e8;
    border-color: #b0b0b0;
}

.btn-primary {
    background: #005ff9;
    color: white;
    border-color: #005ff9;
}

.btn-primary:hover {
    background: #0050d9;
    border-color: #0050d9;
    color: #fff;
}

.btn-danger {
    background: #d93025;
    color: white;
    border-color: #d93025;
}

.btn-danger:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}

.btn-warning {
    background: #f39c12;
    color: white;
    border-color: #f39c12;
}

.btn-warning:hover {
    background: #e67e22;
    border-color: #e67e22;
}

.btn-success {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.btn-success:hover {
    background: #1e8449;
    border-color: #1e8449;
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

.btn-logout {
    background: #f3f4f6;
    border-color: #e0e0e0;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    line-height: 1;
    min-height: 30px;
    box-sizing: border-box;
}

.btn-logout-icon {
    display: block;
}

.btn-admin-header {
    background: #005ff9;
    color: #fff;
    border-color: #005ff9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    line-height: 1;
    font-size: 13px;
    min-height: 30px;
    box-sizing: border-box;
}

.btn-admin-header:hover {
    background: #0050d9;
    border-color: #0050d9;
    color: #fff;
}

.btn-logout:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #444;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #005ff9;
}

.checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
}

.checkbox-group label {
    display: block;
    padding: 3px 0;
    font-weight: normal;
    font-size: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 14px;
}

table th {
    text-align: left;
    padding: 10px 12px;
    background: #f8f9fa;
    border-bottom: 2px solid #e8e8e8;
    font-weight: 600;
}

table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e8e8e8;
}

table tr:hover td {
    background: #f8f9fa;
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.project-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 18px 20px;
    transition: box-shadow 0.2s;
}

.project-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.project-card-header h3 {
    font-size: 17px;
    font-weight: 500;
    margin: 0;
}

.project-card-body {
    font-size: 14px;
    color: #444;
}

.project-card-body p {
    margin: 4px 0;
}

.project-card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* Status Badges */
.status-badge {
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 12px;
    white-space: nowrap;
}

.status-badge.active {
    background: #e6f4ea;
    color: #1e7e34;
}

.status-badge.closed {
    background: #fce8e6;
    color: #b71c1c;
}

.role-badge {
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 12px;
}

.role-badge.admin {
    background: #ebf3ff;
    color: #005ff9;
}

.role-badge.user {
    background: #f0f0f0;
    color: #666;
}

/* Alerts */
.alert {
    padding: 12px 18px;
    margin: 15px 0;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert-success {
    background: #e6f4ea;
    border-color: #c6e0d0;
    color: #1e7e34;
}

.alert-error {
    background: #fce8e6;
    border-color: #f5c6cb;
    color: #b71c1c;
}

.alert-info {
    background: #ebf3ff;
    border-color: #d0d8e8;
    color: #005ff9;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 15px;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 10px 0 15px 0;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 20px;
}

.breadcrumbs a {
    color: #005ff9;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-current {
    color: #222;
    font-weight: 500;
}

.breadcrumb-separator {
    margin: 0 6px;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .header-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .project-grid {
        grid-template-columns: 1fr;
    }
    
    .login-box {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .nav {
        flex-wrap: wrap;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .project-card {
        padding: 14px;
    }
    
    .btn {
        font-size: 12px;
        padding: 4px 12px;
    }
}
/* Новые стили для страницы проекта — см. project2.css */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge.approved {
    background: #e8f5e9;
    color: #1b5e20;
}
.status-badge.obsolete {
    background: #f5f5f5;
    color: #757575;
}
.status-badge.pending {
    background: #fff8e1;
    color: #e65100;
}
.user-email.is-unverified,
input.is-unverified-input {
    color: #b32424;
}

.email-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.15;
    max-width: 100%;
    vertical-align: top;
}

.email-stack .email-local,
.email-stack .email-domain {
    display: block;
    margin: 0;
    padding: 0;
    line-height: 1.15;
    max-width: 100%;
}

.email-stack .email-local {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.email-stack .email-domain {
    white-space: nowrap;
}

.email-stack[data-copy-email] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.activate-email {
    margin: 0 0 16px;
    font-size: 14px;
    overflow-x: auto;
}

.activate-email .email-inline {
    flex: 1;
    min-width: 0;
}

.activate-email-solo {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 0;
}

.activate-email-solo .activate-id-label {
    flex: none;
}

.activate-id-label {
    flex: 0 0 9.5rem;
    color: #818c99;
}

.activate-box .subtitle {
    margin: 0 0 22px;
    font-size: 14px;
    color: #818c99;
}

.activate-box {
    max-width: 480px;
}

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

.activate-phone-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    min-width: 0;
    flex: 1;
}

.activate-phone-mask {
    font-family: Consolas, "Courier New", monospace;
    font-size: 16px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1;
}

#activate-phone-last4 {
    width: 5.2em;
    max-width: 5.2em;
    margin: 0;
    padding: 8px 6px;
    text-align: center;
    letter-spacing: 0.28em;
    font-family: Consolas, "Courier New", monospace;
    font-size: 16px;
}

#activate-phone-last4::placeholder {
    letter-spacing: 0.18em;
    color: #b0b6be;
}

.activate-field-hint {
    flex: 1 0 100%;
    margin: 4px 0 0 calc(9.5rem + 12px);
    font-size: 12px;
    color: #b32424;
}

.activate-field-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.activate-field-row > label:not(.visually-hidden) {
    flex: 0 0 9.5rem;
    margin: 0;
}

.activate-pass-wrap {
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 0;
}

.activate-field-row .activate-pass-wrap input,
.activate-field-row > input,
.activate-field-row > select {
    flex: 1;
    min-width: 0;
    width: auto;
}

.activate-pass-wrap input {
    padding-right: 38px;
}

.activate-pass-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    background: none;
    padding: 0;
    color: #818c99;
    cursor: pointer;
}

.activate-pass-toggle:hover,
.activate-pass-toggle[aria-pressed="true"] {
    color: var(--mail-blue, #005ff9);
    text-decoration: none;
}

.activate-pass-toggle:disabled,
.activate-pass-toggle:disabled:hover {
    color: #b0b6be;
    cursor: default;
    opacity: 0.45;
    pointer-events: none;
}

.activate-pass-toggle .btn-logout-icon {
    display: block;
}

.activate-caps-hint {
    margin: 0 0 8px calc(9.5rem + 12px);
    font-size: 12px;
    color: #b36b00;
}

.activate-password-rules {
    list-style: none;
    margin: 4px 0 16px calc(9.5rem + 12px);
    padding: 0;
    font-size: 13px;
    color: #818c99;
}

.activate-password-rules li {
    margin: 0 0 4px;
    padding-left: 1.1em;
    position: relative;
}

.activate-password-rules li::before {
    content: "•";
    position: absolute;
    left: 0;
}

.activate-password-rules.is-active li {
    color: #b32424;
}

.activate-password-rules li.is-met {
    color: #137333;
}

.activate-rate-limit,
.login-rate-limit,
.portal-rate-limit,
.login-alert {
    text-align: center;
}

.activate-rate-limit-time,
.login-rate-limit-time,
.portal-rate-limit-time {
    font-variant-numeric: tabular-nums;
    font-family: Consolas, "Courier New", monospace;
    white-space: nowrap;
}

.activate-form .form-group.is-invalid input,
.activate-form input.is-invalid {
    border-color: #b32424;
    box-shadow: 0 0 0 2px rgba(179, 36, 36, 0.16);
}

.email-inline[data-copy-email] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

@media (max-width: 520px) {
    .activate-field-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .activate-field-row > label:not(.visually-hidden),
    .activate-id-label {
        flex: none;
    }

    .activate-phone-spacer {
        display: none;
    }

    .activate-field-hint,
    .activate-caps-hint,
    .activate-password-rules {
        margin-left: 0;
    }
}

.email-inline {
    white-space: nowrap;
}

body.portal-mail .form-group input[name="identifier"],
body.portal-mail .form-group input[name="email"],
body.portal-mail .form-group input[type="email"] {
    white-space: nowrap;
}
input.is-unverified-input {
    border-color: #b32424;
}
.status-badge.requires_work {
    background: #ffebee;
    color: #b71c1c;
}
.status-badge.initial {
    background: #eceff1;
    color: #455a64;
}
/* ============================================================
   Рабочая область: стиль Mail.ru
   ============================================================ */
body.portal-mail {
    --mail-blue: #005ff9;
    --mail-blue-hover: #0050d9;
    --mail-blue-soft: #ebf3ff;
    --mail-blue-muted: #d4e7ff;
    --mail-bg: #eef1f6;
    --mail-surface: #ffffff;
    --mail-border: #e1e3e8;
    --mail-border-strong: #d0d3d9;
    --mail-text: #2c2d2e;
    --mail-text-secondary: #818c99;
    --mail-radius-sm: 8px;
    --mail-radius-md: 12px;
    --mail-radius-lg: 16px;
    --mail-shadow: 0 2px 12px rgba(0, 16, 61, 0.08);

    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--mail-bg);
    color: var(--mail-text);
}

body.portal-mail .page-elevator {
    position: fixed;
    z-index: 40;
    top: 72px;
    left: max(10px, calc(50% - var(--portal-container-width, 1000px) / 2 - 58px));
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #818c99;
    box-shadow: 0 2px 8px rgba(0, 16, 61, 0.14);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

body.portal-mail .page-elevator[hidden] {
    display: none !important;
}

body.portal-mail .page-elevator:hover {
    background: #f0f2f5;
    color: #005ff9;
    box-shadow: 0 4px 14px rgba(0, 16, 61, 0.16);
}

body.portal-mail .page-elevator:focus-visible {
    outline: 2px solid #005ff9;
    outline-offset: 2px;
}

body.portal-mail .page-elevator svg {
    display: block;
    transition: transform .18s ease;
}

body.portal-mail .page-elevator.is-restore svg {
    transform: rotate(180deg);
}

@media (max-width: 760px) {
    body.portal-mail .page-elevator {
        left: 10px;
        top: auto;
        bottom: 18px;
    }
}

body.portal-mail .container {
    max-width: var(--portal-container-width, 1000px);
    padding: 16px 20px 8px;
    background: var(--mail-surface);
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-lg);
    box-shadow: var(--mail-shadow);
}

body.portal-mail .header {
    padding-bottom: 12px;
    margin-bottom: 0;
    border-bottom: none;
}

body.portal-mail .header-left h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.portal-mail .header-left h1 .portal-title-link:hover {
    color: var(--mail-blue);
    text-decoration: none;
}

body.portal-mail .header-right {
    font-size: 13px;
    gap: 14px;
}

body.portal-mail .user-name {
    font-size: 14px;
    font-weight: 600;
}

body.portal-mail .user-role {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 999px;
}

body.portal-mail .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 10px 0 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--mail-border);
}

body.portal-mail .nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    border-radius: var(--mail-radius-sm);
    border: none;
    margin-bottom: 0;
    white-space: nowrap;
    color: var(--mail-text);
    background: transparent;
}

body.portal-mail .nav a:hover {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
    text-decoration: none;
}

body.portal-mail .nav a.active {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
    font-weight: 600;
    border: none;
    text-decoration: none;
}

body.portal-mail .nav__badge {
    min-width: 18px;
    padding: 2px 5px;
    border-radius: 999px;
    background: #d33;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

body.portal-mail .breadcrumbs {
    padding: 6px 0 12px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--mail-text-secondary);
    border-bottom: 1px solid var(--mail-border);
}

body.portal-mail .portal-footer-version {
    color: var(--mail-text-secondary);
}

body.portal-mail .portal-area-switch {
    border-color: var(--mail-border);
    border-radius: var(--mail-radius-sm);
}

body.portal-mail a.portal-area-switch-item:hover {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
}

body.portal-mail .portal-area-switch-item.is-active {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
}

body.portal-mail .role-admin {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
}

body.portal-mail .login-container {
    background: var(--mail-bg);
}

body.portal-mail .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--mail-border);
    margin-bottom: 16px;
    padding-bottom: 0;
}

body.portal-mail .tabs .tab-btn {
    padding: 8px 14px;
    border: none;
    border-radius: var(--mail-radius-sm) var(--mail-radius-sm) 0 0;
    background: transparent;
    color: var(--mail-text);
    font-weight: 500;
    font-size: 14px;
}

body.portal-mail .tabs .tab-btn:hover {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
}

body.portal-mail .tabs .tab-btn.active {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
    font-weight: 600;
    border: none;
}

body.portal-mail h2 {
    font-size: 1.35em;
    font-weight: 700;
    margin: 16px 0 12px;
    padding-bottom: 0;
    border-bottom: none;
    font-family: inherit;
    letter-spacing: -0.02em;
    color: var(--mail-text);
}

body.portal-mail h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 14px 0 8px;
    color: var(--mail-text);
    border: none;
    font-family: inherit;
}

body.portal-mail h4 {
    font-size: 1em;
    font-weight: 600;
    margin: 10px 0 6px;
}

body.portal-mail p,
body.portal-mail li,
body.portal-mail td,
body.portal-mail th,
body.portal-mail label,
body.portal-mail input,
body.portal-mail select,
body.portal-mail textarea,
body.portal-mail button {
    font-size: inherit;
}

body.portal-mail a {
    color: #005ff9;
}

body.portal-mail a:visited:not(.btn):not(.tab-btn) {
    color: #0047b3;
}

/* Кнопки — тёмный текст на светлом фоне (не как ссылки) */
body.portal-mail .btn,
body.portal-mail a.btn,
body.portal-mail button.btn {
    color: #2c2d2e;
    text-decoration: none;
}

body.portal-mail a.btn:visited,
body.portal-mail a.btn:hover,
body.portal-mail button.btn:hover {
    color: #2c2d2e;
    text-decoration: none;
}

body.portal-mail .btn {
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.35;
    border-radius: var(--mail-radius-sm);
    border-color: var(--mail-border-strong);
    background: var(--mail-surface);
    font-weight: 500;
}

body.portal-mail .btn:hover {
    background: var(--mail-blue-soft);
    border-color: var(--mail-blue-muted);
}

body.portal-mail .btn:disabled,
body.portal-mail .btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

body.portal-mail .btn-primary,
body.portal-mail a.btn.btn-primary,
body.portal-mail a.btn.btn-primary:link,
body.portal-mail a.btn.btn-primary:visited,
body.portal-mail a.btn.btn-primary:hover,
body.portal-mail a.btn.btn-primary:focus,
body.portal-mail a.btn.btn-primary:active,
body.portal-mail button.btn.btn-primary,
body.portal-mail button.btn.btn-primary:hover,
body.portal-mail button.btn.btn-primary:focus,
body.portal-mail button.btn.btn-primary:active,
body.portal-mail .btn.btn-primary,
body.portal-mail .btn.btn-primary:visited,
body.portal-mail .btn.btn-primary:hover {
    background: #005ff9;
    border-color: #005ff9;
    color: #fff;
}

body.portal-mail .btn-primary:hover,
body.portal-mail a.btn.btn-primary:hover,
body.portal-mail button.btn.btn-primary:hover {
    background: #0050d9;
    border-color: #0050d9;
    color: #fff;
}

body.portal-mail .btn-danger,
body.portal-mail .btn-danger:visited,
body.portal-mail .btn-danger:hover {
    background: #d73333;
    border-color: #d73333;
    color: #fff;
}

body.portal-mail .btn-danger:hover {
    background: #b32424;
    border-color: #b32424;
}

body.portal-mail .btn-warning,
body.portal-mail .btn-warning:visited,
body.portal-mail .btn-warning:hover {
    background: #cc6600;
    border-color: #cc6600;
    color: #fff;
}

body.portal-mail .btn-warning:hover {
    background: #a35200;
    border-color: #a35200;
}

body.portal-mail .btn-success,
body.portal-mail .btn-success:visited,
body.portal-mail .btn-success:hover {
    background: #14866d;
    border-color: #14866d;
    color: #fff;
}

body.portal-mail .btn-success:hover {
    background: #106656;
    border-color: #106656;
}

body.portal-mail .btn-sm {
    padding: 2px 8px;
    font-size: 11px;
}

body.portal-mail .btn-logout {
    min-height: 28px;
    padding: 4px 8px;
    background: #f8f9fa;
    border-color: #e1e3e8;
    color: #2c2d2e;
}

body.portal-mail .btn-logout:hover {
    background: #f0f3f8;
    border-color: #818c99;
    color: #000;
}

.logout-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.logout-form button.btn-logout {
    cursor: pointer;
    font: inherit;
}

body.portal-mail .role-user {
    background: #f0f3f8;
    color: var(--mail-text-secondary);
}

/* Типографика и блоки страницы */
body.portal-mail .page-intro {
    margin-bottom: 12px;
    font-size: 13px;
    color: #818c99;
    line-height: 1.5;
}

body.portal-mail .text-muted {
    color: #818c99;
}

body.portal-mail .text-small {
    font-size: 11px;
}

body.portal-mail .is-hidden {
    display: none !important;
}

body.portal-mail .no-results {
    margin-top: 12px;
    padding: 12px;
    text-align: center;
    color: #818c99;
    font-size: 13px;
}

body.portal-mail .text-small.ml-8 {
    margin-left: 8px;
}

body.portal-mail .section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 12px;
    padding-bottom: 0;
    border-bottom: none;
}

body.portal-mail .section-head h2 {
    margin: 0;
    padding: 0;
    border: none;
}

body.portal-mail .section-head .meta {
    font-size: 12px;
    color: #818c99;
}

body.portal-mail .section-head .form-actions {
    margin-top: 0;
}

body.portal-mail .form-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

body.portal-mail .form-section {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f3f8;
}

body.portal-mail .form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

body.portal-mail .form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

body.portal-mail .form-grid-2 .form-group.span-full {
    grid-column: 1 / -1;
}

body.portal-mail .settings-subsection {
    margin-bottom: 28px;
}

body.portal-mail .settings-subsection h3 {
    margin: 0 0 8px;
    font-size: 1.2em;
    font-weight: 600;
    color: #2c2d2e;
}

body.portal-mail .settings-divider {
    border: none;
    border-top: 1px solid #f0f3f8;
    margin: 28px 0;
}

body.portal-mail .profile-password-policy {
    margin: 0 0 14px;
}

body.portal-mail .profile-password-policy-list {
    margin: 0;
    padding-left: 20px;
}

body.portal-mail .profile-password-policy-list li {
    margin-bottom: 4px;
}

body.portal-mail .profile-password-policy-list li:last-child {
    margin-bottom: 0;
}

body.portal-mail .profile-dashboard-settings {
    grid-column: 1 / -1;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--mail-border);
}

body.portal-mail .profile-dashboard-blocks {
    display: grid;
    gap: 8px;
}

body.portal-mail .profile-dashboard-group {
    display: grid;
    gap: 6px;
}

body.portal-mail .profile-dashboard-group h4 {
    margin: 7px 0 0;
    color: var(--mail-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

body.portal-mail .profile-dashboard-block {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 12px;
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
    background: #f8f9fa;
}

body.portal-mail .profile-dashboard-block__visibility {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    cursor: pointer;
}

body.portal-mail .profile-dashboard-block__visibility input {
    flex: 0 0 auto;
    margin-top: 3px;
}

body.portal-mail .profile-dashboard-block__visibility span,
body.portal-mail .profile-dashboard-block__visibility strong,
body.portal-mail .profile-dashboard-block__visibility small {
    display: block;
}

body.portal-mail .profile-dashboard-block__visibility strong {
    color: var(--mail-text);
    font-size: 13px;
}

body.portal-mail .profile-dashboard-block__visibility small {
    margin-top: 2px;
    color: var(--mail-muted);
    font-size: 11px;
    font-weight: 400;
}

body.portal-mail .profile-dashboard-block__order {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
}

body.portal-mail .profile-dashboard-block__order .btn {
    min-width: 30px;
    padding: 4px 7px;
}

body.portal-mail .profile-dashboard-block__order .btn:disabled {
    opacity: 0.35;
    cursor: default;
}

body.portal-mail .wiki-notice {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--mail-blue-soft);
    border: 1px solid var(--mail-blue-muted);
    border-radius: var(--mail-radius-sm);
    font-size: 14px;
    color: var(--mail-text);
    line-height: 1.5;
}

body.portal-mail .wiki-notice h4 {
    margin: 0 0 6px;
    font-size: 1em;
    font-weight: 600;
}

body.portal-mail .wiki-notice p {
    margin: 0;
    color: #2c2d2e;
}

.user-color-palette {
    display: grid;
    grid-template-columns: repeat(var(--user-color-columns, 4), 32px);
    gap: 7px;
    margin: 8px 0;
}

.user-color-swatch {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    border: 2px solid transparent;
    border-radius: 50%;
    color: #fff;
    background: var(--user-swatch-bg);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.user-color-swatch:hover:not(.is-taken) {
    transform: scale(1.08);
}

.user-color-swatch.is-selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px #005ff9;
}

.user-color-swatch.is-taken {
    cursor: not-allowed;
}

.user-color-swatch.is-taken span {
    color: #c9cdd3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.user-color-swatch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.user-color-swatch:focus-within {
    outline: 2px solid #005ff9;
    outline-offset: 2px;
}

body.portal-mail .form-group label.user-color-swatch {
    display: grid;
    place-items: center;
    margin: 0;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

body.portal-mail code {
    background: #f0f3f8;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 12px;
    color: #2c2d2e;
}

body.portal-mail .log-viewer {
    background: #1a1a1a;
    color: #a0d0a0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #333;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 800px;
    overflow-y: auto;
    line-height: 1.5;
}

body.portal-mail .log-viewer:empty::before,
body.portal-mail .log-viewer-empty {
    color: #818c99;
}

body.portal-mail .form-group {
    margin-bottom: 12px;
}

body.portal-mail .form-group label {
    font-size: 13px;
    font-weight: normal;
    margin-bottom: 3px;
    color: #222;
}

body.portal-mail .form-group input,
body.portal-mail .form-group select,
body.portal-mail .form-group textarea {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: var(--mail-radius-sm);
    border-color: var(--mail-border);
    background: var(--mail-surface);
}

body.portal-mail .form-group input:focus,
body.portal-mail .form-group select:focus,
body.portal-mail .form-group textarea:focus {
    border-color: var(--mail-blue);
    box-shadow: 0 0 0 2px rgba(0, 95, 249, 0.16);
    outline: none;
}

body.portal-mail table {
    font-size: 14px;
    margin: 12px 0;
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
    overflow: hidden;
}

body.portal-mail table th {
    padding: 10px 12px;
    font-weight: 600;
    background: #f5f7fa;
    border-bottom: 1px solid var(--mail-border);
}

body.portal-mail table td {
    padding: 9px 12px;
    border-bottom: 1px solid #eef1f6;
    vertical-align: top;
}

body.portal-mail table tr:hover td {
    background: var(--mail-blue-soft);
}

body.portal-mail .alert {
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 13px;
    border-radius: 8px;
}

body.portal-mail .alert-success {
    background: var(--mail-blue-soft);
    border-color: var(--mail-blue-muted);
    color: var(--mail-text);
}

body.portal-mail .alert-error {
    background: #fee7e6;
    border-color: #f5c6cb;
    color: var(--mail-text);
}

body.portal-mail .alert-info {
    background: var(--mail-blue-soft);
    border-color: var(--mail-blue-muted);
    color: var(--mail-text);
}

body.portal-mail .role-badge.admin {
    background: var(--mail-blue-soft);
    color: var(--mail-blue);
}

body.portal-mail .role-badge.user {
    background: #f0f3f8;
    color: #818c99;
}

body.portal-mail .status-badge,
body.portal-mail .role-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 8px;
}

body.portal-mail .checkbox-group {
    padding: 8px;
    border-color: #e1e3e8;
    border-radius: 8px;
}

body.portal-mail .checkbox-group label {
    font-size: 13px;
    padding: 2px 0;
}

body.portal-mail .status-badge.frozen {
    background: #fef7e0;
    color: #8a4b00;
}

body.portal-mail .empty-state {
    padding: 32px 16px;
    color: #818c99;
}

body.portal-mail .empty-state p {
    font-size: 14px;
}

body.portal-mail .checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}

body.portal-mail .checkbox-grid label {
    font-size: 13px;
    padding: 3px 6px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

body.portal-mail .checkbox-grid label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

body.portal-mail .checkbox-grid .full-width {
    grid-column: 1 / -1;
}

body.portal-mail .category-table td {
    vertical-align: middle;
}

body.portal-mail .category-table .actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

body.portal-mail .category-table .actions .btn-sm {
    padding: 2px 8px;
    font-size: 11px;
}

body.portal-mail .inline-form {
    display: inline;
}

body.portal-mail .inline-form-block {
    display: inline-block;
}

body.portal-mail .add-category-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

body.portal-mail .add-category-form .form-group {
    margin-bottom: 0;
}

body.portal-mail .add-category-form .form-group.name-field {
    flex: 2;
    min-width: 200px;
}

body.portal-mail .add-category-form .form-group.order-field {
    flex: 1;
    min-width: 100px;
}

body.portal-mail .textarea-code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

body.portal-mail .btn-icon {
    font-size: 12px;
    line-height: 1;
    padding: 2px 6px;
    min-width: 28px;
    text-align: center;
    background: transparent;
    border: none;
    color: #005ff9;
    cursor: pointer;
    text-decoration: none;
    border-radius: 8px;
}

body.portal-mail .btn-icon:hover {
    background: #f0f3f8;
    text-decoration: underline;
}

body.portal-mail .table-scroll {
    overflow-x: auto;
}

body.portal-mail .text-center {
    text-align: center;
}

body.portal-mail .col-actions {
    width: 150px;
    text-align: center;
}

body.portal-mail .col-order {
    width: 100px;
}

body.portal-mail .col-status {
    width: 150px;
}

body.portal-mail .checkbox-label-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

body.portal-mail .form-group.checkbox-row {
    display: flex;
    align-items: center;
    padding-top: 14px;
}

body.portal-mail .form-group.tight-follow {
    margin-top: -10px;
}

body.portal-mail .category-table td,
body.portal-mail .perm-table td,
body.portal-mail .perm-table th {
    font-size: 13px;
}

body.portal-mail section > p {
    font-size: 13px;
    color: #818c99;
}

@media (max-width: 768px) {
    body.portal-mail .container {
        padding: 10px 12px 20px;
        border-left: none;
        border-right: none;
    }

    body.portal-mail table {
        font-size: 12px;
    }

    body.portal-mail table th,
    body.portal-mail table td {
        padding: 4px 6px;
    }

    body.portal-mail .form-grid-2,
    body.portal-mail .roles-grid,
    body.portal-mail .checkbox-grid {
        grid-template-columns: 1fr;
    }

    body.portal-mail .role-field-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    body.portal-mail .tabs {
        flex-direction: column;
        align-items: stretch;
    }

    body.portal-mail .wiki-form-table th {
        width: 120px;
        min-width: 100px;
    }

    body.portal-mail .wiki-form-input {
        max-width: none;
    }

    body.portal-mail .tabs .tab-btn {
        border-radius: 0;
        margin-bottom: 0;
    }

    body.portal-mail .tabs .tab-btn.active {
        border-color: #e1e3e8;
        border-bottom-color: #e1e3e8;
    }

    body.portal-mail .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    body.portal-mail .filters-bar-actions {
        margin-left: 0;
    }
}



body.portal-mail .btn-admin-header,
body.portal-mail .btn-admin-header:visited,
body.portal-mail .btn-admin-header:hover {
    background: #005ff9;
    border-color: #005ff9;
    color: #fff;
    min-height: 28px;
    padding: 4px 10px;
    font-size: 12px;
}

body.portal-mail .btn-admin-header:hover {
    background: #0050d9;
    border-color: #0050d9;
}

body.portal-mail .project-grid {
    gap: 12px;
    margin: 12px 0;
}

body.portal-mail .project-card {
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-md);
    padding: 14px 16px;
    box-shadow: var(--mail-shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.portal-mail .project-card:hover {
    border-color: var(--mail-blue-muted);
    box-shadow: 0 4px 16px rgba(0, 16, 61, 0.1);
    background: var(--mail-surface);
}

body.portal-mail .project-card-header h3 {
    font-size: 1.05em;
    font-weight: 600;
    font-family: inherit;
}

body.portal-mail .project-card-body {
    font-size: 13px;
    color: #818c99;
}

body.portal-mail .project-card-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f0f3f8;
}

body.portal-mail table th {
    font-weight: normal;
}

body.portal-mail .status-badge {
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 11px;
}

body.portal-mail .project-status-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: normal;
    border: 1px solid #e1e3e8;
}

body.portal-mail .project-status-badge.active {
    background: #eaf3ff;
    color: #2c2d2e;
    border-color: #e1e3e8;
}

body.portal-mail .project-status-badge.closed {
    background: #f8f9fa;
    color: #818c99;
}


/* upload.php */
body.portal-mail .page-context {
    margin-bottom: 12px;
}

body.portal-mail .form-narrow {
    max-width: 760px;
    margin-top: 12px;
}

body.portal-mail .form-narrow-sm {
    max-width: 600px;
}

body.portal-mail .print-file-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e1e3e8;
    border-radius: 8px;
}

body.portal-mail .print-file-row .form-group {
    margin: 0;
    flex: 1;
    min-width: 160px;
}

body.portal-mail .print-file-row .btn-remove-row {
    margin-bottom: 2px;
}

body.portal-mail .print-file-row .btn-remove-row.is-hidden {
    display: none;
}

body.portal-mail .naming-preview {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e1e3e8;
    border-radius: 8px;
    font-size: 13px;
    color: #2c2d2e;
}

body.portal-mail .add-file-btn-wrap {
    margin-top: 6px;
}

/* package.php */
body.portal-mail .package-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

body.portal-mail .package-form-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #e1e3e8;
    border-radius: 8px;
    background: #f8f9fa;
}

body.portal-mail .package-form-panel h3 {
    margin-top: 0;
}

body.portal-mail .package-versions-section {
    margin-top: 16px;
}

body.portal-mail .package-versions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

body.portal-mail .package-version-panel {
    border: 1px solid #e1e3e8;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

body.portal-mail .package-version-panel h4 {
    margin: 0 0 8px;
}

body.portal-mail .version-list-plain {
    list-style: none;
    padding: 0;
    margin: 0;
}

body.portal-mail .version-list-plain li {
    padding: 3px 0;
    font-size: 13px;
    border-bottom: 1px solid #f0f3f8;
}

body.portal-mail .package-card {
    border: 1px solid #e1e3e8;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
}

body.portal-mail .package-card .package-meta {
    font-size: 12px;
    color: #818c99;
}

body.portal-mail .package-card .package-comment {
    font-weight: normal;
}

body.portal-mail .package-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

body.portal-mail .package-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

body.portal-mail .package-incomplete-note {
    margin-top: 4px;
    font-size: 12px;
    color: #ac6600;
}

body.portal-mail .stats-box {
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e1e3e8;
    font-size: 13px;
}

body.portal-mail .stats-box.success {
    background: #f8f9fa;
    color: #2c2d2e;
}

body.portal-mail .stats-box.warning {
    background: #fef6e7;
    color: #ac6600;
}

body.portal-mail .stats-box .stats-details {
    font-size: 12px;
    margin-top: 4px;
}

body.portal-mail .inline-form {
    display: inline;
}

body.portal-mail .table-scroll {
    overflow-x: auto;
}

body.portal-mail .add-volume-inline {
    margin-bottom: 12px;
    align-items: flex-end;
}

body.portal-mail .add-volume-inline .add-volume-field {
    flex: 1;
    margin: 0;
    min-width: 200px;
}

body.portal-mail .add-volume-inline .add-volume-field input {
    width: 100%;
}

@media (max-width: 768px) {
    body.portal-mail .package-versions-grid {
        grid-template-columns: 1fr;
    }
}

body.portal-mail .login-container .login-box {
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-lg);
    box-shadow: var(--mail-shadow);
    padding: 36px 40px;
}

body.portal-mail .login-container .login-box.setup-box {
    max-width: 560px;
}

body.portal-mail .login-container .login-box h1 {
    font-family: inherit;
    font-weight: 700;
}

body.portal-mail .login-container .btn-primary {
    width: 100%;
}

.login-box .login-title {
    margin-bottom: 24px;
}

.login-box .activate-pass-wrap {
    width: 100%;
}

.login-box input[readonly] {
    background: #f6f7f8;
    color: #222;
}

.login-caps-hint {
    margin: -8px 0 12px;
    font-size: 12px;
    color: #b36b00;
}

@media (max-width: 768px) {
    body.portal-mail .container {
        border-left: none;
        border-right: none;
    }
}

/* Dashboard */
body.portal-mail .dashboard-section {
    margin-bottom: 20px;
}

body.portal-mail .dashboard-welcome h2 {
    margin: 0 0 4px;
    font-weight: normal;
}

body.portal-mail .dashboard-welcome {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

body.portal-mail .dashboard-portfolio-archive {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    width: auto;
    min-height: 28px;
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #8a929d;
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: none;
}

body.portal-mail .dashboard-portfolio-archive:hover {
    background: #f3f4f5;
    border-color: #d4d8dd;
    color: #59636f;
}

body.portal-mail .dashboard-portfolio-archive.is-active {
    background: #e6f2ff;
    border-color: rgba(0, 95, 249, 0.45);
    color: var(--mail-blue);
}

body.portal-mail .dashboard-portfolio-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 6px;
    color: var(--mail-muted);
    font-size: 12px;
}

body.portal-mail .dashboard-portfolio-heat-note {
    max-width: 900px;
    margin: 3px 0 0;
    color: var(--mail-text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

body.portal-mail .dashboard-portfolio-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0 0 8px;
    padding: 0;
    color: #59636f;
    font-size: 12px;
    list-style: none;
}

body.portal-mail .dashboard-portfolio-legend li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

body.portal-mail .dashboard-portfolio-legend__scale {
    padding-left: 12px;
    border-left: 1px solid #d8dde3;
}

body.portal-mail .dashboard-portfolio-legend__swatch {
    width: 11px;
    height: 11px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 2px;
}

body.portal-mail .dashboard-portfolio-legend__swatch.is-cool { background: #dff3e7; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-attention-1 { background: #fff9df; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-attention-2 { background: #fff2c2; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-attention-3 { background: #fee7a0; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-attention-4 { background: #fbd376; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-attention-5 { background: #eeb84e; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-action-1 { background: #fdecec; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-action-2 { background: #f9d7d7; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-action-3 { background: #f2bcbc; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-action-4 { background: #e89b9b; }
body.portal-mail .dashboard-portfolio-legend__swatch.is-action-5 { background: #d97777; }

body.portal-mail .dashboard-treemap {
    position: relative;
    width: 100%;
    height: clamp(360px, 52vw, 620px);
    min-height: 280px;
    overflow: hidden;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
    background: #f4f6f8;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.portal-mail .dashboard-project-tile {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    padding: 13px;
    overflow: hidden;
    border: 2px solid #f4f6f8;
    border-radius: 4px;
    color: #1f2937;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
    transition: filter 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

body.portal-mail .dashboard-project-tile:hover {
    z-index: 2;
    color: #111827;
    text-decoration: none;
    filter: brightness(0.98) saturate(1.04);
    transform: translateY(-1px);
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.08),
        0 7px 18px rgba(15, 23, 42, 0.16);
}

body.portal-mail .dashboard-project-tile.is-selected {
    outline: 3px solid var(--mail-blue);
    outline-offset: -3px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75);
}

body.portal-mail .dashboard-project-tile:focus-visible {
    z-index: 3;
    outline: 3px solid var(--mail-blue);
    outline-offset: -4px;
}

body.portal-mail .dashboard-project-tile--heat-cool { background: #dff3e7; color: #24513a; }
body.portal-mail .dashboard-project-tile--heat-attention_1 { background: #fff9df; color: #5c4a00; }
body.portal-mail .dashboard-project-tile--heat-attention_2 { background: #fff2c2; color: #5c4500; }
body.portal-mail .dashboard-project-tile--heat-attention_3 { background: #fee7a0; color: #563b00; }
body.portal-mail .dashboard-project-tile--heat-attention_4 { background: #fbd376; color: #4d3300; }
body.portal-mail .dashboard-project-tile--heat-attention_5 { background: #eeb84e; color: #422b00; }
body.portal-mail .dashboard-project-tile--heat-action_1 { background: #fdecec; color: #6f2929; }
body.portal-mail .dashboard-project-tile--heat-action_2 { background: #f9d7d7; color: #702323; }
body.portal-mail .dashboard-project-tile--heat-action_3 { background: #f2bcbc; color: #681b1b; }
body.portal-mail .dashboard-project-tile--heat-action_4 { background: #e89b9b; color: #591414; }
body.portal-mail .dashboard-project-tile--heat-action_5 { background: #d97777; color: #420d0d; }

body.portal-mail .dashboard-project-tile.is-closed {
    background: #e5e7eb;
    color: #4b5563;
}

body.portal-mail .dashboard-project-tile__number {
    display: block;
    overflow: hidden;
    font-size: clamp(12px, 1.05vw, 16px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: 0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.82;
}

body.portal-mail .dashboard-project-tile__badge {
    margin-left: auto;
    background: #d33;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__badge,
body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__badge {
    min-width: 16px;
    padding: 1px 5px;
    font-size: 10px;
}

body.portal-mail .dashboard-project-tile__top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

body.portal-mail .dashboard-project-tile__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.72);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.22);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.03em;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
    opacity: 1;
}

body.portal-mail .dashboard-project-tile__name {
    display: -webkit-box;
    min-height: 0;
    overflow: hidden;
    font-size: clamp(12px, 1.12vw, 17px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

body.portal-mail .dashboard-project-tile__signals {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: auto;
    padding-top: 3px;
    border-top: 0;
    opacity: 0.88;
}

body.portal-mail .dashboard-project-tile__signal {
    display: inline-grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    min-height: 0;
    padding: 0 8px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: 9px;
    line-height: 1.1;
    white-space: nowrap;
    box-shadow: none;
}

body.portal-mail .dashboard-project-tile__signal strong {
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

body.portal-mail .dashboard-project-tile__signal-label {
    overflow: hidden;
    font-weight: 500;
    letter-spacing: 0.035em;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

body.portal-mail .dashboard-project-tile__signal--total {
    display: none;
}

body.portal-mail .dashboard-project-tile__clear {
    color: inherit;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

body.portal-mail .dashboard-project-tile.is-compact {
    padding: 8px;
    gap: 4px;
    border-radius: 3px;
}

body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__name {
    -webkit-line-clamp: 2;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__signal-label,
body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__clear {
    display: none;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__name {
    display: none;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__top {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__number {
    max-width: 100%;
    font-size: 12px;
}

body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal {
    padding-right: 6px;
}

body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal--action,
body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal--attention {
    display: none;
}

body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal--total {
    display: inline-grid;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__index {
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 10px;
    height: 1.25em;
    min-width: 1.25em;
    padding: 0 4px;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__signal--action,
body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__signal--attention {
    display: none;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__signal--total {
    display: inline-grid;
}

body.portal-mail .dashboard-project-tile.is-micro {
    padding: 6px;
}

body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__name,
body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__signal-label {
    display: none;
}

body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__top {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__signals {
    margin-top: auto;
    padding-top: 2px;
}

body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__signal--total {
    padding: 0;
}

body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__signal--total strong,
body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__signal--total strong {
    font-size: 18px;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    body.portal-mail .dashboard-project-tile {
        transition: none;
    }

    body.portal-mail .dashboard-project-tile:hover {
        transform: none;
    }
}

body.portal-mail .dashboard-portfolio-empty {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--mail-muted);
    text-align: center;
}

body.portal-mail .dashboard-portfolio-fallback {
    margin: 12px 0;
}

body.portal-mail .dashboard-completion {
    margin-bottom: 20px;
}

body.portal-mail .dashboard-tabs {
    display: flex;
    gap: 2px;
    margin: 0 0 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--mail-border);
}

body.portal-mail .dashboard-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 9px 12px 8px;
    border-bottom: 3px solid transparent;
    color: var(--mail-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

body.portal-mail .dashboard-tab:hover {
    color: var(--mail-blue);
    text-decoration: none;
}

body.portal-mail .dashboard-tab.is-active {
    border-bottom-color: var(--mail-blue);
    color: var(--mail-blue);
}

body.portal-mail .dashboard-tab__badge {
    min-width: 18px;
    padding: 2px 5px;
    border-radius: 999px;
    background: #d33;
    color: #fff;
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
}

body.portal-mail .dashboard-completion__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

body.portal-mail .dashboard-completion__header h2 {
    margin-bottom: 4px;
}

body.portal-mail .dashboard-completion__completed-toggle {
    flex: 0 0 auto;
    padding: 7px 11px;
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
    background: #fff;
    color: var(--mail-blue);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

body.portal-mail .dashboard-completion__completed-toggle:hover {
    background: #f5f9ff;
    border-color: #8ab4ea;
}

body.portal-mail .dashboard-completion__status {
    margin: 12px 0 8px;
    color: var(--mail-muted);
    font-size: 12px;
}

body.portal-mail .dashboard-completion__list {
    display: grid;
    gap: 8px;
}

body.portal-mail .dashboard-completion-card {
    overflow: hidden;
    border: 1px solid var(--mail-border);
    border-left: 3px solid #d6a100;
    border-radius: var(--mail-radius-sm);
    background: #fff;
}

body.portal-mail .dashboard-completion-card.is-complete {
    display: none;
    border-left-color: #2f855a;
}

body.portal-mail .dashboard-completion.show-complete .dashboard-completion-card.is-complete {
    display: block;
}

body.portal-mail .dashboard-completion-card__summary {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 240px) auto;
    align-items: center;
    gap: 16px;
    min-height: 48px;
    padding: 10px 12px;
}

body.portal-mail .dashboard-completion-card__identity {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 9px;
}

body.portal-mail .dashboard-completion-card__identity strong {
    overflow: hidden;
    color: var(--mail-text);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.portal-mail .dashboard-completion-card__number {
    flex: 0 0 auto;
    color: var(--mail-muted);
    font-size: 11px;
}

body.portal-mail .dashboard-completion-card__progress {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 7px;
    color: var(--mail-muted);
    font-size: 11px;
}

body.portal-mail .dashboard-completion-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eaed;
}

body.portal-mail .dashboard-completion-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #d6a100;
}

body.portal-mail .dashboard-completion-card.is-complete .dashboard-completion-progress span {
    background: #2f855a;
}

body.portal-mail .dashboard-completion-card__toggle {
    padding: 6px 10px;
    border: 1px solid #8ab4ea;
    border-radius: var(--mail-radius-sm);
    background: #f5f9ff;
    color: var(--mail-blue);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

body.portal-mail .dashboard-completion-card__done {
    color: #26734d;
    font-size: 12px;
    font-weight: 600;
}

body.portal-mail .dashboard-completion-card__locked {
    color: var(--mail-muted);
    font-size: 11px;
}

body.portal-mail .dashboard-completion-card__missing {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 12px 10px;
}

body.portal-mail .dashboard-completion-card__missing span {
    padding: 2px 6px;
    border: 1px solid #ead68b;
    border-radius: 999px;
    background: #fff9df;
    color: #66520b;
    font-size: 10px;
}

body.portal-mail .dashboard-completion-card__editor {
    padding: 14px 12px;
    border-top: 1px solid var(--mail-border);
    background: #f8f9fa;
}

body.portal-mail .dashboard-card-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

body.portal-mail .dashboard-card-field {
    position: relative;
    min-width: 0;
}

body.portal-mail .dashboard-card-field label,
body.portal-mail .dashboard-card-field legend {
    display: block;
    margin-bottom: 5px;
    color: var(--mail-text);
    font-size: 12px;
    font-weight: 600;
}

body.portal-mail .dashboard-card-field input[type="text"],
body.portal-mail .dashboard-card-field select {
    box-sizing: border-box;
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
    background: #fff;
    color: var(--mail-text);
    font: inherit;
    font-size: 13px;
}

body.portal-mail .dashboard-card-field input:focus,
body.portal-mail .dashboard-card-field select:focus {
    border-color: var(--mail-blue);
    outline: 2px solid rgba(0, 95, 249, 0.14);
    outline-offset: 1px;
}

body.portal-mail .dashboard-reference-suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% - 1px);
    right: 0;
    left: 0;
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid var(--mail-border);
    border-radius: 0 0 var(--mail-radius-sm) var(--mail-radius-sm);
    background: #fff;
    box-shadow: 0 8px 20px rgba(32, 33, 36, 0.14);
}

body.portal-mail .dashboard-reference-suggestion {
    display: block;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px solid #eef0f2;
    background: #fff;
    color: var(--mail-text);
    text-align: left;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

body.portal-mail .dashboard-reference-suggestion:last-child {
    border-bottom: 0;
}

body.portal-mail .dashboard-reference-suggestion:hover,
body.portal-mail .dashboard-reference-suggestion:focus {
    background: #eef5ff;
    outline: 0;
}

body.portal-mail .dashboard-card-field small,
body.portal-mail .dashboard-card-field__empty,
body.portal-mail .dashboard-card-field--locked {
    display: block;
    margin-top: 4px;
    color: var(--mail-muted);
    font-size: 11px;
}

body.portal-mail .dashboard-card-field fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

body.portal-mail .dashboard-card-designers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 12px;
    max-height: 132px;
    overflow-y: auto;
    padding: 7px 8px;
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
    background: #fff;
}

body.portal-mail .dashboard-card-designers label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 400;
}

body.portal-mail .dashboard-card-form-error {
    margin-top: 10px;
    padding: 7px 9px;
    border: 1px solid #d33;
    border-radius: var(--mail-radius-sm);
    background: #fee7e6;
    color: #8b1e1e;
    font-size: 12px;
}

body.portal-mail .dashboard-card-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

body.portal-mail .dashboard-completion__empty {
    padding: 16px;
    border: 1px dashed var(--mail-border);
    border-radius: var(--mail-radius-sm);
    color: var(--mail-muted);
    text-align: center;
}

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

body.portal-mail .dashboard-project-activity {
    margin-top: 22px;
    border-top: 1px solid var(--mail-border);
    padding-top: 18px;
}

body.portal-mail .dashboard-activity-post {
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
}

body.portal-mail .dashboard-activity-post.is-viewed,
body.portal-mail .dashboard-activity-post.is-unread,
body.portal-mail .dashboard-activity-post.needs-action {
    background: #fff;
}

body.portal-mail .dashboard-activity-post.is-viewed {
    border-color: #c5ddd0;
}

body.portal-mail .dashboard-activity-post.is-unread {
    border-color: #d8dde3;
}

body.portal-mail .dashboard-activity-post.needs-action {
    border-color: #efc4c4;
}

body.portal-mail .dashboard-activity-post.is-viewed .dashboard-activity-post__header {
    background: #dff3e7;
    color: #24513a;
}

body.portal-mail .dashboard-activity-post.is-unread .dashboard-activity-post__header {
    background: #eef1f4;
    color: #3a3d40;
}

body.portal-mail .dashboard-activity-post.needs-action .dashboard-activity-post__header {
    background: #fdecec;
    color: #6f2929;
}

body.portal-mail .dashboard-activity-eye {
    border-radius: 3px;
}

@media (max-width: 480px) {
    body.portal-mail .dashboard-treemap {
        display: flex;
        height: auto;
        min-height: 0;
        flex-direction: column;
        overflow: visible;
        border: 0;
        background: transparent;
    }

    body.portal-mail .dashboard-project-tile {
        position: static;
        width: 100% !important;
        height: auto !important;
        min-height: 72px;
        padding: 10px;
        border: 1px solid var(--mail-border);
        border-radius: var(--mail-radius-sm);
    }

    body.portal-mail .dashboard-project-tile.is-tiny .dashboard-project-tile__name,
    body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__name,
    body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__index,
    body.portal-mail .dashboard-project-tile.is-micro .dashboard-project-tile__signal-label {
        display: block;
    }

    body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal--action,
    body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal--attention {
        display: inline-grid;
    }

    body.portal-mail .dashboard-project-tile.is-compact .dashboard-project-tile__signal--total {
        display: none;
    }

    body.portal-mail .dashboard-completion__header,
    body.portal-mail .dashboard-completion-card__identity {
        align-items: stretch;
        flex-direction: column;
    }

    body.portal-mail .dashboard-completion-card__summary {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body.portal-mail .dashboard-card-fields,
    body.portal-mail .dashboard-card-designers {
        grid-template-columns: 1fr;
    }
}

body.portal-mail .dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid var(--mail-border);
    border-radius: var(--mail-radius-sm);
    overflow: hidden;
}

body.portal-mail .dashboard-table th,
body.portal-mail .dashboard-table td {
    padding: 10px 12px;
    border: 1px solid var(--mail-border);
    vertical-align: top;
}

body.portal-mail .dashboard-table th {
    background: #f5f7fa;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

body.portal-mail .user-name-link {
    color: inherit;
    text-decoration: none;
}

body.portal-mail .user-name-link:hover {
    color: var(--mail-blue);
    text-decoration: none;
}

body.admin-wiki .user-name-link {
    color: inherit;
    text-decoration: none;
}

body.admin-wiki .user-name-link:hover {
    color: #005ff9;
    text-decoration: underline;
}

/* Исходные данные: документ, история, комментарии */
.source-set-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.source-set-heading .source-type-hint {
    flex-basis: 100%;
    margin: 0;
    line-height: 1.4;
}

.source-attention-badge {
    display: inline-block;
    background: #ffe9e9;
    color: #c62828;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.source-file-remark-badge {
    margin-left: 6px;
    vertical-align: baseline;
}

.source-file-title {
    display: inline;
}

.source-file-block {
    border: 1px solid #f0f3f8;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
    background: #fff;
}

.source-file-block.is-revoked {
    background: #f8f9fa;
    border-style: dashed;
    opacity: 0.95;
}

.source-file-link.is-revoked-link {
    color: #818c99;
}

.source-file-link.is-revoked-link:hover {
    color: #2c2d2e;
}

.source-file-thread {
    margin-top: 4px;
}

.source-thread-body {
    margin-top: 6px;
    padding-left: 14px;
}

button.source-file-link.source-thread-toggle {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: #005ff9;
    cursor: pointer;
    font: inherit;
    text-align: left;
    text-decoration: none;
}

button.source-file-link.source-thread-toggle::before {
    content: '▸ ';
    color: #818c99;
    font-size: 11px;
}

.source-file-block:has(.source-file-thread.is-expanded) button.source-file-link.source-thread-toggle::before {
    content: '▾ ';
}

button.source-file-link.source-thread-toggle:hover {
    color: #0050d9;
    text-decoration: underline;
}

.source-thread-body.is-collapsed {
    display: none;
}

.source-thread-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.source-thread-toolbar:only-child {
    margin-bottom: 0;
}

.source-file-comment-form {
    margin-top: 0;
    margin-bottom: 8px;
}

.source-thread-body > .source-comment-branch,
.source-thread-body > .source-comment-node {
    margin-top: 8px;
}

.source-thread-body > .source-comment-branch:first-child,
.source-thread-body > .source-comment-node:first-child {
    margin-top: 0;
}

.source-set-deletions {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #f0f3f8;
}

.source-set-deletion-item {
    font-size: 12px;
    color: #818c99;
    line-height: 1.45;
    margin-bottom: 4px;
}

.source-thread-history-item {
    font-size: 12px;
    color: #818c99;
    padding: 3px 0 3px 8px;
    border-left: 2px solid #c8ccd1;
    margin-bottom: 5px;
}

.source-comment-branch {
    display: block;
}

.source-comment-node {
    position: relative;
    margin: 0;
}

.source-comment-item {
    background: #f8f9fa;
    border: 1px solid #f0f3f8;
    border-left: 3px solid #e1e3e8;
    border-radius: 4px;
    padding: 8px 10px;
}

.source-comment-node.is-remark > .source-comment-item {
    background: #fff8f8;
    border-color: #f0d4d4;
    border-left-color: #c62828;
}

.source-comment-node.is-upload-comment > .source-comment-item {
    background: #f4f8ff;
    border-color: #d6e4f7;
    border-left-color: #005ff9;
}

.source-comment-node.is-upload-comment > .source-comment-item.is-awaiting-view {
    background: rgba(255, 214, 102, 0.48);
    box-shadow: inset 0 0 0 1px rgba(214, 158, 0, 0.45);
}

.source-comment-replies {
    margin-top: 8px;
    margin-left: 0;
    padding-left: 14px;
    border-left: 2px solid #d0d7e2;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-comment-replies > .source-comment-branch {
    margin: 0;
}

.source-remark-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #c62828;
    background: #ffe9e9;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 6px;
}

.source-comment-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin-bottom: 4px;
}

.source-comment-meta {
    font-size: 11px;
    color: #818c99;
    line-height: 1.35;
}

.source-comment-text {
    font-size: 13px;
    line-height: 1.5;
    color: #2c2d2e;
}

.source-comment-attachments {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.source-comment-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comment-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comment-gallery-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    cursor: zoom-in;
    line-height: 0;
}

.comment-gallery-thumb:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.comment-gallery-thumb-frame {
    position: absolute;
    inset: 0;
}

.comment-gallery-thumb-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-gallery-thumb-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eef2f7 0%, #dfe6ef 100%);
}

.comment-gallery-thumb.is-thumb-loading .comment-gallery-thumb-placeholder {
    animation: comment-thumb-pulse 1.2s ease-in-out infinite;
}

.comment-gallery-thumb .comment-attachments-preview-size {
    z-index: 2;
}

.source-comment-attachment-size {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    color: #666;
    text-align: center;
    line-height: 1.2;
}

.comment-attachments {
    width: 100%;
}

.comment-attachments-toolbar,
.comment-attachments-toolbar-label {
    display: none;
}

.comment-attachments-dropzone-head {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.comment-attachments.has-files .comment-attachments-dropzone-head {
    margin-bottom: 6px;
    padding-bottom: 6px;
}

.comment-attachments-mode {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    padding: 2px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    flex-shrink: 0;
}

.comment-attachments-mode-btn {
    padding: 3px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    font-size: 11px;
    line-height: 1.3;
    color: #5f6368;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.comment-attachments-mode-btn.is-active {
    background: #fff;
    color: #005ff9;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.comment-attachments.is-photo-mode .comment-attachments-dropzone {
    border-color: rgba(0, 95, 249, 0.35);
}

.comment-attachments-dropzone {
    padding: 10px 12px;
    border: 1px dashed #d9d9d9;
    border-radius: 10px;
    background: #fafafa;
}

.comment-attachments-dropzone.is-dragover {
    border-color: #005ff9;
    background: #f0f6ff;
}

.comment-attachments-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.comment-attachments-hint {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: #777;
    line-height: 1.4;
}

.comment-attachments-add {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    margin: 0;
    padding: 0;
    border: 1px solid #dadce0;
    border-radius: 10px;
    background: #fff;
    color: #5f6368;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.comment-attachments-add:hover {
    border-color: #005ff9;
    background: #f5f9ff;
    color: #005ff9;
    box-shadow: 0 1px 4px rgba(0, 95, 249, 0.12);
}

.comment-attachments-add-icon {
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
}

.comment-attachments.has-files .comment-attachments-hint {
    display: none;
}

.comment-attachments.has-files .comment-attachments-prompt {
    align-items: flex-start;
}

.comment-attachments-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-attachments.has-files .comment-attachments-previews:empty {
    display: none;
}

.comment-attachments.has-files .comment-attachments-previews:not(:empty) + .comment-attachments-prompt {
    margin-top: 2px;
}

.comment-attachments-preview {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
}

.comment-attachments-preview.is-invalid {
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.18);
    background: #fff5f5;
}

.comment-attachments-preview.is-compressing img {
    filter: brightness(0.72);
}

.comment-attachments-preview-progress {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.comment-attachments-progress-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.comment-attachments-progress-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.28);
    stroke-width: 5;
}

.comment-attachments-progress-fg {
    fill: none;
    stroke: #005ff9;
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.15s ease;
}

.comment-attachments-progress-label {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.comment-attachments-preview-size {
    position: absolute;
    right: 3px;
    bottom: 3px;
    max-width: calc(100% - 6px);
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 9px;
    line-height: 1.25;
    white-space: nowrap;
    pointer-events: none;
}

.comment-attachments-preview--file {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    box-sizing: border-box;
}

.comment-attachments-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: #eef2f7;
    color: #455a64;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

.comment-attachments-file-size-below {
    font-size: 9px;
    line-height: 1.2;
    color: #666;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

.comment-attachments-preview.is-compressing {
    opacity: 1;
}

.comment-attachments-preview-badge {
    position: absolute;
    left: 4px;
    top: 4px;
    max-width: calc(100% - 24px);
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 9px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.comment-attachments-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eef2f7 0%, #dfe6ef 100%);
    color: #607d8b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.comment-attachments-preview.is-thumb-loading .comment-attachments-preview-placeholder {
    animation: comment-thumb-pulse 1.2s ease-in-out infinite;
}

@keyframes comment-thumb-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.comment-attachments-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-attachments-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 6px;
    box-sizing: border-box;
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
    color: #555;
}

.comment-attachments-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.comment-attachments-note {
    display: block;
    margin-top: 6px;
}

.comment-attachments-error {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: #c62828;
}

.comment-attachments-error-group + .comment-attachments-error-group,
.comment-attachments-error-group + .comment-attachments-error-line,
.comment-attachments-error-line + .comment-attachments-error-group,
.comment-attachments-error-line + .comment-attachments-error-line {
    margin-top: 8px;
}

.comment-attachments-error-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-attachments-error-list {
    margin: 0;
    padding-left: 18px;
    max-height: 140px;
    overflow: auto;
}

.comment-attachments-error-list li {
    margin: 0 0 2px;
    word-break: break-word;
}

.comment-attachments-error-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-attachments-error[hidden] {
    display: none;
}

.comment-gallery-open {
    overflow: hidden;
}

.comment-gallery-modal[hidden] {
    display: none;
}

.comment-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
}

.comment-gallery-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.comment-gallery-shell {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 16px 64px 56px;
    box-sizing: border-box;
    pointer-events: none;
}

.comment-gallery-shell > * {
    pointer-events: auto;
}

.comment-gallery-figure {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-gallery-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-gallery-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.comment-gallery-viewport.is-zoomed {
    overflow: auto;
    align-items: flex-start;
    justify-content: flex-start;
}

.comment-gallery-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.comment-gallery-image.is-zoomed {
    max-width: none;
    max-height: none;
}

.comment-gallery-image.is-loading {
    opacity: 0;
}

.comment-gallery-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    z-index: 2;
    pointer-events: none;
}

.comment-gallery-loading[hidden] {
    display: none;
}

.comment-gallery-meta {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 4;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    max-width: min(72vw, 720px);
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 13px;
    line-height: 1.3;
}

.comment-gallery-meta-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

.comment-gallery-meta-size {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
}

.comment-gallery-meta-size:empty,
.comment-gallery-meta-size[hidden] {
    display: none;
}

.comment-gallery-download {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.comment-gallery-download:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

.comment-gallery-zoom {
    position: absolute;
    right: 16px;
    bottom: 64px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    cursor: pointer;
}

.comment-gallery-zoom:hover {
    background: rgba(0, 0, 0, 0.72);
}

.comment-gallery-zoom.is-active {
    background: rgba(0, 95, 249, 0.82);
}

.comment-gallery-zoom[hidden] {
    display: none;
}

.comment-gallery-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.comment-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 64px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
}

.comment-gallery-nav:disabled {
    opacity: 0.25;
    cursor: default;
}

.comment-gallery-prev {
    left: 16px;
}

.comment-gallery-next {
    right: 16px;
}

.source-comment-attachment {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 34px;
    min-height: 34px;
    padding: 4px 3px;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid transparent;
}

.source-comment-attachment:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.source-comment-attachment-icon {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

.source-comment-attachment--pdf {
    background: #ffebee;
    border-color: #ffcdd2;
    color: #c62828;
}

.source-comment-attachment--doc {
    background: #e3f2fd;
    border-color: #bbdefb;
    color: #1565c0;
}

.source-comment-attachment--sheet {
    background: #e8f5e9;
    border-color: #c8e6c9;
    color: #2e7d32;
}

.source-comment-attachment--image {
    background: #f3e5f5;
    border-color: #e1bee7;
    color: #6a1b9a;
}

.source-comment-attachment--archive {
    background: #fff3e0;
    border-color: #ffe0b2;
    color: #ef6c00;
}

.source-comment-attachment--cad {
    background: #eceff1;
    border-color: #cfd8dc;
    color: #455a64;
}

.source-comment-attachment--file {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #616161;
}

.source-comment-footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.source-comment-node.is-remark > .source-comment-item .source-comment-footer {
    border-top-color: rgba(198, 40, 40, 0.12);
}

.source-comment-reply-link {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    font-size: 11px;
    line-height: 1.3;
    color: #005ff9;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}

.source-comment-reply-link:hover {
    color: #0050d9;
}

