* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #0f1b26;
    color: #f2f6fa;
}

a {
    color: #6ab7ff;
    text-decoration: none;
}

a:hover {
    color: #ffffff;
}

/* ===== AUTH ===== */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1b26;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: #142230;
    border: 1px solid #294052;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
}

.auth-card h1 {
    margin: 0 0 14px;
    font-size: 26px;
}

.auth-card .muted {
    margin: 0 0 22px;
    color: #8fa6b8;
    font-size: 14px;
    line-height: 1.45;
}

.auth-card .form {
    margin: 0;
}

.auth-card .form + .form {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #294052;
}

.auth-card label {
    display: block;
    margin: 0 0 7px;
    font-weight: 700;
}

.auth-card input {
    width: 100%;
    margin-bottom: 14px;
}

.auth-card button {
    width: 100%;
    margin-top: 4px;
}

.auth-card button.secondary {
    background: #1d3142;
    color: #8fa6b8;
}

.auth-card button.primary {
    background: #2aabee;
    color: #ffffff;
}

/* ===== LAYOUT ===== */

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: #101923;
    border-right: 1px solid #243647;
    padding: 20px;
}

.brand {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #ffffff;
}

.side-card {
    background: #172532;
    border: 1px solid #2b4054;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}

.muted {
    color: #8fa6b8;
    font-size: 13px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.sidebar nav a {
    display: block;
    padding: 11px 12px;
    border-radius: 10px;
    color: #dce8f3;
}

.sidebar nav a:hover {
    background: #1d3142;
    color: #ffffff;
}

.sidebar nav a.logout {
    color: #ff8d8d;
    margin-top: 12px;
}

.content {
    flex: 1;
    padding: 28px;
    max-width: 1100px;
}

h1 {
    margin-top: 0;
    margin-bottom: 22px;
    font-size: 28px;
}

h2 {
    margin-top: 0;
}

/* ===== PANELS / FORMS ===== */

.panel {
    background: #142230;
    border: 1px solid #294052;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.form label {
    display: block;
    font-weight: 700;
    margin: 16px 0 7px;
    color: #f3f7fb;
}

input,
textarea,
select {
    width: 100%;
    background: #0e1b26;
    color: #f3f7fb;
    border: 1px solid #2d4356;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #2aabee;
    box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.15);
}

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

.hint {
    color: #8fa6b8;
    font-size: 14px;
    margin-top: 6px;
    line-height: 1.4;
}

/* Иконка выбора времени */
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.8;
    cursor: pointer;
}

input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ===== BUTTONS ===== */

button,
.button {
    background: #2aabee;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-block;
}

button:hover,
.button:hover {
    background: #229ed9;
    color: #ffffff;
}

button.danger,
.button.danger {
    background: #d94f4f;
}

button.danger:hover,
.button.danger:hover {
    background: #bf3f3f;
}

.form button {
    margin-top: 18px;
}

/* ===== TOOLBAR ===== */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px;
}

.toolbar button {
    width: auto;
    min-width: 40px;
    margin-top: 0;
    padding: 9px 11px;
    border-radius: 10px;
    background: #1d3142;
    color: #f3f7fb;
    border: 1px solid #31506a;
    font-size: 14px;
}

.toolbar button:hover {
    background: #25455d;
    border-color: #2aabee;
}

/* ===== PREVIEW ===== */

.preview {
    margin-top: 12px;
    padding: 14px;
    background: #0e1b26;
    border: 1px solid #2d4356;
    border-radius: 12px;
    color: #f3f7fb;
    line-height: 1.5;
}

.hidden {
    display: none;
}

/* ===== GRID ===== */

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

/* ===== CHECKBOX ===== */

.checkbox-line {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: fit-content;
    margin: 16px 0;
    padding: 0;
    cursor: pointer;
    font-weight: 700;
    color: #f3f7fb;
    line-height: 1.2;
}

.checkbox-line input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    accent-color: #2aabee;
}

/* ===== FILTERS ===== */

.filters,
.post-filters,
.panel.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters a,
.post-filters a,
.panel.filters a,
.panel > a {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    background: #1d3142;
    color: #dce8f3;
    font-weight: 700;
}

.filters a:hover,
.post-filters a:hover,
.panel.filters a:hover,
.panel > a:hover {
    background: #2aabee;
    color: #ffffff;
}

/* ===== TABLES ===== */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #142230;
    border-radius: 14px;
    overflow: hidden;
}

thead th {
    background: #172a3a;
    color: #ffffff;
    font-weight: 700;
    padding: 13px 12px;
    text-align: left;
    vertical-align: top;
}

tbody tr {
    background: #142230;
    box-shadow: inset 0 -1px 0 #294052;
}

tbody tr:last-child {
    box-shadow: none;
}

td {
    padding: 13px 12px;
    text-align: left;
    vertical-align: top;
    background: transparent;
    border: none !important;
    word-break: break-word;
}

th {
    border: none !important;
}

td:nth-child(1),
th:nth-child(1) {
    width: 120px;
}

td:nth-child(2),
th:nth-child(2) {
    width: 150px;
}

td:nth-child(3),
th:nth-child(3) {
    width: auto;
}

td:nth-child(4),
th:nth-child(4) {
    width: 80px;
}

td:nth-child(5),
th:nth-child(5) {
    width: 130px;
}

td:nth-child(6),
th:nth-child(6) {
    width: 150px;
}

td:last-child,
th:last-child {
    width: 110px;
    text-align: center;
}

.actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: none !important;
    box-shadow: none !important;
}

.actions a,
.actions button {
    width: 74px;
    text-align: center;
    font-size: 13px;
    padding: 8px 10px;
}

/* ===== STATUS ===== */

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status.scheduled {
    background: #2d4054;
    color: #cde7ff;
}

.status.processing {
    background: #4b3f20;
    color: #ffe19a;
}

.status.sent {
    background: #1d4b37;
    color: #9ff0c3;
}

.status.error {
    background: #592d2d;
    color: #ffb0b0;
}

/* ===== FLASH ===== */

.flash {
    padding: 13px 15px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 700;
}

.flash.success {
    background: #153f2e;
    color: #a4f0c4;
    border: 1px solid #2d7b58;
}

.flash.error {
    background: #4a2020;
    color: #ffb8b8;
    border: 1px solid #8a3a3a;
}

/* ===== MOBILE ===== */

@media (max-width: 800px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #243647;
    }

    .content {
        padding: 18px;
        max-width: none;
    }

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

    table {
        display: block;
        overflow-x: auto;
    }
}