/* ============================================================
   Server Investment Dashboard — CSS
   Sidebar layout, 0 radius, no shadows, no hover transforms
   ============================================================ */

:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-bg: #eff6ff;
    --green: #10b981;
    --green-bg: #ecfdf5;
    --green-text: #065f46;
    --red: #ef4444;
    --red-bg: #fef2f2;
    --red-text: #991b1b;
    --blue: #3b82f6;
    --blue-bg: #eff6ff;
    --blue-text: #1e40af;
    --purple: #8b5cf6;
    --purple-bg: #f5f3ff;
    --purple-text: #5b21b6;
    --yellow: #f59e0b;
    --yellow-bg: #fffbeb;
    --yellow-text: #92400e;
    --sidebar-width: 240px;
    --header-height: 64px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.sid-dark {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --primary-bg: #1e3a5f;
    --green-bg: #064e3b;
    --green-text: #6ee7b7;
    --red-bg: #450a0a;
    --red-text: #fca5a5;
    --blue-bg: #1e3a5f;
    --blue-text: #93c5fd;
    --purple-bg: #2e1065;
    --purple-text: #c4b5fd;
    --yellow-bg: #451a03;
    --yellow-text: #fcd34d;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Layout: Sidebar + Content ── */
.sid-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sid-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sid-sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sid-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    text-decoration: none;
}

.sid-nav-brand:hover {
    text-decoration: none;
}

.sid-sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sid-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
}

.sid-sidebar-link:hover {
    background: var(--border-light);
    color: var(--text);
    text-decoration: none;
}

.sid-sidebar-link.active {
    background: var(--primary-bg);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sid-sidebar-link svg {
    flex-shrink: 0;
    opacity: .7;
}

.sid-sidebar-link.active svg {
    opacity: 1;
}

.sid-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Sidebar Footer Redesign ── */
.sid-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sid-sidebar-user {
    display: flex;
    flex-direction: column;
}

.sid-sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.sid-sidebar-user-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}

.sid-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Theme toggle specifics inside icon button */
.sid-footer-icon .sid-icon-sun,
.sid-footer-icon .sid-icon-moon {
    display: block;
}

.sid-dark .sid-footer-icon .sid-icon-sun {
    display: none;
}

body:not(.sid-dark) .sid-footer-icon .sid-icon-moon {
    display: none;
}

/* ── Mobile topbar ── */
.sid-mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    z-index: 210;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

.sid-mobile-toggle {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

.sid-mobile-title {
    font-weight: 600;
    font-size: 16px;
    flex: 1;
    text-align: center;
}

.sid-mobile-right-toggle {
    display: none;
}

/* Hide right toggle if no sub-sidebar exists on the page */
.sid-layout:not(:has(.sid-sub-sidebar)) .sid-mobile-right-toggle {
    display: none !important;
}

/* ── Main Content ── */
.sid-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: 300px;
    /* Right Sidebar width */
    min-height: 100vh;
    min-height: 100vh;
    transition: margin 0.3s ease;
}

.sid-main.sid-main-full {
    margin-right: 0;
}

.sid-container {
    padding: 32px;
    width: 100% !important;
    max-width: 1400px !important;
    /* Cap width for better readability on huge screens */
    margin: 0 auto;
}

.sid-content-flex {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.sid-page-content {
    flex: 1;
    min-width: 0;
}

.sid-sub-sidebar {
    width: 300px;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    padding: 0;
    overflow-y: auto;
    z-index: 100;
}

.sid-sub-sidebar-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sid-side-section {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sid-side-section:last-child {
    border-bottom: none;
}

.sid-side-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sid-side-section-title i {
    font-size: 14px;
    color: var(--primary);
}

.sid-side-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}

.sid-side-metric:last-child {
    margin-bottom: 0;
}

.sid-side-metric-label {
    color: var(--text-muted);
}

.sid-side-metric-value {
    font-weight: 700;
    color: var(--text);
}

.sid-side-metric-details {
    width: 100%;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
}

@media (max-width: 1300px) {
    .sid-main {
        margin-right: 0;
    }

    .sid-sub-sidebar {
        position: static;
        width: 100% !important;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 0;
    }

    .sid-content-flex {
        flex-direction: column;
    }
}

.sid-chart-card canvas {
    max-height: 250px;
    width: 100% !important;
}

.sid-dashboard {
    min-height: 100vh;
    width: 100%;
}

/* ── Header ── */
.sid-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    margin: -32px -32px 32px -32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sid-header h1 {
    font-size: 20px;
    font-weight: 700;
}

.sid-header-actions {
    display: flex;
    gap: 8px;
}

.sid-back-link {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-decoration: none;
}

.sid-back-link:hover {
    color: var(--primary);
}

/* ── Notifications ── */
.sid-notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 350px;
    width: 100%;
}

.sid-alert {
    padding: 12px 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 0;
    box-shadow: none;
    pointer-events: auto;
}

.sid-server-card:hover {
    box-shadow: none;
    border-color: var(--primary);
    text-decoration: none;
}

.sid-alert-success {
    background: var(--green-bg);
    color: var(--green-text);
    border: 1px solid var(--green);
}

.sid-alert-error {
    background: var(--red-bg);
    color: var(--red-text);
    border: 1px solid var(--red);
}

.sid-alert-warning {
    background: var(--yellow-bg);
    color: var(--yellow-text);
    border: 1px solid var(--yellow);
}

/* Row Alerts for Tables */
.sid-row-alert-warning {
    background-color: #fffbeb !important;
}

.sid-row-alert-danger {
    background-color: #fef2f2 !important;
}

.sid-row-alert-critical {
    background-color: #fca5a5 !important;
    /* Darker red for 1 day */
    color: #7f1d1d !important;
    font-weight: 600;
}

.sid-row-alert-expired {
    background-color: #e2e8f0 !important;
    /* Gray for expired */
    color: #475569 !important;
    text-decoration: line-through;
}

/* Ensure text in cells inherits color if needed, or specific overrides */
.sid-row-alert-critical td {
    color: inherit;
}

.sid-row-alert-expired td {
    color: inherit;
}

.sid-alert-info {
    background: var(--blue-bg);
    color: var(--blue-text);
    border: 1px solid var(--blue);
}

.sid-alert-close {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.sid-alert-close:hover {
    opacity: 1;
}

.sid-renewal-chip {
    display: inline-block;
    background: rgba(0, 0, 0, .08);
    padding: 2px 8px;
    font-size: 12px;
    margin: 2px 4px;
}

/* ── Buttons ── */
.sid-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border) !important;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    background: transparent !important;
    transition: all 0.2s;
}

.sid-btn:hover {
    background: var(--bg) !important;
    color: var(--primary);
    border-color: var(--primary) !important;
    text-decoration: none;
}

.sid-btn-danger {
    background: transparent !important;
    color: var(--red) !important;
    border: 1px solid var(--red) !important;
}

.sid-btn-danger:hover {
    background: var(--red-bg) !important;
    color: var(--red-text);
    border-color: var(--red) !important;
}

.sid-footer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 32px;
    padding: 0;
    border-radius: 0;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border) !important;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

a.sid-footer-icon {
    text-decoration: none;
}

.sid-footer-icon:hover {
    background: var(--bg);
    color: var(--primary);
    border-color: var(--primary);
}

.sid-dark .sid-footer-icon:hover {
    background: var(--bg-card);
}

/* ── Stats Cards ── */
.sid-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.sid-stats-4 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.sid-stats-5 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.sid-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
}

.sid-stat-card-main {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.sid-stat-card-details {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sid-details-cols {
    flex-direction: column !important;
    gap: 6px !important;
}

.sid-details-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sid-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
}

.sid-detail-row .sid-label {
    color: var(--text-muted);
}

.sid-detail-row .sid-value {
    font-weight: 600;
}

.sid-dark .sid-stat-card-details {
    background: rgba(255, 255, 255, 0.02);
}

.sid-stat-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sid-stat-green .sid-stat-icon {
    background: var(--green-bg);
    color: var(--green);
}

.sid-stat-red .sid-stat-icon {
    background: var(--red-bg);
    color: var(--red);
}

.sid-stat-blue .sid-stat-icon {
    background: var(--blue-bg);
    color: var(--blue);
}

.sid-stat-purple .sid-stat-icon {
    background: var(--purple-bg);
    color: var(--purple);
}

.sid-stat-info {
    display: flex;
    flex-direction: column;
}

.sid-stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.sid-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

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

.sid-section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* ── Charts ── */
.sid-charts-section {
    margin-bottom: 32px;
    margin-right: 0;
    /* Let grid handle gap */
}

.sid-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.sid-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 0;
    width: 100%;
}

.sid-chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.sid-charts-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sid-charts-row {
    display: grid;
    gap: 16px;
}

.sid-charts-row-2-1 {
    grid-template-columns: 2fr 1fr;
}

.sid-charts-row-1-2 {
    grid-template-columns: 1fr 2fr;
}

.sid-charts-row-1-1 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
    .sid-charts-row {
        grid-template-columns: 1fr !important;
    }
}

.sid-year-form select {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
    box-sizing: border-box;
}

/* ── Servers Grid ── */
.sid-servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

/* ── Server Cards ── */
.sid-server-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.sid-server-card:hover {
    box-shadow: none;
    border-color: var(--primary);
    text-decoration: none;
}

.sid-server-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sid-server-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sid-server-icon {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: var(--bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid var(--border);
}

.sid-server-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg);
    border-radius: 0;
    border: 1px solid var(--border-light);
}

.sid-server-card-header .sid-server-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sid-server-card-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.1;
}

.sid-server-card-header .sid-server-id {
    font-size: 12px;
    color: var(--text-muted);
}

.sid-server-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.sid-server-stat .sid-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sid-server-stat .sid-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.sid-capacity-bar {
    height: 6px;
    background: var(--border);
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 6px;
}

.sid-capacity-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 0;
    transition: width 0.3s ease;
}

.sid-capacity-text {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sid-server-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.sid-server-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sid-server-date i {
    color: var(--text-light);
}

/* ── Capacity Bar ── */
.sid-capacity-bar {
    height: 8px;
    background: var(--border-light);
    overflow: hidden;
    margin-bottom: 6px;
}

.sid-capacity-bar-lg {
    height: 12px;
    margin-bottom: 8px;
}

.sid-capacity-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--primary));
}

.sid-capacity-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ── Break-even ── */
.sid-breakeven-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 24px;
}

.sid-breakeven-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.sid-breakeven-bar {
    height: 16px;
    background: var(--red-bg);
    overflow: hidden;
    margin-bottom: 8px;
}

.sid-breakeven-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--yellow), var(--primary));
}

.sid-breakeven-fill.sid-profitable {
    background: linear-gradient(90deg, var(--green), #059669);
}

.sid-breakeven-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Tables ── */
.sid-table-wrapper {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.sid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sid-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    background: var(--border-light);
}

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

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

.sid-table tr:hover td {
    background: var(--border-light);
}

.sid-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 32px !important;
}

/* ── Badges ── */
.sid-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 500;
    background: var(--border-light);
    color: var(--text-muted);
}

.sid-badge-auto {
    background: var(--blue-bg);
    color: var(--blue);
    font-size: 10px;
    padding: 1px 6px;
    vertical-align: middle;
}

.sid-status-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}

.sid-status-active {
    background: var(--green-bg);
    color: var(--green-text);
}

.sid-status-maintenance {
    background: var(--yellow-bg);
    color: var(--yellow-text);
}

.sid-status-retired,
.sid-status-cancelled,
.sid-status-expired {
    background: var(--red-bg);
    color: var(--red-text);
}

.sid-status-pending_payment {
    background: var(--yellow-bg);
    color: var(--yellow-text);
}

.sid-type-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}

.sid-type-income {
    background: var(--green-bg);
    color: var(--green-text);
}

.sid-type-expense {
    background: var(--red-bg);
    color: var(--red-text);
}

.sid-amount-income {
    color: var(--green);
    font-weight: 600;
}

.sid-amount-expense {
    color: var(--red);
    font-weight: 600;
}

.sid-text-green {
    color: var(--green);
}

.sid-text-red {
    color: var(--red);
}

.sid-text-danger {
    color: var(--red);
}

.sid-positive {
    color: var(--green);
}

.sid-negative {
    color: var(--red);
}

/* ── Summary Cards ── */
.sid-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.sid-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px 16px;
    text-align: center;
}

.sid-summary-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: .5px;
}

.sid-summary-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
}

.sid-summary-income {
    border-left: 3px solid var(--green);
}

.sid-summary-expense {
    border-left: 3px solid var(--red);
}

.sid-summary-net {
    border-left: 3px solid var(--primary);
}

/* ── Filters ── */
.sid-filters-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.sid-filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.sid-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
    flex: 1;
}

.sid-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.sid-filter-group select,
.sid-filter-group input {
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    box-sizing: border-box;
}

.sid-filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.sid-filter-actions .sid-btn {
    height: 38px;
    width: 38px;
    padding: 0;
    justify-content: center;
}

.sid-alert {
    padding: 12px 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 0;
    box-shadow: none;
    pointer-events: auto;
}

/* ── Forms ── */
.sid-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.sid-form-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.sid-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sid-form-full {
    grid-column: 1 / -1;
}

.sid-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.sid-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.sid-form-group input,
.sid-form-group select {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    box-sizing: border-box;
}

.sid-form-group textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    box-sizing: border-box;
}

.sid-form-group input:focus,
.sid-form-group select:focus,
.sid-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.sid-form-hint {
    font-size: 12px;
    color: var(--text-light);
}

.sid-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sid-confirm-card {
    max-width: 500px;
    margin: 60px auto;
    text-align: center;
}

.sid-confirm-card h2 {
    margin-bottom: 12px;
}

.sid-confirm-card .sid-form-actions {
    justify-content: center;
}

/* ── Settings ── */
.sid-settings-grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

@media (max-width: 1300px) {

    .sid-settings-grid,
    .sid-settings-grid-1-2 {
        grid-template-columns: 1fr;
    }
}

.sid-grid-full {
    grid-column: 1 / -1;
}

.sid-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sid-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 0;
}

.sid-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ── Login ── */
.sid-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0f172a;
}

.sid-login-card {
    background: #fff;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #e2e8f0;
}

.sid-login-header {
    text-align: center;
    margin-bottom: 28px;
}

.sid-login-header svg {
    color: var(--primary);
    margin-bottom: 12px;
}

.sid-login-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.sid-login-form .sid-form-group {
    margin-bottom: 16px;
}

.sid-login-form .sid-btn {
    margin-top: 8px;
    padding: 12px;
    font-size: 15px;
}

/* ── Transactions Section ── */
.sid-transactions-section {
    margin-bottom: 32px;
}

/* ── Sidebar Badge ── */
.sid-sidebar-badge {
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
}

/* ── Renewals ── */
.sid-renewals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.sid-renewal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 20px;
}

.sid-renewal-card.sid-renewal-resolved {
    opacity: .6;
}

.sid-renewal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 8px;
}

.sid-renewal-card-header strong {
    display: block;
    font-size: 15px;
}

.sid-renewal-server {
    font-size: 12px;
    color: var(--text-muted);
}

.sid-renewal-card-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.sid-renewal-card-details .sid-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: .3px;
}

.sid-renewal-card-details .sid-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
}

.sid-renewal-card-actions {
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sid-renewal-approve-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sid-renewal-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sid-renewal-price-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.sid-renewal-price-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    width: 120px;
}

.sid-renewal-btn-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sid-bulk-check {
    font-size: 13px;
    margin-left: auto;
}

.sid-renewal-card-resolved {
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.sid-summary-pending {
    border-left: 3px solid var(--yellow);
}

.sid-badge-pending {
    background: var(--yellow-bg);
    color: var(--yellow-text);
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
}

/* ── About Page ── */
.sid-about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 24px;
}

.sid-about-version {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.sid-about-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.sid-about-features h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.sid-about-feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.sid-about-feature {
    padding: 14px 0;
}

.sid-about-feature:last-child {
    border-bottom: none;
}

.sid-about-feature strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.sid-about-feature p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.sid-about-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sid-about-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.sid-about-step-num {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.sid-about-step strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.sid-about-step p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sid-sidebar {
        top: 50px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        border-right: 1px solid var(--border);
        border-top: none !important;
    }

    .sid-sidebar.sid-sidebar-open {
        transform: translateX(0);
    }

    .sid-mobile-bar {
        display: flex;
    }

    .sid-main {
        margin-left: 0;
        padding-top: 70px;
        /* 50px topbar + 20px gap */
    }

    .sid-container {
        padding: 12px;
    }

    .sid-charts-grid {
        grid-template-columns: 1fr;
    }

    .sid-servers-grid {
        grid-template-columns: 1fr;
    }

    .sid-filters-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        align-items: end !important;
    }

    .sid-filter-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    .sid-filter-group label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sid-filter-group select,
    .sid-filter-group input {
        width: 100% !important;
        border-radius: 0 !important;
    }

    .sid-filter-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        grid-column: span 2 !important;
        width: 100% !important;
        padding-top: 4px !important;
    }

    .sid-filter-actions .sid-btn {
        width: 100% !important;
        max-width: none !important;
        border-radius: 0 !important;
    }

    .sid-filters-section {
        border-radius: 0 !important;
        padding: 12px !important;
    }

    .sid-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    }

    .sid-container {
        padding: 0 12px 16px 12px !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }

    .sid-dashboard,
    .sid-main {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow-x: hidden;
    }

    .sid-page-content {
        width: 100% !important;
        margin: 0 !important;
    }

    .sid-header {
        margin: 0 0 16px 0 !important;
        padding: 0 12px !important;
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        position: static;
        border-bottom: none !important;
    }

    /* Hide header if no actions are visible */
    .sid-header:not(:has(.sid-btn)) {
        display: none !important;
    }

    .sid-header h1 {
        display: none !important;
    }

    .sid-header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
        padding: 12px 0;
    }

    .sid-header-actions .sid-btn {
        flex: 1;
        min-width: 120px;
    }

    /* Table adjustments for mobile */
    .sid-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
    }

    .sid-table {
        width: auto !important;
        min-width: 100% !important;
    }

    .sid-table th,
    .sid-table td {
        padding: 10px 8px;
        font-size: 13px;
        white-space: nowrap !important;
    }

    .sid-mobile-right-toggle {
        display: block;
    }

    .sid-sub-sidebar {
        position: fixed !important;
        top: 50px;
        /* Below mobile bar */
        right: 0;
        bottom: 0;
        width: 300px !important;
        z-index: 200;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        border-left: 1px solid var(--border);
        border-top: none !important;
        background: var(--bg-sidebar);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sid-sub-sidebar.sid-sub-sidebar-open {
        transform: translateX(0);
    }
}

/* ── iOS Date Mockup (Tablet/Mobile) ── */
@media (max-width: 1024px) {
    .sid-date-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        width: 100%;
        height: 38px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 0 !important;
        box-sizing: border-box;
        cursor: pointer;
        overflow: hidden;
    }

    .sid-date-wrapper input[type="date"] {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        opacity: 0 !important;
        z-index: 2;
        cursor: pointer;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    .sid-date-display {
        display: flex !important;
        visibility: visible !important;
        width: 100%;
        height: 100%;
        padding: 0 10px;
        font-size: 14px;
        color: var(--text) !important;
        justify-content: space-between;
        align-items: center;
        pointer-events: none;
        z-index: 1;
        min-height: 36px;
        background: transparent;
    }

    .sid-date-display::after {
        content: '\f073';
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        color: var(--text-muted);
        font-size: 12px;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    .sid-stats-grid {
        grid-template-columns: 1fr;
    }

    .sid-renewals-grid {
        grid-template-columns: 1fr;
    }

    .sid-summary-cards {
        grid-template-columns: 1fr;
    }
}

.sid-text-green {
    color: var(--green) !important;
}

.sid-text-red {
    color: var(--red) !important;
}

.sid-text-orange {
    color: var(--yellow) !important;
}

.sid-text-dark-orange {
    color: #d97706 !important;
}

/* ── Renewal Alerts ── */
.sid-renewal-alert-7 {
    border-left: 4px solid #f59e0b !important;
}

.sid-renewal-alert-3 {
    border-left: 4px solid #d97706 !important;
    background: #fffbeb !important;
}

.sid-renewal-alert-1 {
    border-left: 4px solid #dc2626 !important;
    background: #fef2f2 !important;
}

.sid-dark .sid-renewal-alert-3 {
    background: #451a03 !important;
}

.sid-dark .sid-renewal-alert-1 {
    background: #450a0a !important;
}

.sid-text-orange {
    color: #f59e0b;
    font-weight: 600;
}

.sid-text-dark-orange {
    color: #d97706;
    font-weight: 600;
}

.sid-text-red {
    color: #dc2626;
    font-weight: 600;
}

@media (min-width: 1025px) {
    .sid-date-display {
        display: none !important;
    }
}

/* ── Sidebar Backdrop ── */
.sid-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.sid-sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* ── Dark Mode Row Alert Overrides ── */
.sid-dark .sid-row-alert-warning {
    background-color: rgba(251, 191, 36, 0.1) !important;
    /* Subtle Amber */
}

.sid-dark .sid-row-alert-danger {
    background-color: rgba(220, 38, 38, 0.15) !important;
    /* Subtle Red */
}

.sid-dark .sid-row-alert-critical {
    background-color: rgba(220, 38, 38, 0.3) !important;
    /* Stronger Red */
    color: #fca5a5 !important;
}

.sid-dark .sid-row-alert-expired {
    background-color: rgba(148, 163, 184, 0.1) !important;
    /* Subtle Gray */
    color: #94a3b8 !important;
}

/* ── Custom Mobile Tooltip ── */
.sid-custom-tooltip {
    position: fixed;
    bottom: 24px;
    left: 12px;
    right: 12px;
    background: #1e293b;
    color: #f8fafc;
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    z-index: 100000;
    /* Higher than location overlay */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sid-custom-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sid-custom-tooltip-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.sid-custom-tooltip-close:active {
    background: rgba(255, 255, 255, 0.3);
}

.fa-circle-info {
    cursor: pointer !important;
    touch-action: manipulation;
}

.sid-dark .sid-custom-tooltip {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ── Settings Tabs ── */
.sid-tabs-nav {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    background: var(--bg-sidebar);
}

.sid-tab-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sid-tab-btn i {
    font-size: 16px;
    opacity: 0.7;
}

.sid-tab-btn:hover {
    color: var(--text);
    background: var(--border-light);
}

.sid-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-bg);
}

.sid-tab-btn.active i {
    opacity: 1;
}

.sid-tab-pane {
    display: none;
}

.sid-tab-pane.active {
    display: block;
    animation: sidFadeIn 0.3s ease-out;
}

@keyframes sidFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}