:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e1e2d;
    --sidebar-hover: #2a2a3d;
    --sidebar-active: #3a3a52;
    --sidebar-text: #9899ac;
    --sidebar-text-active: #fff;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --body-bg: #f4f6f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

html, body {
    height: 100%;
    margin: 0;
    font-size: 14px;
    background: var(--body-bg);
}

@media (min-width: 768px) {
    html { font-size: 14.5px; }
}

/* Sidebar */
.dm-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s;
}

.dm-sidebar-brand {
    padding: 1.25rem 1.25rem .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
}

.dm-sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.dm-sidebar-brand .brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
}

.dm-sidebar-brand .brand-sub {
    color: var(--sidebar-text);
    font-size: .7rem;
    display: block;
    line-height: 1;
    margin-top: 2px;
}

.dm-nav {
    list-style: none;
    padding: .5rem 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.dm-nav-section {
    padding: .75rem 1.25rem .25rem;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5b5b78;
    font-weight: 600;
}

.dm-nav-item a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    border-radius: 0;
    transition: all .15s;
}

.dm-nav-item a:hover {
    background: var(--sidebar-hover);
    color: #e0e0ee;
}

.dm-nav-item a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.dm-nav-item a .nav-icon {
    width: 18px;
    height: 18px;
    opacity: .7;
    flex-shrink: 0;
}

.dm-nav-item a.active .nav-icon { opacity: 1; }

.dm-nav-item .nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    padding: .15rem .45rem;
    border-radius: 10px;
    font-weight: 600;
}

.dm-sidebar-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid #2a2a3d;
}

.dm-sidebar-footer .user-name {
    color: var(--sidebar-text);
    font-size: .8rem;
    display: block;
    margin-bottom: .3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-sidebar-footer .btn-logout {
    color: var(--sidebar-text);
    font-size: .75rem;
    text-decoration: none;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.dm-sidebar-footer .btn-logout:hover { color: #ef4444; }

/* Main content */
.dm-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 1.5rem 2rem;
}

/* Mobile */
@media (max-width: 767.98px) {
    .dm-sidebar { transform: translateX(-100%); }
    .dm-sidebar.show { transform: translateX(0); }
    .dm-main { margin-left: 0; padding: 1rem; }
}

/* Page header */
.dm-page-header {
    margin-bottom: 1.5rem;
}

.dm-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e1e2d;
    margin: 0;
}

.dm-page-header .subtitle {
    color: #6b7280;
    font-size: .875rem;
    margin-top: .2rem;
}

/* Stat cards */
.dm-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: box-shadow .15s;
}

.dm-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.dm-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dm-stat-icon svg { width: 22px; height: 22px; }

.dm-stat-icon.blue { background: #dbeafe; color: #3b82f6; }
.dm-stat-icon.green { background: #d1fae5; color: #10b981; }
.dm-stat-icon.amber { background: #fef3c7; color: #f59e0b; }
.dm-stat-icon.violet { background: #ede9fe; color: #8b5cf6; }
.dm-stat-icon.red { background: #fee2e2; color: #ef4444; }
.dm-stat-icon.slate { background: #e2e8f0; color: #64748b; }

.dm-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e1e2d;
    line-height: 1;
}

.dm-stat-label {
    font-size: .8rem;
    color: #6b7280;
    margin-top: .15rem;
}

/* Cards */
.dm-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.dm-card-header {
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #f1f3f5;
    font-weight: 600;
    font-size: .9rem;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dm-card-body {
    padding: 1.25rem;
}

/* Buttons */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.btn-accent:hover {
    background: var(--accent-light);
    color: #fff;
}

/* Table */
.dm-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.dm-table th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    font-weight: 600;
    padding: .65rem 1rem;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.dm-table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid #f1f3f5;
    font-size: .875rem;
    color: #374151;
    vertical-align: middle;
}

.dm-table tbody tr:hover {
    background: #f9fafb;
}

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

/* Badges */
.badge-status {
    font-size: .7rem;
    padding: .25rem .55rem;
    border-radius: 6px;
    font-weight: 600;
}

.badge-active { background: #d1fae5; color: #065f46; }
.badge-draft { background: #e2e8f0; color: #475569; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dbeafe; color: #1e40af; }
.badge-applied { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-failed { background: #1e1e2d; color: #fff; }
.badge-connected { background: #d1fae5; color: #065f46; }
.badge-disconnected { background: #fee2e2; color: #991b1b; }

/* Form improvements */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #d1d5db;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.form-label {
    font-weight: 500;
    font-size: .85rem;
    color: #374151;
}

/* Empty state */
.dm-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.dm-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: .75rem;
    opacity: .4;
}

.dm-empty p {
    font-size: .9rem;
    margin: 0;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
    font-size: .875rem;
}

/* Mobile toggle */
.dm-toggle {
    display: none;
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 1050;
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767.98px) {
    .dm-toggle { display: flex; }
}

/* Backdrop */
.dm-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1035;
}

.dm-backdrop.show { display: block; }
