:root {
    --bg: #0f1216;
    --panel: #161b22;
    --panel-2: #1c222b;
    --border: #2a313c;
    --text: #e6e9ef;
    --muted: #8b949e;
    --accent: #4f8cff;
    --accent-2: #3b6fd6;
    --success: #3fb950;
    --warn: #d29922;
    --error: #f85149;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
}

.brand { font-weight: 700; font-size: 1.1rem; margin-bottom: 1.5rem; }

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar nav a {
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}
.sidebar nav a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    font-size: 0.85rem;
}

.content { flex: 1; padding: 2rem 2.5rem; max-width: 1200px; }

h1 { margin-top: 0; font-size: 1.5rem; }
h2 { font-size: 1.1rem; margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.text-error { color: var(--error); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }

input[type=text], input[type=password], input[type=number], input[type=file], select {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); margin-left: 0.5rem; }
.btn-block { width: 100%; margin-top: 0.5rem; }

.link-danger { background: none; border: none; color: var(--error); cursor: pointer; padding: 0; font-size: 0.9rem; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(248, 81, 73, 0.12); border: 1px solid rgba(248, 81, 73, 0.4); color: #ffb4af; }
.alert-warn { background: rgba(210, 153, 34, 0.12); border: 1px solid rgba(210, 153, 34, 0.4); color: #ffd479; }

.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.actions a { margin-right: 0.75rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}
.stat-card.stat-error { border-color: rgba(248, 81, 73, 0.5); }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .progress-grid { grid-template-columns: 1fr; } }

.progress-bar {
    background: var(--panel-2);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
}
.progress-bar.small { height: 6px; margin: 0.25rem 0; }
.progress-fill { background: linear-gradient(90deg, var(--accent), var(--success)); height: 100%; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-pending { background: rgba(210, 153, 34, 0.15); color: #ffd479; }
.badge-sent { background: rgba(63, 185, 80, 0.15); color: #6fe08a; }
.badge-failed { background: rgba(248, 81, 73, 0.15); color: #ffb4af; }

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    width: 320px;
}
.auth-card h1 { font-size: 1.3rem; margin-bottom: 0.2rem; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }

code { background: var(--panel-2); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85em; }
