* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: #f4f6f8;
    color: #18212f;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button {
    font: inherit;
}

.shell {
    min-height: 100vh;
}

.topbar {
    min-height: 74px;
    padding: 0 36px;

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

    background: #111827;
    color: white;
}

.brand {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .08em;
}

.subtitle {
    margin-top: 3px;

    font-size: 12px;
    color: #9ca3af;
}

.topbar-right {
    font-size: 13px;
    color: #d1d5db;
}

main {
    width: min(1400px, calc(100% - 48px));
    margin: 0 auto;
    padding: 42px 0 80px;
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;

    margin-bottom: 32px;
}

.eyebrow {
    margin-bottom: 7px;

    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    color: #6b7280;
}

.hero h1 {
    margin: 0;

    font-size: 34px;
    line-height: 1.1;
}

.hero p {
    margin: 10px 0 0;

    font-size: 15px;
    color: #6b7280;
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 9px;

    cursor: pointer;

    font-weight: 700;
}

.primary-button {
    padding: 13px 18px;

    background: #111827;
    color: #fff;
}

.secondary-button {
    width: 100%;
    padding: 11px 14px;

    background: #eef1f5;
    color: #1f2937;
}

.stats {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 16px;

    margin-bottom: 38px;
}

.stat-card {
    padding: 22px;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    background: white;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
}

.stat-value {
    margin-top: 8px;

    font-size: 31px;
    font-weight: 800;
}

.customer-section {
    margin-top: 10px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 16px;
}

.section-title h2 {
    margin: 0;

    font-size: 21px;
}

.section-title p {
    margin: 5px 0 0;

    font-size: 13px;
    color: #6b7280;
}

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

.customer-card {
    padding: 22px;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    background: white;
}

.customer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    padding-bottom: 18px;

    border-bottom: 1px solid #edf0f3;
}

.customer-head h3 {
    margin: 0;

    font-size: 19px;
}

.customer-id {
    margin-top: 5px;

    font-family: monospace;
    font-size: 12px;
    color: #8a93a1;
}

.badge {
    display: inline-flex;

    padding: 6px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 800;

    white-space: nowrap;
}

.badge.success {
    background: #e9f7ef;
    color: #1c6c3e;
}

.badge.warning {
    background: #fff4dd;
    color: #946200;
}

.badge.danger {
    background: #fdeaea;
    color: #a12d2d;
}

.badge.info {
    background: #e8f1fb;
    color: #275f9d;
}

.badge.muted {
    background: #eceff3;
    color: #687181;
}

.details {
    padding: 16px 0;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 8px 0;

    font-size: 13px;
}

.detail-row span {
    color: #6b7280;
}

.detail-row strong {
    text-align: right;

    font-weight: 700;
}

.card-actions {
    padding-top: 4px;
}

.error-box {
    margin-top: 16px;
    padding: 12px;

    border-radius: 9px;

    background: #fdeaea;
    color: #8e2525;

    font-size: 13px;
}

.empty-state {
    grid-column: 1 / -1;

    padding: 50px;

    border: 1px dashed #cfd5dd;
    border-radius: 14px;

    text-align: center;
    color: #7b8491;
}

@media (max-width: 900px) {

    .stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .customer-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 600px) {

    .topbar {
        padding: 0 20px;
    }

    main {
        width: min(
            100% - 28px,
            1400px
        );

        padding-top: 28px;
    }

    .hero {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-button {
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

}

.action-link {
    display: block;
    text-align: center;
    text-decoration: none;
}

.top-link {
    color: #d1d5db;
    text-decoration: none;
    font-size: 13px;
}

.detail-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 28px;
}

.detail-hero h1 {
    margin: 0;
    font-size: 34px;
}

.mono {
    margin: 7px 0 0;

    font-family: monospace;
    color: #7b8491;
}

.badge.large {
    padding: 8px 12px;
    font-size: 12px;
}

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

.panel-card {
    padding: 22px;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    background: #fff;
}

.panel-head {
    margin-bottom: 10px;
}

.panel-head h2 {
    margin: 0;
    font-size: 18px;
}

.full {
    width: 100%;
}

.button-gap {
    height: 10px;
}

.user-list {
    margin-top: 12px;
}

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

    padding: 11px 0;

    border-bottom: 1px solid #edf0f3;
}

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

.empty-mini,
.muted-text {
    color: #7b8491;
    font-size: 13px;
}

@media (max-width: 800px) {

    .detail-grid {
        grid-template-columns: 1fr;
    }

}

.danger-button {
    border: 0;
    border-radius: 9px;

    padding: 13px 18px;

    background: #b42318;
    color: white;

    cursor: pointer;

    font: inherit;
    font-weight: 700;
}

.danger-button:hover {
    opacity: .92;
}

.action-link-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;
}

.form-wrap {
    max-width: 720px;
}

.form-card {
    padding: 28px;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;

    margin-bottom: 8px;

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

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

    padding: 12px 13px;

    border: 1px solid #d8dde5;
    border-radius: 9px;

    background: #fff;
    color: #18212f;

    font: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: 2px solid #dbe5f2;
    border-color: #aebdce;
}

.field-help {
    margin-top: 6px;

    font-size: 12px;
    color: #87909c;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    padding-top: 6px;
}

.form-actions .secondary-button {
    width: auto;
    padding-left: 18px;
    padding-right: 18px;
}

@media (max-width: 600px) {

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .secondary-button,
    .form-actions .primary-button {
        width: 100%;
    }

}

.form-group textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d8dde5;
    border-radius: 9px;
    resize: vertical;
    background: #fff;
    color: #18212f;
    font: inherit;
}

.form-group textarea:focus {
    outline: 2px solid #dbe5f2;
    border-color: #aebdce;
}

.customer-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    margin-bottom: 20px;
}

.renew-option {
    margin-bottom: 12px;
}

.renew-option label {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    padding: 14px;

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

    cursor: pointer;
}

.renew-option input {
    margin-top: 4px;
}

.renew-option span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.renew-option small {
    color: #7b8491;
}

.history-section {
    margin-top: 18px;
}

.history-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    padding: 13px 0;

    border-bottom: 1px solid #edf0f3;
}

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

.history-time {
    margin-top: 4px;

    font-size: 11px;
    color: #8a93a1;
}

.history-meta {
    text-align: right;

    font-size: 12px;
    color: #596273;
}

@media (max-width: 650px) {

    .customer-toolbar {
        flex-direction: column;
    }

}

.danger-zone {
    margin-top: 28px;
}

.danger-zone-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;

    border-color: #efc5c1;
}

.danger-zone-card h2 {
    margin: 0 0 7px;
    color: #a32920;
}

.danger-zone-card p {
    margin: 0;
    max-width: 720px;

    color: #79504c;
    font-size: 13px;
    line-height: 1.5;
}

.delete-page {
    max-width: 760px;
    margin: 40px auto 0;
}

.delete-card {
    padding: 34px;
}

.delete-icon {
    font-size: 42px;
}

.delete-card h1 {
    margin: 12px 0 8px;
}

.delete-warning {
    margin: 24px 0;
    padding: 18px;

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

    background: #fff3f1;
    color: #7f2d25;

    line-height: 1.65;
}

@media (max-width: 700px) {

    .danger-zone-card {
        align-items: stretch;
        flex-direction: column;
    }

}

.telegram-section h3 {
    margin: 0 0 12px;
    font-size: 14px;
}

.telegram-divider {
    height: 1px;
    margin: 22px 0;
    background: #edf0f3;
}

.inline-form {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.inline-form input {
    flex: 1;

    padding: 11px 12px;

    border: 1px solid #d8dde5;
    border-radius: 9px;

    font: inherit;
}

.mini-danger-button {
    border: 0;
    border-radius: 7px;

    padding: 7px 10px;

    background: #fdeaea;
    color: #a12d2d;

    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 600px) {

    .inline-form {
        flex-direction: column;
    }

}

.token-warning {
    padding: 13px 14px;
    border: 1px solid #f0d7a4;
    border-radius: 9px;
    background: #fff8e8;
    color: #805d16;
    font-size: 13px;
    line-height: 1.45;
}

.telegram-add-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 16px;
}

.telegram-add-form input {
    padding: 11px 12px;
    border: 1px solid #d8dde5;
    border-radius: 9px;
    font: inherit;
}

.telegram-user-id {
    margin-top: 3px;
    font-family: monospace;
    font-size: 11px;
    color: #8a93a1;
}

@media (max-width: 700px) {
    .telegram-add-form {
        grid-template-columns: 1fr;
    }
}

.token-status-box {
    margin-bottom: 14px;
    padding: 13px 14px;

    border: 1px solid #dfe4ea;
    border-radius: 9px;

    background: #f8fafc;
}

.token-status-box.empty-token {
    border-color: #f0d7a4;
    background: #fff8e8;
}

.token-mask {
    font-family: monospace;
    font-size: 18px;
    letter-spacing: 2px;
    color: #374151;
}

.login-page {
    min-height: 100vh;

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

    padding: 24px;

    background: #111827;
}

.login-card {
    width: min(420px, 100%);

    padding: 34px;

    border-radius: 16px;

    background: #fff;
}

.login-brand {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .08em;
    color: #111827;
}

.login-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #7b8491;
}

.login-card h1 {
    margin: 28px 0 22px;
    font-size: 26px;
}

.login-error {
    margin-bottom: 16px;
    padding: 11px 12px;

    border-radius: 8px;

    background: #fdeaea;
    color: #a12d2d;

    font-size: 13px;
}

.logout-form {
    margin-left: auto;
}

.logout-button {
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;

    padding: 8px 12px;

    background: transparent;
    color: #fff;

    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.logout-button:hover {
    background: rgba(255,255,255,.08);
}

.bot-action-form {
    margin-bottom: 9px;
}

.restart-button {
    border: 0;
    border-radius: 8px;

    padding: 11px 14px;

    background: #e8eef7;
    color: #243b5a;

    cursor: pointer;
    font-weight: 700;
}

.restart-button:hover {
    background: #dce6f3;
}

.dashboard-restart-form {
    margin-left: auto;
}

.restart-all-button {
    border: 0;
    border-radius: 10px;

    padding: 13px 16px;

    background: #e8eef7;
    color: #243b5a;

    cursor: pointer;
    font-weight: 700;
}

.restart-all-button:hover {
    background: #dce6f3;
}
