:root {
    --sidebar-w: 224px;
    --bg: #f1f5f9;
    --card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-hover: rgba(255,255,255,0.07);
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #4f46e5;
    --accent-light: #eef2ff;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* ── SHELL / SIDEBAR ──────────────────────────────── */
.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    height: 100vh;
    overflow: hidden;
}

.sidebar-logo {
    padding: 20px 20px 18px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: block;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 48px;
    height: 48px;
    animation: minimalGlow 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
    transition: scale ease-in-out 0.3s; 
}

@keyframes minimalGlow {
    0% {
        filter: brightness(1.1) drop-shadow(-4px 0px 16px #000);
    }

    100% {
        filter: brightness(1.7) drop-shadow(3px 0px 10px #2c98d9);
    }
}

.sidebar-logo img:hover {
    filter: brightness(1.9);
    scale: 1.2;
}

.sidebar-logo span { color: #818cf8; }

.sidebar-nav {
    padding: 10px 0 20px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-logout-form {
    margin: 0;
    padding: 0;
    width: 100%;
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    color: #94a3b8;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.sidebar-logout-btn svg {
    color: #94a3b8;
    transition: transform 0.15s ease, color 0.15s ease;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.sidebar-logout-btn:hover svg {
    color: #f87171;
    transform: translateX(2px);
}

.nav-section {
    padding: 14px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 0.12s, color 0.12s;
    border-right: 2px solid transparent;
}

.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: rgba(99,102,241,0.15); color: #c7d2fe; border-right-color: #818cf8; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    padding: 28px 32px;
    flex: 1;
}

/* ── PAGE HEADER ──────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0 0 2px;
    font-size: 1.4rem;
    font-weight: 700;
}

.muted {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.breadcrumb:hover { color: var(--accent); }

/* ── SUB-TABS (agency detail) ─────────────────────── */
.sub-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.sub-tab {
    padding: 10px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.12s, border-color 0.12s;
}

.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── STAT CARDS ───────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}

.stat-val {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── CARDS ────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card.padded { padding: 20px 24px; }

/* ── TABLES ───────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }
.table .fw { font-weight: 600; }
.table .mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; }

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, opacity 0.12s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn.sm { padding: 5px 10px; font-size: 0.8rem; }

.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #4338ca; border-color: #4338ca; }

.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--bg); }

.btn.danger { color: var(--danger); border-color: #fecaca; background: transparent; }
.btn.danger:hover { background: var(--danger-light); }

.btn.success { color: var(--success); border-color: #a7f3d0; background: transparent; }
.btn.success:hover { background: var(--success-light); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* compact alias kept for backward compat */
.btn.compact { padding: 5px 10px; font-size: 0.8rem; }

/* ── ACTIONS CELL ─────────────────────────────────── */
.actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

/* ── BADGES ───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge.green  { background: var(--success-light); color: var(--success); }
.badge.amber  { background: var(--warning-light); color: var(--warning); }
.badge.red    { background: var(--danger-light);  color: var(--danger); }
.badge.blue   { background: #dbeafe; color: #1d4ed8; }
.badge.indigo { background: var(--accent-light); color: var(--accent); }
.badge.gray   { background: #f1f5f9; color: #475569; }

/* legacy .pill alias */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    background: var(--accent-light);
    color: var(--accent);
}

/* ── SECTION HEADER ───────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-header h2 { margin: 0; font-size: 1rem; font-weight: 700; }

/* ── FORMS ────────────────────────────────────────── */
.field {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.875rem;
}

.field input,
.field select,
.field textarea,
select.field,
input.field {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font: inherit;
    font-size: 0.875rem;
    color: var(--text);
    background-color: #ffffff;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Modern Minimalist Select Styling */
select,
.field select,
select.field {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px !important;
    cursor: pointer;
    font-weight: 500;
}

select:hover,
.field select:hover,
select.field:hover {
    border-color: #cbd5e1;
    background-color: #fafbfc;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
select.field:focus,
input.field:focus {
    outline: none;
    border-color: var(--accent);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12), 0 1px 2px rgba(0, 0, 0, 0.05);
}

select:disabled,
.field select:disabled {
    background-color: #f8fafc;
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
    border-color: var(--border);
}

/* Filter Bar Select & Inputs */
.filter-select {
    display: inline-flex;
    align-items: center;
    padding: 8px 36px 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease-in-out;
}

.filter-select:hover {
    border-color: #cbd5e1;
    background-color: #fafbfc;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* ── MODALS ───────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 200;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--card);
    border-radius: 12px;
    width: min(500px, 100%);
    box-shadow: 0 24px 64px rgba(15,23,42,0.22);
    animation: modal-in 0.14s ease;
}

.modal.wide { width: min(1000px, 100%); }

@keyframes modal-in {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { margin: 0; font-size: 1rem; font-weight: 700; }

.modal-body {
    padding: 20px 24px;
    display: grid;
    gap: 14px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

/* ── LOADING / EMPTY ──────────────────────────────── */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    padding: 20px 0;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 44px 24px;
    color: var(--text-muted);
}

.empty-state strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

/* ── MISC ─────────────────────────────────────────── */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
    gap: 20px;
    align-items: start;
}

.permission-form { margin-bottom: 16px; }

.fw { font-weight: 600; }
.strong { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.error { color: var(--danger); margin: 0; }

.codebox {
    min-height: 360px;
    resize: vertical;
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ── TABS (legacy, kept for backward compat) ─────── */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-button {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
}

.tab-button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .split { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── SCRIPT MANAGEMENT ENHANCEMENTS ──────────────── */
.view-switcher {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: var(--radius);
    padding: 3px;
    gap: 3px;
}

.view-btn {
    border: none;
    background: transparent;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.view-btn:hover {
    color: var(--text);
}

.view-btn.active {
    background: #ffffff;
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.matrix-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    max-height: 75vh;
}

.matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.matrix-table th,
.matrix-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}

.matrix-table th.sticky-col,
.matrix-table td.sticky-col {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 10;
    text-align: left;
    font-weight: 600;
    min-width: 170px;
    border-right: 2px solid var(--border);
}

.matrix-table thead th {
    background: #f8fafc;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 5;
    white-space: nowrap;
}

.matrix-table thead th.sticky-col {
    z-index: 15;
    background: #f8fafc;
}

.matrix-cell {
    min-width: 120px;
    padding: 6px 8px !important;
    transition: background 0.12s;
}

.matrix-cell:hover {
    background: #f8fafc;
}

.cell-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 8px;
    border-radius: 6px;
    width: 100%;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    font-weight: 600;
    font-size: 0.8rem;
}

.cell-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.cell-badge.active-script {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.cell-badge.draft-script {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.cell-badge.archived-script {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.cell-empty-btn {
    color: #94a3b8;
    font-size: 0.78rem;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.cell-empty-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Modal Code Editor */
.modal-code-editor {
    width: min(1500px, 96vw);
    height: 92vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background: #1e1e1e;
    color: #d4d4d4;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #252526;
    border-bottom: 1px solid #333333;
}

.editor-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 20px;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    font-size: 0.85rem;
    color: #cccccc;
}

.editor-toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-toolbar select,
.diff-toolbar select,
.editor-toolbar input,
.editor-toolbar textarea {
    background: #333338;
    border: 1px solid #4a4a50;
    color: #f1f5f9;
    padding: 6px 30px 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.editor-toolbar select,
.diff-toolbar select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
}

.editor-toolbar select:hover,
.diff-toolbar select:hover {
    background-color: #3b3b42;
    border-color: #6366f1;
}

.editor-toolbar select:focus,
.diff-toolbar select:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25);
}

.editor-container {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #252526;
    border-top: 1px solid #333333;
}

/* Diff Modal */
.modal-diff {
    width: min(1600px, 98vw);
    height: 94vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background: #1e1e1e;
    color: #d4d4d4;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.diff-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
}

/* Sürüm Geçmişi Kartları */
.version-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    background: #ffffff;
    transition: border-color 0.15s, background 0.15s;
}

.version-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.version-card.is-active {
    border-color: #10b981;
    background: #f0fdf4;
}

.version-card.is-deleted {
    opacity: 0.65;
    background: #fff1f2;
    border-color: #fecdd3;
}

.version-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.version-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Accordion Group Cards */
.group-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.group-header {
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.group-header:hover {
    background: #f1f5f9;
}

.group-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-body {
    padding: 16px 20px;
}

/* ── PAGINATION & FILTERS ─────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    background: var(--card);
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.pagination-info {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 16px;
}

.pagination-size-select {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-size-select select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 700;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 700;
}

/* ── FILTER CHIPS ─────────────────────────────────── */
.filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text);
    font-weight: 500;
}

.filter-chip strong {
    color: var(--text-muted);
    font-weight: 600;
}

.filter-chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    display: flex;
    align-items: center;
}

.filter-chip-remove:hover {
    color: var(--danger);
}

.filter-clear-all {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius);
    text-decoration: underline;
}

.filter-clear-all:hover {
    background: #fee2e2;
}

/* ── DETAIL MODAL STYLES ──────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.detail-item {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius);
    padding: 10px 14px;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

/* ── ALERTS & NOTIFICATIONS ───────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert svg {
    flex-shrink: 0;
}

.alert.success {
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    color: var(--success);
}

.alert.danger, .alert.error {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: var(--danger);
}

.alert.warning {
    background: var(--warning-light);
    border: 1px solid #fde68a;
    color: var(--warning);
}

/* ── AUTH / LOGIN PAGE ────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
    padding: 24px;
    box-sizing: border-box;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 36px 32px 28px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-logo-icon {
    width: 72px;
    height: 72px;
}

.auth-brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.auth-brand-text span {
    color: #4f46e5;
    font-weight: 700;
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.auth-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}

.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.auth-alert svg {
    flex-shrink: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon svg {
    position: absolute;
    left: 12px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.15s ease;
}

.input-with-icon input {
    width: 100%;
    padding-left: 38px !important;
}

.input-with-icon:focus-within svg {
    color: var(--accent);
}

.auth-submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    margin-top: 6px;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.775rem;
    color: #94a3b8;
}

/* ── AGENCY LICENSE CARD & STATS ──────────────────── */
.license-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
}

.license-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.license-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.license-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

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

.license-stat-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.license-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.license-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.license-stat-sub {
    font-size: 0.8rem;
    margin-top: 6px;
}

.license-progress-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.license-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.license-empty-card {
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    margin-bottom: 28px;
}

.license-empty-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.license-empty-sub {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}


