@layer app {
    :root {
        --blue: var(--brand);
    }

    html {
        scrollbar-gutter: stable;
        text-size-adjust: 100%;
    }

    .site-page {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .site-page > .workspace {
        flex: 1 0 auto;
    }

    .site-page > .topbar,
    .site-page > .footer {
        flex-shrink: 0;
    }

    .site-page > .footer {
        margin-top: auto;
    }

    a {
        color: var(--brand);
    }

    .workspace {
        width: min(1320px, calc(100% - 2 * clamp(16px, 3vw, 40px)));
        margin-inline: auto;
        padding-block: 32px 72px;
    }

    .workspace.management-shell {
        display: grid;
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 24px;
        align-items: start;
    }

    main {
        min-width: 0;
    }

    h1 {
        font-size: var(--step-3);
        letter-spacing: -.035em;
        line-height: 1.25;
    }

    h2 {
        font-size: var(--step-2);
        margin-bottom: 16px;
    }

    h3 {
        font-size: var(--step-1);
    }

    p + p {
        margin-top: 12px;
    }

    label {
        display: block;
        font-weight: 650;
        margin-bottom: 6px;
    }

    input:not([type='checkbox']):not([type='radio']):not([type='file']),
    select,
    textarea {
        width: 100%;
        min-height: 44px;
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 10px 12px;
        background: var(--surface);
        color: var(--ink);
    }

    input:read-only {
        background: var(--surface-2);
    }

    input[type='checkbox'],
    input[type='radio'] {
        width: 18px;
        height: 18px;
        accent-color: var(--brand);
        flex-shrink: 0;
    }

    button,
    .button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 16px;
        min-height: 44px;
        line-height: 1.25;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 8px;
        border: 1px solid var(--brand);
        background: var(--brand);
        color: var(--brand-ink);
        font-weight: 680;
        text-decoration: none;
    }

    button:hover,
    .button:hover {
        filter: brightness(.96);
    }

    button.secondary,
    .button.secondary {
        border-color: var(--line);
        color: var(--ink);
        background: var(--surface);
    }

    button:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

    .actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }

    .actions form {
        margin: 0;
    }

    .page-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        margin-bottom: 24px;
    }

    .panel,
    .search-grid {
        margin: 20px 0;
        padding: 24px;
        border: 1px solid var(--line);
        border-radius: var(--radius-m);
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    .form-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 24px;
    }

    .full-width {
        grid-column: 1 / -1;
    }

    .checkbox {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .search-grid {
        display: flex;
        flex-wrap: wrap;
        align-items: end;
        gap: 16px;
    }

    .search-grid > div {
        flex: 1 1 180px;
    }

    .required {
        color: var(--danger);
        font-size: var(--fs-s);
    }

    .hint,
    small {
        color: var(--muted);
        font-size: var(--step--1);
    }

    .eyebrow {
        color: var(--brand);
        font-size: var(--fs-s);
        font-weight: 750;
        letter-spacing: .07em;
    }

    .table-scroll {
        overflow: auto;
        border: 1px solid var(--line);
        border-radius: var(--radius-m);
        background: var(--surface);
    }

    table {
        width: 100%;
    }

    th,
    td {
        text-align: left;
        padding: 16px;
        border-bottom: 1px solid var(--line);
        vertical-align: middle;
    }

    th {
        color: var(--muted);
        background: var(--surface-2);
        font-size: var(--step--1);
        white-space: nowrap;
    }

    td .actions {
        min-width: 180px;
        gap: 8px;
    }

    .badge {
        display: inline-flex;
        align-items: center;
        border-radius: 6px;
        padding: 4px 9px;
        background: var(--surface-2);
        color: var(--muted);
        font-size: var(--fs-s);
        font-weight: 700;
        white-space: nowrap;
    }

    .badge[data-s='req'] {
        color: var(--s-req);
        background: color-mix(in oklab, var(--s-req) 10%, transparent);
    }

    .badge[data-s='recv'] {
        color: var(--s-recv);
        background: color-mix(in oklab, var(--s-recv) 10%, transparent);
    }

    .badge[data-s='prog'] {
        color: var(--s-prog);
        background: color-mix(in oklab, var(--s-prog) 10%, transparent);
    }

    .badge[data-s='review'] {
        color: var(--s-review);
        background: color-mix(in oklab, var(--s-review) 10%, transparent);
    }

    .badge[data-s='long'] {
        color: var(--s-long);
        background: color-mix(in oklab, var(--s-long) 10%, transparent);
    }

    .badge[data-s='done'] {
        color: var(--s-done);
        background: color-mix(in oklab, var(--s-done) 10%, transparent);
    }

    .danger {
        color: var(--danger);
        background: color-mix(in oklab, var(--danger) 8%, transparent);
    }

    .pagination {
        display: flex;
        gap: 20px;
        justify-content: center;
        align-items: center;
        margin-top: 24px;
        flex-wrap: wrap;
    }

    .empty-state {
        padding: 48px 24px;
        text-align: center;
        color: var(--muted);
    }

    .notice {
        padding: 14px 18px;
        border-left: 3px solid var(--s-long);
        background: color-mix(in oklab, var(--s-long) 8%, transparent);
        margin-bottom: 20px;
    }

    [role='alert'] {
        color: var(--danger);
        padding: 12px 16px;
        background: color-mix(in oklab, var(--danger) 8%, transparent);
        border-radius: 8px;
    }

    pre {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        font-size: var(--fs-s);
        max-width: 600px;
    }

    .sidebar {
        background: var(--surface);
        padding: 20px;
        border: 1px solid var(--line);
        border-radius: 10px;
    }

    .sidebar nav {
        display: grid;
        gap: 5px;
    }

    .sidebar a {
        padding: 8px 10px;
        border-radius: 6px;
        color: var(--muted);
    }

    .sidebar a:hover {
        background: var(--surface-2);
        color: var(--brand);
    }

    .sidebar a[aria-current='page'] {
        background: var(--surface-2);
        color: var(--brand);
        font-weight: 700;
    }

    .nav-title {
        margin: 16px 0 6px;
        font-weight: 750;
    }

    .topbar .gnav {
        flex: 1;
        min-width: 0;
    }

    .topbar .gnav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar .gnav a {
        padding: 8px 10px;
        font-weight: 680;
        color: var(--muted);
    }

    .topbar .gnav a[aria-current='page'] {
        color: var(--brand);
        background: var(--surface-2);
        border-radius: 6px;
    }

    .top-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-left: auto;
    }

    .top-actions .icon-btn {
        color: var(--muted);
        background: transparent;
        border: 1px solid var(--line);
        padding: 8px;
    }

    .user-menu {
        position: relative;
    }

    .user-menu summary {
        list-style: none;
        display: flex;
        align-items: center;
        gap: 10px;
        cursor: pointer;
    }

    .user-menu summary::-webkit-details-marker {
        display: none;
    }

    .user-menu .profile-menu {
        position: absolute;
        right: 0;
        top: calc(100% + 12px);
        z-index: 40;
        width: 270px;
        padding: 20px;
        background: var(--surface);
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
        border-radius: 12px;
        display: grid;
        gap: 12px;
    }

    .user-menu .avatar {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        background: var(--surface-2);
        color: var(--brand);
        border-radius: 50%;
    }

    .user-menu .who {
        display: grid;
        font-size: var(--step--1);
    }

    .user-menu .profile-menu button {
        width: 100%;
    }

    .auth-page {
        min-height: 100dvh;
        display: grid;
        place-items: center;
        padding: 24px;
    }

    .auth-card {
        width: min(560px, 100%);
        padding: 32px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 16px;
    }

    .auth-card form {
        display: grid;
        gap: 12px;
        margin-top: 20px;
    }

    .login-side .brand-text span {
        color: inherit;
    }

    .login-form form {
        display: grid;
        gap: 14px;
    }

    .login-form p {
        margin-bottom: 8px;
    }

    .login-form .hint {
        margin-top: 16px;
    }

    .kpi-strip {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 12px;
        margin: 24px 0;
    }

    .kpi-strip a {
        display: grid;
        padding: 20px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
        color: var(--ink);
    }

    .kpi-strip strong {
        font-size: 32px;
        font-variant-numeric: tabular-nums;
    }

    .kpi-strip a:hover {
        border-color: var(--brand);
    }

    .dashboard-section {
        padding-top: 20px;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .bar-list {
        display: grid;
        gap: 10px;
    }

    .bar-list a {
        display: flex;
        justify-content: space-between;
        padding: 10px 12px;
        border-radius: 8px;
        background: var(--surface-2);
        color: var(--ink);
    }

    .section-heading {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 14px;
    }

    .history-list {
        display: grid;
        gap: 12px;
        padding: 0 0 0 20px;
        border-left: 2px solid var(--line);
    }

    .history-list li {
        padding-left: 8px;
    }

    .history-list time {
        margin-left: 10px;
        font-size: var(--fs-s);
        color: var(--muted);
    }

    .board-shell {
        display: grid;
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 24px;
        align-items: start;
    }

    .board-side .panel {
        margin-top: 0;
        padding: 20px;
    }

    .board-side .region-card {
        display: grid;
        gap: 12px;
    }

    .region-card > .badge {
        justify-self: start;
    }

    .region-guidance {
        line-height: 1.65;
        word-break: keep-all;
        overflow-wrap: anywhere;
    }

    .region-guidance p + p {
        margin-top: 12px;
    }

    .board-side .region-list a {
        display: flex;
        padding: 10px;
        border-radius: 6px;
    }

    .board-side details {
        margin-top: 12px;
    }

    .status-tabs {
        display: flex;
        overflow: auto;
        gap: 8px;
        margin-bottom: 20px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 12px;
    }

    .status-tabs a {
        flex: 1;
        min-width: 94px;
        padding: 10px;
        display: grid;
        text-align: center;
        border-radius: 8px;
        color: var(--muted);
    }

    .status-tabs a[aria-current='page'] {
        background: var(--surface-2);
        color: var(--brand);
    }

    .status-tabs strong {
        font-size: 24px;
    }

    .file-selection {
        display: grid;
        gap: 8px;
        margin-top: 12px;
    }

    .file-selection li {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        overflow-wrap: anywhere;
    }

    .file-selection button {
        padding: 4px 8px;
        font-size: var(--fs-s);
    }
    @media (max-width: 1023px) {
        .workspace.management-shell,
        .board-shell {
            grid-template-columns: 1fr;
        }

        .sidebar {
            padding: 10px;
        }

        .sidebar nav {
            display: flex;
            flex-wrap: wrap;
        }

        .topbar .wrap {
            flex-wrap: wrap;
            gap: 12px;
            padding-block: 12px;
        }

        .topbar .gnav {
            order: 3;
            flex-basis: 100%;
        }

        .board-side {
            display: none;
        }
    }
    @media (max-width: 859px) {
        .kpi-strip {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .form-grid,
        .dashboard-grid {
            grid-template-columns: 1fr;
        }

        .top-actions .who {
            display: none;
        }

        .page-heading {
            align-items: start;
            flex-direction: column;
        }
    }

    textarea {
        box-sizing: border-box;
        width: 100%;
        padding: 12px;
        border: 1px solid #9eaabd;
        border-radius: 5px;
        font: inherit;
        resize: vertical;
    }

    .content {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        padding: 20px 0;
    }

    .ticket-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
        color: var(--muted);
        font-size: 14px;
    }

    .stats-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 18px;
    }

    .stat-card {
        border: 1px solid var(--line);
        background: var(--surface);
        border-radius: 10px;
        padding: 24px;
        display: flex;
        flex-direction: column;
    }

    .stat-card strong {
        font-size: 36px;
        color: var(--brand);
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .counts {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 12px;
    }

    .counts dd {
        margin: 0;
        font-weight: 700;
    }

    .dashboard-section {
        margin: 32px 0;
    }

    .answer-preview {
        max-height: 200px;
        overflow: auto;
    }
    @media (max-width: 800px) {
        .stats-grid,
        .dashboard-grid {
            grid-template-columns: 1fr;
        }
    }

    .upload-progress {
        display: block;
        width: 100%;
        height: 20px;
        margin-top: 14px;
    }

    .attachment-list {
        margin: 16px 0;
    }

    .attachment-item {
        border-top: 1px solid var(--line);
        padding: 14px 0;
        overflow-wrap: anywhere;
    }

    .attachment-item small {
        margin-left: 12px;
    }

    .attachment-item video {
        display: block;
        width: 100%;
        max-width: 800px;
        max-height: 500px;
        margin-top: 12px;
        background: #101828;
    }

    button:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

    .board-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        flex-basis: 100%;
        padding-top: 14px;
    }

    .site-header {
        flex-wrap: wrap;
    }

    .board-columns {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
        align-items: start;
    }

    .board-columns.panel-open {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    }

    .post-list {
        min-width: 0;
    }

    .detail-panel {
        min-width: 0;
        max-height: calc(100vh - 40px);
        position: sticky;
        top: 20px;
        overflow: auto;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--surface);
        padding: 20px;
    }

    .panel-toolbar {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 20px;
    }

    [hidden] {
        display: none !important;
    }
    @media (max-width: 859px) {
        .board-columns.panel-open {
            grid-template-columns: minmax(0, 1fr);
        }

        .detail-panel {
            position: static;
            max-height: none;
        }
    }

    .notice-band {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 8px 32px;
        background: var(--surface-2);
        border-bottom: 1px solid var(--line);
    }

    .notice-band > a {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
    }

    .notice-band form {
        flex-shrink: 0;
    }

    .notice-band form > button {
        margin: 0;
        padding: 4px 12px;
    }

    .notice-popup {
        width: min(620px, calc(100vw - 32px));
        max-height: calc(100vh - 48px);
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 28px;
        color: var(--ink);
    }

    .notice-popup::backdrop {
        background: rgb(10 20 40 / 55%);
    }

    .notice-popup-content {
        max-height: 50vh;
        overflow: auto;
    }

    .notice-popup .actions {
        flex-wrap: wrap;
    }

    .notice-popup form > .actions {
        margin-top: 18px;
    }

    .notification-widget {
        position: relative;
    }

    .notification-count {
        display: inline-block;
        min-width: 22px;
        padding: 0 5px;
        border-radius: 12px;
        background: #b32632;
        color: #fff;
        font-size: 12px;
    }

    .notification-dropdown {
        position: absolute;
        right: 0;
        top: calc(100% + 8px);
        z-index: 30;
        width: min(400px, calc(100vw - 32px));
        padding: 18px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--surface);
        color: var(--ink);
        box-shadow: 0 8px 30px rgb(20 35 60 / 15%);
    }

    .notification-dropdown ul,
    .notification-page-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .notification-dropdown ul {
        max-height: 55vh;
        overflow: auto;
        margin: 14px 0;
    }

    .notification-dropdown li {
        border-bottom: 1px solid var(--line);
        padding: 10px 0;
    }

    .notification-dropdown .notification-item,
    .notification-link {
        display: block;
        width: 100%;
        text-align: left;
        color: var(--ink);
        background: transparent;
        border: 0;
        padding: 8px 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .notification-dropdown .notification-unread {
        border-left: 3px solid var(--brand);
        padding-left: 10px;
    }

    .notification-dropdown time,
    .notification-page-list time {
        display: block;
        font-size: 12px;
        color: var(--muted);
    }

    .notification-page-list .notification-link {
        margin-top: 0;
    }

    .answerer-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mini-row {
        padding: 16px 0;
        border-bottom: 1px solid var(--line);
    }

    .mini-row:first-child {
        padding-top: 0;
    }

    .mini-row > a,
    .mini-row > strong {
        display: block;
        margin: 8px 0;
        font-weight: 700;
        color: var(--ink);
    }

    .kpi-strip [data-status='REQUESTED'] {
        border-top: 3px solid var(--s-req);
    }

    .kpi-strip [data-status='RECEIVED'] {
        border-top: 3px solid var(--s-recv);
    }

    .kpi-strip [data-status='IN_PROGRESS'] {
        border-top: 3px solid var(--s-prog);
    }

    .kpi-strip [data-status='REVIEWING'] {
        border-top: 3px solid var(--s-review);
    }

    .kpi-strip [data-status='LONG_TERM'] {
        border-top: 3px solid var(--s-long);
    }

    .kpi-strip [data-status='COMPLETED'] {
        border-top: 3px solid var(--s-done);
    }

    .board-columns.panel-open {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-panel {
        position: fixed;
        top: 0;
        right: 0;
        width: min(680px, 60vw);
        height: 100dvh;
        max-height: 100dvh;
        z-index: 35;
        border-radius: 16px 0 0 16px;
        padding: 28px;
        box-shadow: var(--shadow);
    }

    .panel-toolbar {
        position: sticky;
        top: -28px;
        padding-block: 12px;
        background: var(--surface);
        z-index: 2;
    }

    .tabs a {
        display: inline-flex;
        padding: 12px 20px;
        color: var(--muted);
        border-bottom: 2px solid transparent;
    }

    .tabs a[aria-current='page'] {
        color: var(--brand);
        border-color: var(--brand);
    }

    .pw-rules li.ok::before {
        content: '✓';
        background: none;
        text-align: center;
        font-size: 12px;
    }
    @media (max-width: 859px) {
        .detail-panel {
            width: 100%;
        }
    }

    .post-link {
        font-weight: 700;
        color: var(--ink);
    }

    .post-table .post-attachment {
        display: inline-block;
        margin-left: 4px;
        vertical-align: middle;
    }

    .post-table .cell-title {
        min-width: 220px;
    }
    @media (max-width: 859px) {
        .post-table thead {
            display: none;
        }

        .post-table,
        .post-table tbody {
            display: block;
        }

        .post-table tr {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 8px 16px;
            padding: 18px;
            border-bottom: 1px solid var(--line);
        }

        .post-table td {
            padding: 0;
            border: 0;
        }

        .post-table .cell-no {
            grid-column: 1;
            grid-row: 1;
            color: var(--muted);
        }

        .post-table .cell-status {
            grid-column: 2;
            grid-row: 1;
        }

        .post-table .cell-title {
            min-width: 0;
            grid-column: 1 / -1;
            grid-row: 2;
        }

        .post-table .cell-org {
            grid-column: 1;
            grid-row: 3;
        }

        .post-table .cell-author {
            grid-column: 2;
            grid-row: 3;
        }

        .post-table .cell-date {
            grid-column: 1 / -1;
            grid-row: 4;
            color: var(--muted);
        }

        .post-table .cell-date br {
            display: none;
        }
    }

    /* Shared control geometry and spacing for live application screens. */
    input:not([type='checkbox']):not([type='radio']):not([type='file']),
    select {
        height: 44px;
    }

    textarea {
        line-height: 1.65;
    }

    .actions > a:not(.button),
    .search-grid > a,
    .pagination > a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 10px 16px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
        color: var(--ink);
        font-weight: 680;
        line-height: 1.25;
        white-space: nowrap;
        text-decoration: none;
    }

    .actions > a:hover,
    .search-grid > a:hover,
    .pagination > a:hover {
        border-color: var(--brand);
        color: var(--brand);
    }

    .actions form {
        display: flex;
        align-items: center;
    }

    .form-grid > .actions {
        padding-top: 16px;
        border-top: 1px solid var(--line);
    }

    .form-grid small {
        display: block;
        margin-top: 6px;
    }

    .field-action {
        display: flex;
        align-items: start;
        gap: 8px;
    }

    .field-action > input {
        min-width: 0;
        flex: 1;
    }

    .field-action > button {
        flex-shrink: 0;
    }

    .field-action + .hint {
        margin-top: 8px;
    }

    form.panel:not(.form-grid):not(.search-grid) > label:not(:first-child) {
        margin-top: 16px;
    }

    form.panel:not(.form-grid):not(.search-grid) > button,
    form.panel:not(.form-grid):not(.search-grid) > .actions {
        margin-top: 20px;
    }

    form.panel > .upload-picker {
        margin-top: 20px;
    }

    .post-detail details > form {
        margin-top: 16px;
    }

    .post-detail details > form > button {
        margin-top: 12px;
    }

    .post-detail .ticket-meta + p {
        margin-top: 12px;
    }

    td .actions > a,
    td .actions button,
    .file-selection button,
    .attachment-item > button,
    .notice-band button,
    .notification-dropdown .actions button {
        min-height: 36px;
        padding: 7px 12px;
        font-size: 13px;
        line-height: 1.25;
    }

    .account-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 248px;
    }

    .account-actions > a,
    .account-actions form,
    .account-actions button {
        width: 100%;
    }

    .search-grid > button,
    .search-grid > a {
        align-self: end;
    }

    .search-grid > .checkbox {
        flex: 0 0 auto;
        min-height: 44px;
        margin-bottom: 0;
    }

    .search-grid .checkbox label {
        margin-bottom: 0;
    }

    .topbar .gnav a {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
        white-space: nowrap;
    }

    .top-actions .icon-btn,
    #notification-toggle {
        position: relative;
        width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        flex-shrink: 0;
    }

    .notification-count {
        position: absolute;
        top: -6px;
        right: -6px;
        line-height: 20px;
        border: 2px solid var(--surface);
    }

    .user-menu .user-chip {
        min-height: 44px;
        padding: 4px 12px 4px 4px;
    }

    .user-menu .avatar {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }

    .notification-dropdown .actions {
        justify-content: space-between;
    }

    .panel-toolbar {
        align-items: center;
    }

    .panel-toolbar a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .notice-popup {
        background: var(--surface);
    }

    .notice-popup .actions {
        justify-content: flex-end;
        gap: 8px;
    }

    .attachment-item {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .attachment-item > a {
        flex: 1 1 180px;
        min-width: 0;
    }

    .attachment-item small {
        margin-left: 0;
    }

    .attachment-item video {
        flex-basis: 100%;
    }

    .file-selection li {
        gap: 12px;
    }

    .file-selection li > span {
        min-width: 0;
    }

    .upload-picker input[type='file'] {
        max-width: 100%;
    }

    .upload-picker input[type='file']::file-selector-button {
        min-height: 44px;
        margin-right: 12px;
        padding: 10px 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface-2);
        color: var(--ink);
        font: inherit;
        cursor: pointer;
    }
    @media (max-width: 1199px) {
        .topbar .wrap {
            flex-wrap: wrap;
            gap: 12px;
            padding-block: 12px;
        }

        .topbar .gnav {
            order: 3;
            flex-basis: 100%;
        }

        .management-shell .user-kpis {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }
    }
    @media (max-width: 599px) {
        .panel,
        .search-grid {
            padding: 16px;
        }

        .search-grid {
            gap: 12px;
        }

        .search-grid > div {
            flex-basis: 100%;
        }

        .page-heading {
            gap: 12px;
        }

        .page-heading > .button {
            align-self: stretch;
        }

        .field-action {
            flex-wrap: wrap;
        }

        .field-action > input {
            flex-basis: 100%;
        }

        .kpi-strip a {
            padding: 12px;
        }

        .top-actions {
            gap: 6px;
        }

        .user-menu .user-chip {
            padding: 4px;
        }

        .notice-band {
            padding-inline: 16px;
        }

        .notice-popup {
            padding: 20px;
        }

        .notice-popup .actions > button {
            flex: 1 1 100%;
            white-space: normal;
        }
    }

    .compact-filters {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 12px 16px;
        padding: 16px;
        margin-top: 0;
    }

    .compact-filters .filter-query {
        grid-column: span 2;
    }

    .compact-filters label,
    .search-grid label {
        font-size: var(--fs-s);
        margin-bottom: 4px;
    }

    .compact-filters input:not([type='checkbox']):not([type='radio']),
    .compact-filters select,
    .search-grid input:not([type='checkbox']):not([type='radio']),
    .search-grid select {
        height: 38px;
        min-height: 38px;
        min-width: 0;
        padding: 6px 10px;
        font-size: var(--fs-s);
    }

    .compact-filters > .checkbox {
        align-self: center;
        margin: 0;
        font-weight: 500;
    }

    .compact-filters > .filter-actions {
        grid-column: span 2;
        align-self: end;
        justify-content: flex-end;
        gap: 8px;
    }

    .compact-filters .filter-actions button,
    .compact-filters .filter-actions a,
    .search-grid > button,
    .search-grid > a {
        min-height: 38px;
        padding: 7px 12px;
        font-size: var(--fs-s);
    }

    .search-grid {
        padding: 16px;
        gap: 12px;
    }

    .search-grid > div {
        flex-basis: 150px;
    }

    .panel-backdrop {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: rgb(10 16 28 / .45);
        backdrop-filter: blur(2px);
        z-index: 34;
        cursor: default;
        animation: panel-shade-in .2s ease-out;
    }

    .panel-backdrop:hover {
        filter: none;
    }

    .detail-panel {
        animation: panel-slide-in .25s cubic-bezier(.2, .7, .2, 1);
    }
    @keyframes panel-slide-in {
        from {
            opacity: 0;
            transform: translateX(40px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    @keyframes panel-shade-in {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
    @media (min-width: 860px) {
        body:has(#detail-panel) {
            overflow: hidden;
        }
    }
    @media (max-width: 1199px) {
        .compact-filters {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }
    }
    @media (max-width: 859px) {
        .compact-filters {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .compact-filters > .filter-actions {
            grid-column: 1 / -1;
        }
    }
    @media (max-width: 479px) {
        .compact-filters {
            grid-template-columns: 1fr;
        }

        .compact-filters .filter-query,
        .compact-filters > .filter-actions {
            grid-column: 1;
        }

        .compact-filters .filter-actions > * {
            flex: 1;
        }
    }
    @media (prefers-reduced-motion: reduce) {
        .detail-panel,
        .panel-backdrop {
            animation: none;
        }
    }

    /* Compact search bar with optional advanced conditions. */
    .visually-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .board-search {
        margin-top: 0;
        padding: 20px 24px;
        box-shadow: none;
    }

    .search-top {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 150px auto 76px;
        align-items: center;
        gap: 8px;
    }

    .search-input-wrap {
        position: relative;
        min-width: 0;
    }

    .board-search .search-input-wrap input[type='search'] {
        padding-left: 42px;
        padding-right: 14px;
    }

    .search-icon {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
        pointer-events: none;
    }

    .board-search input:not([type='checkbox']):not([type='radio']),
    .board-search select {
        height: 44px;
        min-height: 44px;
        font-size: var(--fs-s);
    }

    .board-search .detail-filter-toggle,
    .board-search .search-submit {
        height: 44px;
        min-height: 44px;
        padding: 0 14px;
        font-size: var(--fs-s);
    }

    .detail-filter-toggle {
        gap: 7px;
    }

    .filter-count {
        display: inline-grid;
        place-items: center;
        min-width: 20px;
        height: 20px;
        padding-inline: 5px;
        border-radius: 50%;
        background: var(--brand);
        color: var(--brand-ink);
        font-size: 13px;
        line-height: 1;
    }

    .advanced-filters {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px 16px;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid var(--line);
    }

    .advanced-filters .mine-filter {
        align-self: end;
        min-height: 44px;
        margin: 0;
        font-weight: 500;
    }

    .applied-filters {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 16px;
        min-height: 32px;
        font-size: var(--fs-s);
    }

    .applied-label {
        color: var(--muted);
        margin-right: 4px;
    }

    .board-search .filter-chip {
        min-height: 32px;
        max-width: 100%;
        padding: 5px 12px;
        gap: 10px;
        border: 0;
        border-radius: 999px;
        background: color-mix(in oklab, var(--brand) 7%, var(--surface));
        color: var(--brand);
        font-size: var(--fs-s);
        font-weight: 650;
    }

    .filter-chip > span:first-child {
        min-width: 0;
        overflow-wrap: anywhere;
        white-space: normal;
        text-align: left;
    }

    .clear-filters {
        margin-left: 6px;
        text-decoration: underline;
        text-underline-offset: 3px;
        color: var(--muted);
    }

    .search-results-heading {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        margin: 16px 4px;
        font-size: var(--fs-s);
    }

    .search-results-heading p strong {
        color: var(--brand);
    }

    .result-sort {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .result-sort label {
        margin: 0;
        font-weight: 500;
        color: var(--muted);
        white-space: nowrap;
    }

    .result-sort select {
        width: 160px;
        height: 40px;
        min-height: 40px;
        padding-block: 7px;
        font-size: var(--fs-s);
    }
    @media (max-width: 1199px) {
        .search-top {
            grid-template-columns: minmax(0, 1fr) 130px auto 70px;
        }

        .board-search {
            padding: 18px;
        }
    }
    @media (max-width: 759px) {
        .search-top {
            grid-template-columns: minmax(0, 1fr) auto 76px;
        }

        .search-input-wrap {
            grid-column: 1 / -1;
        }

        .advanced-filters {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .search-results-heading {
            margin-inline: 0;
        }
    }
    @media (max-width: 479px) {
        .board-search {
            padding: 16px;
        }

        .search-top {
            grid-template-columns: minmax(0, 1fr) auto;
        }

        .search-top .search-submit {
            grid-column: 1 / -1;
        }

        .advanced-filters {
            grid-template-columns: 1fr;
        }

        .search-results-heading {
            align-items: start;
        }

        .result-sort {
            gap: 6px;
        }

        .result-sort select {
            width: 130px;
        }
    }
}

@layer app {
    .notifications-page {
        max-width: 880px;
        margin-inline: auto;
    }

    .notifications-page > h1 {
        font-size: 28px;
        margin-bottom: 20px;
    }

    .notification-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        margin-bottom: 20px;
    }

    .notification-tabs {
        display: flex;
        gap: 4px;
        padding: 4px;
        background: var(--surface-2);
        border-radius: 8px;
        font-size: 13px;
    }

    .notification-tabs a {
        padding: 6px 12px;
        border-radius: 6px;
        color: var(--muted);
        font-weight: 650;
    }

    .notification-tabs a[aria-current='page'] {
        background: var(--surface);
        color: var(--ink);
        box-shadow: 0 1px 3px rgb(0 0 0 / .1);
    }

    .notification-tab-count {
        display: inline-grid;
        place-items: center;
        min-width: 18px;
        height: 18px;
        padding-inline: 4px;
        border-radius: 99px;
        background: var(--brand);
        color: var(--brand-ink);
        font-size: 11px;
    }

    .notification-toolbar button {
        min-height: 34px;
        padding: 6px 12px;
        font-size: 12px;
    }

    .notification-timeline {
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--surface);
    }

    .notification-date {
        margin: 0;
        padding: 10px 20px;
        background: var(--surface-2);
        font-size: 12px;
        font-weight: 650;
        color: var(--muted);
    }

    .notification-row {
        margin: 0;
        border-top: 1px solid var(--line);
    }

    .notification-row-link {
        display: flex;
        width: 100%;
        gap: 14px;
        padding: 18px 20px;
        border: 0;
        border-radius: 0;
        background: var(--surface);
        color: var(--ink);
        text-align: left;
        white-space: normal;
    }

    .notification-row.is-unread .notification-row-link {
        background: color-mix(in oklab, var(--brand) 3%, var(--surface));
    }

    .notification-kind-icon {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        flex-shrink: 0;
        border-radius: 9px;
        background: var(--surface-2);
        color: var(--muted);
    }

    .notification-kind-icon.is-answer {
        background: color-mix(in oklab, var(--brand) 8%, var(--surface));
        color: var(--brand);
    }

    .notification-kind-icon.is-warning {
        background: #fff5e6;
        color: #b86200;
    }

    .notification-copy {
        flex: 1;
        min-width: 0;
        display: grid;
        gap: 5px;
    }

    .notification-copy strong {
        font-size: 14px;
        font-weight: 450;
        overflow-wrap: anywhere;
    }

    .is-unread .notification-copy strong {
        font-weight: 700;
    }

    .notification-copy small {
        font-size: 12px;
        color: var(--muted);
    }

    .notification-row time {
        color: var(--muted);
        font-size: 11px;
        white-space: nowrap;
    }

    .notification-unread-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--brand);
        flex-shrink: 0;
    }

    .notification-empty {
        display: grid;
        justify-items: center;
        gap: 12px;
        padding: 44px 20px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 10px;
        text-align: center;
    }

    .notification-empty-icon {
        display: grid;
        place-items: center;
        width: 52px;
        height: 52px;
        background: var(--surface-2);
        color: var(--muted);
        border-radius: 50%;
    }

    .notification-empty h2 {
        font-size: 17px;
        margin: 0;
    }

    .notification-empty p,
    .notification-empty a {
        font-size: 13px;
    }

    .notification-empty p {
        color: var(--muted);
    }

    #notification-toggle.has-unread::after {
        content: '';
        position: absolute;
        top: 7px;
        right: 8px;
        width: 6px;
        height: 6px;
        background: #dc3545;
        border: 2px solid var(--surface);
        border-radius: 50%;
        box-sizing: content-box;
    }
    @media (max-width: 479px) {
        .notification-toolbar {
            align-items: flex-start;
            flex-wrap: wrap;
        }

        .notification-row-link {
            gap: 8px;
            padding: 14px 12px;
        }

        .notification-row time {
            font-size: 10px;
        }
    }
}

@layer app {
    .notice-popup {
        padding: 24px;
        box-shadow: var(--shadow);
    }

    .notice-popup > h2 {
        margin-bottom: 20px;
        font-size: 22px;
        line-height: 1.4;
    }

    .notice-popup-content {
        padding-bottom: 8px;
        overflow-wrap: anywhere;
    }

    .notice-popup .notice-confirm {
        margin: 24px -24px -24px;
    }

    .notice-popup-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 14px 20px;
        border-top: 1px solid var(--line);
    }

    .notice-popup .notice-today {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        margin: 0;
        color: var(--muted);
        font-size: 12px;
        font-weight: 450;
        cursor: pointer;
        white-space: nowrap;
    }

    .notice-today input {
        width: 14px;
        height: 14px;
        margin: 0;
    }

    .notice-popup-buttons {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .notice-popup-buttons .button,
    .notice-popup-buttons button {
        min-height: 34px;
        padding: 7px 13px;
        border-radius: 7px;
        font-size: 12px;
    }

    .notice-confirm > .notice-action-error {
        margin: 0;
        padding: 0 20px 14px;
        font-size: 12px;
        color: var(--danger);
    }
    @media (max-width: 379px) {
        .notice-popup-footer {
            flex-wrap: wrap;
            gap: 12px;
        }

        .notice-popup-buttons {
            margin-left: auto;
        }
    }
}

@layer app {
    button.button-sm,
    .button.button-sm {
        height: 36px;
        min-height: 36px;
        padding: 7px 12px;
        font-size: 13px;
        line-height: 1.25;
        font-weight: 650;
    }

    .brand .company-logo {
        width: 102px;
        height: auto;
        max-height: 44px;
        object-fit: contain;
        flex-shrink: 0;
        background: #fff;
        border-radius: 3px;
    }

    .brand .brand-text {
        padding-left: 14px;
        border-left: 1px solid var(--line);
    }

    .brand .brand-text strong {
        font-size: 17px;
        color: var(--ink);
    }

    .brand .brand-text > span {
        font-size: 11px;
    }

    .company-footer {
        padding-block: 24px;
        background: var(--surface);
    }

    .company-footer > .wrap {
        display: flex;
        align-items: center;
        gap: 22px;
    }

    .footer-logo {
        width: 70px;
        height: auto;
        max-height: 38px;
        object-fit: contain;
        flex-shrink: 0;
        filter: grayscale(1);
        background: #fff;
        border-radius: 3px;
    }

    .footer-company {
        min-width: 0;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.8;
    }

    .footer-company p + p {
        margin: 0;
    }

    .footer-company p > span {
        margin-left: 12px;
    }

    .footer-company small {
        font-size: 11px;
    }
    @media (max-width: 479px) {
        .brand {
            gap: 10px;
        }

        .brand .company-logo {
            width: 80px;
        }

        .brand .brand-text {
            padding-left: 10px;
        }

        .brand .brand-text strong {
            font-size: 15px;
        }

        .company-footer > .wrap {
            gap: 14px;
            align-items: flex-start;
        }

        .footer-company p > span {
            display: block;
            margin: 0;
        }
    }
}

@layer app {
    .footer-company address {
        font-style: normal;
    }

    .footer-contacts {
        display: flex;
        flex-wrap: wrap;
        gap: 0 16px;
    }

    .footer-company .footer-contacts > span {
        margin: 0;
    }

    .footer-contacts a {
        color: inherit;
        text-decoration: none;
    }

    .footer-contacts a:hover {
        color: var(--brand);
        text-decoration: underline;
    }
}

@layer app {
    .attachment-item > .attachment-download,
    .attachment-item > .attachment-preview-link {
        flex: 0 0 auto;
        font-size: 12px;
        padding: 5px 2px;
    }

    .attachment-item > .attachment-image-preview {
        flex: 1 0 100%;
        min-width: 0;
        width: 100%;
        margin-top: 8px;
    }

    .attachment-image-preview img {
        display: block;
        width: auto;
        max-width: 100%;
        max-height: 280px;
        border: 1px solid var(--line);
        border-radius: 8px;
        object-fit: contain;
    }

    .attachment-video-preview {
        width: 100%;
        max-height: 320px;
        border-radius: 8px;
    }

    .pending-file-preview {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px 16px;
        width: 100%;
    }

    .pending-file-preview img,
    .pending-file-preview video {
        display: block;
        flex-basis: 100%;
        width: auto;
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
        border-radius: 8px;
    }

    .pending-file-preview a {
        font-size: 12px;
    }

    .attachment-chips .attachment-item:has(.attachment-image-preview),
    .attachment-chips .attachment-item:has(video) {
        flex-basis: 100%;
        width: 100%;
    }
}

@layer app {
    .attachment-image-preview img,
    .pending-file-preview img,
    .pending-file-preview video {
        background: var(--surface-2);
    }

    .attachment-preview-note {
        flex-basis: 100%;
        color: var(--muted);
        font-size: 11px;
    }
}

.notification-dropdown li {
    position: relative;
}

.notification-dropdown .notification-item {
    padding-right: 48px;
}

.notification-dropdown .notification-delete {
    position: absolute;
    right: 8px;
    top: 8px;
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
}
