/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    --bg: #0b1020;
    --panel: #11182e;
    --muted: #96a0c3;
    --text: #eef2ff;
    --brand: #4f7cff;
    --brand-2: #6fe3ff;
    --ok: #22c55e;
    --warn: #f59e0b;
    --err: #ef4444;
    --card: #121a33;
    --card-2: #0f152b;
    --border: #1f2a4d;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(1200px 800px at 10% -10%, rgba(111, 227, 255, 0.08), transparent 60%),
        radial-gradient(1000px 700px at 120% 30%, rgba(79, 124, 255, 0.10), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography
   ========================================================================== */
a {
    color: var(--brand);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--brand-2);
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: 600;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px;
}

/* ==========================================================================
   Header & Brand
   ========================================================================== */
header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: grid;
    place-items: center;
    color: white;
    box-shadow: var(--shadow);
}

.brand .name {
    font-size: 18px;
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */
.card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
}

.title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
}

/* ==========================================================================
   Buttons & Toolbar
   ========================================================================== */
.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #0d1430;
    color: var(--text);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn:hover {
    border-color: #2a3a72;
    transform: translateY(-1px);
}

.btn.primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border: none;
    color: #06112a;
    font-weight: 700;
}

.btn.primary:hover {
    background: linear-gradient(135deg, var(--brand-2), var(--brand));
}

.btn.ghost {
    background: transparent;
}

.btn.danger {
    background: transparent;
    border-color: #3a2330;
    color: #ffc7c7;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   Grid System
   ========================================================================== */
.grid {
    display: grid;
    gap: 16px;
}

.row {
    display: grid;
    gap: 12px;
}

@media (min-width: 900px) {
    .grid.cols-2 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 700px) {
    .row.cols-2-3 {
        grid-template-columns: 1fr 2fr;
    }

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

    .row.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0 20px;
}

.tab {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    background: #0b1330;
    color: #cfd7ff;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tab:hover {
    background: #0c1638;
}

.tab.active {
    background: linear-gradient(135deg, rgba(79, 124, 255, 0.25), rgba(111, 227, 255, 0.15));
    border-color: #31407a;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.field.inline {
    flex-direction: row;
    align-items: center;
}

label {
    font-size: 13px;
    color: #c6d0ff;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0b1330;
    color: var(--text);
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3a4aa0;
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.25);
}

/* ==========================================================================
   Table
   ========================================================================== */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.table th {
    color: #9fb0ff;
    text-align: left;
    font-weight: 600;
    padding: 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 14px 10px;
    background: #0b1330;
    border: 1px solid var(--border);
    font-size: 14px;
}

.table tr td:first-child {
    border-radius: 12px 0 0 12px;
}

.table tr td:last-child {
    border-radius: 0 12px 12px 0;
}

/* ==========================================================================
   Badges & Chips
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.b-new {
    background: #1a2a66;
    color: #b7c7ff;
    border: 1px solid #2b3ea0;
}

.b-sent {
    background: #103021;
    color: #aaf2c8;
    border: 1px solid #1f6f42;
}

.chip {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #0c1433;
    font-size: 12px;
    color: #c8d3ff;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.muted {
    color: var(--muted);
}

.empty {
    padding: 40px 20px;
    text-align: center;
    color: #a7b0d6;
}

.hr {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    margin: 14px 0;
    border: none;
}

.hint {
    font-size: 12px;
    color: #9aa5d1;
    font-style: italic;
}

.right {
    display: flex;
    justify-content: flex-end;
}

.link {
    font-size: 13px;
    text-decoration: none;
    color: var(--brand);
}

.link:hover {
    text-decoration: none;
}

/* ==========================================================================
   Toast & Alerts
   ========================================================================== */
.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    padding: 12px 14px;
    background: #0c1535;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 1000;
}

.alert {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.alert.alert-success {
    font-size: 16px;
    color: #9aa5d1;
    text-align: center;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

/* ==========================================================================
   Animations
   ========================================================================== */
.fade-in {
    animation: fade 0.25s ease;
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .wrap {
        padding: 16px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .toolbar {
        width: 100%;
        justify-content: center;
    }

    .tabs {
        justify-content: center;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .brand .name {
        font-size: 16px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

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