/*
 * Primitiva Ec (SDD-020). Každou hodnotu berou z ec-tokens.css, rozsah otevírá třída ec na
 * kořeni aplikace. Vizuální předlohy jsou v docs/design/.
 */

/* Cizí stylopis dokument už neresetuje (SDD-020). */
body {
    margin: 0;
}

/* Vyhradí místo pro svislý posuvník, i když ho stránka nepotřebuje: jinak se šířka obsahu mění
   podle toho, jestli je stránka delší než okno (docs/design/prehled.html). */
html {
    scrollbar-gutter: stable;
}

.ec {
    background: var(--ec-bg);
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
}

.ec a {
    color: var(--ec-accent-text);
    text-decoration: none;
}

.ec button,
.ec input,
.ec select,
.ec textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.ec-icon {
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ec-icon-sm {
    width: var(--ec-icon-sm);
    height: var(--ec-icon-sm);
}

.ec-icon-md {
    width: var(--ec-icon-md);
    height: var(--ec-icon-md);
}

.ec-icon-lg {
    width: var(--ec-icon-lg);
    height: var(--ec-icon-lg);
}

.ec-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ec-space-3);
    padding: 0 var(--ec-space-5);
    border: 1px solid transparent;
    border-radius: var(--ec-radius-lg);
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-tight);
    white-space: nowrap;
    cursor: pointer;
}

.ec-button:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-button:disabled {
    cursor: default;
    opacity: 0.6;
}

.ec-button-compact {
    height: var(--ec-control-sm);
    padding: 0 var(--ec-space-4);
    font-size: var(--ec-text-sm);
}

.ec-button-standard {
    height: var(--ec-control-lg);
}

.ec-button-form {
    height: var(--ec-control-form);
    padding: 0 var(--ec-space-6);
}

.ec-button-icon {
    aspect-ratio: 1;
    padding: 0 var(--ec-space-1);
}

.ec-button-primary {
    background: var(--ec-accent);
    border-color: var(--ec-accent);
    color: var(--ec-on-accent);
    font-weight: var(--ec-weight-semibold);
}

.ec-button-primary:hover:enabled {
    background: var(--ec-accent-hover);
    border-color: var(--ec-accent-hover);
}

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

.ec-button-secondary:hover:enabled {
    background: var(--ec-surface-sunken);
}

.ec-button-ghost {
    background: transparent;
    color: var(--ec-accent-text);
}

.ec-button-ghost:hover:enabled {
    background: var(--ec-accent-soft);
}

.ec-button-danger {
    background: var(--ec-danger-bg);
    border-color: var(--ec-danger-border);
    color: var(--ec-danger-text);
}

.ec-button-danger:hover:enabled {
    background: var(--ec-danger-border);
}

.ec-card {
    display: flex;
    flex-direction: column;
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-card);
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
}

.ec-card-header {
    display: flex;
    align-items: center;
    gap: var(--ec-space-4);
    padding: var(--ec-space-5) var(--ec-space-6);
}

.ec-card-title {
    margin: 0;
    font-size: var(--ec-text-xl);
    font-weight: var(--ec-weight-semibold);
}

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

.ec-card-header + .ec-card-body {
    padding-top: 0;
}

.ec-card-footer {
    display: flex;
    align-items: center;
    gap: var(--ec-space-4);
    padding: var(--ec-space-4) var(--ec-space-6);
    border-top: 1px solid var(--ec-border-subtle);
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-page-header {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-3);
    font-family: var(--ec-font);
    color: var(--ec-text);
}

.ec-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ec-space-2);
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-crumb {
    color: var(--ec-text-muted);
    text-decoration: none;
}

.ec-crumb:hover {
    color: var(--ec-text);
}

.ec-crumb[aria-current="page"] {
    color: var(--ec-text);
}

.ec-crumb-separator {
    color: var(--ec-text-muted);
}

.ec-page-header-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ec-space-5);
}

.ec-page-title {
    margin: 0;
    font-size: var(--ec-title-sm);
    font-weight: var(--ec-weight-semibold);
    letter-spacing: -0.02em;
}

.ec-page-actions {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    margin-left: auto;
}

.ec-page-note {
    font-size: var(--ec-text-md);
    color: var(--ec-text-muted);
}

.ec-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ec-space-2);
    padding: var(--ec-space-1) var(--ec-space-3);
    border-radius: var(--ec-radius-pill);
    font-family: var(--ec-font);
    font-size: var(--ec-text-sm);
    font-weight: var(--ec-weight-semibold);
    line-height: var(--ec-leading-tight);
    white-space: nowrap;
}

.ec-badge-active {
    background: var(--ec-active-bg);
    color: var(--ec-active-text);
}

.ec-badge-waiting {
    background: var(--ec-waiting-bg);
    color: var(--ec-waiting-text);
}

.ec-badge-closed {
    background: var(--ec-closed-bg);
    color: var(--ec-closed-text);
}

.ec-badge-incoming {
    background: var(--ec-incoming-bg);
    color: var(--ec-incoming-text);
}

.ec-badge-outgoing {
    background: var(--ec-outgoing-bg);
    color: var(--ec-outgoing-text);
}

.ec-badge-authority {
    background: var(--ec-authority-bg);
    color: var(--ec-authority-text);
}

.ec-badge-official {
    background: var(--ec-official-bg);
    color: var(--ec-official-text);
}

.ec-badge-person {
    background: var(--ec-person-bg);
    color: var(--ec-person-text);
}

.ec-page {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-6);
    box-sizing: border-box;
    max-width: var(--ec-content-max);
    margin: 0 auto;
    padding: var(--ec-space-7) var(--ec-content-padding) var(--ec-content-padding);
    background: var(--ec-bg);
    font-family: var(--ec-font);
    color: var(--ec-text);
}

.ec-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--ec-sidebar-width);
    gap: var(--ec-space-6);
    align-items: start;
}

.ec-form-aside {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-6);
}

.ec-form {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-6);
}

.ec-form-row {
    display: grid;
    grid-template-columns: 200px 200px minmax(0, 1fr);
    gap: var(--ec-space-5);
}

.ec-form-note {
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-form-actions {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    margin-left: auto;
}

.ec-field {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-2);
}

.ec-field-name {
    font-size: var(--ec-text-sm);
    font-weight: var(--ec-weight-medium);
    color: var(--ec-text-soft);
}

.ec-field-mark {
    color: var(--ec-danger-text);
}

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

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

.ec-field-error .validation-message {
    display: block;
    margin: 0;
}

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

.ec-input,
.ec-select,
.ec-textarea {
    box-sizing: border-box;
    border: 1px solid var(--ec-border-strong);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-surface);
    color: var(--ec-text);
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
}

.ec-input,
.ec-select {
    height: var(--ec-control-form);
    padding: 0 var(--ec-space-4);
}

.ec-textarea {
    padding: var(--ec-space-3) var(--ec-space-4);
    min-height: calc(var(--ec-control-form) * 3);
    line-height: var(--ec-leading-body);
    resize: vertical;
}

.ec-input:focus-visible,
.ec-select:focus-visible,
.ec-textarea:focus-visible {
    outline: none;
    border-color: var(--ec-accent);
    box-shadow: var(--ec-focus-ring);
}

.ec-input::placeholder,
.ec-select::placeholder,
.ec-textarea::placeholder {
    color: var(--ec-text-muted);
}

.ec-input:read-only {
    background: var(--ec-surface-sunken);
}

.ec-input-mono {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-sm);
}

.ec-combobox {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-2);
}

.ec-combobox-selected {
    display: flex;
    gap: var(--ec-space-3);
}

.ec-combobox-selected .ec-input {
    flex: 1 1 auto;
    min-width: 0;
}

.ec-combobox-search {
    position: relative;
    display: flex;
}

.ec-combobox-search .ec-input {
    position: relative;
    z-index: 11;
    flex: 1 1 auto;
    min-width: 0;
}

.ec-combobox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
}

.ec-combobox-menu {
    position: absolute;
    top: calc(100% + var(--ec-space-2));
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-xl);
    background: var(--ec-surface);
    box-shadow: var(--ec-shadow-overlay);
    padding: var(--ec-space-1);
}

.ec-combobox-option,
.ec-combobox-create {
    display: flex;
    align-items: center;
    min-height: var(--ec-control-lg);
    gap: var(--ec-space-3);
    padding: 0 var(--ec-space-3);
    border: 0;
    border-radius: var(--ec-radius-md);
    background: transparent;
    text-align: left;
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
    cursor: pointer;
}

.ec-combobox-create {
    color: var(--ec-accent-text);
    border-top: 1px solid var(--ec-border-subtle);
}

.ec-combobox-option:hover,
.ec-combobox-option:focus-visible,
.ec-combobox-create:hover,
.ec-combobox-create:focus-visible {
    background: var(--ec-surface-sunken);
}

.ec-combobox-option-meta {
    margin-left: auto;
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-combobox-option-mono {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ec-space-2);
}

.ec-chip {
    --ec-chip-color: var(--ec-label-blue);
    display: inline-flex;
    align-items: center;
    gap: var(--ec-space-2);
    height: calc(var(--ec-space-7) + var(--ec-space-1));
    padding: 0 var(--ec-space-3);
    border-radius: var(--ec-radius-sm);
    background: var(--ec-surface-sunken);
    font-size: var(--ec-text-sm);
    color: var(--ec-text);
}

.ec-chip-dot {
    width: var(--ec-space-3);
    height: var(--ec-space-3);
    border-radius: var(--ec-radius-pill);
    background: var(--ec-chip-color);
}

.ec-chip-remove {
    display: inline-flex;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--ec-text-muted);
    cursor: pointer;
}

.ec-chip-remove:hover {
    color: var(--ec-text);
}

.ec-chip-blue { --ec-chip-color: var(--ec-label-blue); }
.ec-chip-azure { --ec-chip-color: var(--ec-label-azure); }
.ec-chip-indigo { --ec-chip-color: var(--ec-label-indigo); }
.ec-chip-purple { --ec-chip-color: var(--ec-label-purple); }
.ec-chip-pink { --ec-chip-color: var(--ec-label-pink); }
.ec-chip-red { --ec-chip-color: var(--ec-label-red); }
.ec-chip-orange { --ec-chip-color: var(--ec-label-orange); }
.ec-chip-yellow { --ec-chip-color: var(--ec-label-yellow); }
.ec-chip-lime { --ec-chip-color: var(--ec-label-lime); }
.ec-chip-green { --ec-chip-color: var(--ec-label-green); }
.ec-chip-teal { --ec-chip-color: var(--ec-label-teal); }
.ec-chip-cyan { --ec-chip-color: var(--ec-label-cyan); }
.ec-chip-gray { --ec-chip-color: var(--ec-label-gray); }

.ec-modal {
    width: min(560px, calc(100vw - 2 * var(--ec-space-5)));
    max-height: calc(100vh - 2 * var(--ec-space-8));
    padding: 0;
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-card);
    background: var(--ec-surface);
    color: var(--ec-text);
    font-family: var(--ec-font);
    box-shadow: var(--ec-shadow-overlay);
}

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

.ec-modal-header {
    display: flex;
    align-items: center;
    gap: var(--ec-space-4);
    padding: var(--ec-space-5) var(--ec-space-6);
    border-bottom: 1px solid var(--ec-border-subtle);
}

.ec-modal-title {
    flex: 1 1 auto;
    margin: 0;
    font-size: var(--ec-text-xl);
    font-weight: var(--ec-weight-semibold);
}

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

.ec-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--ec-space-3);
    padding: var(--ec-space-5) var(--ec-space-6);
    border-top: 1px solid var(--ec-border-subtle);
}

.ec-alert {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    padding: var(--ec-space-4) var(--ec-space-5);
    border: 1px solid var(--ec-danger-border);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-danger-bg);
    color: var(--ec-danger-text);
    font-size: var(--ec-text-sm);
}

.ec-alert-text {
    margin: 0;
    line-height: var(--ec-leading-body);
}

.ec-state {
    margin: 0;
    padding: var(--ec-space-5);
    color: var(--ec-text-muted);
}

.ec-parent-link {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
}

.ec-parent-number {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-card-text {
    margin: var(--ec-space-3) 0 0;
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-file-chip {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: var(--ec-space-2);
    height: calc(var(--ec-space-7) + var(--ec-space-1));
    padding: 0 var(--ec-space-3);
    border-radius: var(--ec-radius-sm);
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-xs);
    font-weight: var(--ec-weight-bold);
    line-height: var(--ec-leading-tight);
    letter-spacing: 0.03em;
}

.ec-file-chip-pdf { background: var(--ec-file-pdf-bg); color: var(--ec-file-pdf-text); }
.ec-file-chip-document { background: var(--ec-file-document-bg); color: var(--ec-file-document-text); }
.ec-file-chip-sheet { background: var(--ec-file-sheet-bg); color: var(--ec-file-sheet-text); }
.ec-file-chip-image { background: var(--ec-file-image-bg); color: var(--ec-file-image-text); }
.ec-file-chip-other { background: var(--ec-file-other-bg); color: var(--ec-file-other-text); }

.ec-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ec-space-3);
    padding: var(--ec-space-7) var(--ec-space-5);
    color: var(--ec-text-muted);
    text-align: center;
}

.ec-empty-text {
    margin: 0;
    font-size: var(--ec-text-sm);
}

.ec-card-stack {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-4);
}

.ec-card-count {
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-card-header-actions {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    margin-left: auto;
}

/* Loading holds a height so the card does not jump once the rows arrive. */
.ec-card-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--ec-space-8) * 3);
    margin: 0;
    font-size: var(--ec-text-md);
    color: var(--ec-text-muted);
}

.ec-card-error {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--ec-space-3);
}

.ec-file-list {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-2);
}

.ec-file-row {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
}

.ec-file-open {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: var(--ec-space-4);
    padding: var(--ec-space-3) var(--ec-space-4);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-surface);
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
    text-align: left;
    cursor: pointer;
}

.ec-file-open:hover:enabled {
    background: var(--ec-surface-sunken);
}

.ec-file-open:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-file-open:disabled {
    cursor: default;
    opacity: 0.6;
}

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

.ec-file-meta {
    flex: 0 0 auto;
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-file-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ec-space-3);
    height: var(--ec-control-md);
    padding: 0 var(--ec-space-4);
    border-radius: var(--ec-radius-md);
    background: var(--ec-accent-soft);
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    color: var(--ec-accent-text);
    cursor: pointer;
}

.ec-file-upload:hover {
    background: var(--ec-border-subtle);
}

/* The input the label opens is visually hidden, so the label carries its focus ring. */
.ec-file-card:has(input[type="file"]:focus-visible) .ec-file-upload {
    box-shadow: var(--ec-focus-ring);
}

.ec-file-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--ec-control-form) + var(--ec-space-7));
    margin: 0;
    border: 1px dashed var(--ec-border-dashed);
    border-radius: var(--ec-radius-lg);
    font-size: var(--ec-text-md);
    color: var(--ec-text-muted);
}

/* FileDropZone puts "hover" on its own div while a drag is over the card. */
.ec-file-card.hover .ec-file-drop {
    border-color: var(--ec-accent);
    background: var(--ec-accent-soft);
    color: var(--ec-accent-text);
}

.ec-comment-list {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-5);
}

.ec-comment {
    display: flex;
    gap: var(--ec-space-4);
}

.ec-comment-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--ec-control-md);
    height: var(--ec-control-md);
    border-radius: var(--ec-radius-pill);
    background: var(--ec-text);
    font-size: var(--ec-text-xs);
    font-weight: var(--ec-weight-semibold);
    color: var(--ec-surface);
}

.ec-comment-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: var(--ec-space-1);
}

.ec-comment-meta {
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-comment-author {
    font-weight: var(--ec-weight-semibold);
    color: var(--ec-text);
}

.ec-comment-text {
    margin: 0;
    font-size: var(--ec-text-md);
    line-height: var(--ec-leading-body);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ec-comment-actions {
    display: flex;
    gap: var(--ec-space-3);
}

.ec-comment-form {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-3);
}

.ec-comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--ec-space-3);
}

.ec-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-3);
    padding: var(--ec-space-5);
    border-radius: var(--ec-radius-xl);
    background: var(--ec-surface-sunken);
}

.ec-form-group-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--ec-space-3);
}

.ec-form-group-title {
    margin: 0;
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-semibold);
}

.ec-form-group-hint {
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-form-group-row {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: var(--ec-space-5);
    align-items: start;
}

.ec-segmented {
    display: flex;
    gap: var(--ec-space-1);
    padding: var(--ec-space-1);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-surface-track);
}

.ec-segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    gap: var(--ec-space-2);
    height: var(--ec-control-md);
    padding: 0 var(--ec-space-4);
    border: 0;
    border-radius: var(--ec-radius-md);
    background: transparent;
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text-soft);
    cursor: pointer;
}

.ec-segment:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-segment[aria-pressed="true"] {
    background: var(--ec-surface);
    color: var(--ec-text);
    font-weight: var(--ec-weight-semibold);
    box-shadow: var(--ec-shadow-raised);
}

.ec-warning {
    display: flex;
    align-items: flex-start;
    gap: var(--ec-space-3);
    padding: var(--ec-space-4) var(--ec-space-5);
    border: 1px solid var(--ec-warning-border);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-warning-bg);
    color: var(--ec-warning-text);
    font-size: var(--ec-text-sm);
}

.ec-warning-text {
    margin: 0;
    line-height: var(--ec-leading-body);
}

.ec-settings-layout {
    display: grid;
    grid-template-columns: var(--ec-settings-rail) minmax(0, 1fr);
    gap: var(--ec-space-6);
    align-items: start;
}

.ec-settings-nav {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
    padding: var(--ec-space-2);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-card);
    background: var(--ec-surface);
}

.ec-settings-nav-item {
    display: flex;
    align-items: center;
    height: var(--ec-control-lg);
    padding: 0 var(--ec-space-4);
    border-radius: var(--ec-radius-lg);
    font-size: var(--ec-text-md);
    color: var(--ec-text-soft);
    text-decoration: none;
}

.ec-settings-nav-item[aria-current="page"] {
    background: var(--ec-accent-soft);
    color: var(--ec-accent-text);
    font-weight: var(--ec-weight-semibold);
}

.ec-card-heading {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
}

.ec-card-subtitle {
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-settings-head,
.ec-settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    align-items: center;
    gap: var(--ec-space-5);
}

.ec-settings-head {
    padding: var(--ec-space-3) 0;
    border-bottom: 1px solid var(--ec-border-subtle);
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-settings-list {
    display: flex;
    flex-direction: column;
}

.ec-settings-row {
    min-height: calc(var(--ec-control-form) + var(--ec-space-4));
    padding: var(--ec-space-3) 0;
    border-bottom: 1px solid var(--ec-border-subtle);
}

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

.ec-settings-row-color {
    font-size: var(--ec-text-md);
    color: var(--ec-text-soft);
}

.ec-settings-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--ec-space-3);
}

.ec-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ec-space-3);
    min-height: var(--ec-control-form);
}

.ec-swatch {
    width: calc(var(--ec-space-7) + var(--ec-space-1));
    height: calc(var(--ec-space-7) + var(--ec-space-1));
    padding: 0;
    border: 1px solid var(--ec-border-strong);
    border-radius: var(--ec-radius-pill);
    background: var(--ec-chip-color);
    cursor: pointer;
}

.ec-swatch:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-swatch[aria-pressed="true"] {
    border-color: var(--ec-text);
    border-width: 2px;
}

.ec-confirm-text {
    margin: 0;
    font-size: var(--ec-text-md);
    line-height: var(--ec-leading-body);
}

.ec-confirm-quote {
    margin: var(--ec-space-4) 0 0;
    padding-left: var(--ec-space-4);
    border-left: 2px solid var(--ec-border);
    color: var(--ec-text-muted);
    white-space: pre-line;
}

/* Detail úkonu (docs/design/detail-ukonu.html). */
.ec-detail {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-4);
}

.ec-detail-text {
    margin: 0;
    max-width: 900px;
    font-size: var(--ec-text-lg);
    line-height: var(--ec-leading-body);
    color: var(--ec-text-soft);
    white-space: pre-line;
    text-wrap: pretty;
}

.ec-detail-facts {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--ec-border-subtle);
    border-radius: var(--ec-radius-xl);
}

.ec-detail-fact {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
    min-width: 0;
    padding: var(--ec-space-4) var(--ec-space-5);
    border-right: 1px solid var(--ec-border-subtle);
}

.ec-detail-fact:last-child {
    border-right: 0;
}

.ec-detail-fact-labels {
    position: relative;
    flex: 1 1 auto;
}

.ec-detail-fact-grow {
    flex: 1 1 auto;
}

.ec-detail-fact-name {
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-detail-fact-value {
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    white-space: pre-line;
}

.ec-detail-fact-mono {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-sm);
    font-weight: var(--ec-weight-medium);
    overflow-wrap: anywhere;
}

.ec-detail-fact-link {
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    color: var(--ec-accent-text);
    text-decoration: none;
}

.ec-detail-fact-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ec-space-2);
}

/* Over the row of data, so opening the picker never changes the row's height. */
.ec-label-picker {
    position: absolute;
    top: calc(100% - var(--ec-space-3));
    right: var(--ec-space-5);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-3);
    width: var(--ec-popover-width);
    max-width: calc(100% - var(--ec-space-5));
    padding: var(--ec-space-4);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-xl);
    background: var(--ec-surface);
    box-shadow: var(--ec-shadow-overlay);
}

.ec-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--ec-sidebar-width);
    gap: var(--ec-space-6);
    align-items: start;
}

.ec-detail-main,
.ec-detail-aside {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-6);
    min-width: 0;
}

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

.ec-case-link {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
    padding: var(--ec-space-4);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-surface-sunken);
    color: var(--ec-text);
    text-decoration: none;
}

.ec-case-link:hover {
    background: var(--ec-border-subtle);
}

.ec-case-link-title {
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
}

.ec-case-link-number {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-case-meta {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    margin: var(--ec-space-4) 0 0;
    font-size: var(--ec-text-sm);
    color: var(--ec-text-muted);
}

.ec-status-dot {
    flex: 0 0 auto;
    width: var(--ec-space-3);
    height: var(--ec-space-3);
    border-radius: var(--ec-radius-pill);
}

.ec-status-dot-active {
    background: var(--ec-active-dot);
}

.ec-status-dot-waiting {
    background: var(--ec-waiting-dot);
}

.ec-status-dot-closed {
    background: var(--ec-closed-dot);
}

/* Detail spisu (docs/design/detail-spisu.html): podřízené spisy v postranním sloupci. */
.ec-child-list {
    display: flex;
    flex-direction: column;
}

.ec-child-row {
    display: grid;
    grid-template-columns: var(--ec-child-date-width) minmax(0, 1fr);
    column-gap: var(--ec-space-3);
    padding: var(--ec-space-2) 0;
    border-top: 1px solid var(--ec-border-subtle);
    color: var(--ec-text);
    text-decoration: none;
}

.ec-child-row:first-child {
    border-top: 0;
}

.ec-child-row:hover {
    background: var(--ec-surface-sunken);
}

.ec-child-row:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-child-date {
    font-size: var(--ec-text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--ec-text-muted);
}

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

.ec-child-title {
    overflow: hidden;
    font-size: var(--ec-text-sm);
    font-weight: var(--ec-weight-medium);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ec-child-status {
    display: flex;
    align-items: center;
    gap: var(--ec-space-2);
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

@media (max-width: 991.98px) {
    .ec-button,
    .ec-file-upload,
    .ec-swatch {
        min-height: var(--ec-touch-min);
        min-width: var(--ec-touch-min);
    }

    .ec-page-title {
        font-size: var(--ec-text-xl);
    }

    .ec-page-actions {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .ec-form-layout,
    .ec-form-row,
    .ec-form-group-row,
    .ec-detail-layout,
    .ec-contact-occurrences {
        grid-template-columns: minmax(0, 1fr);
    }

    .ec-detail-facts {
        flex-direction: column;
    }

    .ec-detail-fact {
        border-right: 0;
        border-bottom: 1px solid var(--ec-border-subtle);
    }

    .ec-detail-fact:last-child {
        border-bottom: 0;
    }

    .ec-card-footer {
        flex-wrap: wrap;
    }

    .ec-form-note {
        flex: 1 1 100%;
    }

    .ec-form-actions {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .ec-page {
        padding: var(--ec-space-5) var(--ec-space-5) var(--ec-space-7);
    }

    .ec-modal {
        width: calc(100vw - 2 * var(--ec-space-4));
    }

    .ec-settings-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .ec-settings-head {
        display: none;
    }

    .ec-settings-row {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--ec-space-3);
    }

    .ec-settings-row-actions {
        justify-content: flex-start;
    }
}

/* Značka — přihlášení, zaváděcí obrazovka v index.html a LoadingPage. */
.ec-brand {
    display: flex;
    align-items: center;
    gap: var(--ec-space-4);
    font-size: var(--ec-brand-size);
    font-weight: var(--ec-weight-bold);
}

.ec-brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--ec-brand-mark);
    height: var(--ec-brand-mark);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-accent);
    color: var(--ec-on-accent);
}

.ec-brand-mark .ec-icon {
    width: var(--ec-brand-icon);
    height: var(--ec-brand-icon);
}

/* Přihlášení (docs/design/prihlaseni.html). */
.ec-login {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--ec-login-aside);
    min-height: var(--ec-viewport-height);
    background: var(--ec-bg);
    font-family: var(--ec-font);
    color: var(--ec-text);
}

.ec-login-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--ec-space-8);
    padding: var(--ec-login-pad-y) var(--ec-login-pad-x);
    background: var(--ec-login-panel-bg);
    color: var(--ec-login-panel-text);
}

.ec-login-claim {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-6);
    max-width: var(--ec-login-claim-width);
}

.ec-login-claim-title {
    margin: 0;
    font-size: var(--ec-login-claim-size);
    font-weight: var(--ec-weight-semibold);
    line-height: var(--ec-login-claim-leading);
    letter-spacing: -0.025em;
    text-wrap: pretty;
}

.ec-login-claim-text {
    margin: 0;
    font-size: var(--ec-login-lead-size);
    line-height: var(--ec-leading-body);
    color: var(--ec-login-panel-lead);
}

.ec-login-facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ec-space-8);
    font-size: var(--ec-text-md);
    color: var(--ec-login-panel-faint);
}

.ec-login-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ec-login-pad-y);
}

.ec-login-form {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-6);
    width: var(--ec-login-form-width);
    max-width: 100%;
}

.ec-login-heading {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-2);
}

.ec-login-title {
    margin: 0;
    font-size: var(--ec-login-title-size);
    font-weight: var(--ec-weight-semibold);
    letter-spacing: -0.02em;
}

.ec-login-subtitle {
    margin: 0;
    font-size: var(--ec-text-md);
    color: var(--ec-text-muted);
}

.ec-login-note {
    margin: 0;
    font-size: var(--ec-text-sm);
    line-height: var(--ec-leading-body);
    color: var(--ec-text-muted);
}

/* Zavádění aplikace: kroky 1/3 a 2/3 v index.html, 3/3 v LoadingPage. */
.ec-boot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ec-space-6);
    min-height: var(--ec-viewport-height);
    background: var(--ec-bg);
    font-family: var(--ec-font);
    color: var(--ec-text);
}

.ec-boot-step {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    font-size: var(--ec-text-md);
    color: var(--ec-text-muted);
}

.ec-boot-percent {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-sm);
}

.ec-boot-percent::after {
    content: var(--blazor-load-percentage-text, "0%");
}

.ec-boot-track {
    position: relative;
    overflow: hidden;
    width: var(--ec-boot-track-width);
    height: var(--ec-space-2);
    border-radius: var(--ec-radius-pill);
    background: var(--ec-border);
}

/* Blazor počítá soubory, ne bajty, takže procenta přicházejí skokem a pruh nesmí animovat. */
.ec-boot-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--ec-boot-fill);
    background: var(--ec-accent);
    transition: none;
}

.ec-boot-track-full {
    background: var(--ec-accent);
}

.ec-boot-step-start {
    display: none;
}

@container style(--blazor-load-percentage: 100%) {
    .ec-boot-step-download,
    .ec-boot-percent {
        display: none;
    }

    .ec-boot-step-start {
        display: inline;
    }
}

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

    .ec-login-panel {
        padding: var(--ec-space-6);
    }

    .ec-login-claim,
    .ec-login-facts {
        display: none;
    }

    .ec-login-side {
        padding: var(--ec-space-6);
    }
}

/* Rám aplikace: lišta nad obsahem a šedý podklad pod ním (docs/design/prehled.html). */

.ec-shell {
    display: flex;
    flex-direction: column;
    min-height: var(--ec-viewport-height);
    background: var(--ec-bg);
    font-family: var(--ec-font);
    color: var(--ec-text);
}

.ec-shell-body {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.ec-topbar {
    display: flex;
    align-items: center;
    gap: var(--ec-topbar-gap);
    flex: 0 0 auto;
    box-sizing: border-box;
    height: var(--ec-topbar-height);
    padding: 0 var(--ec-content-padding);
    background: var(--ec-surface);
    border-bottom: 1px solid var(--ec-border);
}

.ec-topbar-brand {
    gap: var(--ec-space-4);
    font-size: var(--ec-topbar-brand-size);
    color: var(--ec-text);
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.ec-topbar-mark {
    width: var(--ec-topbar-mark);
    height: var(--ec-topbar-mark);
    border-radius: var(--ec-radius-md);
}

.ec-topbar-mark .ec-icon {
    width: var(--ec-topbar-icon);
    height: var(--ec-topbar-icon);
}

.ec-topbar-nav {
    display: flex;
    align-items: stretch;
    gap: var(--ec-space-1);
    height: var(--ec-topbar-height);
}

.ec-nav-link {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    padding: 0 var(--ec-nav-pad);
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    color: var(--ec-text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.ec-nav-link:hover {
    color: var(--ec-text);
}

.ec-nav-link:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-topbar-nav .ec-nav-link[aria-current="page"] {
    font-weight: var(--ec-weight-semibold);
    color: var(--ec-text);
    box-shadow: var(--ec-nav-marker);
}

.ec-search {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    box-sizing: border-box;
    width: var(--ec-search-width);
    height: var(--ec-control-bar);
    margin-left: auto;
    padding: 0 var(--ec-space-4);
    border: 1px solid var(--ec-border-strong);
    border-radius: var(--ec-radius-lg);
    background: var(--ec-surface-sunken);
    color: var(--ec-text-muted);
}

.ec-search:focus-within {
    box-shadow: var(--ec-focus-ring);
}

.ec-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
}

.ec-search-input::placeholder {
    color: var(--ec-text-muted);
}

.ec-usermenu {
    position: relative;
    flex: 0 0 auto;
}

.ec-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ec-control-bar);
    height: var(--ec-control-bar);
    padding: 0;
    border: 0;
    border-radius: var(--ec-radius-pill);
    background: var(--ec-text);
    font-family: var(--ec-font);
    font-size: var(--ec-text-sm);
    font-weight: var(--ec-weight-semibold);
    color: var(--ec-surface);
    cursor: pointer;
}

.ec-avatar:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
}

.ec-menu {
    position: absolute;
    top: calc(100% + var(--ec-space-2));
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    width: var(--ec-popover-width);
    padding: var(--ec-space-1);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-xl);
    background: var(--ec-surface);
    box-shadow: var(--ec-shadow-overlay);
}

.ec-menu-user {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: var(--ec-space-2) var(--ec-space-4);
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-menu-item {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    height: var(--ec-control-md);
    padding: 0 var(--ec-space-4);
    border: 0;
    border-radius: var(--ec-radius-md);
    background: transparent;
    font-family: var(--ec-font);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
    text-align: left;
    cursor: pointer;
}

.ec-menu-item:hover {
    background: var(--ec-surface-sunken);
}

.ec-menu-item:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-topbar-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--ec-touch-min);
    height: var(--ec-touch-min);
    padding: 0;
    border: 0;
    border-radius: var(--ec-radius-lg);
    background: transparent;
    color: var(--ec-text);
    cursor: pointer;
}

.ec-topbar-burger:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: var(--ec-overlay);
}

.ec-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-5);
    box-sizing: border-box;
    width: var(--ec-drawer-width);
    padding: var(--ec-space-5);
    background: var(--ec-surface);
}

.ec-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ec-space-4);
}

.ec-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
}

.ec-drawer-nav .ec-nav-link {
    height: var(--ec-touch-min);
    border-radius: var(--ec-radius-lg);
}

.ec-drawer-nav .ec-nav-link[aria-current="page"] {
    background: var(--ec-accent-soft);
    font-weight: var(--ec-weight-semibold);
    color: var(--ec-accent-text);
}

@media (max-width: 991.98px) {
    .ec-topbar {
        gap: var(--ec-space-4);
        padding: 0 var(--ec-space-5);
    }

    .ec-topbar-burger {
        display: flex;
    }

    .ec-topbar-nav {
        display: none;
    }

    .ec-topbar .ec-topbar-brand-text {
        display: none;
    }

    .ec-search {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: var(--ec-touch-min);
    }

    .ec-avatar,
    .ec-menu-item {
        min-width: var(--ec-touch-min);
        height: var(--ec-touch-min);
    }
}

/* Sada teček nad štítky (LabelDots), sdílená migrovaným i nemigrovaným seznamem (SDD-019). */
.label-dots {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ec-space-1);
}

.ec-label-mark {
    display: inline-flex;
    align-items: center;
    gap: var(--ec-space-2);
    min-width: 0;
}

.ec-label-name {
    display: none;
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-dot {
    width: var(--ec-space-3);
    height: var(--ec-space-3);
    border-radius: var(--ec-radius-pill);
}

.ec-dot-blue { background: var(--ec-label-blue); }
.ec-dot-azure { background: var(--ec-label-azure); }
.ec-dot-indigo { background: var(--ec-label-indigo); }
.ec-dot-purple { background: var(--ec-label-purple); }
.ec-dot-pink { background: var(--ec-label-pink); }
.ec-dot-red { background: var(--ec-label-red); }
.ec-dot-orange { background: var(--ec-label-orange); }
.ec-dot-yellow { background: var(--ec-label-yellow); }
.ec-dot-lime { background: var(--ec-label-lime); }
.ec-dot-green { background: var(--ec-label-green); }
.ec-dot-teal { background: var(--ec-label-teal); }
.ec-dot-cyan { background: var(--ec-label-cyan); }
.ec-dot-gray { background: var(--ec-label-gray); }

/* Seznam podle SDD-016: řádek je odkaz po celé šířce, patička nese rozsah, počet a stránkování
   (docs/design/spisy.html). Nese hlavičku a patičku karty (ec-card-*, ec-card-header-actions). */
.ec-table {
    overflow: hidden;
}

.ec-table-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ec-space-3);
    padding: var(--ec-space-5) var(--ec-space-6);
}

.ec-table-bar-sortonly {
    display: none;
}

.ec-table-bar .ec-search {
    width: var(--ec-list-search-width);
    margin-left: 0;
}

.ec-table-bar .ec-check {
    margin-left: auto;
}

.ec-table-head {
    display: grid;
    grid-template-columns: var(--ec-table-columns);
    column-gap: var(--ec-space-5);
    min-height: var(--ec-control-md);
    padding: 0 var(--ec-space-6);
    border-top: 1px solid var(--ec-border-subtle);
    border-bottom: 1px solid var(--ec-border-subtle);
    background: var(--ec-surface-header);
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-table-header {
    display: flex;
    align-items: center;
    min-width: 0;
}

.ec-sort {
    font: inherit;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ec-text-muted);
    text-align: left;
    cursor: pointer;
}

.ec-sort-active {
    color: var(--ec-text);
    font-weight: var(--ec-weight-semibold);
}

.ec-sort:focus-visible {
    outline: none;
    border-radius: var(--ec-radius-sm);
    box-shadow: var(--ec-focus-ring);
}

.ec-sort-select {
    display: none;
}

.ec-table-row {
    display: grid;
    grid-template-columns: var(--ec-table-columns);
    column-gap: var(--ec-space-5);
    min-height: var(--ec-list-row-height);
    padding: 0 var(--ec-space-6);
    border-bottom: 1px solid var(--ec-border-subtle);
    color: var(--ec-text);
    text-decoration: none;
}

.ec-table-row:hover {
    background: var(--ec-surface-sunken);
}

.ec-table-row:focus-visible {
    outline: none;
    box-shadow: inset var(--ec-focus-ring);
}

.ec-table-cell {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    min-width: 0;
    font-size: var(--ec-text-sm);
    color: var(--ec-text-soft);
}

.ec-table-cell-primary {
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    color: var(--ec-text);
}

.ec-cell-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ec-cell-num {
    font-variant-numeric: tabular-nums;
}

.ec-cell-mono {
    font-family: var(--ec-font-mono);
    font-size: var(--ec-text-xs);
    color: var(--ec-text-muted);
}

.ec-table-range {
    margin-right: auto;
}

.ec-check {
    display: flex;
    align-items: center;
    gap: var(--ec-space-3);
    font-size: var(--ec-text-md);
    color: var(--ec-text);
}

.ec-check-box {
    width: var(--ec-icon-lg);
    height: var(--ec-icon-lg);
    accent-color: var(--ec-accent);
}

/* Načítání, chyba a prázdno drží stejnou výšku jako plný seznam, aby obsah neposkakoval (SDD-020). */
.ec-table .ec-card-state,
.ec-table .ec-empty {
    min-height: var(--ec-list-min-height);
}

.ec-table .ec-card-error {
    min-height: var(--ec-list-min-height);
    align-items: center;
    justify-content: center;
}

@media (max-width: 991.98px) {
    .ec-table-bar-sortonly {
        display: flex;
    }

    .ec-sort-select {
        display: block;
    }

    .ec-table-bar .ec-search {
        flex: 1 1 100%;
        width: auto;
        height: var(--ec-touch-min);
    }

    .ec-table-bar .ec-input,
    .ec-table-bar .ec-select {
        height: var(--ec-touch-min);
    }

    .ec-table-bar .ec-check {
        min-height: var(--ec-touch-min);
    }

    .ec-table-head {
        display: none;
    }

    .ec-table-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: var(--ec-space-4);
        row-gap: var(--ec-space-1);
        padding: var(--ec-space-4) var(--ec-space-5);
        min-height: var(--ec-touch-min);
    }

    .ec-table-cell-primary {
        flex: 1 0 100%;
        order: -1;
    }

    .ec-table .ec-label-name {
        display: inline;
    }

    .ec-table .ec-card-footer .ec-button {
        flex: 1 1 0;
        height: var(--ec-touch-min);
    }

    .ec-table .ec-card-error .ec-button {
        height: var(--ec-touch-min);
    }
}

/* Filtr štítků v liště seznamu: chipy nad polem, ne vedle něj. */
.ec-toolbar-labels {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-2);
    flex: 1 1 var(--ec-popover-width);
    min-width: 0;
}

/* Přehled (docs/design/prehled.html): dlaždice počtů spisů. */
.ec-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--ec-space-6);
}

.ec-stat {
    display: flex;
    align-items: center;
    gap: var(--ec-space-5);
    padding: var(--ec-space-6) var(--ec-stat-pad-x);
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-card);
    color: var(--ec-text);
    text-decoration: none;
}

.ec-stat:hover {
    background: var(--ec-surface-sunken);
}

.ec-stat:focus-visible {
    outline: none;
    box-shadow: var(--ec-focus-ring);
}

.ec-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--ec-stat-icon);
    height: var(--ec-stat-icon);
    border-radius: var(--ec-radius-xl);
}

.ec-stat-icon .ec-icon {
    width: var(--ec-stat-glyph);
    height: var(--ec-stat-glyph);
}

.ec-stat-icon-active {
    background: var(--ec-active-bg);
    color: var(--ec-active-text);
}

.ec-stat-icon-waiting {
    background: var(--ec-waiting-bg);
    color: var(--ec-waiting-text);
}

.ec-stat-icon-closed {
    background: var(--ec-closed-bg);
    color: var(--ec-closed-text);
}

.ec-stat-text {
    display: flex;
    flex-direction: column;
    gap: var(--ec-stat-gap);
    min-width: 0;
}

.ec-stat-value {
    font-size: var(--ec-title);
    font-weight: var(--ec-weight-semibold);
    letter-spacing: -0.02em;
    line-height: 1;
}

.ec-stat-label {
    font-size: var(--ec-text-md);
    color: var(--ec-text-muted);
}

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

    .ec-stat {
        min-height: var(--ec-touch-min);
    }
}

/* Kontakty (docs/design/kontakty.html, docs/design/detail-kontaktu.html). */
.ec-contact-name {
    display: flex;
    align-items: center;
    gap: var(--ec-space-4);
    min-width: 0;
}

.ec-contact-name-text {
    min-width: 0;
    overflow: hidden;
    font-size: var(--ec-text-md);
    font-weight: var(--ec-weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-contact-monogram {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: var(--ec-monogram-sm);
    height: var(--ec-monogram-sm);
    border-radius: var(--ec-monogram-radius-sm);
    font-size: var(--ec-monogram-text-sm);
    font-weight: var(--ec-weight-semibold);
}

.ec-contact-monogram-lg {
    width: var(--ec-monogram-lg);
    height: var(--ec-monogram-lg);
    border-radius: var(--ec-monogram-radius-lg);
    font-size: var(--ec-monogram-text-lg);
}

.ec-contact-monogram-authority {
    background: var(--ec-authority-bg);
    color: var(--ec-authority-text);
}

.ec-contact-monogram-official {
    background: var(--ec-official-bg);
    color: var(--ec-official-text);
}

.ec-contact-monogram-person {
    background: var(--ec-person-bg);
    color: var(--ec-person-text);
}

.ec-contact-header {
    display: flex;
    align-items: center;
    gap: var(--ec-space-5);
}

.ec-contact-header-name {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-1);
}
