.mtz {
    --mtz-line: #d8d3c8;
    --mtz-muted: #66645f;
    --mtz-accent: #365d55;
    --mtz-accent-hover: #294942;
    --mtz-soft: #f3f6f5;
    --mtz-warning: #8a4b1e;
    --mtz-error: #7b2222;
    max-width: 920px;
}

.mtz *, .mtz *::before, .mtz *::after {
    box-sizing: border-box;
}

.mtz-city-grid {
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    align-items: start;
    gap: 5px;
    width: 100%;
    margin: 0 0 14px;
}

.mtz-city-choice {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 3px 1px;
    border: 2px solid transparent;
    border-radius: 5px;
    background: #fff;
    color: inherit;
    appearance: none;
    cursor: pointer;
    font: inherit;
    line-height: 1;
}

.mtz-city-choice:hover {
    border-color: #111;
    background: var(--mtz-soft);
}

.mtz-city-choice:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.mtz-city-choice.is-selected {
    border-color: #111;
    background: var(--mtz-soft);
}

.mtz-city-choice.is-selected::after {
    content: '\2713';
    position: absolute;
    top: 16px;
    right: 1px;
    display: grid;
    width: 14px;
    height: 14px;
    place-items: center;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font: 700 10px/1 sans-serif;
}

.mtz-city-choice-label {
    display: block;
    width: 100%;
    overflow: hidden;
    font-size: .5rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
}

.mtz-city-choice-image {
    display: block;
    width: 100%;
    max-width: 58px;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
}

.mtz-book-note {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-left: 3px solid var(--mtz-accent);
    background: var(--mtz-soft);
    font-size: .94rem;
    line-height: 1.4;
}

.mtz-book-note[hidden] {
    display: none;
}

.mtz-form {
    border: 1px solid var(--mtz-line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.mtz-search-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 14px;
}

.mtz-section {
    min-width: 0;
}

.mtz-section-title {
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: .02em;
}

.mtz-label {
    display: block;
    margin: 0 0 10px;
    font-weight: 600;
    line-height: 1.25;
}

.mtz-label select,
.mtz-label input {
    display: block;
    width: 100%;
    min-height: 40px;
    margin-top: 5px;
    padding: 7px 9px;
    border: 1px solid #aaa69d;
    border-radius: 5px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.mtz-label select:disabled,
.mtz-label input:disabled,
.mtz-button:disabled {
    opacity: .52;
    cursor: not-allowed;
}

.mtz-label select:focus,
.mtz-label input:focus {
    outline: 2px solid rgba(54, 93, 85, .18);
    border-color: var(--mtz-accent);
}

.mtz-hint {
    display: block;
    margin-top: 4px;
    color: var(--mtz-muted);
    font-size: .84rem;
    font-weight: 400;
}

.mtz-andor {
    padding-top: 35px;
    color: var(--mtz-muted);
    font-size: .9rem;
}

.mtz-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 10px;
}

.mtz-button {
    min-height: 39px;
    padding: 7px 15px;
    border-radius: 5px;
    border: 1px solid var(--mtz-accent);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.mtz-button-primary {
    background: var(--mtz-accent);
    color: #fff;
}

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

.mtz-button-secondary {
    background: #fff;
    color: var(--mtz-accent);
}

.mtz-message {
    margin-top: 12px;
    padding: 9px 11px;
    border-radius: 5px;
    background: var(--mtz-soft);
    font-size: .92rem;
}

.mtz-message[hidden] {
    display: none;
}

.mtz-message.is-warning {
    background: #fff4e9;
    color: var(--mtz-warning);
}

.mtz-message.is-error {
    background: #fbecec;
    color: var(--mtz-error);
}

.mtz-results {
    margin-top: 14px;
}

.mtz-result {
    padding: 9px 2px 10px;
    border-bottom: 1px solid var(--mtz-line);
}

.mtz-result:first-child {
    border-top: 1px solid var(--mtz-line);
}

.mtz-result-head {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 4px;
}

.mtz-result-name {
    min-width: 0;
    font-size: 1.03rem;
    font-weight: 700;
    line-height: 1.25;
}

.mtz-result-period {
    color: var(--mtz-muted);
    font-size: .91rem;
    white-space: nowrap;
}

.mtz-result-worker {
    min-width: 0;
    color: var(--mtz-muted);
    font-size: .91rem;
}

.mtz-result-line {
    display: grid;
    grid-template-columns: 126px minmax(0, 1fr);
    gap: 8px;
    margin-top: 2px;
    font-size: .93rem;
    line-height: 1.3;
}

.mtz-result-label {
    font-weight: 600;
}

.mtz-result-value {
    min-width: 0;
}

.mtz-mark-type {
    margin-left: 5px;
    color: var(--mtz-muted);
    font-size: .9em;
}

.mtz-mark-separator {
    color: var(--mtz-muted);
}

.mtz-extra {
    margin-top: 5px;
    font-size: .92rem;
    line-height: 1.32;
}

.mtz-result-line:last-child {
    margin-top: 5px;
}

.mtz-no-results {
    padding: 11px 0;
    color: var(--mtz-muted);
}

@media (max-width: 700px) {
    .mtz-city-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .mtz-form {
        padding: 13px;
    }

    .mtz-search-columns {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .mtz-andor {
        padding: 0;
    }

    .mtz-result-head {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: flex-start;
        gap: 10px;
    }

    .mtz-result-worker {
        grid-column: 1;
        grid-row: 2;
    }

    .mtz-result-period {
        grid-column: 2;
        grid-row: 1 / span 2;
        white-space: normal;
        text-align: right;
    }

    .mtz-result-line {
        grid-template-columns: 112px minmax(0, 1fr);
    }
}

@media (min-width: 701px) and (max-width: 820px) {
    .mtz-city-grid {
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }
}

@media (max-width: 440px) {
    .mtz-city-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
