/* Global reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: light dark;
    --bg-gradient: radial-gradient(circle at top left, #1f3bff, #191919);
    --card-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04));
    --text-color: #f5f7ff;
    --muted-color: #a6b0cf;
    --accent-color: #5df2ff;
    --accent-dark: #14c6cb;
    --danger-color: #ff7171;
    --success-color: #5dffa5;
    --shadow-color: rgba(15, 23, 42, 0.55);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-gradient) fixed;
    color: var(--text-color);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    backdrop-filter: blur(6px);
}

.layout {
    display: grid;
    gap: 2rem;
    padding: clamp(1.5rem, 3vw, 3rem);
}

.glass-card {
    background: var(--card-gradient);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    padding: clamp(1.5rem, 4vw, 3rem);
    position: relative;
    overflow: hidden;
}

.glass-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0.4;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.25), transparent 60%);
}

.glass-card > * {
    position: relative;
    z-index: 1;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tab {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab.active {
    background: rgba(93, 242, 255, 0.2);
    color: var(--text-color);
    box-shadow: 0 10px 30px -12px var(--shadow-color);
}

.section {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.section.active {
    display: flex;
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
    color: #071021;
    box-shadow: 0 12px 28px -10px rgba(20, 198, 203, 0.65);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px -12px rgba(20, 198, 203, 0.75);
}

.btn-small {
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #e35252);
    color: #180808;
    box-shadow: 0 12px 28px -10px rgba(255, 113, 113, 0.55);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-color);
    box-shadow: none;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
    border-radius: 18px;
    overflow: hidden;
}

.data-grid thead {
    background: rgba(255, 255, 255, 0.12);
}

.data-grid th,
.data-grid td {
    padding: 0.9rem 1.2rem;
    text-align: left;
    font-size: 0.95rem;
    color: rgba(245, 247, 255, 0.92);
}

.data-grid tbody tr:nth-child(every) {
    background: transparent;
}

.data-grid tbody tr {
    backdrop-filter: blur(4px);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--muted-color);
}

.status-pill {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pill.success {
    background: rgba(93, 255, 165, 0.15);
    color: var(--success-color);
}

.status-pill.failed {
    background: rgba(255, 113, 113, 0.15);
    color: var(--danger-color);
}

form {
    display: grid;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-color);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    border-radius: 14px;
    padding: 0.75rem 1rem;
    background: rgba(10, 13, 28, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    transition: border 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(93, 242, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(93, 242, 255, 0.2);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px;
    padding: 1rem 1.2rem;
    background: rgba(10, 13, 28, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    gap: 1rem;
}

.list-row h4 {
    margin: 0;
    font-size: 1rem;
}

.list-row span {
    color: var(--muted-color);
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    gap: 0.6rem;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 30, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: min(820px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(10, 13, 28, 0.9);
    border-radius: 22px;
    border: 1px solid rgba(93, 242, 255, 0.2);
    padding: 2rem;
    box-shadow: 0 35px 65px -20px rgba(8, 15, 45, 0.75);
    display: grid;
    gap: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--muted-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.18s ease;
}

.modal-close:hover {
    color: var(--text-color);
}

.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(7, 15, 32, 0.85);
    border: 1px solid rgba(93, 242, 255, 0.35);
    border-radius: 16px;
    padding: 1rem 1.4rem;
    color: var(--text-color);
    box-shadow: 0 18px 34px -18px rgba(5, 15, 45, 0.9);
    z-index: 1100;
    opacity: 0;
    transform: translateY(-16px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.error {
    border-color: rgba(255, 113, 113, 0.35);
}

.send-results {
    display: grid;
    gap: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
}

.send-summary {
    color: var(--muted-color);
    padding: 0.5rem 0;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.attachment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.attachment-row button {
    flex-shrink: 0;
}

.send-result {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.send-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.send-result-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.send-result-error {
    display: none;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: rgba(255, 113, 113, 0.12);
    border-left: 3px solid var(--danger-color);
    color: var(--danger-color);
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.send-result-error.open {
    display: block;
}

.error-toggle {
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: var(--muted-color);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.error-toggle:hover {
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.45);
}

.empty-state {
    padding: 2rem;
    border-radius: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    text-align: center;
    color: var(--muted-color);
}

.hidden {
    display: none !important;
}

@media (max-width: 960px) {
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-group {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-content {
        padding: 1.5rem;
    }
}
