:root {
    --bg: #070b17;
    --bg-soft: rgba(14, 20, 38, 0.85);
    --line: rgba(126, 202, 255, 0.22);
    --line-strong: rgba(126, 202, 255, 0.5);
    --text: #eaf4ff;
    --muted: #91a5c2;
    --cyan: #67e8f9;
    --violet: #8b5cf6;
    --lime: #bef264;
    --danger: #fb7185;
    --warning: #fbbf24;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    --radius: 24px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(103, 232, 249, 0.12), transparent 35%),
        radial-gradient(circle at top right, rgba(139, 92, 246, 0.14), transparent 34%),
        linear-gradient(180deg, #050814 0%, #090d1c 55%, #050814 100%);
    color: var(--text);
    overflow-x: hidden;
}

.stars,
.nebula {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.stars {
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.8), transparent),
        radial-gradient(2px 2px at 75% 25%, rgba(255,255,255,.6), transparent),
        radial-gradient(1.5px 1.5px at 40% 70%, rgba(255,255,255,.8), transparent),
        radial-gradient(1px 1px at 65% 60%, rgba(255,255,255,.8), transparent),
        radial-gradient(2px 2px at 85% 80%, rgba(255,255,255,.7), transparent),
        radial-gradient(1px 1px at 10% 85%, rgba(255,255,255,.8), transparent);
    opacity: .7;
}

.nebula-a {
    background: radial-gradient(circle at 15% 25%, rgba(103, 232, 249, .18), transparent 28%);
}

.nebula-b {
    background: radial-gradient(circle at 82% 18%, rgba(139, 92, 246, .18), transparent 30%);
}

.shell {
    position: relative;
    z-index: 1;
    width: min(1380px, calc(100% - 32px));
    margin: 28px auto 40px;
}

.panel {
    background: linear-gradient(180deg, rgba(10, 15, 30, 0.95), rgba(6, 11, 22, 0.95));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(103, 232, 249, 0.06), transparent 30%, rgba(139, 92, 246, 0.05) 100%);
    pointer-events: none;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--cyan);
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: 12px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.05;
}

.lead {
    color: var(--muted);
    max-width: 700px;
    margin: 14px 0 0;
    line-height: 1.6;
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 14px;
    min-width: 380px;
}

.metric {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: rgba(8, 13, 27, 0.65);
}

.metric span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
    font-size: 13px;
}

.metric strong {
    font-size: 28px;
    color: var(--cyan);
}

.flash {
    margin: 18px 0;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid;
    font-weight: 600;
}
.flash.success {
    border-color: rgba(190, 242, 100, .45);
    background: rgba(190, 242, 100, .08);
}
.flash.error {
    border-color: rgba(251, 113, 133, .45);
    background: rgba(251, 113, 133, .08);
}

.grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}
.top-grid { grid-template-columns: 1.1fr; }
.bottom-grid { grid-template-columns: 1.2fr .8fr; }

.panel-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.panel-title h2 {
    margin: 0;
    font-size: 1.25rem;
}

.panel-title span {
    color: var(--muted);
    font-size: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.compact-form { align-items: end; }
.compact-form button { height: 50px; }

label span {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

input[type="text"],
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(5, 10, 20, 0.9);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
    transition: .2s ease;
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 4px rgba(103, 232, 249, .09);
}

.primary-btn,
.template-tab {
    border: 1px solid rgba(103, 232, 249, .4);
    border-radius: 18px;
    padding: 14px 18px;
    background: linear-gradient(180deg, rgba(9, 17, 31, .95), rgba(7, 12, 24, .95));
    color: var(--text);
    cursor: pointer;
    transition: .2s ease;
    font-weight: 700;
}

.primary-btn:hover,
.template-tab:hover,
.template-tab.active {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(103, 232, 249, .12);
    border-color: rgba(103, 232, 249, .8);
}

.danger-btn {
    border: 1px solid rgba(251, 113, 133, .55);
    border-radius: 14px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(44, 12, 24, .96), rgba(24, 7, 14, .98));
    color: #ffe4ea;
    cursor: pointer;
    font-weight: 700;
    transition: .2s ease;
}

.danger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(251, 113, 133, .16);
    border-color: rgba(251, 113, 133, .85);
}

.hint {
    color: var(--muted);
    font-size: 14px;
    margin-top: 12px;
}

.preview-box {
    min-height: 136px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line);
    border-radius: 20px;
    background: rgba(4, 8, 18, .7);
    padding: 18px;
}

.preview-box code,
.log-card code {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--lime);
}

.table-wrap {
    overflow: auto;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(4, 8, 18, .6);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(126, 202, 255, .1);
}

th {
    color: var(--cyan);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

td { color: var(--text); }

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #67e8f9;
}

.composer-block {
    display: grid;
    gap: 18px;
}

.broadcast-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: end;
}

.template-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.template-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.template-tab small {
    color: var(--muted);
    font-weight: 500;
}

.template-form {
    display: none;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    background: rgba(6, 11, 22, 0.75);
}
.template-form.active { display: block; }

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.template-header h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

.template-header p {
    margin: 0;
    color: var(--muted);
}

.file-pill {
    border: 1px solid rgba(139, 92, 246, .45);
    color: #ddd6fe;
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(139, 92, 246, .09);
    white-space: nowrap;
}

.template-selection {
    margin-bottom: 18px;
}

.template-selection > span {
    display: inline-block;
    color: var(--muted);
    margin-bottom: 10px;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    position: relative;
}

.chip input {
    position: absolute;
    opacity: 0;
}

.chip span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 999px;
    background: rgba(8, 13, 27, .78);
    border: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
}

.chip input:checked + span {
    border-color: rgba(103, 232, 249, .8);
    box-shadow: 0 0 0 4px rgba(103, 232, 249, .08);
}

.log-list {
    display: grid;
    gap: 12px;
}

.log-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: rgba(5, 9, 18, .75);
}

.log-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.log-meta span,
.log-ids { color: var(--muted); font-size: 14px; }

.bullet-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text);
}

.bullet-list li { margin-bottom: 12px; color: var(--muted); }

@media (max-width: 1080px) {
    .hero,
    .top-grid,
    .bottom-grid,
    .broadcast-box,
    .form-grid,
    .template-tabs {
        grid-template-columns: 1fr;
        display: grid;
    }

    .hero {
        align-items: flex-start;
    }

    .hero-metrics {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 100%);
        margin: 10px auto 28px;
    }

    .panel {
        padding: 18px;
        border-radius: 20px;
    }

    .hero h1 { font-size: 2rem; }
    .panel-title {
        flex-direction: column;
        align-items: flex-start;
    }
}


.hero-side {
    display: grid;
    gap: 14px;
}

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(8, 13, 27, 0.65);
}

.ghost-link {
    color: var(--cyan);
    text-decoration: none;
    font-weight: 700;
}

.selection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(5, 10, 20, 0.72);
}

.selection-status span {
    color: var(--muted);
}

.selection-status strong {
    color: var(--cyan);
    word-break: break-word;
}

.selection-status.compact {
    margin-bottom: 18px;
}

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-shell {
    width: min(520px, calc(100% - 24px));
    position: relative;
    z-index: 1;
}

.auth-panel h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

input[type="password"] {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(5, 10, 20, 0.9);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
    transition: .2s ease;
}

input[type="password"]:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 4px rgba(103, 232, 249, .09);
}

.auth-note {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, .35);
    background: rgba(139, 92, 246, .08);
    color: var(--muted);
    line-height: 1.6;
}


.inline-delete-form {
    margin: 0;
}

.inline-delete-form .danger-btn {
    white-space: nowrap;
}
