:root {
    --bg: #0f1419;
    --surface: #1a222d;
    --surface-2: #232d3b;
    --border: #2e3a4a;
    --text: #e8eef4;
    --text-muted: #8b9cb0;
    --accent: #22c9a8;
    --accent-dim: rgba(34, 201, 168, 0.15);
    --danger: #f07178;
    --warning: #e6b450;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ——— Login ——— */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(34, 201, 168, 0.12), transparent),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.login-brand {
    text-align: center;
    padding: 1.25rem 0 1.75rem;
    margin-bottom: 0.25rem;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.login-brand p {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
    resize: vertical;
}

.form-group textarea {
    min-height: 8rem;
    line-height: 1.55;
}

.form-group textarea.textarea-message {
    min-height: 6rem;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-hint {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-panel {
    padding: 1.5rem 1.75rem;
    max-width: 640px;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.alert {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(240, 113, 120, 0.12);
    border: 1px solid rgba(240, 113, 120, 0.35);
    color: #ffb4b9;
}

.alert-info {
    background: var(--accent-dim);
    border: 1px solid rgba(34, 201, 168, 0.35);
    color: #9ef0df;
    font-size: 0.8rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    font: inherit;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: #062820;
}

.btn-primary:hover {
    opacity: 0.92;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text-muted);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

/* ——— App shell ——— */
.app-body {
    min-height: 100vh;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 2rem;
}

.brand:hover {
    text-decoration: none;
}

.brand-text {
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.nav-item.is-active {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-icon {
    opacity: 0.85;
    font-size: 0.95rem;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(26, 34, 45, 0.6);
}

.topbar-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.content {
    padding: 1.75rem;
    flex: 1;
}

/* ——— Dashboard ——— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.35rem;
}

.stat-value.accent {
    color: var(--accent);
}

.stat-value.warning {
    color: var(--warning);
}

.stat-value.danger {
    color: var(--danger);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table.data-table th,
table.data-table td {
    padding: 0.75rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table.data-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

table.data-table tr:last-child td {
    border-bottom: none;
}

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-sent {
    background: var(--accent-dim);
    color: var(--accent);
}

.status-pending {
    background: rgba(230, 180, 80, 0.15);
    color: var(--warning);
}

.status-failed {
    background: rgba(240, 113, 120, 0.15);
    color: var(--danger);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.filter-chip {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-decoration: none;
}

.filter-chip:hover {
    color: var(--text);
    text-decoration: none;
}

.filter-chip.is-active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(34, 201, 168, 0.35);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-foot {
        display: none;
    }
}
