@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* =========================================================
   Unslop Graphite Admin Theme (Dark Default + Light Mode)
   4px spacing scale · 3 text roles · 1 accent · 0 gradients
   ========================================================= */
:root {
    --bg-sidebar: #0F0F10;
    --bg-page: #141415;
    --bg-card: #19191B;
    --bg-raised: #232325;
    --bg-input: #141415;
    --border-hairline: rgba(237, 237, 237, 0.08);
    --border-strong: rgba(237, 237, 237, 0.16);
    --text-primary: #EDEDED;
    --text-secondary: #A1A1A6;
    --text-muted: #85858B;
    --accent: #E5484D;
    --accent-soft: rgba(229, 72, 77, 0.14);
    --btn-primary-bg: #EDEDED;
    --btn-primary-fg: #141415;
    --positive: #4CC38A;
    --positive-soft: rgba(76, 195, 138, 0.12);
    --negative: #E5484D;
    --negative-soft: rgba(229, 72, 77, 0.12);
    --warn: #F5A623;
    --warn-soft: rgba(245, 166, 35, 0.12);
    --radius-tag: 6px;
    --radius-control: 8px;
    --radius-card: 12px;
    --radius-panel: 16px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --shadow-card: none;
}

[data-theme="light"] {
    --bg-sidebar: #F4F4F5;
    --bg-page: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-raised: #F4F4F5;
    --bg-input: #FFFFFF;
    --border-hairline: rgba(23, 23, 23, 0.08);
    --border-strong: rgba(23, 23, 23, 0.16);
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #737373;
    --accent: #D91B23;
    --accent-soft: rgba(217, 27, 35, 0.10);
    --btn-primary-bg: #171717;
    --btn-primary-fg: #FFFFFF;
    --positive: #16A34A;
    --positive-soft: #DCFCE7;
    --negative: #DC2626;
    --negative-soft: #FEE2E2;
    --warn: #B45309;
    --warn-soft: #FEF3C7;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.mono-num {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* =========================================================
   App Shell (260px Sidebar + Fluid Main up to 1480px)
   ========================================================= */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-hairline);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 160ms var(--ease);
}

.admin-sidebar.collapsed {
    width: 72px;
}

.admin-sidebar.collapsed .hide-on-collapse {
    display: none;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 16px;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-brand svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    margin-bottom: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
}

.sidebar-search input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

.keycap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 6px;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-tag);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-section-title {
    margin: 24px 8px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-control);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: background-color 140ms var(--ease), color 140ms var(--ease);
}

.sidebar-link:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}

.sidebar-link.is-active {
    background: var(--bg-raised);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-hairline);
}

.sidebar-link-left {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-icon-box {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.sidebar-link.is-active .sidebar-icon-box {
    color: var(--accent);
}

.sidebar-count {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-hairline);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* =========================================================
   Main Content & Topbar
   ========================================================= */
.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    height: 60px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-hairline);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-page);
}

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

.topbar-context {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.db-latency-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
    font-size: 12px;
    color: var(--text-secondary);
}

.db-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--positive);
}

.admin-content {
    width: 100%;
    max-width: 1480px;
    padding: 28px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0 0 4px 0;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* =========================================================
   Buttons & Quiet Controls
   ========================================================= */
.btn-quiet-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-control);
    border: 1px solid var(--border-hairline);
    background: transparent;
    color: var(--text-secondary);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 140ms var(--ease), color 140ms var(--ease);
}

.btn-quiet-icon:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}

.btn-admin-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 140ms var(--ease), transform 120ms var(--ease);
}

.btn-admin-primary:hover {
    opacity: 0.9;
}

.btn-admin-primary:active {
    transform: scale(0.98);
}

.btn-admin-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    background: var(--bg-raised);
    color: var(--text-primary);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}

.btn-admin-secondary:hover {
    border-color: var(--border-strong);
}

.btn-admin-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    background: transparent;
    color: var(--negative);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}

.btn-admin-danger:hover {
    background: var(--negative-soft);
    border-color: var(--negative);
}

.btn-icon-action {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-control);
    border: 1px solid var(--border-hairline);
    background: var(--bg-raised);
    color: var(--text-secondary);
    cursor: pointer;
    vertical-align: middle;
    transition: background-color 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease), transform 120ms var(--ease);
}

.btn-icon-action:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.btn-icon-action:active {
    transform: scale(0.96);
}

.btn-icon-action.is-danger {
    background: transparent;
    color: var(--negative);
}

.btn-icon-action.is-danger:hover {
    background: var(--negative-soft);
    border-color: var(--negative);
    color: var(--negative);
}

/* =========================================================
   Stat Cards (Numbers Only, Equal Height) & Bento Split
   ========================================================= */
.stat-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 30px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stat-meta {
    font-size: 12.5px;
    color: var(--text-muted);
}

.dashboard-split {
    display: grid;
    grid-template-columns: 1.65fr 1fr;
    gap: 16px;
    align-items: start;
}

.unslop-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

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

.unslop-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.unslop-card-body {
    padding: 20px;
}

/* Chart Rows (One Accent Only) */
.chart-bar-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.chart-bar-label {
    color: var(--text-primary);
    font-weight: 500;
}

.chart-bar-code {
    color: var(--text-muted);
    margin-right: 8px;
}

.chart-bar-track {
    height: 10px;
    background: var(--bg-raised);
    border-radius: var(--radius-tag);
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: var(--text-muted);
    border-radius: var(--radius-tag);
    transition: transform 300ms var(--ease);
}

.chart-bar-fill.is-lead {
    background: var(--accent);
}

/* =========================================================
   Tables (Header, Value, Selection, Focus recognizable)
   ========================================================= */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.unslop-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.unslop-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-hairline);
    background: var(--bg-card);
    white-space: nowrap;
}

.unslop-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-hairline);
    color: var(--text-primary);
    vertical-align: middle;
}

.unslop-table tbody tr {
    transition: background-color 120ms var(--ease);
}

.unslop-table tbody tr:hover {
    background: var(--bg-raised);
}

.unslop-table tbody tr:last-child td {
    border-bottom: none;
}

.status-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* =========================================================
   Forms
   ========================================================= */
.form-stack-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.admin-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.admin-input,
.admin-select,
.admin-textarea {
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 140ms var(--ease);
}

.admin-input:focus,
.admin-select:focus,
.admin-textarea:focus {
    outline: none;
    border-color: var(--border-strong);
}

.admin-textarea {
    min-height: 92px;
    resize: vertical;
}

.toast-bar {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    color: var(--text-primary);
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-dot-ok {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--positive);
}

.toast-dot-err {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--negative);
}

.mobile-sidebar-btn {
    display: none;
}

@media (max-width: 1024px) {
    .stat-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -270px;
        z-index: 70;
    }
    .admin-sidebar.mobile-open {
        left: 0;
    }
    .mobile-sidebar-btn {
        display: inline-grid;
    }
    .stat-grid-4,
    .form-stack-2 {
        grid-template-columns: 1fr;
    }
    .admin-content {
        padding: 20px 16px;
    }
    .admin-topbar {
        padding: 0 16px;
    }
}

/* =========================================================
   Admin Blurred Centered Logo Loader (DİA Sync & Forms)
   ========================================================= */
.admin-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 16, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms var(--ease);
}

[data-theme="light"] .admin-loader-overlay {
    background: rgba(250, 250, 250, 0.74);
}

.admin-loader-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.admin-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-card);
    text-align: center;
}

.admin-loader-svg {
    width: 176px;
    height: auto;
    overflow: visible;
}

.admin-loader-overlay.is-visible .loader-red-arc {
    animation: adminArcIn 600ms var(--ease) both;
}

.admin-loader-overlay.is-visible .loader-grey-arrow {
    animation: adminArrowIn 600ms var(--ease) 120ms both;
}

.admin-loader-overlay.is-visible .loader-logo-texts {
    animation: adminTextIn 450ms var(--ease) 240ms both;
}

@keyframes adminArcIn {
    from { opacity: 0; transform: translate(-20px, -12px) scale(0.92); }
    to { opacity: 1; transform: translate(0, 0) scale(1); }
}

@keyframes adminArrowIn {
    from { opacity: 0; transform: translate(20px, 12px) scale(0.92); }
    to { opacity: 1; transform: translate(0, 0) scale(1); }
}

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

.admin-loader-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* =========================================================
   Mobile Sidebar Backdrop & Admin Modal
   ========================================================= */
.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(0, 0, 0, 0.55);
}

.admin-sidebar-backdrop.is-open {
    display: block;
}

.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 15, 16, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms var(--ease);
}

[data-theme="light"] .admin-modal-backdrop {
    background: rgba(23, 23, 23, 0.45);
}

.admin-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.admin-modal-dialog {
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(8px);
    transition: transform 180ms var(--ease);
}

.admin-modal-backdrop.is-open .admin-modal-dialog {
    transform: translateY(0);
}

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

.admin-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.admin-modal-body .unslop-card {
    border: none;
    box-shadow: none;
    background: transparent;
}

.admin-modal-body .unslop-card-body {
    padding: 0;
}
