* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
}

button,
input,
select {
    font: inherit;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: #252a30;
    color: white;
    padding: 18px 14px;
    overflow-y: auto;
}

.brand {
    display: block;
    color: inherit;
    text-decoration: none;
    font-size: 21px;
    font-weight: 700;
    padding: 8px 10px 22px;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu a,
.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #d7dce1;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 6px;
}

.menu a:hover,
.sidebar-link:hover {
    background: #343a41;
    color: white;
}

.menu a.active,
.sidebar-link.active {
    background: #343a41;
    color: white;
}

.sidebar-menu-group {
    margin: 0;
}

.sidebar-menu-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 11px 12px;

    border-radius: 6px;

    color: #d7dce1;

    cursor: pointer;
    list-style: none;
}

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

.sidebar-menu-group summary::after {
    content: "›";
    font-size: 18px;
    line-height: 1;
}

.sidebar-menu-group[open] summary::after {
    transform: rotate(90deg);
}

.sidebar-menu-group summary:hover {
    background: #343a41;
    color: #ffffff;
}

.sidebar-menu-items {
    display: flex;
    flex-direction: column;
    gap: 2px;

    margin: 2px 0 8px;
    padding-left: 12px;

    border-left: 1px solid #47505a;
}

.sidebar-menu-items a {
    padding-top: 8px;
    padding-bottom: 8px;
}

.sidebar-mail-account {
    margin: 0;
}

.sidebar-mail-account summary {
    padding: 8px 12px;
    color: #d7dce1;
    cursor: pointer;
    list-style: none;
}

.sidebar-mail-account summary::-webkit-details-marker {
    display: none;
}

.sidebar-mail-account summary::before {
    content: "›";
    display: inline-block;
    width: 14px;
}

.sidebar-mail-account[open] summary::before {
    transform: rotate(90deg);
}

.sidebar-personal-mail-account > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    padding-bottom: 5px;
    color: #9da5ae;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-personal-mail-account > summary::before {
    content: none;
    display: none;
}

.sidebar-personal-mail-account > summary::after {
    content: "›";
    font-size: 14px;
    line-height: 1;
}

.sidebar-personal-mail-account[open] > summary::after {
    transform: rotate(90deg);
}

.sidebar-personal-mail-more > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-personal-mail-more > summary::before {
    content: none;
    display: none;
}

.sidebar-personal-mail-more > summary::after {
    content: "›";
    font-size: 14px;
    line-height: 1;
}

.sidebar-personal-mail-more[open] > summary::after {
    transform: rotate(90deg);
}

.sidebar-personal-mail-account > summary:hover {
    color: #d7dce1;
}

.sidebar-resolver-groups {
    margin-top: 10px;
}

.sidebar-resolver-groups > summary {
    padding: 0 10px 5px;
    color: #9da5ae;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-resolver-groups > summary:hover {
    background: transparent;
    color: #d7dce1;
}

.sidebar-resolver-groups > summary::after {
    font-size: 14px;
}

.sidebar-subtitle {
    margin: 10px 0 5px;
    padding: 0 10px;

    color: #9da5ae;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.count {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 12px;
    background: #454c54;
    font-size: 12px;
    text-align: center;
}

.sidebar-section {
    margin-top: 30px;
}

.sidebar-title {
    padding: 0 10px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #9da5ae;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-shell {
    margin-left: 250px;
    min-height: 100vh;
}

.topbar {
    height: 70px;
    background: white;
    border-bottom: 1px solid #dfe3e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-box {
    flex: 1;
    max-width: 620px;
}

.search-box input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cfd5dc;
    border-radius: 7px;
    background: #f9fafb;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 9px 14px;
    cursor: pointer;
}

.btn-primary {
    background: #1f6feb;
    color: white;
}

.btn-primary:hover {
    background: #195fc8;
}

.btn-light {
    background: white;
    border-color: #cfd5dc;
    color: #333;
}

.btn-light:hover {
    background: #f3f5f7;
}

.active-view {
    background: #eef4ff;
    border-color: #9dbcf3;
    color: #174ea6;
}

.user-box {
    padding: 9px 12px;
    border-radius: 6px;
    background: #eef1f4;
    font-weight: 600;
}

.content {
    padding: 28px;
}

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

.page-header h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.subtitle {
    margin: 0;
    color: #68717d;
}

/* =========================================================
   POŠTA – PŘEHLED OSOBNÍCH SCHRÁNEK
   ========================================================= */

.mail-overview-card {
    max-width: 900px;

    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

.mail-account-list {
    display: flex;
    flex-direction: column;
}

.mail-account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 18px 20px;

    border-bottom: 1px solid #e8ebef;
    color: #222;
    text-decoration: none;
}

.mail-account-item:last-child {
    border-bottom: 0;
}

.mail-account-item:hover {
    background: #f7f9fc;
}

.mail-account-item strong,
.mail-account-address,
.mail-account-status,
.mail-overview-empty span {
    display: block;
}

.mail-account-address {
    margin-top: 5px;
    color: #68717d;
    font-size: 14px;
}

.mail-account-status {
    color: #68717d;
    font-size: 13px;
    text-align: right;
}

.mail-overview-empty {
    display: flex;
    flex-direction: column;
    gap: 7px;

    padding: 22px 20px;
}

.mail-overview-empty span {
    color: #68717d;
}

.mail-inbox-card {
    overflow: hidden;

    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

.mail-message-list {
    display: flex;
    flex-direction: column;
}

.mail-message-item {
    display: grid;
    grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 2fr) minmax(260px, 1fr);
    align-items: center;
    gap: 18px;

    padding: 15px 20px;

    border-bottom: 1px solid #e8ebef;
}

.mail-bulk-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #e8ebef;
}

.mail-selected-count {
    color: #68717d;
    font-size: 13px;
}

.mail-message-item {
    grid-template-columns: auto auto minmax(160px, 0.8fr) minmax(220px, 2fr) minmax(260px, 1fr);
}

.mail-sent-item {
    grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 2fr) minmax(260px, 1fr);
}

.mail-message-select {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(32, 43, 54, 0.12);
    cursor: pointer;
}

.mail-message-select:hover,
.ticket-select-control:hover,
.mail-star-button:hover,
.pin-button:hover {
    border-color: #7d9dce;
    background: #f3f7fd;
}

.mail-message-select:active,
.ticket-select-control:active,
.mail-star-button:active,
.pin-button:active {
    box-shadow: inset 0 1px 2px rgba(32, 43, 54, 0.16);
    transform: translateY(1px);
}

.mail-message-select input,
.ticket-select,
#select-all-tickets {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.ticket-select-control {
    display: flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(32, 43, 54, 0.12);
    cursor: pointer;
}

.mail-star-button {
    border: 0;
    background: transparent;
    color: #9aa4b2;
    cursor: pointer;
    min-width: 36px;
    min-height: 36px;
    padding: 4px;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(32, 43, 54, 0.12);
    font-size: 19px;
    filter: grayscale(1);
    opacity: 0.5;
}

.mail-star-button.is-starred {
    color: #e6a700;
    filter: none;
    opacity: 1;
}

.mail-message-item:last-child {
    border-bottom: 0;
}

.mail-message-openable {
    cursor: pointer;
}

.mail-message-openable:hover {
    background: #f7f9fc;
}

.mail-message-item.is-unread {
    background: #f1f6ff;
}

.mail-message-item[draggable="true"] {
    cursor: grab;
}

.mail-message-item.is-dragging {
    opacity: 0.45;
}

.mail-folder-drop-target.is-drop-target,
.mail-inbox-drop-target.is-drop-target,
.mail-trash-drop-target.is-drop-target {
    outline: 2px solid #2d6cdf;
    outline-offset: -2px;
}

.mail-folder-manager-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid #e8ebef;
}

.mail-folder-manager-item:last-child {
    border-bottom: 0;
}

.mail-folder-manager-item > a {
    min-width: 180px;
}

.mail-folder-rename-form {
    display: flex;
    flex: 1;
    gap: 8px;
}

.mail-folder-order-form {
    display: flex;
    gap: 4px;
}

.mail-folder-rename-form input {
    min-width: 0;
    flex: 1;
}

.mail-rule-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e8ebef;
}

.mail-rule-run-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e8ebef;
}

.mail-rule-run-actions span {
    color: #68717d;
}

.mail-rule-note,
.mail-rule-error {
    padding: 10px 16px;
    border-bottom: 1px solid #e8ebef;
}

.mail-rule-note {
    color: #68717d;
}

.mail-rule-error {
    color: #9c1c1c;
    background: #fff1f1;
}

.mail-rule-form label,
.mail-rule-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mail-rule-form input[name="sender_contains"],
.mail-rule-form input[name="subject_contains"] {
    min-width: 180px;
    flex: 1;
}

.mail-rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid #e8ebef;
}

.mail-rule-item > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mail-rule-item span {
    color: #68717d;
}

.mail-rule-item.is-inactive {
    background: #f7f8fa;
    opacity: 0.72;
}

.mail-rule-buttons {
    display: flex;
    gap: 8px;
}

.mail-draft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
}

.mail-draft-item > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mail-draft-item span,
.mail-folder-label {
    color: #68717d;
    font-size: 13px;
}

.mail-message-item.is-unread .mail-message-subject {
    font-weight: 700;
}

.mail-search-form {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #e8ebef;
}

.mail-search-form input {
    flex: 1;
    min-width: 0;
}

.mail-message-sender,
.mail-message-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-message-sender {
    font-weight: 700;
}

.mail-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;

    color: #68717d;
    font-size: 13px;
}

.mail-message-meta a {
    color: #1f6feb;
}

.mail-status {
    padding: 3px 7px;

    border-radius: 10px;

    background: #eef1f4;
    color: #52606d;
    font-size: 12px;
}

.mail-status-processed {
    background: #e8f5ec;
    color: #20753b;
}

.mail-status-failed {
    background: #fff0f0;
    color: #b42318;
}

.mail-pagination {
    display: flex;
    gap: 10px;

    margin-top: 18px;
}

.mail-message-detail {
    max-width: 980px;
    overflow: hidden;

    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

.mail-detail-actions {
    display: flex;
    gap: 10px;
}

.mail-compose-form {
    display: flex;
    flex-direction: column;
    gap: 16px;

    max-width: 920px;
    padding: 22px;

    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

.mail-compose-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.mail-compose-form label > span {
    color: #68717d;
    font-size: 12px;
    font-weight: 700;
}

.mail-compose-form input,
.mail-compose-form textarea {
    width: 100%;
    padding: 9px 11px;

    border: 1px solid #ccd3dc;
    border-radius: 6px;
}

.mail-compose-form textarea {
    resize: vertical;
}

.recipient-disclosure {
    margin: 0 0 10px;
}

.recipient-disclosure summary {
    width: fit-content;
    color: #1f6feb;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.recipient-disclosure[open] summary {
    margin-bottom: 10px;
}

.mail-compose-form .recipient-disclosure {
    margin-bottom: 0;
}

.mail-compose-form .recipient-disclosure label {
    margin-top: 4px;
}

.personal-mail-editor-tools {
    display: flex;
    gap: 8px;
}

.personal-mail-editor-tools button,
.personal-mail-attachment-item button,
.attachment-preview-card button {
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    padding: 7px 10px;
}

.personal-mail-attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.draft-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.attachment-preview-card {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(100%, 280px);
    min-height: 58px;
    padding: 7px;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    background: #fff;
}

.attachment-preview-thumbnail {
    position: relative;
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 42px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #d8dee8;
    background: #f7f9fc;
}

.attachment-preview-thumbnail.is-image-preview {
    cursor: zoom-in;
}

.attachment-preview-thumbnail.is-image-preview:focus-visible {
    outline: 2px solid #1f6feb;
    outline-offset: 2px;
}

.attachment-preview-thumbnail img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-preview-icon {
    font-size: 24px;
}

.attachment-preview-info {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.attachment-preview-name {
    overflow: hidden;
    color: #1f6feb;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-preview-size {
    color: #68717d;
    font-size: 12px;
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.message-attachment-card {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(100%, 280px);
    min-height: 58px;
    padding: 7px;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    background: #fff;
}

.message-attachment-card .attachment-security-warning {
    margin: 2px 0 0;
}

.message-attachment-card .attachment-security-reason {
    margin: 3px 0 0;
}

.mail-compose-form.is-file-drop-target,
#reply-form.is-file-drop-target {
    outline: 2px dashed #1f6feb;
    outline-offset: 4px;
    background: #f3f8ff;
}

.attachment-lightbox {
    position: fixed;
    z-index: 1100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 56px 76px;
    background: rgb(15 23 42 / 86%);
}

.attachment-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 130px);
    object-fit: contain;
    box-shadow: 0 12px 40px rgb(0 0 0 / 45%);
}

.attachment-lightbox-close,
.attachment-lightbox-navigation {
    position: absolute;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 75%);
    border-radius: 50%;
    background: rgb(15 23 42 / 72%);
    color: #fff;
    cursor: pointer;
    font-size: 31px;
    line-height: 1;
}

.attachment-lightbox-close {
    top: 18px;
    right: 22px;
}

.attachment-lightbox-navigation {
    top: 50%;
    transform: translateY(-50%);
}

.attachment-lightbox-previous { left: 20px; }
.attachment-lightbox-next { right: 20px; }

.attachment-lightbox-caption {
    position: absolute;
    right: 50%;
    bottom: 20px;
    max-width: calc(100% - 40px);
    padding: 7px 13px;
    overflow: hidden;
    border-radius: 16px;
    background: rgb(15 23 42 / 80%);
    color: #fff;
    font-size: 13px;
    text-overflow: ellipsis;
    transform: translateX(50%);
    white-space: nowrap;
}

.attachment-document-viewer {
    padding: 42px 56px;
}

.attachment-document-frame {
    width: min(1180px, 100%);
    height: min(900px, calc(100vh - 84px));
    border: 0;
    background: #fff;
    box-shadow: 0 12px 40px rgb(0 0 0 / 45%);
}

.attachment-choice-modal {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgb(15 23 42 / 55%);
}

.attachment-choice-panel {
    width: min(100%, 380px);
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 40px rgb(0 0 0 / 30%);
}

.attachment-choice-panel strong,
.attachment-choice-panel p,
.attachment-choice-panel label { display: block; }
.attachment-choice-panel p { margin: 10px 0; }
.attachment-choice-panel label { font-size: 14px; }

.attachment-choice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.attachment-choice-actions button {
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
}

.attachment-choice-actions button:first-child {
    border-color: #1f6feb;
    background: #1f6feb;
    color: #fff;
}

.reply-ticket-edit {
    margin: 12px 0;
    border: 1px solid #d8dee8;
    border-radius: 7px;
    background: #fbfcfe;
}

.reply-ticket-edit summary {
    padding: 10px 12px;
    color: #315b88;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.reply-ticket-edit[open] summary {
    border-bottom: 1px solid #d8dee8;
}

.reply-ticket-edit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px 16px;
    padding: 14px;
}

.reply-ticket-edit-grid label {
    display: grid;
    gap: 5px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.reply-ticket-edit-grid input,
.reply-ticket-edit-grid select {
    min-width: 0;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid #ccd3dc;
    border-radius: 5px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-weight: 400;
}

.reply-ticket-deadline-control {
    display: flex;
    gap: 6px;
}

.reply-ticket-deadline-control input {
    flex: 1;
}

.reply-ticket-deadline-control button {
    width: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
}

@media (max-width: 760px) {
    .reply-ticket-edit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .attachment-lightbox { padding: 48px 12px; }
    .attachment-lightbox-navigation { width: 36px; height: 36px; }
    .attachment-lightbox-previous { left: 8px; }
    .attachment-lightbox-next { right: 8px; }
    .attachment-document-viewer { padding: 48px 8px 8px; }
    .attachment-document-frame { height: calc(100vh - 56px); }
}

.mail-compose-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.mail-compose-error {
    max-width: 920px;
    margin-bottom: 16px;
    padding: 12px 14px;

    background: #fff0f0;
    border: 1px solid #f3c3c3;
    border-radius: 7px;
    color: #b42318;
}

.mail-signature-preview {
    padding-top: 14px;

    border-top: 1px solid #e5e7eb;
}

.mail-signature-preview > span {
    display: block;
    margin-bottom: 8px;

    color: #68717d;
    font-size: 12px;
    font-weight: 700;
}

.mail-sent-item {
    color: #222;
    text-decoration: none;
}

.mail-sent-item:hover {
    background: #f7f9fc;
}

.mail-message-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 28px;

    margin: 0;
    padding: 20px;

    border-bottom: 1px solid #e8ebef;
}

.mail-message-details div {
    min-width: 0;
}

.mail-message-details dt {
    margin-bottom: 4px;

    color: #68717d;
    font-size: 12px;
    font-weight: 700;
}

.mail-message-details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.mail-message-details a {
    color: #1f6feb;
}

.mail-message-body {
    padding: 22px 20px;

    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.mail-message-html {
    padding: 22px 20px;

    overflow-wrap: anywhere;
}

.mail-message-html table {
    max-width: 100%;
    border-collapse: collapse;
}

.mail-message-html td,
.mail-message-html th {
    padding: 5px;
    border: 1px solid #dfe3e8;
}

.mail-message-html a,
.mail-attachments a {
    color: #1f6feb;
}

.mail-attachments {
    padding: 0 20px 22px;
}

.mail-attachments h2 {
    margin: 0 0 10px;
    font-size: 17px;
}

.mail-attachments ul {
    display: flex;
    flex-direction: column;
    gap: 7px;

    margin: 0;
    padding-left: 20px;
}

.mail-attachments small {
    margin-left: 7px;
    color: #9a6700;
}

@media (max-width: 700px) {

    .mail-account-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .mail-account-status {
        text-align: left;
    }

    .mail-message-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .mail-message-meta {
        justify-content: flex-start;
    }

    .mail-message-details {
        grid-template-columns: 1fr;
    }

    .mail-detail-actions,
    .mail-compose-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

}

.view-switch {
    display: flex;
    gap: 8px;
}

.filter-panel {
    background: white;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
}

.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-row + .filter-row {
    margin-top: 12px;
}

.filter-row input,
.filter-row select {
    min-height: 38px;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    padding: 8px 10px;
    background: white;
}

.filter-search {
    min-width: 240px;
    flex: 1;
}

.filter-row-secondary {
    align-items: center;
}

.filter-chip {
    background: #f7f8fa;
    border: 1px solid #d9dee4;
    border-radius: 16px;
    padding: 6px 10px;
    cursor: pointer;
    color: #46505c;
}

.filter-chip:hover {
    background: #eef1f4;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-bottom: 1px solid #eceff2;
    background: #fafbfc;
}

.bulk-actions strong {
    font-size: 13px;
    color: #505966;
}

.bulk-actions select {
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    background: white;
}

.select-col {
    width: 40px;
    text-align: center !important;
}

.table-sort {
    color: inherit;
    text-decoration: none;
}

.table-sort:hover {
    color: #1f6feb;
}

.list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.list-tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    background: #eef2ff;
    color: #3d4d9b;
    font-size: 11px;
    font-weight: 700;
}

.empty-ticket-list {
    padding: 45px 20px !important;
    text-align: center !important;
    color: #68717d;
}

.empty-ticket-list strong,
.empty-ticket-list span {
    display: block;
}

.empty-ticket-list span {
    margin-top: 6px;
    font-size: 13px;
}

.calendar-card {
    background: white;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
}

.calendar-header {
    padding: 16px;
    border-bottom: 1px solid #eceff2;
    background: #fafbfc;
}

.calendar-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.calendar-header p {
    margin: 0;
    color: #68717d;
    font-size: 13px;
}

.calendar-ticket-list {
    display: flex;
    flex-direction: column;
}

.calendar-ticket {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #eceff2;
    color: inherit;
    text-decoration: none;
}

.calendar-ticket:last-child {
    border-bottom: none;
}

.calendar-ticket:hover {
    background: #f8fbff;
}

.calendar-date {
    font-weight: 700;
    color: #1f5fa8;
}

.calendar-ticket-title {
    margin-bottom: 4px;
}

.calendar-ticket-title strong {
    margin-right: 8px;
}

.calendar-ticket-meta {
    color: #7a838e;
    font-size: 12px;
}

.calendar-empty {
    padding: 40px 20px;
    text-align: center;
    color: #68717d;
}

.ticket-card {
    background: white;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow-x: auto;
}

.ticket-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1250px;
}

.ticket-table th,
.ticket-table td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid #eceff2;
    vertical-align: top;
    white-space: nowrap;
}

.ticket-table th {
    background: #f7f8fa;
    color: #505966;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ticket-table tbody tr:hover {
    background: #f8fbff;
    cursor: pointer;
}

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

.pin-col {
    width: 42px;
    text-align: center !important;
}

.pin-button {
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    background: #ffffff;
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    box-shadow: 0 1px 2px rgba(32, 43, 54, 0.12);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.pin-button:hover {
    box-shadow: 0 2px 4px rgba(32, 43, 54, 0.18);
}

.pin-button:not(.is-pinned) {
    filter: grayscale(1);
    opacity: 0.5;
}

.pin-button.is-pinned {
    background: #fff8dc;
    border-color: #e3a800;
}

.ticket-id {
    font-weight: 700;
    color: #1f5fa8;
}

.subject {
    font-weight: 600;
    color: #232a31;
    margin-bottom: 4px;
}

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

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

.ticket-meta {
    color: #7a838e;
    font-size: 12px;
    margin-top: 4px;
}

.assignee-empty {
    color: #8b949e;
    font-style: italic;
}

.status,
.priority {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.status-new {
    background: #e8f1ff;
    color: #1d4f91;
}

.status-working {
    background: #fff2cc;
    color: #7a5b00;
}

.status-waiting {
    background: #f3e8ff;
    color: #6b2ca0;
}

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

.priority-normal {
    background: #eef1f4;
    color: #46505c;
}

.priority-high {
    background: #fff4d6;
    color: #8a5a00;
}

.priority-urgent {
    background: #ffe3e3;
    color: #a11a1a;
}

@media (max-width: 1100px) {
    .sidebar {
        width: 220px;
    }

    .app-shell {
        margin-left: 220px;
    }

    .topbar {
        padding: 0 18px;
    }

    .content {
        padding: 20px;
    }
}/* =========================================================
   DETAIL TICKETU
   ========================================================= */

.ticket-detail-page {
    padding: 28px;
}

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

.ticket-detail-id {
    color: #1f5fa8;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 5px;
}

.ticket-detail-header h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.ticket-detail-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    color: #68717d;
    font-size: 13px;
}

.ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

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

.ticket-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.ticket-tab {
    border: 1px solid #cfd5dc;
    background: white;
    padding: 9px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.ticket-tab.active {
    background: #eef4ff;
    border-color: #9dbcf3;
    color: #174ea6;
    font-weight: 700;
}

.tab-count {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    margin-left: 5px;
    border-radius: 10px;
    background: #dfe7f3;
    font-size: 11px;
    text-align: center;
}

.reply-card {
    background: white;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
}

.reply-row {
    display: grid;
    grid-template-columns: 55px 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.reply-row label {
    color: #59636e;
    font-size: 13px;
    font-weight: 700;
}

.reply-row input,
.reply-row select {
    width: 100%;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    padding: 9px 10px;
    background: white;
}

.reply-toolbar {
    display: flex;
    gap: 6px;
    padding: 10px 0;
    border-top: 1px solid #eceff2;
    margin-top: 12px;
}

.reply-toolbar button {
    min-width: 38px;
    height: 34px;
    border: 1px solid #cfd5dc;
    background: white;
    border-radius: 5px;
    cursor: pointer;
}

.reply-toolbar button:hover {
    background: #f2f5f8;
}

.reply-editor {
    width: 100%;
    min-height: 210px;
    resize: vertical;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    padding: 12px;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.signature-preview {
    margin-top: 12px;
    padding: 12px;
    border-left: 3px solid #d9dee4;
    background: #fafbfc;
    color: #555f69;
    font-size: 12px;
    line-height: 1.45;
}

.signature-preview strong {
    display: block;
    margin-top: 7px;
    color: #222;
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eceff2;
}

.btn-close-ticket {
    background: #fff7e6;
    border-color: #f3c779;
    color: #704900;
}

.btn-close-ticket:hover {
    background: #ffefc9;
}

.after-send-status {
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    padding: 9px 10px;
    background: white;
    min-width: 200px;
}

.conversation {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message {
    background: white;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow: hidden;
}

.message-customer {
    border-left: 4px solid #4f8ad9;
}

.message-agent {
    border-left: 4px solid #4fa56d;
}

.message-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 14px;
    background: #f7f8fa;
    border-bottom: 1px solid #eceff2;
    font-size: 13px;
}

.message-address {
    margin-left: 6px;
    color: #707985;
    font-weight: 400;
}

.message-time {
    color: #747d87;
    white-space: nowrap;
}

.message-body {
    padding: 16px;
    line-height: 1.55;
    font-size: 14px;
}

.message-body p:first-child {
    margin-top: 0;
}

.message-body p:last-child {
    margin-bottom: 0;
}

.attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 14px;
}

.attachment {
    padding: 8px 10px;
    border: 1px solid #d9dee4;
    border-radius: 6px;
    background: #fafbfc;
    color: #315b88;
    font-size: 13px;
    cursor: pointer;
}

.attachment-security-warning {
    display: inline-block;

    margin-left: 6px;
    padding: 2px 7px;

    border: 1px solid #f3c779;
    border-radius: 5px;

    background: #fff7e6;
    color: #704900;

    font-size: 12px;
    font-weight: 700;
}

.attachment-security-reason {
    margin-top: 4px;
    margin-left: 22px;

    color: #8a5a00;

    font-size: 12px;
    line-height: 1.4;
}

.system-event {
    padding: 10px 14px;
    background: #f0f3f6;
    border: 1px dashed #cfd5dc;
    border-radius: 6px;
    color: #68717d;
    font-size: 13px;
    text-align: center;
}

.ticket-properties {
    background: white;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    padding: 16px;
    position: sticky;
    top: 90px;
}

.properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eceff2;
}

.properties-header h2 {
    margin: 0;
    font-size: 18px;
}

.properties-edit {
    border: none;
    background: transparent;
    color: #1f6feb;
    cursor: pointer;
}

.property-group {
    margin-bottom: 15px;
}

.property-group label {
    display: block;
    margin-bottom: 6px;
    color: #66707b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.property-control {
    width: 100%;
    border: 1px solid #cfd5dc;
    border-radius: 6px;
    padding: 9px 10px;
    background: white;
}

.status-control {
    background: #e6fbf4;
    border-color: #8bd8c2;
    color: #136a53;
    font-weight: 700;
}

.property-value {
    padding: 9px 10px;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
    background: #fafbfc;
    font-size: 14px;
}

.property-secondary {
    display: block;
    margin-top: 4px;
    color: #7a838e;
    font-size: 12px;
}

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

.ticket-tag {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 12px;
    background: #eef2ff;
    color: #3d4d9b;
    font-size: 12px;
    font-weight: 700;
}

.tag-add {
    border: 1px dashed #bfc7d0;
    background: white;
    color: #4f5965;
    border-radius: 12px;
    padding: 4px 9px;
    cursor: pointer;
}

.tag-add:hover {
    background: #f5f7f9;
}

@media (max-width: 1250px) {
    .ticket-layout {
        grid-template-columns: 1fr;
    }

    .ticket-properties {
        position: static;
    }
}

@media (max-width: 800px) {
    .ticket-detail-page {
        padding: 16px;
    }

    .ticket-detail-header {
        flex-direction: column;
    }

    .reply-actions {
        align-items: stretch;
    }

    .reply-actions .btn,
    .after-send-status {
        width: 100%;
    }

    .message-header {
        flex-direction: column;
        gap: 5px;
    }
}.ticket-id a {
    color: #1f5fa8;
    text-decoration: none;
    font-weight: 700;
}

.ticket-id a:hover {
    text-decoration: underline;
}
.draft-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.draft-modal-content {
    width: min(720px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    background: white;
    border: 1px solid #d8dee6;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.draft-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.draft-modal-info {
    font-size: 13px;
    color: #667085;
    margin-bottom: 12px;
}

.draft-modal-body {
    white-space: pre-wrap;
    padding: 12px;
    border: 1px solid #e1e5ea;
    border-radius: 6px;
    background: #f8f9fb;
    margin-bottom: 12px;
}

.draft-modal-attachments {
    font-size: 14px;
}
/* =========================================================
   PLANOVAC TERMINU
   ========================================================= */

.deadline-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.35);
    display: grid;
    place-items: center;
    padding: 16px;
}

.deadline-modal-content {
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: white;
    border: 1px solid #cfd5dc;
    border-radius: 8px;
    box-shadow: 0 14px 45px rgba(0, 0, 0, 0.25);
}

.deadline-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid #dfe3e8;
    font-size: 17px;
}

.deadline-modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid #cfd5dc;
    background: #f7f8fa;
    border-radius: 5px;
    cursor: pointer;
}

.deadline-calendar-toolbar {
    display: grid;
    grid-template-columns: auto 118px 82px 1fr auto;
    gap: 6px;
    align-items: center;
    padding: 9px 14px;
    border-bottom: 1px solid #eceff2;
    background: #fafbfc;
}

.deadline-calendar-toolbar select {
    height: 34px;
    border: 1px solid #cfd5dc;
    border-radius: 5px;
    background: white;
    padding: 0 8px;
}

.deadline-nav {
    min-width: 34px;
    min-height: 34px;
    padding: 5px 8px;
}

.deadline-calendars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px 14px;
}

.deadline-calendar {
    min-width: 0;
}

.deadline-calendar-title {
    margin-bottom: 7px;
    text-align: center;
    font-weight: 700;
}

.deadline-weekdays,
.deadline-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.deadline-weekdays {
    margin-bottom: 3px;
}

.deadline-weekdays span {
    padding: 3px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #59636e;
}

.deadline-day {
    min-height: 32px;
    border: 1px solid #d9dee4;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    color: #1f5fa8;
}

.deadline-day:hover {
    background: #eef4ff;
    border-color: #9dbcf3;
}

.deadline-day-empty {
    border-color: transparent;
    background: transparent;
    cursor: default;
}

.deadline-day-today {
    border-color: #f0b429;
    background: #fff7d6;
    font-weight: 700;
}

.deadline-day-selected {
    background: #1f6feb;
    border-color: #1f6feb;
    color: white;
    font-weight: 700;
}

.deadline-time-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid #eceff2;
}

.deadline-time-row select {
    min-width: 64px;
    height: 34px;
    border: 1px solid #cfd5dc;
    border-radius: 5px;
    background: white;
    padding: 0 8px;
}

.deadline-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 10px 14px;
    border-top: 1px solid #eceff2;
}

.deadline-setting label {
    display: block;
    margin-bottom: 5px;
    color: #68717d;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.deadline-selected-value {
    min-height: 34px;
    padding: 7px 8px;
    border-bottom: 1px solid #d9dee4;
    font-weight: 600;
}

.deadline-setting select {
    width: 100%;
    height: 34px;
    border: 1px solid #cfd5dc;
    border-radius: 5px;
    background: white;
    padding: 0 8px;
}

.deadline-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #dfe3e8;
    background: #fafbfc;
}

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

.btn-danger:hover {
    background: #b9251d;
}

.deadline-summary-button {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid #d6e0eb;
    border-radius: 6px;
    background: #f8fafd;
    color: #243b53;
    text-align: left;
    cursor: pointer;
}

.deadline-summary-button:hover,
.deadline-summary-button:focus-visible {
    border-color: #9dbce0;
    background: #f0f6fd;
}

.deadline-summary-icon {
    font-size: 16px;
}

.deadline-summary-content {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.deadline-summary-value {
    font-weight: 600;
}

.deadline-summary-value.is-unset,
.deadline-summary-reminder {
    color: #64748b;
    font-size: 12px;
    font-weight: 400;
}

.deadline-summary-edit {
    margin-left: auto;
    color: #3e668f;
    font-size: 12px;
}

@media (max-width: 800px) {
    .deadline-calendars {
        grid-template-columns: 1fr;
    }

    .deadline-calendar-toolbar {
        grid-template-columns: auto 1fr 90px auto;
    }

    #deadline-second-month-title {
        display: none;
    }

    .deadline-settings-row {
        grid-template-columns: 1fr;
    }

    .deadline-modal {
        padding: 8px;
    }

    .deadline-modal-content {
        width: 100%;
        max-height: calc(100dvh - 16px);
    }

    .deadline-calendar-toolbar {
        grid-template-columns: auto minmax(0, 1fr) 78px auto;
        padding: 9px 10px;
    }

    .deadline-calendars {
        padding: 10px;
    }

    .deadline-day {
        min-height: 40px;
    }

    .deadline-time-row,
    .deadline-settings-row,
    .deadline-modal-actions {
        padding-right: 10px;
        padding-left: 10px;
    }
}
/* =========================================================
   HLAVNI DVOUMESICNI KALENDAR TICKETU
   ========================================================= */

.calendar-board {
    margin-top: 18px;
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border-bottom: 1px solid #e6e9ed;
}

.calendar-board-header h2 {
    margin: 0;
    font-size: 18px;
}

.calendar-board-header p {
    margin: 4px 0 0;
    color: #68717d;
    font-size: 13px;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calendar-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
}

.calendar-month {
    min-width: 0;
    padding: 16px;
}

.calendar-month:first-child {
    border-right: 1px solid #e6e9ed;
}

.calendar-month-title {
    margin-bottom: 14px;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: #252a31;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid #e6e9ed;
    border-left: 1px solid #e6e9ed;
}

.calendar-weekdays > div {
    padding: 8px 4px;
    border-right: 1px solid #e6e9ed;
    border-bottom: 1px solid #e6e9ed;
    background: #f7f8fa;
    text-align: center;
    color: #68717d;
    font-size: 12px;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(58px, auto);
    border-left: 1px solid #e6e9ed;
}

.calendar-day {
    position: relative;
    min-width: 0;
    min-height: 58px;
    padding: 3px;
    border-right: 1px solid #e6e9ed;
    border-bottom: 1px solid #e6e9ed;
    background: #ffffff;
}

.calendar-day-empty {
    background: #f8f9fb;
}

.calendar-day-has-tickets {
    background: #fcfdff;
}

.calendar-day-today {
    background: #fff9df;
    box-shadow: inset 0 0 0 2px #e5b422;
}

.calendar-day-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    margin-left: auto;
    margin-bottom: 5px;
    border-radius: 50%;
    color: #4d5763;
    font-size: 12px;
    font-weight: 700;
}

.calendar-day-today .calendar-day-number {
    background: #e5b422;
    color: #ffffff;
}

.calendar-day-tickets {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-event {
    display: block;
    min-width: 0;
    padding: 2px 4px;
    border: 1px solid #dce3ec;
    border-left-width: 4px;
    border-radius: 5px;
    background: #ffffff;
    color: #26313d;
    text-decoration: none;
    transition:
        box-shadow 0.12s ease,
        transform 0.12s ease;
}

.calendar-event:hover {
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.calendar-event-top {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    font-size: 10px;
}

.calendar-event-top strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-time {
    flex: 0 0 auto;
    color: #1f6feb;
    font-weight: 700;
}

.calendar-event-subject {
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
}

.calendar-event-meta {
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #78828e;
    font-size: 10px;
}


/* Priorita ticketu = barevný levý okraj */

.calendar-event-priority-low {
    border-left-color: #9aa4af;
}

.calendar-event-priority-normal {
    border-left-color: #3b82f6;
}

.calendar-event-priority-high {
    border-left-color: #e5a100;
}

.calendar-event-priority-urgent {
    border-left-color: #dc3545;
}


/* Tickety bez termínu */

.calendar-no-deadline {
    border-top: 1px solid #e6e9ed;
}

.calendar-no-deadline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 18px;
    background: #f7f8fa;
}

.calendar-no-deadline-header > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-no-deadline-header span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 23px;
    height: 23px;
    padding: 0 7px;
    border-radius: 12px;
    background: #e2e6eb;
    color: #505966;
    font-size: 11px;
    font-weight: 700;
}

.calendar-no-deadline-header small {
    color: #78828e;
}

.calendar-no-deadline-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calendar-no-deadline-ticket {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 14px;
    border-right: 1px solid #eceff2;
    border-bottom: 1px solid #eceff2;
    color: #252a31;
    text-decoration: none;
}

.calendar-no-deadline-ticket:hover {
    background: #f8faff;
}

.calendar-no-deadline-ticket > strong {
    color: #075fb8;
    font-size: 12px;
}

.calendar-no-deadline-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-no-deadline-assignee {
    color: #68717d;
    font-size: 12px;
}


/* Mensi obrazovky */

@media (max-width: 1200px) {
    .calendar-months {
        grid-template-columns: 1fr;
    }

    .calendar-month:first-child {
        border-right: 0;
        border-bottom: 1px solid #e6e9ed;
    }
}

@media (max-width: 800px) {
    .calendar-board-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .calendar-grid {
        grid-auto-rows: minmax(90px, auto);
    }

    .calendar-day {
        min-height: 90px;
        padding: 3px;
    }

    .calendar-event-meta {
        display: none;
    }

    .calendar-no-deadline-list {
        grid-template-columns: 1fr;
    }

    .calendar-no-deadline-ticket {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .calendar-no-deadline-assignee,
    .calendar-no-deadline-ticket .priority {
        display: none;
    }
}
/* =========================================================
   NOTIFIKACE
   ========================================================= */

.notification-top-button {
    position: relative;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 20px;
    height: 20px;

    margin-left: 5px;
    padding: 0 6px;

    border-radius: 10px;

    background: #d93025;
    color: white;

    font-size: 11px;
    font-weight: 700;
}

.notification-page-title {
    font-weight: 700;
}

.notifications-card {
    overflow: hidden;

    background: white;

    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 15px;

    padding: 14px 16px;

    border-bottom: 1px solid #eceff2;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item-unread {
    background: #f3f7ff;
}

.notification-item-main {
    min-width: 0;
    flex: 1;
}

.notification-item-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;
}

.notification-time {
    flex: 0 0 auto;

    color: #7a838e;

    font-size: 12px;
}

.notification-message {
    margin-top: 5px;

    color: #505966;

    font-size: 13px;
}

.notification-ticket-link {
    display: inline-block;

    margin-top: 7px;

    color: #075fb8;

    font-size: 12px;
    font-weight: 700;

    text-decoration: none;
}

.notification-ticket-link:hover {
    text-decoration: underline;
}

.notification-item-actions {
    flex: 0 0 auto;
}

.notification-action {
    width: 32px;
    height: 32px;

    border: 1px solid #cfd5dc;
    border-radius: 50%;

    background: white;

    cursor: pointer;
}

.notification-action:hover {
    background: #f0f3f6;
}

.notifications-empty {
    padding: 50px 20px;

    text-align: center;

    color: #68717d;
}

.notifications-empty strong,
.notifications-empty span {
    display: block;
}

.notifications-empty span {
    margin-top: 6px;
}

.notifications-pagination {
    display: flex;
    justify-content: space-between;

    margin-top: 14px;
}
/* =========================================================
   POPUP NOTIFIKACE
   ========================================================= */

.notification-toast-container {
    position: fixed;

    top: 72px;
    right: 20px;

    width: 360px;
    max-width: calc(100vw - 40px);

    z-index: 5000;

    display: flex;
    flex-direction: column;

    gap: 10px;

    pointer-events: none;
}


.notification-toast {
    position: relative;

    padding: 16px 42px 14px 16px;

    background: #ffffff;

    border: 1px solid #d7dde5;
    border-radius: 8px;

    box-shadow:
        0 8px 24px
        rgba(0, 0, 0, 0.16);

    pointer-events: auto;
}


.notification-toast-title {
    padding-right: 5px;

    font-size: 14px;
    font-weight: 700;

    color: #20252b;
}


.notification-toast-message {
    margin-top: 6px;

    font-size: 13px;
    line-height: 1.4;

    color: #59636f;
}


.notification-toast-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-top: 12px;

    font-size: 11px;

    color: #7b8490;
}


.notification-toast-open {
    flex: 0 0 auto;

    color: #075fb8;

    font-size: 12px;
    font-weight: 700;

    text-decoration: none;
}


.notification-toast-open:hover {
    text-decoration: underline;
}


.notification-toast-close {
    position: absolute;

    top: 8px;
    right: 8px;

    width: 28px;
    height: 28px;

    padding: 0;

    border: none;
    border-radius: 5px;

    background: transparent;

    color: #69727d;

    font-size: 20px;
    line-height: 28px;

    cursor: pointer;
}


.notification-toast-close:hover {
    background: #f0f2f5;
}


/* Mobil */

@media (max-width: 767px) {

    .notification-toast-container {
        top: 68px;
        left: 10px;
        right: 10px;

        width: auto;
        max-width: none;
    }

    .notification-toast {
        padding:
            14px
            40px
            14px
            14px;
    }

    .notification-toast-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}
/* =========================================================
   ADMINISTRACE UŽIVATELŮ
   ========================================================= */

.admin-card {
    margin-bottom: 18px;
    padding: 20px;

    background: #ffffff;

    border: 1px solid #dfe3e8;
    border-radius: 8px;
}


.admin-card h2 {
    margin-top: 0;
    margin-bottom: 6px;

    font-size: 18px;
}


.admin-user-list {
    display: flex;
    flex-direction: column;
}


.admin-user-row {
    display: grid;

    grid-template-columns:
        minmax(180px, 1.4fr)
        minmax(180px, 1fr)
        minmax(180px, 1fr)
        auto;

    gap: 18px;

    align-items: center;

    padding: 14px 8px;

    border-bottom: 1px solid #edf0f3;

    color: inherit;

    text-decoration: none;
}


.admin-user-row:last-child {
    border-bottom: none;
}


.admin-user-row:hover {
    background: #f7f9fc;
}


.admin-user-main {
    display: flex;
    flex-direction: column;

    gap: 3px;
}


.admin-user-main span {
    font-size: 12px;
    color: #6d7682;
}


.admin-user-roles,
.admin-user-groups {
    display: flex;
    flex-wrap: wrap;

    gap: 5px;
}


.admin-chip {
    display: inline-flex;

    padding: 4px 8px;

    border-radius: 12px;

    background: #eef3fb;

    color: #315c96;

    font-size: 11px;
    font-weight: 600;
}


.admin-status-active {
    color: #16815d;

    font-size: 12px;
    font-weight: 700;
}


.admin-status-disabled {
    color: #9b4b4b;

    font-size: 12px;
    font-weight: 700;
}


.admin-user-form {
    max-width: 1050px;
}


.admin-form-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 15px;
}


.admin-form-grid label {
    display: flex;
    flex-direction: column;

    gap: 6px;
}


.admin-form-grid label > span {
    font-size: 12px;
    font-weight: 700;

    color: #68717c;
}


.admin-form-grid input,
.admin-group-row select {
    width: 100%;

    padding: 9px 10px;

    border: 1px solid #ccd3dc;
    border-radius: 6px;

    background: #ffffff;

    box-sizing: border-box;
}


.admin-checkbox {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-top: 18px;
}


.admin-role-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 10px;

    margin-top: 15px;
}


.admin-option-card {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 14px;

    border: 1px solid #d9dee5;
    border-radius: 7px;

    cursor: pointer;
}


.admin-option-card:hover {
    background: #f7f9fc;
}


.admin-option-card > div {
    display: flex;
    flex-direction: column;

    gap: 4px;
}


.admin-option-card span {
    font-size: 12px;

    color: #6f7884;
}


.admin-groups-table {
    margin-top: 15px;
}


.admin-group-row {
    display: grid;

    grid-template-columns:
        minmax(200px, 1fr)
        220px;

    gap: 20px;

    align-items: center;

    padding: 12px 0;

    border-bottom: 1px solid #edf0f3;
}


.admin-group-row:last-child {
    border-bottom: none;
}


.admin-group-row > div {
    display: flex;
    flex-direction: column;

    gap: 3px;
}


.admin-group-row span {
    font-size: 12px;

    color: #6f7884;
}


.admin-form-actions {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    margin-bottom: 30px;
}


/* =========================================================
   MOBILNÍ ADMINISTRACE
   ========================================================= */

@media (max-width: 767px) {

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


    .admin-role-grid {
        grid-template-columns: 1fr;
    }


    .admin-group-row {
        grid-template-columns: 1fr;

        gap: 8px;
    }


    .admin-user-row {
        grid-template-columns: 1fr;

        gap: 8px;

        padding: 14px;
    }


    .admin-form-actions {
        position: sticky;

        bottom: 0;

        padding: 10px 0;

        background: #f4f6f8;
    }

}
/* =========================================================
   E-MAILY ŘEŠITELSKÝCH SKUPIN
   ========================================================= */

.admin-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;
}


.admin-group-emails {
    display: flex;
    flex-direction: column;

    gap: 8px;

    margin-top: 16px;
}


.admin-group-email-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 195px)
        auto;

    gap: 12px;

    align-items: center;

    padding: 10px;

    border: 1px solid #e1e5ea;
    border-radius: 7px;

    background: #fafbfc;
}


.admin-group-email-row > input[type="email"] {
    width: 100%;

    padding: 9px 10px;

    border: 1px solid #ccd3dc;
    border-radius: 6px;

    box-sizing: border-box;
}

.admin-group-email-row[data-alias-row] {
    grid-template-columns: minmax(0, 1fr) auto;
}

.admin-group-email-row > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.group-email-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.group-email-actions form {
    margin: 0;
}

.group-primary-badge {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid #9ec6e9;
    border-radius: 999px;
    background: #e8f4ff;
    color: #075598;
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .admin-group-email-row:not([data-alias-row]) {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-group-email-row:not([data-alias-row]) .group-email-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.ticket-group-picker {
    padding: 18px;
    border: 1px solid var(--km-border);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(18, 55, 91, 0.08);
}

.ticket-group-picker h1 {
    margin: 0 0 6px;
    font-size: 20px;
}

.ticket-group-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.ticket-group-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 70px;
    padding: 12px 16px;
    border: 1px solid #cad7e5;
    border-radius: 6px;
    background: #fff;
    color: #135bab;
    text-decoration: none;
}

.ticket-group-card:hover {
    border-color: #1d75d6;
    background: #f3f8ff;
}

.ticket-group-card small {
    display: block;
    margin-top: 4px;
    color: #66788b;
    font-weight: 400;
}

.ticket-group-icon {
    display: grid;
    width: 32px;
    height: 40px;
    place-items: center;
    border: 2px solid #6f7d89;
    border-radius: 5px;
    color: #6f7d89;
    font-size: 20px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .ticket-group-grid {
        grid-template-columns: repeat(2, minmax(210px, 1fr));
    }
}

@media (max-width: 650px) {
    .ticket-group-grid {
        grid-template-columns: 1fr;
    }
}


.admin-inline-check {
    display: flex;
    align-items: center;

    gap: 6px;

    font-size: 12px;
}


@media (max-width: 767px) {

    .admin-card-heading {
        flex-direction: column;
    }


    .admin-group-email-row {
        grid-template-columns: 1fr;
    }

    .admin-group-email-row[data-alias-row] {
        grid-template-columns: minmax(0, 1fr);
    }

    .group-email-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

}
/* =========================================================
   ADMINISTRACE ROLÍ A OPRÁVNĚNÍ
   ========================================================= */

.admin-role-list {
    display: flex;
    flex-direction: column;
}


.admin-role-list-row {
    display: grid;

    grid-template-columns:
        minmax(240px, 1fr)
        140px
        100px;

    gap: 20px;

    align-items: center;

    padding: 14px 10px;

    border-bottom: 1px solid #edf0f3;

    color: inherit;

    text-decoration: none;
}


.admin-role-list-row:last-child {
    border-bottom: none;
}


.admin-role-list-row:hover {
    background: #f7f9fc;
}


.admin-role-list-row > div {
    display: flex;
    flex-direction: column;

    gap: 3px;
}


.admin-role-list-row span {
    font-size: 12px;

    color: #6e7782;
}


.admin-permission-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 10px;

    margin-top: 14px;
}


.admin-permission-card {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 14px;

    border: 1px solid #d9dee5;
    border-radius: 7px;

    cursor: pointer;
}


.admin-permission-card:hover {
    background: #f7f9fc;
}


.admin-permission-card > div {
    display: flex;
    flex-direction: column;

    gap: 4px;
}


.admin-permission-card span {
    font-size: 12px;

    color: #6f7884;
}


.admin-permission-card code {
    font-size: 11px;

    color: #8a939f;
}


@media (max-width: 767px) {

    .admin-role-list-row {
        grid-template-columns: 1fr;

        gap: 8px;

        padding: 14px;
    }


    .admin-permission-grid {
        grid-template-columns: 1fr;
    }

}
/* =========================================================
   PŘIHLÁŠENÍ
   ========================================================= */

.login-page {
    margin: 0;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f3f5f8;
}


.login-container {
    width: 100%;

    max-width: 420px;

    padding: 24px;

    box-sizing: border-box;
}


.login-card {
    padding: 30px;

    background: #ffffff;

    border: 1px solid #dce1e7;
    border-radius: 10px;
}


.login-brand {
    margin-bottom: 28px;

    font-size: 21px;
    font-weight: 700;
}


.login-card h1 {
    margin: 0 0 6px 0;
}


.login-form {
    display: flex;
    flex-direction: column;

    gap: 18px;

    margin-top: 26px;
}


.login-form label {
    display: flex;
    flex-direction: column;

    gap: 6px;
}


.login-form input {
    width: 100%;

    padding: 11px 12px;

    border: 1px solid #ccd3dc;
    border-radius: 6px;

    box-sizing: border-box;

    font-size: 15px;
}


.login-submit {
    width: 100%;

    margin-top: 6px;

    padding: 11px;
}


.login-error {
    margin-top: 18px;

    padding: 10px 12px;

    border-radius: 6px;

    background: #fff0f0;

    color: #b42318;
}

.mail-account-form {
    display: flex;
    flex-direction: column;
    gap: 18px;

    max-width: 980px;
}


.admin-form-section {
    padding: 20px;

    border: 1px solid #e2e8f0;
    border-radius: 10px;

    background: #ffffff;
}


.admin-form-section h2 {
    margin: 0 0 18px;

    font-size: 17px;
    font-weight: 700;
}


.admin-form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px 22px;
}


.form-group {
    display: flex;
    flex-direction: column;

    gap: 7px;
}


.form-group label {
    font-size: 13px;
    font-weight: 600;

    color: #334155;
}


.form-group input,
.form-group select {
    width: 100%;
    min-height: 40px;

    padding: 8px 10px;

    border: 1px solid #cbd5e1;
    border-radius: 7px;

    background: #ffffff;

    box-sizing: border-box;
}


.form-group input:focus,
.form-group select:focus {
    outline: none;

    border-color: #94a3b8;
}


.form-group-checkbox {
    justify-content: flex-end;
}


.form-group-checkbox label {
    display: flex;
    align-items: center;

    gap: 8px;

    min-height: 40px;
}


.form-group-checkbox input {
    width: auto;
    min-height: auto;
}

/* Ovládání odeslání zůstává při dlouhé citaci vždy na dosah. */
.reply-card .reply-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    background: #fff;
    padding-bottom: 10px;
}

.topbar-history { position: relative; }
.topbar-history-button { min-width: 42px; font-size: 20px; line-height: 1; }
.recent-tickets-popover { position: absolute; z-index: 1200; top: calc(100% + 6px); right: 0; width: min(520px, calc(100vw - 24px)); max-height: min(70vh, 620px); overflow-y: auto; background: #fff; border: 1px solid #bfd2e8; box-shadow: 0 12px 30px rgba(13, 46, 83, .22); border-radius: 6px; }
.recent-tickets-popover h2 { margin: 0; padding: 12px 14px; color: #fff; background: #07376b; font-size: 15px; }
.recent-ticket-item { position: relative; display: grid; gap: 4px; padding: 10px 46px 10px 14px; border-bottom: 1px solid #e3ebf4; }
.recent-ticket-link { color: #1261c9; font-weight: 700; text-decoration: none; }
.recent-ticket-link:hover { text-decoration: underline; }
.recent-ticket-meta { color: #63758a; font-size: 12px; }
.recent-ticket-pin { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 1px solid transparent; border-radius: 5px; background: transparent; filter: grayscale(1); opacity: .46; cursor: pointer; font-size: 16px; }
.recent-ticket-pin:hover { background: #edf5ff; border-color: #b9d3f0; filter: none; opacity: 1; }
.recent-ticket-item.is-pinned { background: #fff8dc; border-left: 4px solid #e3a800; padding-left: 10px; }
.recent-ticket-item.is-pinned .recent-ticket-link { color: #805700; }
.recent-ticket-pin.is-pinned { background: #ffe28a; border-color: #e3a800; filter: none; opacity: 1; }
.recent-tickets-empty { margin: 0; padding: 16px; color: #63758a; }
.recent-tickets-history-link { display: block; padding: 11px 14px; color: #0c5db8; font-weight: 700; text-decoration: none; border-top: 1px solid #e3ebf4; }
.recent-tickets-history-link:hover { background: #f1f7ff; text-decoration: underline; }
.topbar-notifications { position: relative; }
.notification-preview-popover { position: absolute; z-index: 1200; top: calc(100% + 6px); right: 0; width: min(620px, calc(100vw - 24px)); max-height: min(72vh, 690px); overflow-y: auto; background: #fff; border: 1px solid #bfd2e8; border-radius: 6px; box-shadow: 0 12px 30px rgba(13, 46, 83, .22); }
.notification-preview-header { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; color: #fff; background: #07376b; }
.notification-preview-header h2 { margin: 0; font-size: 15px; }
.notification-preview-mark-all { padding: 4px 0; border: 0; background: transparent; color: #dcecff; font-size: 12px; cursor: pointer; }
.notification-preview-mark-all:hover:not(:disabled) { color: #fff; text-decoration: underline; }
.notification-preview-mark-all:disabled { cursor: wait; opacity: .65; }
.notification-preview-item { position: relative; display: grid; gap: 5px; padding: 11px 84px 11px 14px; border-bottom: 1px solid #e3ebf4; }
.notification-preview-item.is-unread { background: #f1f7ff; }
.notification-preview-item.is-pinned { border-left: 4px solid #e3a800; padding-left: 10px; }
.notification-preview-title { color: #1261c9; font-weight: 700; text-decoration: none; }
.notification-preview-title:hover { text-decoration: underline; }
.notification-preview-message { margin: 0; color: #33475c; font-size: 13px; max-height: 38px; overflow: hidden; }
.notification-preview-meta { color: #708196; font-size: 12px; }
.notification-preview-action { position: absolute; top: 11px; border: 1px solid transparent; border-radius: 5px; background: transparent; cursor: pointer; color: #62748a; }
.notification-preview-action:hover { background: #edf5ff; border-color: #b9d3f0; }
.notification-preview-action.is-pinned { right: 42px; background: #ffe28a; border-color: #e3a800; }
.notification-preview-action:not(.is-pinned):not(.notification-preview-read) { right: 42px; filter: grayscale(1); opacity: .5; }
.notification-preview-read { right: 12px; font-size: 18px; }
.notification-preview-empty { margin: 0; padding: 16px; color: #63758a; }
.notification-preview-history-link { display: block; padding: 11px 14px; color: #0c5db8; font-weight: 700; text-decoration: none; }
.notification-preview-history-link:hover { background: #f1f7ff; text-decoration: underline; }
.notification-preview-open, .recent-ticket-open { display: none; }
.recent-ticket-touch-preview { grid-column: 1 / -1; min-width: 0; }


/* Sdílení osobní schránky: kompaktní výběr uživatelů bez roztažených checkboxů. */
#shared_users_group {
    grid-column: 1 / -1;
}


.mail-account-shared-users {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-top: 2px;
}


.admin-form-grid .mail-account-shared-users label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #d7dee8;
    border-radius: 6px;
    color: #1f2937;
    cursor: pointer;
}


.admin-form-grid .mail-account-shared-users input[type="checkbox"] {
    width: auto;
    min-height: auto;
    margin: 0;
    flex: 0 0 auto;
}


@media (max-width: 700px) {
    .mail-account-shared-users {
        grid-template-columns: 1fr;
    }
}


.mail-account-form .form-actions {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 4px;
}


@media (max-width: 900px) {

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

}

.admin-group-list {
    display: flex;
    flex-direction: column;
}

.admin-group-row {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.6fr)
        minmax(220px, 1fr)
        auto;
    gap: 20px;
    align-items: center;

    padding: 16px 18px;

    border-bottom: 1px solid #e5e7eb;

    text-decoration: none;
    color: inherit;
}

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

.admin-group-row:hover {
    background: #f8fafc;
}

.admin-group-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.admin-group-main strong {
    font-size: 15px;
}

.admin-group-main span {
    font-size: 13px;
    color: #64748b;
}

.admin-group-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 900px) {
    .admin-group-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

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

.message-body-prewrap {
    white-space: pre-wrap;
}

.inline-form {
    display: inline;
}

.previous-email-preview {
    margin-top: 14px;
    margin-bottom: 18px;
    border: 1px solid #b9d4f5;
    border-radius: 8px;
    background: #f4f8fd;
    overflow: hidden;
}

.previous-email-summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    color: #174a7e;
    background: #e7f1fb;
    user-select: none;
}

.previous-email-summary:hover {
    background: #dcecf9;
}

.previous-email-content {
    padding: 14px;
    border-top: 1px solid #cbdff5;
    background: #ffffff;
    font-size: 12px;
    line-height: 1.45;
    color: #374151;
}

.previous-email-body {
    margin-top: 12px;
    white-space: pre-wrap;
}

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

.message-header-addresses {
    min-width: 0;
}

.message-recipient {
    margin-top: 3px;
    font-size: 12px;
    color: #667085;
}

.message-header-right {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.message-action-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #3972b8;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

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

.message-more-button {
    color: #667085;
    font-size: 15px;
}

.message-content-wrapper {
    position: relative;
}

.message-body-collapsible {
    max-height: 260px;
    overflow: hidden;
}

.message-body-collapsible.is-expanded {
    max-height: none;
    overflow: visible;
}

.message-expand-button {
    margin: 8px 0 4px 14px;
    min-width: 36px;
    height: 26px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    background: #3478d4;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.message-expand-button:hover {
    filter: brightness(0.95);
}

.message-expand-button.is-hidden {
    display: none;
}
.message > .message-header {
    background: #e7f1fb;
}

.message-body-html img {
    max-width: 100%;
    height: auto;
}

.message-body-html table {
    max-width: 100%;
    border-collapse: collapse;
}

.message-body-html a {
    color: #2563eb;
    text-decoration: underline;
}

/* =========================================================
   ADRESAR
   ========================================================= */

.contacts-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;

    padding: 16px;

    border-bottom: 1px solid #eceff2;

    background: #fafbfc;
}

.contacts-search input {
    width: min(460px, 100%);
    min-height: 38px;

    padding: 8px 11px;

    border: 1px solid #cfd5dc;
    border-radius: 6px;

    background: #ffffff;
}

.contacts-search input:focus {
    outline: none;
    border-color: #9dbcf3;
    box-shadow: 0 0 0 2px #eef4ff;
}


.contacts-table {
    width: 100%;

    border-collapse: collapse;

    background: #ffffff;
}

.contacts-table th,
.contacts-table td {
    padding: 13px 16px;

    border-bottom: 1px solid #eceff2;

    text-align: left;
    vertical-align: middle;
}

.contacts-table th {
    background: #f7f8fa;

    color: #505966;

    font-size: 12px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.contacts-table tbody tr:hover {
    background: #f8fbff;
}

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

.contacts-table td:first-child {
    width: 80px;

    color: #68717d;

    font-size: 13px;
}

.contacts-table td:nth-child(2) {
    font-weight: 600;
}

.contacts-table td a[href^="mailto:"] {
    color: #075fb8;

    text-decoration: none;
}

.contacts-table td a[href^="mailto:"]:hover {
    text-decoration: underline;
}

.contacts-table th:last-child,
.contacts-table td:last-child {
    width: 170px;
}

.contacts-table td:last-child > div {
    display: flex !important;
    align-items: center !important;

    gap: 8px !important;
}

.contacts-table td:last-child form {
    margin: 0 !important;
}

.contacts-table td:last-child .btn {
    min-height: 36px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;
}

.contacts-table td:last-child .btn-danger {
    min-width: 38px;
    padding-left: 10px;
    padding-right: 10px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.empty-state {
    padding: 45px 20px !important;

    color: #68717d;

    text-align: center !important;
}


@media (max-width: 900px) {

    .contacts-search {
        align-items: stretch;
    }

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

    .contacts-table {
        min-width: 850px;
    }

}

/* =========================================================
   FORMULAR KONTAKTU
   ========================================================= */

.contact-form {
    max-width: 900px;
}

.contact-form .admin-card {
    padding: 22px;
}

.contact-form .admin-form-grid {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px 22px;
}

.contact-form .admin-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.contact-form .admin-form-grid label > span {
    font-size: 12px;
    font-weight: 700;

    color: #68717c;
}

.contact-form .admin-form-grid input {
    width: 100%;
    min-height: 40px;

    padding: 9px 11px;

    border: 1px solid #ccd3dc;
    border-radius: 6px;

    background: #ffffff;
}

.contact-form .admin-form-grid input:focus {
    outline: none;

    border-color: #9dbcf3;

    box-shadow:
        0 0 0 2px
        #eef4ff;
}

.contact-form-actions {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 16px;
    margin-bottom: 30px;
}

@media (max-width: 800px) {

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

    .contact-form-actions {
        justify-content: stretch;
    }

    .contact-form-actions .btn {
        flex: 1;
        text-align: center;
    }

}

/* =========================================================
   NAŠEPTÁVÁNÍ KONTAKTŮ
   ========================================================= */

.contact-autocomplete {
    position: absolute;

    top: calc(100% + 4px);
    left: 0;
    right: 0;

    z-index: 2000;

    max-height: 320px;
    overflow-y: auto;

    background: #ffffff;

    border: 1px solid #cfd5dc;
    border-radius: 7px;

    box-shadow:
        0 8px 24px
        rgba(0, 0, 0, 0.14);
}

.contact-autocomplete-item {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 3px;

    padding: 10px 12px;

    border: 0;
    border-bottom: 1px solid #eceff2;

    background: #ffffff;

    text-align: left;

    cursor: pointer;
}

.contact-autocomplete-item:last-child {
    border-bottom: 0;
}

.contact-autocomplete-item:hover {
    background: #f3f7ff;
}

.contact-autocomplete-main {
    color: #20252b;

    font-size: 14px;
    font-weight: 700;
}

.contact-autocomplete-job {
    color: #68717d;

    font-size: 12px;
}

.contact-autocomplete-email {
    color: #1f6feb;

    font-size: 12px;
}

/* Společný editor odpovědí pro ticket i osobní poštu. */
.rich-text-source {
    position: absolute !important;
    width: 1px !important;
    min-height: 0 !important;
    height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
}

.rich-text-toolbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 7px;
    border: 1px solid #cfd5dc;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    background: #f8fafc;
}

.rich-text-palette {
    position: absolute;
    top: calc(100% + 4px);
    left: 6px;
    z-index: 30;
    display: grid;
    gap: 6px;
    padding: 9px;
    border: 1px solid #b9c4d2;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(20, 36, 58, .18);
}

.rich-text-palette-title {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 700;
    color: #465567;
}

.rich-text-color-palette {
    grid-template-columns: repeat(5, 24px);
}

.rich-text-color-swatch {
    width: 24px;
    min-width: 24px !important;
    min-height: 24px !important;
    height: 24px;
    padding: 0 !important;
    border: 1px solid #95a1b0 !important;
    border-radius: 3px !important;
}

.rich-text-emoji-palette {
    grid-template-columns: repeat(6, 34px);
}

.rich-text-emoji-item {
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 3px !important;
    font-size: 20px;
}

.rich-text-toolbar button {
    min-width: 34px;
    min-height: 32px;
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #273444;
    cursor: pointer;
}

.rich-text-toolbar button:hover,
.rich-text-toolbar button:focus-visible {
    border-color: #b8c6d8;
    background: #eaf2ff;
    outline: none;
}

.rich-text-toolbar button.is-active {
    border-color: #7da2d4;
    background: #dceaff;
    box-shadow: inset 0 1px 2px rgba(42, 86, 145, .22);
    color: #123e77;
}

.rich-text-editor {
    min-height: 260px;
    padding: 13px;
    border: 1px solid #cfd5dc;
    border-radius: 0 0 7px 7px;
    background: #fff;
    color: #20252b;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.rich-text-editor:focus {
    border-color: #2f6fda;
    box-shadow: 0 0 0 3px rgba(47, 111, 218, .16);
    outline: none;
}

.rich-text-editor blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 3px solid #9db5d4;
    color: #4a5b70;
}

.rich-text-editor mark[data-km-highlight] {
    padding: 0 1px;
    color: inherit;
}

.rich-text-editor table {
    border-collapse: collapse;
    margin: 10px 0;
}

.rich-text-editor td,
.rich-text-editor th {
    min-width: 72px;
    padding: 7px;
    border: 1px solid #aeb8c5;
}

.mail-sync-card { max-width: 820px; padding: 22px; }
.mail-sync-card h2 { margin-top: 0; }
.mail-sync-summary { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 10px; margin: 20px 0; }
.mail-sync-summary div { padding: 12px; border: 1px solid #d9e0e8; border-radius: 6px; background: #f8fafc; }
.mail-sync-summary dt { color: #5e6c7d; font-size: 13px; }
.mail-sync-summary dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.mail-sync-section-title { margin-top: 26px; font-size: 18px; }
.mail-sync-folder-list { display: grid; gap: 6px; margin-top: 10px; }
.mail-sync-folder-list div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 11px; border: 1px solid #d9e0e8; border-radius: 5px; }
.mail-sync-folder-list span { color: #5e6c7d; font-size: 13px; }
.mail-sync-cleanup-form { margin-top: 16px; padding: 14px; border: 1px solid #efc2be; border-radius: 6px; background: #fff8f7; }
.mail-sync-cleanup-form p { margin: 0 0 10px; }
.mail-sync-cleanup-form label { display: block; margin-bottom: 10px; }
.mail-sync-import-form { margin-top: 16px; padding: 14px; border: 1px solid #bed8c5; border-radius: 6px; background: #f7fcf8; }
.mail-sync-import-form p { margin: 0 0 10px; }
.mail-sync-progress { display: grid; gap: 7px; margin-top: 13px; color: #2d5e3d; font-size: 14px; }
.mail-sync-progress[hidden] { display: none; }
.mail-sync-progress-track { display: block; height: 9px; overflow: hidden; border-radius: 999px; background: #d7eadc; }
.mail-sync-progress-bar { display: block; width: 38%; height: 100%; border-radius: inherit; background: #287a45; animation: mail-sync-progress 1.25s ease-in-out infinite; }
.mail-sync-progress.is-determinate .mail-sync-progress-bar { animation: none; }

/* =========================================================
   VIZUÁLNÍ ZÁKLAD APLIKACE
   Společný rámec: zachovává strukturu i rozměry pracovních ploch,
   pouze sjednocuje navigaci, hlavičku a běžné ovládací prvky.
   ========================================================= */

:root {
    --km-navy: #07356e;
    --km-navy-deep: #042756;
    --km-navy-light: #174d8a;
    --km-red: #e30613;
    --km-red-dark: #bf0712;
    --km-page: #f4f7fb;
    --km-surface: #ffffff;
    --km-border: #d8e1ed;
    --km-text: #172b4d;
    --km-muted: #607086;
    --km-focus: rgba(34, 104, 194, .20);
}

body {
    background: var(--km-page);
    color: var(--km-text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.sidebar {
    width: 250px;
    padding: 15px 12px 22px;
    background: linear-gradient(180deg, var(--km-navy-deep) 0%, var(--km-navy) 58%, #052c60 100%);
    box-shadow: inset -1px 0 rgba(255, 255, 255, .10);
}

.brand {
    margin: -15px -12px 12px;
    padding: 15px 18px 16px;
    color: #ffffff;
    background: #ffffff;
    color: var(--km-navy);
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: -.35px;
}

.brand-short { display: none; }
.ticket-back-mobile,
.ticket-secondary-toggle,
.reply-label-mobile,
.after-send-status-label { display: none; }
.draft-save-icon { display: none; }
.ticket-header-actions,
.ticket-secondary-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.ticket-row-restore { margin-top: 6px; }
.ticket-row-restore .btn { padding: 4px 9px; font-size: 12px; }
.mail-detail-secondary-actions { display: contents; }
.topbar-profile-photo { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; object-fit: cover; }
.topbar-profile-placeholder { display: inline-flex; align-items: center; justify-content: center; background: #dbeafe; color: #174f88; font-weight: 700; }
.application-settings-form { display: grid; max-width: 720px; gap: 18px; }
.application-settings-form label { display: grid; gap: 7px; font-weight: 700; }
.application-settings-form select { min-height: 42px; }

@media (max-width: 800px) {
    .notification-preview-open,
    .recent-ticket-open { display: inline-flex; width: fit-content; min-height: 40px; align-items: center; margin-top: 4px; }
    .notification-preview-item:not(.is-preview-open) .notification-preview-message,
    .notification-preview-item:not(.is-preview-open) .notification-preview-open { display: none; }
    .recent-ticket-item:not(.is-preview-open) .recent-ticket-open { display: none; }
    .brand-full, .topbar-user-name, .user-box > span:last-child { display: none; }
    .brand-short { display: inline; }
    .user-box { padding: 5px; border-radius: 50%; }
    .topbar-profile-photo { width: 36px; height: 36px; flex-basis: 36px; }
}

.menu {
    gap: 5px;
}

.menu a,
.sidebar-link,
.sidebar-menu-group summary,
.sidebar-mail-account summary {
    color: rgba(255, 255, 255, .90);
    border-radius: 5px;
    transition: background-color .15s ease, color .15s ease;
}

.menu a,
.sidebar-link {
    padding: 8px 10px;
}

.menu a:hover,
.sidebar-link:hover,
.sidebar-menu-group summary:hover {
    background: rgba(255, 255, 255, .12);
    color: #ffffff;
}

.menu a.active,
.sidebar-link.active {
    background: rgba(255, 255, 255, .18);
    box-shadow: inset 3px 0 0 #ffffff;
    color: #ffffff;
    font-weight: 700;
}

.sidebar-menu-group summary {
    padding: 9px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .45px;
    text-transform: uppercase;
}

.sidebar-menu-items {
    gap: 1px;
    margin: 3px 0 10px 10px;
    padding-left: 9px;
    border-left-color: rgba(255, 255, 255, .24);
}

.sidebar-menu-items a {
    padding-top: 7px;
    padding-bottom: 7px;
}

.sidebar-mail-account summary {
    padding: 7px 8px;
    font-weight: 700;
}

.sidebar-subtitle,
.sidebar-title {
    color: rgba(255, 255, 255, .60);
}

.count {
    min-width: 22px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, .20);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
}

.topbar {
    height: 64px;
    padding: 0 24px;
    gap: 16px;
    border-bottom: 0;
    background: linear-gradient(110deg, #eaf5ff 0%, #d8ecff 70%, #cce5fb 100%);
    box-shadow: 0 2px 8px rgba(26, 43, 75, .13);
}

.search-box {
    max-width: 560px;
}

.search-box input {
    height: 36px;
    padding: 8px 13px;
    border: 1px solid #b7d2ea;
    border-radius: 5px;
    background: rgba(255, 255, 255, .97);
    color: var(--km-text);
    box-shadow: none;
}

.search-box input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #2d73c9;
    box-shadow: 0 0 0 3px var(--km-focus);
    outline: none;
}

.topbar-actions {
    gap: 8px;
}

.btn {
    border-radius: 5px;
    padding: 8px 13px;
    font-weight: 600;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn-primary {
    background: var(--km-navy);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .12);
}

.btn-primary:hover {
    background: var(--km-navy-deep);
}

.topbar .btn-light {
    border-color: #a9c9e5;
    background: rgba(255, 255, 255, .72);
    color: var(--km-navy);
}

.topbar .btn-light:hover {
    border-color: #7da9d1;
    background: #ffffff;
}

.user-box {
    padding: 7px 4px;
    border-radius: 0;
    background: transparent;
    color: var(--km-navy);
    font-size: 13px;
    font-weight: 700;
}

.user-menu {
    position: relative;
}

.user-menu > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
}

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

.user-menu-popover {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 10px);
    right: 0;
    min-width: 235px;
    padding: 7px;
    border: 1px solid #c8d8e8;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(26, 43, 75, .18);
}

.user-menu-popover a,
.user-menu-popover button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--km-text);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.user-menu-popover a:hover,
.user-menu-popover button:hover {
    background: #edf5fc;
}

.user-menu-logout {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #dce6ef;
}

.prepared-responses-page {
    max-width: 1180px;
}

.prepared-response-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.prepared-response-filters input,
.prepared-response-filters select {
    min-width: 190px;
}

.prepared-response-filters input {
    flex: 1 1 280px;
}

.prepared-response-row {
    display: grid;
    grid-template-columns: minmax(250px, 1.5fr) minmax(240px, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e2e9f0;
}

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

.prepared-response-row-main,
.prepared-response-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.prepared-response-row-main {
    flex-direction: column;
}

.prepared-response-row-main span,
.prepared-response-meta > span:first-child {
    color: var(--km-muted);
}

.prepared-response-actions,
.form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.prepared-response-form {
    display: grid;
    gap: 18px;
}

.prepared-response-form > label,
.prepared-response-form > div > label {
    display: grid;
    gap: 6px;
}

.prepared-response-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 13px;
    border: 1px solid #d6e0e9;
    border-radius: 6px;
}

.prepared-response-group-option {
    display: flex;
    gap: 7px;
    align-items: center;
}

.prepared-response-editor {
    min-height: 260px;
}

.prepared-response-detail-meta,
.profile-fields {
    display: grid;
    gap: 12px;
}

.prepared-response-detail-meta > div,
.profile-fields > div {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 18px;
}

.prepared-response-preview {
    margin-top: 14px;
    min-height: 180px;
}

.prepared-response-delete {
    margin-top: 14px;
}

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

.prepared-response-modal-search {
    width: 100%;
    margin: 12px 0;
}

.prepared-response-modal-list {
    display: grid;
    gap: 5px;
    max-height: 360px;
    overflow-y: auto;
}

.prepared-response-modal-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px;
    border: 1px solid #dce5ed;
    border-radius: 5px;
    background: #fff;
    color: var(--km-text);
    text-align: left;
    cursor: pointer;
}

.prepared-response-modal-item:hover {
    border-color: #8bb2d5;
    background: #f4f9fd;
}

.prepared-response-modal-item span {
    color: var(--km-muted);
    font-size: 12px;
}

.prepared-response-modal-actions {
    flex-wrap: wrap;
    margin-top: 14px;
}

.profile-card {
    max-width: 760px;
}

.profile-identity {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.profile-photo {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-photo-placeholder {
    display: grid;
    place-items: center;
    background: #d8e9f7;
    color: var(--km-navy);
    font-size: 34px;
    font-weight: 700;
}

.profile-fields {
    margin: 0;
}

.profile-fields dt {
    color: var(--km-muted);
    font-weight: 600;
}

.profile-fields dd {
    margin: 0;
}

@media (max-width: 850px) {
    .prepared-response-row {
        grid-template-columns: 1fr;
    }

    .prepared-response-detail-meta > div,
    .profile-fields > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

.content {
    padding: 26px 28px 34px;
}

.page-header {
    margin-bottom: 18px;
}

.page-header h1,
.ticket-detail-header h1 {
    color: var(--km-text);
    letter-spacing: -.35px;
}

.subtitle,
.ticket-detail-meta {
    color: var(--km-muted);
}

.ticket-presence {
    margin-top: 7px;
    color: #53677e;
    font-size: 12px;
}

.reply-lock-message {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid #d7e2ee;
    border-radius: 5px;
    background: #f6f9fd;
    color: #40566f;
    font-size: 13px;
}

.rich-text-editor.is-reply-locked {
    background: #f3f5f7;
    color: #65717d;
    cursor: not-allowed;
}

.filter-panel,
.mail-inbox-card,
.mail-overview-card,
.ticket-card,
.mail-message-detail,
.mail-compose-form,
.admin-card,
.contact-card {
    border-color: var(--km-border);
    box-shadow: 0 1px 2px rgba(20, 47, 87, .04);
}

@media (max-width: 1100px) {
    .topbar {
        padding: 0 18px;
    }
}

/* Pracovní seznamy – tickety a pošta. */
.filter-panel,
.mail-inbox-card,
.mail-overview-card,
.ticket-card,
.calendar-card {
    border-color: var(--km-border);
    border-radius: 7px;
    background: var(--km-surface);
}

.filter-panel {
    padding: 14px;
    box-shadow: 0 1px 3px rgba(20, 47, 87, .05);
}

.filter-row {
    gap: 8px;
}

.filter-row input,
.filter-row select,
.mail-search-form input,
.mail-search-form select,
.bulk-actions select,
.mail-bulk-actions select {
    min-height: 36px;
    border-color: #cbd7e5;
    border-radius: 5px;
    color: var(--km-text);
}

.filter-row input::placeholder,
.mail-search-form input::placeholder {
    color: #8a98ab;
}

.bulk-actions,
.mail-bulk-actions {
    min-height: 54px;
    padding: 9px 14px;
    border-bottom-color: var(--km-border);
    background: #f8fafd;
}

.bulk-actions strong,
.mail-selected-count {
    color: var(--km-muted);
}

.ticket-table th {
    padding-top: 11px;
    padding-bottom: 11px;
    border-bottom-color: var(--km-border);
    background: #f5f8fc;
    color: #50647d;
    font-size: 11px;
    font-weight: 700;
}

.ticket-table td {
    border-bottom-color: #e4ebf3;
}

.ticket-table tbody tr:hover,
.calendar-ticket:hover,
.mail-message-openable:hover,
.mail-account-item:hover {
    background: #f5f9ff;
}

.ticket-id,
.calendar-date,
.mail-message-meta a {
    color: #135bab;
}

.subject {
    color: var(--km-text);
}

.ticket-meta,
.mail-message-meta,
.mail-folder-label {
    color: var(--km-muted);
}

.ticket-select-control,
.mail-message-select,
.mail-star-button,
.pin-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-color: #cfdae7;
    border-radius: 5px;
    box-shadow: none;
}

.mail-search-form {
    padding: 12px 14px;
    border-bottom-color: var(--km-border);
    background: #f8fafd;
}

.mail-message-item {
    min-height: 61px;
    padding: 12px 14px;
    border-bottom-color: #e4ebf3;
}

.mail-message-item.is-unread {
    background: #edf5ff;
    box-shadow: inset 3px 0 0 #2d73c9;
}

.mail-message-sender {
    color: var(--km-text);
}

.mail-status {
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
}

.mail-account-item,
.calendar-ticket {
    border-bottom-color: #e4ebf3;
}

.mail-account-item strong {
    color: var(--km-text);
}

.mail-account-address,
.mail-account-status {
    color: var(--km-muted);
}

/* Editory a detail ticketu/e-mailu. */
.mail-compose-form,
.reply-card,
.message,
.ticket-properties,
.mail-message-detail {
    border-color: var(--km-border);
    border-radius: 7px;
    box-shadow: 0 1px 3px rgba(20, 47, 87, .05);
}

.mail-compose-form {
    gap: 14px;
    padding: 20px;
}

.mail-compose-form label > span,
.reply-row label,
.reply-ticket-edit-grid label {
    color: #4f6279;
    font-size: 12px;
}

.mail-compose-form input,
.mail-compose-form textarea,
.reply-row input,
.reply-row select,
.property-control,
.reply-ticket-edit-grid input,
.reply-ticket-edit-grid select {
    border-color: #cbd7e5;
    border-radius: 5px;
    color: var(--km-text);
}

.recipient-disclosure summary,
.properties-edit {
    color: #135bab;
}

.rich-text-toolbar {
    padding: 6px 8px;
    border-color: #cbd7e5;
    background: #f6f9fd;
}

.rich-text-toolbar button {
    color: #29425f;
}

.rich-text-toolbar button:hover,
.rich-text-toolbar button:focus-visible {
    border-color: #a8bfdc;
    background: #e5f0fd;
}

.rich-text-editor {
    border-color: #cbd7e5;
    background: #fff;
}

.personal-mail-editor-tools button,
.personal-mail-attachment-item button,
.attachment-preview-card button {
    border-color: #cbd7e5;
    color: #264869;
}

.mail-signature-preview,
.signature-preview {
    border-top-color: #dce5ef;
    border-left-color: #8ab1df;
    background: #f8fbff;
}

.mail-compose-actions,
.reply-actions {
    margin-top: 2px;
    padding-top: 13px;
    border-top-color: #dce5ef;
}

.ticket-tabs {
    gap: 6px;
    margin-bottom: 12px;
}

.ticket-tab {
    border-color: #cbd7e5;
    border-radius: 5px;
    color: #41556e;
}

.ticket-tab.active {
    border-color: #9dbce0;
    background: #eaf3ff;
    color: #0f4f97;
}

.reply-card {
    padding: 15px;
}

.message-header {
    border-bottom-color: #dce5ef;
    background: #f5f8fc;
    color: #243a56;
}

.message-customer {
    border-left-color: #3177c5;
}

.message-agent {
    border-left-color: #299267;
}

.message-address,
.message-time {
    color: var(--km-muted);
}

.attachment,
.attachment-preview-card,
.message-attachment-card {
    border-color: #d3dfec;
    border-radius: 5px;
    background: #fbfdff;
}

.attachment {
    color: #135bab;
}

.ticket-properties {
    padding: 15px;
}

.properties-header {
    border-bottom-color: #dce5ef;
}

.property-group label {
    color: #53677e;
}

.property-value {
    border-color: #d6e0eb;
    border-radius: 5px;
    background: #f8fafd;
}

.reply-ticket-edit {
    border-color: #ccdbea;
    border-radius: 6px;
    background: #f8fbff;
}

.reply-ticket-edit summary {
    color: #174f88;
}

.reply-ticket-edit[open] summary {
    border-bottom-color: #ccdbea;
}

/* Vedlejší pracovní obrazovky: administrace, adresář a plánování. */
.admin-card,
.admin-form-section,
.card,
.calendar-board,
.deadline-modal-content,
.draft-modal-content,
.attachment-choice-panel,
.notifications-card {
    border-color: var(--km-border);
    border-radius: 7px;
    box-shadow: 0 1px 3px rgba(20, 47, 87, .05);
}

.admin-card,
.admin-form-section {
    background: var(--km-surface);
}

.admin-card h2,
.admin-form-section h2,
.calendar-board-header h2 {
    color: var(--km-text);
}

.admin-user-row,
.admin-role-list-row,
.admin-group-row,
.contacts-table td {
    border-bottom-color: #e4ebf3;
}

.admin-user-row:hover,
.admin-role-list-row:hover,
.admin-group-row:hover,
.contacts-table tbody tr:hover {
    background: #f5f9ff;
}

.admin-chip,
.ticket-tag,
.list-tag {
    background: #eaf3ff;
    color: #195a9f;
}

.admin-form-grid label > span,
.form-group label,
.contact-form .admin-form-grid label > span {
    color: #4f6279;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-group-row select,
.form-group input,
.form-group select,
.contact-form .admin-form-grid input,
.contacts-search input {
    border-color: #cbd7e5;
    border-radius: 5px;
    color: var(--km-text);
}

.admin-option-card,
.admin-permission-card,
.admin-form-grid .mail-account-shared-users label,
.admin-group-email-row {
    border-color: #d3dfec;
    border-radius: 6px;
    background: #fbfdff;
}

.admin-option-card:hover,
.admin-permission-card:hover,
.admin-form-grid .mail-account-shared-users label:hover {
    background: #f3f8ff;
    border-color: #b7cce5;
}

.contacts-search {
    border-bottom-color: var(--km-border);
    background: #f8fafd;
}

.contacts-table th {
    border-bottom-color: var(--km-border);
    background: #f5f8fc;
    color: #50647d;
    font-size: 11px;
}

.contacts-table td a[href^="mailto:"] {
    color: #135bab;
}

.calendar-board-header,
.calendar-header {
    border-bottom-color: var(--km-border);
    background: #f6f9fd;
}

.calendar-month:first-child,
.calendar-weekdays,
.calendar-days,
.calendar-day {
    border-color: #dce5ef;
}

.calendar-day:hover,
.deadline-day:hover {
    border-color: #a9c5e5;
    background: #edf5ff;
}

.calendar-day-selected,
.deadline-day-selected {
    border-color: #135bab;
    background: #135bab;
}

.deadline-modal,
.draft-modal {
    background: rgba(7, 27, 57, .48);
}

.deadline-modal-header,
.deadline-modal-actions {
    border-color: var(--km-border);
    background: #f6f9fd;
}

.deadline-calendar-toolbar,
.deadline-time-row,
.deadline-settings-row {
    border-color: var(--km-border);
}

.notification-toast {
    border-color: #c9d8e8;
    border-radius: 7px;
    box-shadow: 0 10px 30px rgba(10, 37, 73, .20);
}

.notification-toast-title {
    color: var(--km-text);
}

.notification-toast-open,
.notification-ticket-link {
    color: #135bab;
}

.login-page {
    background: linear-gradient(135deg, #edf3fa, #f7f9fc);
}

.login-card {
    border-color: var(--km-border);
    box-shadow: 0 10px 32px rgba(20, 47, 87, .10);
}

.login-brand {
    color: var(--km-navy);
}

/* Rychlý náhled poslední zprávy v seznamu ticketů. */
.ticket-hover-preview {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 400;
    width: min(760px, calc(100vw - 28px));
    height: min(72vh, calc(100vh - 28px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 15px 16px;
    border: 1px solid #b9d2ea;
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(10, 37, 73, .24);
    color: var(--km-text);
    pointer-events: auto;
}

.ticket-preview-actions {
    position: absolute;
    top: 15px;
    right: 16px;
}

.ticket-hover-preview-heading {
    padding-right: 220px;
    min-height: 32px;
}

.ticket-hover-preview[hidden],
.message-hover-preview[hidden] {
    display: none !important;
}

.ticket-hover-preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ticket-hover-preview-heading strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-hover-preview-heading > div:first-child {
    min-width: 0;
}

.ticket-hover-preview-heading span,
.ticket-hover-preview-email {
    color: var(--km-muted);
    font-size: 12px;
}

.ticket-hover-preview-heading span {
    flex: 0 0 auto;
}

.ticket-hover-preview-email {
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-hover-preview-subject {
    display: block;
    margin-top: 12px;
    color: #174f88;
    font-size: 13px;
}

.hover-preview-body {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 8px;
    padding-right: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    color: #31455d;
    line-height: 1.5;
    white-space: pre-wrap;
}

.hover-preview-body.is-html {
    white-space: normal;
}

.hover-preview-body > :first-child { margin-top: 0; }
.hover-preview-body > :last-child { margin-bottom: 0; }
.hover-preview-body img { max-width: 100%; height: auto; }
.hover-preview-body table { max-width: 100%; border-collapse: collapse; }
.hover-preview-body td,
.hover-preview-body th { overflow-wrap: anywhere; }

.hover-preview-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.hover-preview-actions .btn {
    padding: 6px 9px;
    font-size: 12px;
}

/* Interní komentáře v detailu ticketu. */
.internal-comments {
    display: grid;
    gap: 14px;
}

.internal-comment-form,
.internal-comment {
    padding: 15px;
    border: 1px solid var(--km-border);
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(20, 47, 87, .05);
}

.internal-comment-form label {
    display: block;
    margin-bottom: 7px;
    color: #4f6279;
    font-size: 12px;
    font-weight: 700;
}

.internal-comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #cbd7e5;
    border-radius: 5px;
    color: var(--km-text);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.internal-comment-editor {
    min-height: 170px;
}

.internal-comment-mention-hint {
    margin-top: 7px;
    color: var(--km-muted);
    font-size: 12px;
}

.internal-mention {
    color: inherit;
    font-weight: inherit;
}

.internal-mention-menu {
    position: absolute;
    z-index: 60;
    left: 14px;
    bottom: 56px;
    display: grid;
    width: min(320px, calc(100% - 28px));
    overflow: hidden;
    border: 1px solid #b9cbe0;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(20, 47, 87, .18);
}

.internal-mention-menu button {
    padding: 9px 11px;
    border: 0;
    border-bottom: 1px solid #e3ebf4;
    background: #ffffff;
    color: #214568;
    text-align: left;
    cursor: pointer;
}

.internal-mention-menu button:last-child { border-bottom: 0; }
.internal-mention-menu button:hover { background: #edf5ff; }

.ticket-merge-bulk {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.ticket-merge-bulk input {
    width: 132px;
}

.ticket-merge-detail {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    text-align: left;
}

.ticket-merge-detail summary {
    display: inline-flex;
    cursor: pointer;
    color: #1559a6;
    font-weight: 600;
}

.ticket-merge-detail form {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    right: 0;
    width: min(460px, 80vw);
    padding: 16px;
    border: 1px solid #bfd4ec;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(20, 47, 87, .18);
}

.ticket-merge-detail label,
.ticket-merge-detail input {
    display: block;
    width: 100%;
}

.ticket-merge-detail label { margin-bottom: 5px; font-weight: 700; }
.ticket-merge-detail input { margin-bottom: 10px; }
.ticket-merge-detail p { color: #8a2a2a; font-size: 13px; line-height: 1.4; }
.ticket-merge-detail form .btn + .btn { margin-left: 7px; }

.ticket-merge-error {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #f1b7b7;
    border-radius: 6px;
    background: #fff0f0;
    color: #8a2020;
}

.contacts-tabs {
    display: flex;
    gap: 7px;
    margin: 0 0 12px;
}

.contacts-tabs a {
    padding: 8px 12px;
    border: 1px solid #c8d8ea;
    border-radius: 6px;
    color: #1559a6;
    text-decoration: none;
}

.contacts-tabs a.active {
    border-color: #1559a6;
    background: #eaf3ff;
    font-weight: 700;
}

.internal-comment-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.internal-comment-attachment-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: #64748b;
    font-size: 12px;
}

.internal-comment-attachment-drop {
    min-height: 16px;
    margin-top: 8px;
    padding: 6px;
    border: 1px dashed transparent;
    border-radius: 6px;
}

.internal-comment-attachment-drop.is-dragging {
    border-color: #6ea0d6;
    background: #f0f6fd;
}

.internal-comment-attachment-row,
.internal-comment-attachments {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.internal-comment-attachment-row {
    justify-content: space-between;
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
}

.internal-comment-attachments {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
}

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

.internal-comment header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid #e2eaf3;
}

.internal-comment header span {
    color: var(--km-muted);
    font-size: 12px;
    white-space: nowrap;
}

.internal-comment-body {
    padding-top: 10px;
    color: #31455d;
    line-height: 1.55;
    white-space: pre-wrap;
}

/* Jednoduché osobní nastavení upozornění. */
.notification-settings-form {
    display: grid;
    gap: 16px;
    max-width: 1240px;
}

.notification-settings-card {
    padding: 18px;
    border: 1px solid var(--km-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(20, 47, 87, .05);
}

.notification-settings-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.notification-settings-heading h2 {
    margin: 0;
    color: var(--km-text);
    font-size: 17px;
}

.notification-settings-heading p,
.notification-settings-empty {
    margin: 5px 0 0;
    color: var(--km-muted);
    font-size: 13px;
    line-height: 1.45;
}

.notification-settings-grid {
    display: grid;
    align-items: stretch;
    overflow-x: auto;
    border: 1px solid #dce6f1;
    border-radius: 6px;
}

.notification-settings-grid-personal {
    grid-template-columns: minmax(230px, 1fr) repeat(3, minmax(120px, .32fr));
}

.notification-settings-grid-direct,
.notification-settings-grid-group {
    grid-template-columns: minmax(250px, 1fr) repeat(4, minmax(118px, .28fr));
}

.notification-settings-grid > div,
.notification-settings-grid > label {
    min-height: 54px;
    padding: 10px 12px;
    border-right: 1px solid #e3ebf4;
    border-bottom: 1px solid #e3ebf4;
}

.notification-settings-grid > :nth-last-child(-n + 4),
.notification-settings-grid-personal > :nth-last-child(-n + 3) {
    border-bottom: 0;
}

.notification-settings-grid > div:nth-child(n),
.notification-settings-grid > label:nth-child(n) {
    display: flex;
    align-items: center;
}

.notification-settings-grid-heading {
    background: #f3f8fd;
    color: #4f6279;
    font-size: 12px;
    font-weight: 700;
}

.notification-setting-name {
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: center;
    gap: 3px;
}

.notification-setting-name span {
    color: var(--km-muted);
    font-size: 12px;
}

.notification-toggle {
    justify-content: center;
    cursor: pointer;
}

.notification-toggle input {
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.notification-group-settings {
    margin-top: 10px;
    border: 1px solid #dce6f1;
    border-radius: 6px;
}

.notification-group-settings summary {
    padding: 11px 13px;
    color: var(--km-text);
    font-weight: 700;
    cursor: pointer;
}

.notification-group-settings .notification-settings-grid {
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
}

.notification-settings-actions {
    display: flex;
    justify-content: flex-end;
}

.notification-settings-saved {
    padding: 11px 14px;
    border: 1px solid #a7d7bb;
    border-radius: 6px;
    background: #eefaf1;
    color: #23633a;
}

.ticket-rule-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

#ticket-rules {
    max-width: 1240px;
    margin-top: 16px;
}

.ticket-rule-form {
    display: grid;
    grid-template-columns: minmax(150px, .8fr) minmax(210px, 1fr) minmax(210px, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid #dce6f1;
    border-radius: 7px;
    background: #f9fbfd;
}

.ticket-rule-form.is-inactive {
    opacity: .68;
}

.ticket-rule-form label:not(.notification-rule-active) {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #53677e;
    font-size: 12px;
}

.ticket-rule-form input[type="text"],
.ticket-rule-form input[type="email"] {
    width: 100%;
}

.notification-rule-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    white-space: nowrap;
}

.ticket-rule-actions {
    display: flex;
    gap: 7px;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.ticket-rule-summary {
    grid-column: 1 / -1;
    color: var(--km-muted);
    font-size: 12px;
}

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

@media (max-width: 760px) {
    .notification-settings-heading {
        flex-direction: column;
    }

    .notification-settings-grid-personal {
        grid-template-columns: minmax(210px, 1fr) repeat(3, 110px);
    }

    .notification-settings-grid-direct,
    .notification-settings-grid-group {
        grid-template-columns: minmax(220px, 1fr) repeat(4, 110px);
    }
}

.message-hover-preview {
    position: fixed;
    z-index: 400;
    width: min(760px, calc(100vw - 28px));
    height: min(72vh, calc(100vh - 28px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 15px 16px;
    border: 1px solid #b9d2ea;
    border-radius: 7px;
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(10, 37, 73, .24);
    color: var(--km-text);
    pointer-events: auto;
}

.message-hover-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.message-hover-preview-heading > div:first-child { min-width: 0; }
.message-hover-preview-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-hover-preview-heading span,
.message-hover-preview-email { color: var(--km-muted); font-size: 12px; }
.message-hover-preview-heading span { flex: 0 0 auto; }
.message-hover-preview-email { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-hover-preview-subject { display: block; margin-top: 12px; color: #174f88; font-size: 13px; }

@media (hover: none), (max-width: 900px) {
    .message-hover-preview.is-touch-preview:not([hidden]) {
        display: flex;
        position: fixed;
        z-index: 1500;
        top: 12px !important;
        right: 12px;
        bottom: 12px;
        left: 12px !important;
        width: auto;
        max-height: none;
    }

    .ticket-hover-preview.is-touch-preview:not([hidden]) {
        display: flex;
        position: fixed;
        z-index: 1500;
        top: 12px !important;
        right: 12px;
        bottom: 12px;
        left: 12px !important;
        width: auto;
        max-height: none;
        min-height: 0;
    }

    .ticket-hover-preview.is-touch-preview .ticket-hover-preview-heading {
        padding-right: 0;
        min-height: 0;
    }

    .ticket-hover-preview.is-touch-preview .ticket-preview-actions {
        position: static;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        flex: 0 0 auto;
        margin: 10px -16px -15px;
        padding: 8px 16px max(8px, env(safe-area-inset-bottom));
        border-top: 1px solid #d7e2ee;
        background: #f8fbff;
    }

    .ticket-hover-preview.is-touch-preview .ticket-preview-actions .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 44px;
        padding: 8px 6px;
        font-size: 13px;
    }
}

.mobile-ticket-preview { display: none; }
@keyframes mail-sync-progress { from { transform: translateX(-115%); } to { transform: translateX(365%); } }

/* =========================================================
   RESPONZIVNÍ APLIKAČNÍ SHELL
   ========================================================= */

.mobile-nav-toggle,
.sidebar-mobile-header,
.sidebar-backdrop,
.topbar-action-short {
    display: none;
}

html,
body {
    max-width: 100%;
}

.app-shell,
.content,
.ticket-detail-page,
.ticket-layout,
.ticket-main {
    min-width: 0;
}

@media (max-width: 800px) {
    .mobile-ticket-preview { display: inline-flex; min-height: 40px; align-items: center; margin-top: 7px; padding: 5px 10px; border: 1px solid #b9d3f0; border-radius: 5px; background: #f3f8ff; color: #174f88; font-weight: 700; }
    .ticket-table .ticket-row > td:nth-child(11) { display: none; }
    .sidebar .brand {
        margin: -3px 0 10px;
        padding: 5px 9px;
        width: max-content;
        border: 1px solid rgba(255, 255, 255, .24);
        border-radius: 5px;
        background: rgba(255, 255, 255, .10);
        color: #fff;
        font-size: 13px;
    }
    .sidebar .brand-full { display: none; }
    .sidebar .brand-short { display: inline; }
    body {
        overflow-x: hidden;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .app-shell {
        width: 100%;
        margin-left: 0;
    }

    .sidebar {
        z-index: 1400;
        width: min(310px, calc(100vw - 46px));
        max-width: 100%;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 10px 0 30px rgba(4, 25, 52, .28);
    }

    body.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: -4px 0 10px;
        color: rgba(255, 255, 255, .75);
        font-size: 12px;
        letter-spacing: .5px;
        text-transform: uppercase;
    }

    .sidebar-close,
    .mobile-nav-toggle {
        display: inline-grid;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, .28);
        border-radius: 6px;
        background: transparent;
        color: inherit;
        cursor: pointer;
        font-size: 24px;
        line-height: 1;
    }

    .mobile-nav-toggle {
        border-color: #a9c9e5;
        background: rgba(255, 255, 255, .78);
        color: var(--km-navy);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 1390;
        inset: 0;
        display: block;
        visibility: hidden;
        border: 0;
        background: rgba(4, 21, 45, .52);
        opacity: 0;
        transition: opacity .2s ease, visibility .2s ease;
    }

    body.mobile-nav-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
    }

    .topbar {
        height: auto;
        min-height: 62px;
        padding: 9px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .topbar .search-box {
        order: 3;
        width: 100%;
        max-width: none;
        flex-basis: 100%;
    }

    .topbar .search-box input {
        min-height: 42px;
    }

    .topbar-actions {
        min-width: 0;
        flex: 1;
        justify-content: flex-end;
        gap: 5px;
    }

    .topbar-actions .btn,
    .user-box {
        min-height: 44px;
        padding: 8px 10px;
    }

    .topbar-history-button,
    .notification-top-button {
        min-width: 44px;
    }

    .topbar-action-full {
        display: none;
    }

    .topbar-action-short {
        display: inline;
    }

    .user-box {
        max-width: 44px;
        overflow: hidden;
        color: transparent;
        white-space: nowrap;
    }

    .user-box span {
        color: var(--km-navy);
        font-size: 18px;
    }

    .recent-tickets-popover,
    .notification-preview-popover,
    .user-menu-popover {
        position: fixed;
        top: 118px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
    }

    .content,
    .ticket-detail-page {
        width: 100%;
        padding: 16px 12px 28px;
    }

    .page-header,
    .ticket-detail-header {
        gap: 12px;
        flex-direction: column;
    }

    .page-header h1,
    .ticket-detail-header h1 {
        overflow-wrap: anywhere;
        font-size: 23px;
    }

    .page-header > .btn,
    .ticket-detail-header > .btn {
        width: 100%;
        min-height: 44px;
        text-align: center;
    }

    .view-switch {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }

    .view-switch .btn {
        text-align: center;
    }
}

@media (max-width: 390px) {
    .topbar {
        padding-right: 8px;
        padding-left: 8px;
    }

    .topbar-actions {
        gap: 3px;
    }

    .topbar-actions .btn {
        padding-right: 8px;
        padding-left: 8px;
    }
}

/* =========================================================
   MOBILNÍ SEZNAM TICKETŮ A FILTRY
   ========================================================= */

.mobile-filter-disclosure > summary {
    display: none;
}

@media (max-width: 800px) {
    .mobile-filter-disclosure {
        margin-bottom: 14px;
    }

    .mobile-filter-disclosure > summary {
        display: flex;
        min-height: 46px;
        align-items: center;
        justify-content: space-between;
        padding: 10px 13px;
        border: 1px solid var(--km-border);
        border-radius: 7px;
        background: #fff;
        color: var(--km-navy);
        font-weight: 700;
        cursor: pointer;
        list-style: none;
    }

    .mobile-filter-disclosure > summary::-webkit-details-marker {
        display: none;
    }

    .mobile-filter-disclosure > summary::after {
        content: "⌄";
        margin-left: 8px;
        font-size: 18px;
    }

    .mobile-filter-disclosure[open] > summary {
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
    }

    .mobile-filter-disclosure[open] > summary::after {
        transform: rotate(180deg);
    }

    .mobile-filter-status {
        margin-left: auto;
        padding: 2px 8px;
        border-radius: 999px;
        background: #eaf3ff;
        color: #1559a6;
        font-size: 11px;
    }

    .mobile-filter-disclosure .filter-panel {
        margin: 0;
        padding: 12px;
        border-top: 0;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    .filter-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .filter-row input,
    .filter-row select,
    .filter-row .btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }

    .ticket-card {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .ticket-table,
    .ticket-table tbody {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .ticket-table thead {
        display: none;
    }

    .ticket-table tbody {
        display: grid;
        gap: 12px;
    }

    .ticket-table .ticket-row {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        gap: 8px 10px;
        padding: 12px;
        border: 1px solid var(--km-border);
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(20, 47, 87, .06);
    }

    .ticket-table .ticket-row > td {
        display: grid;
        min-width: 0;
        grid-template-columns: 98px minmax(0, 1fr);
        gap: 8px;
        align-items: baseline;
        padding: 3px 0;
        border: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .ticket-table .ticket-row > td::before {
        content: attr(data-label);
        color: var(--km-muted);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .2px;
        text-transform: uppercase;
    }

    .ticket-table .ticket-row > td:nth-child(1),
    .ticket-table .ticket-row > td:nth-child(2),
    .ticket-table .ticket-row > td:nth-child(3),
    .ticket-table .ticket-row > td:nth-child(4) {
        display: flex;
        width: auto;
        align-items: center;
        padding: 0;
    }

    .ticket-table .ticket-row > td:nth-child(1)::before,
    .ticket-table .ticket-row > td:nth-child(2)::before,
    .ticket-table .ticket-row > td:nth-child(3)::before,
    .ticket-table .ticket-row > td:nth-child(4)::before {
        display: none;
    }

    .ticket-table .ticket-row > td:nth-child(3) {
        font-size: 13px;
    }

    .ticket-table .ticket-row > td:nth-child(4) {
        justify-content: flex-end;
    }

    .ticket-table .ticket-row > td:nth-child(n + 5) {
        grid-column: 1 / -1;
    }

    .ticket-table .ticket-row > td:nth-child(5) {
        display: block;
        padding: 8px 0 6px;
        border-top: 1px solid #e4ebf3;
        font-size: 16px;
    }

    .ticket-table .ticket-row > td:nth-child(5)::before {
        display: none;
    }

    .ticket-table .subject {
        margin-bottom: 3px;
        font-size: 16px;
        line-height: 1.35;
        display: flex;
        align-items: flex-start;
        gap: 8px;
    }
    .ticket-table .subject a {
        display: -webkit-box;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    .ticket-table .mobile-ticket-preview { flex: 0 0 auto; margin: 0; }
    .ticket-table .ticket-row > td:nth-child(6),
    .ticket-table .ticket-row > td:nth-child(7),
    .ticket-table .ticket-row > td:nth-child(8),
    .ticket-table .ticket-row > td:nth-child(9),
    .ticket-table .ticket-row > td:nth-child(10),
    .ticket-table .ticket-row > td:nth-child(12) {
        display: block;
        grid-column: span 2;
        padding: 0;
        font-size: 12px;
        line-height: 1.35;
    }
    .ticket-table .ticket-row > td:nth-child(6)::before,
    .ticket-table .ticket-row > td:nth-child(7)::before,
    .ticket-table .ticket-row > td:nth-child(8)::before,
    .ticket-table .ticket-row > td:nth-child(9)::before,
    .ticket-table .ticket-row > td:nth-child(10)::before,
    .ticket-table .ticket-row > td:nth-child(12)::before { display: inline; margin-right: 4px; font-size: 10px; }

    .ticket-table .ticket-meta {
        white-space: normal;
    }

    .ticket-table .empty-ticket-list {
        display: flex;
        min-height: 140px;
        flex-direction: column;
        justify-content: center;
        border: 1px solid var(--km-border);
        border-radius: 8px;
        background: #fff;
    }

    .ticket-table .empty-ticket-list::before {
        display: none;
    }

    .bulk-actions {
        display: none;
        margin-bottom: 12px;
        border: 1px solid var(--km-border);
        border-radius: 8px;
    }

    .bulk-actions.has-selection {
        display: grid;
        grid-template-columns: 1fr;
    }

    .bulk-actions select,
    .bulk-actions .btn,
    .ticket-merge-bulk,
    .ticket-merge-bulk input {
        width: 100%;
        min-height: 44px;
        margin-left: 0;
    }

    .ticket-merge-bulk {
        display: grid;
    }

    .ticket-select-control,
    .pin-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* =========================================================
   MOBILNÍ DETAIL TICKETU A EDITORY
   ========================================================= */

.message-body,
.message-body-html,
.mail-message-html,
.previous-email-content,
.email-signature-preview,
.mail-signature-preview,
.signature-preview {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.message-body img,
.message-body-html img,
.mail-message-html img,
.previous-email-content img,
.email-signature-preview img,
.mail-signature-preview img,
.signature-preview img {
    max-width: 100% !important;
    height: auto !important;
}

.message-body table,
.message-body-html table,
.mail-message-html table,
.previous-email-content table,
.email-signature-preview table,
.mail-signature-preview table,
.signature-preview table,
.rich-text-editor table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 800px) {
    .ticket-layout {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .ticket-main,
    .ticket-properties,
    .reply-card,
    .message,
    .conversation {
        width: 100%;
        min-width: 0;
    }

    .ticket-detail-header > div:last-child {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    .ticket-detail-header .ticket-header-actions { justify-content: space-between; }
    .ticket-header-actions > .btn,
    .ticket-header-actions > .ticket-secondary-toggle { flex: 0 0 auto !important; width: auto !important; min-height: 44px; }
    .ticket-back-desktop { display: none; }
    .ticket-back-mobile,
    .ticket-secondary-toggle { display: inline; }
    .ticket-secondary-actions {
        display: none;
        width: 100%;
        padding: 8px;
        border: 1px solid var(--km-border);
        border-radius: 6px;
        background: #fff;
    }
    .ticket-secondary-actions.is-open { display: grid; gap: 7px; }
    .ticket-secondary-actions > form,
    .ticket-secondary-actions > details { margin: 0; width: 100%; }
    .ticket-secondary-actions .btn,
    .ticket-secondary-actions .ticket-merge-detail > summary { width: 100%; min-height: 44px; }

    .ticket-detail-header > div:last-child > .btn,
    .ticket-detail-header > div:last-child > form,
    .ticket-detail-header > div:last-child > details {
        flex: 1 1 150px;
        margin: 0;
    }

    .ticket-detail-header > div:last-child .btn,
    .ticket-merge-detail > summary {
        display: flex;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .ticket-merge-detail form {
        position: fixed;
        z-index: 1300;
        top: 76px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100dvh - 88px);
        overflow-y: auto;
    }

    .ticket-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ticket-tab {
        min-height: 44px;
        padding: 8px;
    }

    .reply-card,
    .ticket-properties,
    .internal-comment-form,
    .internal-comment {
        padding: 12px;
    }

    .reply-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .reply-row input,
    .reply-row select,
    .property-control,
    .reply-ticket-edit-grid input,
    .reply-ticket-edit-grid select {
        min-height: 44px;
        font-size: 16px;
    }

    .reply-toolbar,
    .personal-mail-editor-tools {
        flex-wrap: wrap;
    }

    .reply-toolbar button,
    .personal-mail-editor-tools button {
        min-width: 44px;
        min-height: 44px;
    }

    .rich-text-toolbar {
        flex-wrap: nowrap;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .rich-text-toolbar button {
        min-width: 42px;
        min-height: 42px;
        flex: 0 0 42px;
    }

    .rich-text-palette {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        max-height: min(70dvh, 420px);
        overflow-y: auto;
    }

    .rich-text-editor {
        width: 100%;
        min-height: 220px;
        font-size: 16px;
    }

    .reply-actions,
    .mail-compose-actions {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .reply-actions {
        grid-template-columns: auto minmax(0, 1fr) 36px;
        grid-template-areas: "label status send" "close close draft";
        column-gap: 4px;
        row-gap: 3px;
        margin-top: 2px;
        padding-top: 4px;
        padding-bottom: 2px;
    }
    .reply-card .reply-actions { padding-bottom: 2px; }

    .reply-actions .after-send-status-label { display: block; grid-area: label; align-self: center; font-size: 11px; font-weight: 700; white-space: nowrap; }
    .reply-actions #send-email-button { grid-area: send; }
    .reply-actions .after-send-status { grid-area: status; }
    .reply-actions #send-close-button { grid-area: close; border-color: #9ab5d1; background: #fff; color: #174f88; }
    .reply-actions #save-draft-button { grid-area: draft; color: #52677d; }
    .reply-actions .draft-save-label { display: none; }
    .reply-actions .draft-save-icon { display: block; width: 15px; height: 15px; }
    .reply-actions .reply-label-desktop { display: none; }
    .reply-actions .reply-label-mobile { display: inline; }
    .reply-actions #send-email-button { font-size: 19px; padding: 0; }

    .reply-actions .btn,
    .reply-actions .after-send-status {
        width: 100%;
        min-width: 0;
    }
    .mail-compose-actions .btn { width: 100%; min-width: 0; min-height: 46px; }

    .reply-actions #send-email-button,
    .reply-actions .after-send-status { height: 36px; min-height: 36px; }
    .reply-actions .after-send-status { padding: 3px 5px; font-size: 12px; }
    .reply-actions #send-close-button,
    .reply-actions #save-draft-button { height: 36px; min-height: 36px; padding: 4px 7px; font-size: 12px; line-height: 1.2; }
    .reply-actions #save-draft-button { display: flex; align-items: center; justify-content: center; justify-self: end; width: 36px; padding: 0; }

    .draft-attachments,
    .message-attachments,
    .attachments {
        display: grid;
        grid-template-columns: 1fr;
    }

    .attachment-preview-card,
    .message-attachment-card,
    .attachment {
        width: 100%;
        min-width: 0;
    }

    .attachment-preview-name,
    .message-address,
    .message-recipient,
    .property-secondary {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .message-header-right {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .message-actions {
        width: 100%;
        gap: 4px 12px;
    }

    .message-action-button {
        min-height: 40px;
        white-space: normal;
        text-align: left;
    }

    .message-body,
    .mail-message-body,
    .mail-message-html {
        padding: 14px 12px;
    }

    .ticket-properties {
        position: static;
        order: 2;
    }

    .properties-edit,
    .deadline-open-button,
    .tag-add {
        min-height: 44px;
    }

    .internal-comment-form-actions {
        justify-content: stretch;
    }

    .internal-comment-form-actions .btn {
        flex: 1;
        min-height: 44px;
    }

    .internal-comment header {
        flex-direction: column;
    }
}

/* =========================================================
   MOBILNÍ OSOBNÍ POŠTA
   ========================================================= */

@media (max-width: 800px) {
    .mail-inbox-card,
    .mail-overview-card,
    .mail-message-detail,
    .mail-compose-form {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .mail-search-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }

    .mail-search-form input,
    .mail-search-form select,
    .mail-search-form .btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }

    .mail-bulk-actions {
        display: none;
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .mail-bulk-actions.has-selection {
        display: grid;
    }

    .mail-bulk-actions .btn,
    .mail-bulk-actions select {
        width: 100%;
        min-height: 44px;
    }

    .mail-message-list {
        gap: 0;
    }

    .mail-message-item {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr);
        gap: 6px 9px;
        min-width: 0;
        padding: 12px;
    }

    .mail-message-item .mail-message-select {
        grid-column: 1;
        grid-row: 1;
    }

    .mail-message-item .mail-star-button {
        grid-column: 2;
        grid-row: 1;
    }

    .mail-message-item .mail-message-sender {
        grid-column: 3;
        grid-row: 1;
        align-self: center;
    }

    .mail-message-item .mail-message-subject {
        grid-column: 1 / -1;
        grid-row: 2;
        padding-top: 4px;
        color: var(--km-text);
        font-size: 15px;
        line-height: 1.35;
    }

    .mail-message-item .mail-message-meta {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-content: flex-start;
    }

    .mail-message-sender,
    .mail-message-subject {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mail-message-select,
    .mail-star-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .mail-sent-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .mail-sent-item .mail-message-sender {
        grid-column: 1;
        grid-row: 1;
    }

    .mail-sent-item .mail-message-subject {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .mail-sent-item .mail-message-meta {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .mail-compose-form {
        padding: 12px;
    }

    .mail-compose-form input,
    .mail-compose-form textarea {
        min-height: 44px;
        font-size: 16px;
    }

    .personal-mail-editor-tools {
        display: grid;
        grid-template-columns: 1fr;
    }

    .mail-message-details {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px 12px;
    }

    .mail-detail-actions {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }
    .mail-detail-secondary-actions { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
    .mail-detail-secondary-actions .inline-form { min-width: 0; }
    .mail-detail-secondary-actions .btn { padding: 7px 3px; font-size: 11px; white-space: normal; }

    .mail-detail-actions .btn,
    .page-header > .inline-form,
    .page-header > .inline-form .btn {
        width: 100%;
        min-height: 44px;
        text-align: center;
    }

    .mail-attachments {
        padding: 0 12px 16px;
    }

    .mail-attachments li,
    .mail-attachments a {
        overflow-wrap: anywhere;
    }

    .mail-pagination {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mail-pagination .btn {
        min-height: 44px;
        text-align: center;
    }

    .mail-account-item,
    .mail-draft-item,
    .mail-folder-manager-item,
    .mail-rule-item {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 14px 12px;
    }

    .mail-rule-buttons,
    .mail-folder-rename-form,
    .mail-folder-order-form {
        width: 100%;
        flex-wrap: wrap;
    }

    .mail-rule-buttons .btn,
    .mail-folder-manager-item > form:not(.mail-folder-order-form),
    .mail-folder-manager-item > form:not(.mail-folder-order-form) .btn,
    .mail-folder-manager-item > form:not(.mail-folder-order-form) input {
        width: 100%;
        min-height: 44px;
    }

    .mail-folder-manager-item > a {
        min-width: 0;
        white-space: normal;
    }

    .mail-folder-order-form .btn {
        min-width: 44px;
        min-height: 44px;
        flex: 1;
    }
}

/* =========================================================
   MOBILNÍ DOPLŇKOVÉ OBRAZOVKY, MODALY A DOTYK
   ========================================================= */

@media (max-width: 800px) {
    .admin-card,
    .admin-form-section,
    .notification-settings-card,
    .card {
        max-width: 100%;
        min-width: 0;
        padding: 14px 12px;
    }

    .admin-form-grid,
    .admin-role-grid,
    .admin-permission-grid,
    .contact-form .admin-form-grid,
    .prepared-response-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .ticket-rule-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .ticket-rule-actions,
    .ticket-rule-summary {
        grid-column: 1;
    }

    .ticket-rule-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .ticket-rule-actions .btn {
        flex: 1 1 120px;
    }

    .admin-form-grid input,
    .admin-form-grid select,
    .admin-form-grid textarea,
    .form-group input,
    .form-group select,
    .form-group textarea,
    .contact-form input,
    .prepared-response-filters input,
    .prepared-response-filters select,
    .prepared-response-form input,
    .prepared-response-form select,
    .prepared-response-form textarea {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        font-size: 16px;
    }

    .admin-form-actions,
    .contact-form-actions,
    .mail-account-form .form-actions,
    .prepared-response-actions,
    .prepared-response-modal-actions,
    .deadline-modal-actions,
    .draft-modal-actions,
    .attachment-choice-actions {
        display: grid;
        position: static;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .admin-form-actions .btn,
    .contact-form-actions .btn,
    .mail-account-form .form-actions .btn,
    .prepared-response-actions .btn,
    .prepared-response-modal-actions .btn,
    .deadline-modal-actions .btn,
    .draft-modal-actions button,
    .attachment-choice-actions button {
        width: 100%;
        min-height: 46px;
        text-align: center;
    }

    .admin-user-row,
    .admin-role-list-row,
    .admin-group-row,
    .admin-group-email-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
    }

    .admin-card-heading,
    .notification-settings-heading,
    .profile-identity {
        flex-direction: column;
    }

    .admin-card-heading .btn,
    .notification-settings-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    .table-wrap,
    .notification-settings-grid {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .contacts-search {
        display: grid;
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .contacts-search .btn,
    .contacts-tabs a {
        min-height: 44px;
        text-align: center;
    }

    .contacts-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .notification-item {
        padding: 13px 12px;
    }

    .notification-item-heading,
    .notification-item-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .notification-action,
    .notification-ticket-link {
        min-height: 42px;
    }

    .notification-preview-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .notification-preview-mark-all,
    .notification-preview-history-link,
    .recent-tickets-history-link {
        min-height: 44px;
    }

    .notification-preview-item {
        padding-right: 76px;
    }

    .prepared-response-filters {
        display: grid;
        grid-template-columns: 1fr;
    }

    .prepared-response-modal,
    .deadline-modal,
    .draft-modal,
    .attachment-choice-modal {
        padding: 10px;
    }

    .prepared-response-modal-content,
    .deadline-modal-content,
    .draft-modal-content,
    .attachment-choice-panel {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 20px);
        overflow-y: auto;
    }

    .prepared-response-modal-list {
        max-height: min(50dvh, 360px);
    }

    .prepared-response-modal-item {
        min-height: 52px;
        flex-direction: column;
        gap: 3px;
    }

    .deadline-calendars {
        display: grid;
        grid-template-columns: 1fr;
    }

    .deadline-calendar:nth-child(2),
    #deadline-second-month-title {
        display: none;
    }

    .deadline-calendar-toolbar,
    .deadline-time-row,
    .deadline-settings-row {
        flex-wrap: wrap;
    }

    .notification-toast-container {
        top: 124px;
        right: 8px;
        left: 8px;
        width: auto;
    }

    .notification-toast {
        max-width: 100%;
    }

    .attachment-lightbox-close,
    .attachment-lightbox-navigation,
    .notification-preview-action,
    .recent-ticket-pin {
        min-width: 44px;
        min-height: 44px;
    }

    .profile-identity {
        align-items: flex-start;
    }

    .profile-fields dd,
    .prepared-response-preview {
        overflow-wrap: anywhere;
    }

    .deadline-modal {
        padding: 8px;
    }

    .deadline-modal-content {
        max-height: calc(100dvh - 16px);
    }
}

@media (hover: none), (pointer: coarse) {
    .message-actions,
    .mail-message-meta,
    .group-email-actions {
        opacity: 1;
        visibility: visible;
    }

    button,
    .btn,
    summary,
    .menu a {
        touch-action: manipulation;
    }
}

/* Kompaktní dialog termínu a informačně hustší náhled upozornění. */
.deadline-modal-content { width: min(475px, calc(100vw - 32px)); }
.deadline-modal-header { padding: 7px 10px; font-size: 15px; }
.deadline-modal-close { width: 26px; height: 26px; }
.deadline-calendar-toolbar { grid-template-columns: auto 92px 66px 1fr auto; gap: 4px; padding: 6px 10px; }
.deadline-calendar-toolbar select { height: 27px; padding: 0 5px; }
.deadline-nav { min-width: 27px; min-height: 27px; padding: 3px 6px; }
.deadline-calendars { gap: 8px; padding: 8px 10px; }
.deadline-calendar-title { margin-bottom: 4px; font-size: 13px; }
.deadline-weekdays, .deadline-days { gap: 2px; }
.deadline-weekdays { margin-bottom: 2px; }
.deadline-weekdays span { padding: 2px 0; font-size: 10px; }
.deadline-day { min-height: 22px; font-size: 12px; }
.deadline-time-row { gap: 4px; padding: 7px 10px; font-size: 13px; }
.deadline-time-row select { min-width: 52px; height: 27px; padding: 0 5px; }
.deadline-settings-row { gap: 9px; padding: 7px 10px; }
.deadline-setting label { margin-bottom: 3px; font-size: 10px; }
.deadline-selected-value { min-height: 27px; padding: 5px 6px; font-size: 13px; }
.deadline-setting select { height: 27px; padding: 0 5px; }
.deadline-modal-actions { gap: 5px; padding: 7px 10px; }
.deadline-modal-actions .btn { padding: 6px 9px; font-size: 12px; }

.notification-preview-content { display: grid; min-width: 0; gap: 4px; }
.notification-preview-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-preview-message { display: -webkit-box; overflow: hidden; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mail-account-section + .mail-account-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid #dfe7ef; }
.mail-account-section h2 { margin: 0 0 11px; color: #173e67; font-size: 15px; }
.mail-account-section-empty { margin: 0; padding: 10px 0; color: #68717d; }

@media (max-width: 800px) {
    .mobile-home-button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 8px; border: 1px solid #cfd5dc; border-radius: 6px; color: #174f88; font-size: 14px; font-weight: 800; letter-spacing: .2px; text-decoration: none; }
    .mobile-home-button:hover, .mobile-home-button:focus-visible { background: #eef4ff; border-color: #9dbcf3; }
    .deadline-modal-content { width: min(100%, 475px); }
    .deadline-calendar-toolbar { grid-template-columns: auto minmax(0, 1fr) 68px auto; padding: 8px 10px; }
    .deadline-day { min-height: 40px; font-size: 14px; }
    .deadline-time-row, .deadline-settings-row, .deadline-modal-actions { padding-right: 10px; padding-left: 10px; }
    .notification-preview-item { padding-top: 10px; padding-bottom: 10px; }
    .notification-preview-title { white-space: normal; }
    .notification-preview-meta { line-height: 1.35; }
    .mail-account-section + .mail-account-section { margin-top: 20px; padding-top: 18px; }
}

@media (max-width: 390px) {
    .mobile-home-button { min-width: 40px; padding-right: 5px; padding-left: 5px; }
}
