:root {
    --bg: #090909;
    --bg-soft: #111111;
    --panel: rgba(20, 20, 20, 0.88);
    --panel-2: rgba(32, 32, 32, 0.92);
    --text: #f4f0e8;
    --muted: #bda98f;
    --border: rgba(255, 110, 30, 0.18);
    --accent: #ff5a1f;
    --accent-2: #ff9e2f;
    --accent-red: #ff3d2e;
    --toxic: #8fd400;
    --shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --radius-lg: 24px;
    --sidebar-width: 290px;
    --header-height: 88px;
    --font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
}

body {
    position: relative;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select {
    font: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: 0.2s ease;
    font-weight: 700;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-2));
    color: #fff9f1;
    box-shadow: 0 0 24px rgba(255, 76, 35, 0.24);
}

.btn-secondary {
    background: rgba(255, 120, 40, 0.12);
    border-color: rgba(255, 120, 40, 0.35);
    color: #ffd8b0;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #f6efe5;
}

.btn-danger-outline {
    background: transparent;
    border-color: rgba(255, 70, 70, 0.35);
    color: #ffb0a3;
}

.widget-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    backdrop-filter: blur(12px);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 110, 30, 0.12);
    border: 1px solid rgba(255, 110, 30, 0.25);
    color: #ffd8b0;
    font-size: 13px;
    font-weight: 700;
}

.pulse-red {
    animation: pulseRed 1.8s infinite;
}

@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(255, 70, 46, 0.45); }
    70% { box-shadow: 0 0 0 12px rgba(255, 70, 46, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 70, 46, 0); }
}

.empty-state {
    color: var(--muted);
    padding: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.stack-list {
    display: grid;
    gap: 12px;
}

.stack-item {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.search-input,
.form-group input,
.form-group select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 140, 50, 0.18);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    outline: none;
}

.search-input:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: rgba(255, 140, 50, 0.55);
    box-shadow: 0 0 0 3px rgba(255, 100, 50, 0.12);
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    color: #ffd6bb;
}

.data-table-wrap {
    overflow: auto;
    border-radius: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.96);
    color: #ffcf9c;
    text-align: left;
    padding: 14px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 120, 40, 0.18);
}

.data-table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #f2e7d8;
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: rgba(255, 110, 30, 0.06);
}

.admin-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.action-result {
    margin-top: 16px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: #ffe3ca;
    min-height: 48px;
}

.skeleton-card {
    min-height: 110px;
    background:
        linear-gradient(
            90deg,
            rgba(255,255,255,0.02) 0%,
            rgba(255,255,255,0.08) 50%,
            rgba(255,255,255,0.02) 100%
        );
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite linear;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.form-desc {
    display: block;
    font-size: 12px;
    opacity: 0.6;
    margin-bottom: 6px;
}

.settings-group {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}

.settings-group h3 {
    margin-bottom: 10px;
    font-size: 16px;
    opacity: 0.8;
}

select {
    width: 100%;
    padding: 10px;
    background: #0d0d0d;
    border: 1px solid rgba(255, 140, 0, 0.4);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-image: linear-gradient(45deg, transparent 50%, #ff7a00 50%),
                      linear-gradient(135deg, #ff7a00 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(50% - 3px),
                         calc(100% - 15px) calc(50% - 3px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

select option {
    background: #111;
    color: #fff;
}

select:focus {
    outline: none;
    border-color: #ff7a00;
    box-shadow: 0 0 0 1px rgba(255, 122, 0, 0.4);
}

.form-desc {
    display: block;
    font-size: 12px;
    opacity: 0.6;
    margin-bottom: 6px;
}


/* 🔥 changed field highlight */
.form-group.changed input,
.form-group.changed select {
    border-color: #ff7a00 !important;
    box-shadow: 0 0 0 1px rgba(255,122,0,0.4);
}

/* 🔥 toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #111;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px 18px;
    border-radius: 6px;
    color: #fff;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { border-color: #00ff9c; }
.toast.error { border-color: #ff4d4d; }

/* 🔥 warning bar */
.unsaved-bar {
    background: rgba(255,122,0,0.1);
    border: 1px solid rgba(255,122,0,0.4);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
    display: none;
}

.unsaved-bar.show {
    display: block;
}







.settings-unsaved-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 140, 0, 0.35);
    background: rgba(255, 140, 0, 0.08);
    border-radius: 10px;
}

.settings-unsaved-bar.show {
    display: flex;
}

.settings-unsaved-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-group.changed input,
.form-group.changed select,
.form-group.changed textarea {
    border-color: rgba(255, 140, 0, 0.9) !important;
    box-shadow: 0 0 0 1px rgba(255, 140, 0, 0.25);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.settings-toast-wrap {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.settings-toast {
    min-width: 220px;
    max-width: 340px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #fff;
    background: #171717;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.settings-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.settings-toast-success {
    border-color: rgba(0, 255, 156, 0.45);
}

.settings-toast-error {
    border-color: rgba(255, 77, 77, 0.45);
}

.settings-toast-info {
    border-color: rgba(255, 140, 0, 0.45);
}