:root {
    --bg: #eef2f6;
    --card: #ffffff;
    --text: #17212b;
    --muted: #66717d;
    --border: #dce2e8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;

    --green: #15803d;
    --green-bg: #ecfdf3;
    --green-border: #bbf7d0;

    --yellow: #a16207;
    --yellow-bg: #fffbeb;
    --yellow-border: #fde68a;

    --red: #b91c1c;
    --red-bg: #fef2f2;
    --red-border: #fecaca;

    --grey-bg: #f3f4f6;
    --grey-border: #d1d5db;

    --shadow:
        0 10px 30px rgba(15, 23, 42, 0.07);

    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
}

a {
    color: inherit;
}

.page {
    min-height: 100vh;
    padding: 22px 14px;
}

.app-container {
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
}

.login-container {
    width: 100%;
    max-width: 410px;
    margin: 6vh auto 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 19px 24px;
    border-bottom: 1px solid var(--border);

    background:
        linear-gradient(
            135deg,
            #ffffff 0%,
            #f8fafc 100%
        );
}

.card-body {
    padding: 22px 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    border-radius: 10px;

    background: var(--primary);
    color: #fff;

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

    box-shadow:
        0 5px 14px rgba(37, 99, 235, 0.2);
}

.brand h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
}

.brand p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;
    margin-bottom: 16px;
}

.user-info {
    color: var(--muted);
    font-size: 13px;
}

.user-info strong {
    color: var(--text);
}

.logout-link {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.logout-link:hover {
    color: var(--red);
}

.status {
    display: flex;
    align-items: center;

    gap: 11px;
    padding: 11px 14px;
    margin-bottom: 10px;

    border: 1px solid;
    border-radius: 9px;
}

.status:last-of-type {
    margin-bottom: 18px;
}

.status-icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;

    width: 29px;
    height: 29px;

    border-radius: 50%;
    font-weight: 700;
}

.status-text {
    min-width: 0;
}

.status-text strong {
    display: block;
    font-size: 14px;
}

.status-text span {
    display: block;
    margin-top: 1px;

    font-size: 12px;
    opacity: 0.82;

    overflow-wrap: anywhere;
}

.status-off {
    background: var(--grey-bg);
    border-color: var(--grey-border);
}

.status-off .status-icon {
    background: #e5e7eb;
    color: #4b5563;
}

.status-waiting {
    background: var(--yellow-bg);
    border-color: var(--yellow-border);
    color: var(--yellow);
}

.status-waiting .status-icon {
    background: #fef3c7;
}

.status-active,
.status-message {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

.status-active .status-icon,
.status-message .status-icon {
    background: #dcfce7;
}

.status-ended,
.status-error {
    background: var(--red-bg);
    border-color: var(--red-border);
    color: var(--red);
}

.status-ended .status-icon,
.status-error .status-icon {
    background: #fee2e2;
}

.section {
    padding-bottom: 20px;
}

.section + .section {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.section-title {
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: 17px;
}

.section-title p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.field {
    margin-bottom: 14px;
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    display: block;
    margin-bottom: 5px;

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

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea,
select {
    width: 100%;

    padding: 8px 10px;

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

    outline: none;

    background: #fff;
    color: var(--text);

    font: inherit;
    font-size: 14px;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

select {
    cursor: pointer;
}

.field-help {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.date-clear-link {
    display: none;
    margin-top: 5px;

    color: var(--muted);

    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;

    text-decoration: none;
    cursor: pointer;
}

.date-clear-link:hover {
    color: var(--red);
    text-decoration: underline;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    padding: 11px 14px;
    margin-bottom: 14px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: #fafbfc;
}

.switch-description strong {
    display: block;
    font-size: 13px;
}

.switch-description span {
    display: block;
    margin-top: 1px;

    color: var(--muted);
    font-size: 11px;
}

.switch {
    position: relative;
    display: inline-block;

    flex: 0 0 auto;

    width: 44px;
    height: 24px;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;

    border-radius: 999px;

    background: #cbd5e1;

    cursor: pointer;
    transition: 0.2s;
}

.slider::before {
    content: "";

    position: absolute;
    top: 3px;
    left: 3px;

    width: 18px;
    height: 18px;

    border-radius: 50%;

    background: #fff;

    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.2);

    transition: 0.2s;
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 9px;

    padding-top: 18px;

    border-top: 1px solid var(--border);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    min-height: 37px;
    padding: 8px 15px;

    border: 1px solid transparent;
    border-radius: 8px;

    font: inherit;
    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
    cursor: pointer;
}

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

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

.button-secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.button-secondary:hover {
    background: #f8fafc;
}

.login-card .card-body {
    padding: 26px;
}

.login-title {
    margin-bottom: 20px;
    text-align: center;
}

.login-title .brand-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 11px;
}

.login-title h1 {
    margin: 0;
    font-size: 21px;
}

.login-title p {
    margin: 4px 0 0;

    color: var(--muted);
    font-size: 13px;
}

.login-error {
    padding: 9px 11px;
    margin-bottom: 15px;

    border: 1px solid var(--red-border);
    border-radius: 8px;

    background: var(--red-bg);
    color: var(--red);

    font-size: 12px;
}

.login-button {
    width: 100%;
    margin-top: 3px;
}

.footer-note {
    margin-top: 14px;

    color: #8a949f;

    font-size: 11px;
    text-align: center;
}

@media (max-width: 650px) {
    .page {
        padding: 12px 8px;
    }

    .card-header,
    .card-body {
        padding: 17px;
    }

    .date-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .user-bar {
        align-items: flex-start;
    }

    .actions {
        flex-direction: column;
    }

    .actions .button,
    .actions button {
        width: 100%;
    }
}

.date-clear-link {
    display: inline-block;
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: #64748b;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.3;
    text-decoration: underline;
    cursor: pointer;
}

.date-clear-link:hover {
    color: #334155;
}
