:root {
    --bg-main: #09090b;
    --bg-sidebar: #18181b;
    --bg-panel: #27272a;
    --bg-hover: #3f3f46;

    --text-main: #fafafa;
    --text-muted: #a1a1aa;

    --primary: #3b82f6;
    /* Blue */
    --primary-hover: #2563eb;

    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;

    --border: #3f3f46;
    --radius: 8px;

    --env-prod: #ef4444;
    --env-stg: #f59e0b;
    --env-dev: #3b82f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Utilities */
.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-auto {
    margin-top: auto;
}

.pt-2 {
    padding-top: 0.5rem;
}

.pt-3 {
    padding-top: 1rem;
}

.pb-3 {
    padding-bottom: 1rem;
}

.border-bottom {
    border-bottom: 1px solid var(--border);
}

.border-top {
    border-top: 1px solid var(--border);
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.85rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-primary {
    color: var(--primary);
}

.text-error {
    color: var(--error);
}

.text-center {
    text-align: center;
}

.font-bold {
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

.h-48 {
    height: 12rem;
}

.min-h-20 {
    min-height: 5rem;
}

/* SVG Icons generally */
.icon {
    width: 18px;
    height: 18px;
}

/* Layout */
.app-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-left: 0.5rem;
}

.sidebar-header .logo-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.env-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem;
    overflow-y: auto;
    background-color: var(--bg-main);
}

.top-bar {
    align-items: flex-end;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.top-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-box input {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    width: 250px;
    transition: 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

/* Table Panel */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 10;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr.selected {
    background-color: rgba(59, 130, 246, 0.05);
}

/* Table Cell Content */
.flag-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.flag-info strong {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.flag-info .flag-key {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge.prod {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.stg {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.dev {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Status Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #52525b;
    /* zinc 600 */
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.outline-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.outline-btn:hover {
    background: var(--bg-hover);
}

.small-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
}

.icon-btn:hover {
    color: #fff;
}

.action-menu {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto 1rem auto;
    display: block;
    opacity: 0.5;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 500px;
    max-width: 90%;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.two-cols>* {
    flex: 1;
}

.input-control {
    width: 100%;
    background: #18181b;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s;
}

.input-control:focus {
    border-color: var(--primary);
}

textarea.input-control {
    resize: vertical;
}

.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

/* Code Block */
.code-block {
    position: relative;
    background: #000;
    border-radius: 6px;
    padding: 1rem;
    border: 1px solid var(--border);
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #e5e7eb;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Tabs */
.tabs {
    border-bottom: 1px solid var(--border);
}

.tab {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-main);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-panel);
    color: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}