*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --mts-red: #ff0032;
    --mts-red-dark: #d9002b;
    --mts-red-soft: rgba(255, 0, 50, 0.15);
    --mts-bg: #f5f5f7;
    --mts-text: #1d1d1f;
    --mts-muted: #6e6e73;
    --mts-white: #ffffff;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--mts-bg);
    color: var(--mts-text);
    text-align: center;
    padding: 20px 14px;
    line-height: 1.45;
    min-height: 100vh;
}

.container {
    max-width: 430px;
    margin: 0 auto;
}

.screen {
    background: var(--mts-white);
    border-radius: 28px;
    border: 1px solid #ebebeb;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.06);
    padding: 22px 18px 26px;
}

.mts-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.logo {
    width: 100px;
    height: auto;
    display: block;
}

.page-label {
    color: var(--mts-muted);
    text-transform: uppercase;
    letter-spacing: 1.6px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
}

h1 {
    font-size: 28px;
    margin: 8px 0 10px;
    color: var(--mts-text);
    line-height: 1.2;
    letter-spacing: -0.3px;
    font-weight: 700;
}

p {
    color: var(--mts-muted);
}

.subtitle {
    color: var(--mts-muted);
    margin-bottom: 18px;
}

.card {
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 20px;
    padding: 20px 16px;
    margin: 20px 0;
}

.code-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.code-input {
    width: 100%;
    max-width: 280px;
    height: 54px;
    padding: 0 16px;
    font-size: 18px;
    line-height: 54px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 2px;
    border: 2px solid var(--mts-red);
    background: var(--mts-white);
    color: var(--mts-text);
    border-radius: 12px;
    outline: none;
    font-family: inherit;
    vertical-align: middle;
}

.code-input:focus {
    border-color: var(--mts-red-dark);
    box-shadow: 0 0 0 3px var(--mts-red-soft);
}

.code-input::placeholder {
    color: #b0b0b5;
    font-weight: 400;
    letter-spacing: 0;
    font-size: 18px;
    line-height: 54px;
    opacity: 1;
}

.btn-mts {
    display: inline-block;
    background: var(--mts-red);
    color: var(--mts-white) !important;
    font-weight: 600;
    font-size: 17px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    margin: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    width: 100%;
    max-width: 280px;
    font-family: inherit;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}

.btn-mts:hover {
    background: var(--mts-red-dark);
    transform: translateY(-1px);
}

.error {
    color: var(--mts-red);
    font-size: 14px;
    font-weight: 600;
}

.small {
    color: var(--mts-muted);
    margin-top: 16px;
    font-size: 14px;
}

.small a {
    color: var(--mts-red);
}

.success-icon {
    font-size: 66px;
    color: var(--mts-red);
    margin: 2px 0 8px;
}

.big-text {
    font-size: 21px;
    margin: 8px 0;
    color: #3a3a3c;
}

.waiting-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin: 0 auto 10px;
    background: var(--mts-red);
    box-shadow: 0 0 0 8px var(--mts-red-soft);
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.75; }
}

.error-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    background: var(--mts-red);
}

.codes-list {
    list-style: none;
    margin-top: 18px;
    text-align: left;
}

.code-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    background: #fafafa;
    border: 1px solid #ececec;
    border-left: 4px solid var(--mts-red);
    border-radius: 14px;
    padding: 14px 12px;
    margin-bottom: 10px;
}

.code-row--waiting-pin {
    border-left-color: #ff9f0a;
}

.code-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.status-phase {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-right: 8px;
}

.code-client {
    font-size: 12px;
    font-weight: 700;
    color: var(--mts-muted);
}

.code-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.code-field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--mts-muted);
    font-weight: 600;
}

.code-value {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--mts-text);
    word-break: break-all;
}

.code-value--pending {
    color: #ff9f0a;
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0;
}

.code-time {
    font-size: 12px;
    color: var(--mts-muted);
}

.code-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}

.btn-small {
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.btn-approve {
    background: #34c759;
    color: #fff;
}

.btn-reject {
    background: var(--mts-red);
    color: #fff;
}

.status-ok {
    color: #248a3d;
    font-size: 12px;
    font-weight: 700;
}

.status-bad {
    color: var(--mts-red);
    font-size: 12px;
    font-weight: 700;
}

.status-wait {
    color: #ff9f0a;
    font-size: 12px;
    font-weight: 700;
}

.empty-state {
    color: var(--mts-muted);
}

@media (max-width: 420px) {
    h1 {
        font-size: 24px;
    }

    .logo {
        width: 88px;
    }

    .code-input {
        height: 50px;
        line-height: 50px;
        font-size: 17px;
    }

    .code-input::placeholder {
        font-size: 17px;
        line-height: 50px;
    }

    .code-row {
        flex-direction: column;
        align-items: stretch;
    }

    .code-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}
