:root {
    --stitch-bg: #f4f7fb;
    --stitch-surface: #ffffff;
    --stitch-surface-soft: #f8fbff;
    --stitch-border: #e6ecf5;
    --stitch-text: #111827;
    --stitch-muted: #667085;
    --stitch-primary: #2563eb;
    --stitch-primary-soft: #eff6ff;
    --stitch-success: #16a34a;
    --stitch-warning: #f59e0b;
    --stitch-danger: #ef4444;
    --stitch-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --stitch-shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.05);
    --stitch-radius: 18px;
}

body {
    background: linear-gradient(180deg, #f8fbff 0%, var(--stitch-bg) 100%);
    color: var(--stitch-text);
}

body:not(.login-page):not(.register-page) .content-wrapper {
    background: transparent;
}

.main-header.navbar {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.main-sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #172554 100%) !important;
    border-right: 0;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.16);
}

.brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.brand-text {
    color: #fff !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link {
    color: rgba(255, 255, 255, 0.82);
    border-radius: 14px;
    margin: 0.2rem 0.7rem;
    padding: 0.75rem 0.95rem;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar .nav-header {
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-left: 1.2rem !important;
}

.content-header h1,
.content-header .m-0 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--stitch-text);
}

.stitch-card,
.card,
.info-box {
    border-radius: var(--stitch-radius);
    border: 1px solid var(--stitch-border);
    background: var(--stitch-surface);
    box-shadow: var(--stitch-shadow-soft);
}

.card.stitch-card .card-header,
.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--stitch-border);
    padding: 1rem 1.25rem;
}

.card .card-title {
    font-weight: 700;
    color: var(--stitch-text);
}

.card .card-body,
.card .card-footer {
    padding: 1.25rem;
}

.table {
    color: var(--stitch-text);
}

.table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--stitch-border);
    color: var(--stitch-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.table td,
.table th {
    vertical-align: middle;
}

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

.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.6rem 1rem;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: #1e40af;
}

.btn-secondary,
.btn-outline-secondary {
    border-color: #d0d7e2;
}

.badge {
    border-radius: 999px;
    padding: 0.45em 0.7em;
    font-weight: 700;
}

.form-control,
.custom-select {
    border-radius: 12px;
    border-color: #d8e1ec;
    min-height: calc(1.6em + 1rem + 2px);
    box-shadow: none !important;
}

.form-control:focus,
.custom-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.12) !important;
}

.form-group > label {
    font-weight: 600;
    color: #334155;
}

.alert {
    border: 0;
    border-radius: 14px;
    box-shadow: var(--stitch-shadow-soft);
}

.info-box {
    min-height: auto;
    padding: 0.2rem;
}

.info-box .info-box-icon {
    width: 62px;
    border-radius: 14px;
    margin: 0.6rem;
}

.info-box .info-box-content {
    padding: 0.85rem 0.75rem 0.85rem 0;
}

.small-box {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid transparent;
    box-shadow: var(--stitch-shadow);
}

.small-box > .inner {
    padding: 1.25rem 1.25rem 0.75rem;
}

.small-box .icon {
    top: 14px;
    right: 16px;
    font-size: 54px;
    opacity: 0.18;
}

.small-box .small-box-footer {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.8rem 1rem;
    font-weight: 600;
}

.small-box.bg-info {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
}

.small-box.bg-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
}

.small-box.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #fff !important;
}

.small-box.bg-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
}

.login-page,
.register-page {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.14), transparent 30%),
        linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
}

.login-box .card,
.register-box .card {
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.login-logo,
.register-logo {
    margin-bottom: 1.25rem;
}

.login-logo a,
.register-logo a {
    color: #0f172a;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.content-wrapper .content {
    padding-bottom: 1.5rem;
}

.main-footer {
    background: transparent;
    border-top: 0;
    color: var(--stitch-muted);
}

.stitch-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #60a5fa 100%);
    color: #fff;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--stitch-shadow);
    position: relative;
    overflow: hidden;
}

.stitch-hero::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.26), transparent 70%);
}

.stitch-kpi {
    background: var(--stitch-surface);
    border: 1px solid var(--stitch-border);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    box-shadow: var(--stitch-shadow-soft);
    height: 100%;
}

.stitch-kpi-label {
    color: var(--stitch-muted);
    font-size: 0.84rem;
    margin-bottom: 0.4rem;
}

.stitch-kpi-value {
    color: var(--stitch-text);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
}

.stitch-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
}

.stitch-action-card {
    display: block;
    background: var(--stitch-surface-soft);
    border: 1px solid var(--stitch-border);
    border-radius: 18px;
    padding: 1rem;
    color: var(--stitch-text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stitch-action-card:hover {
    color: var(--stitch-text);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--stitch-shadow-soft);
    border-color: #c9d7ee;
}

.stitch-action-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--stitch-primary-soft);
    color: var(--stitch-primary);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.stitch-dashboard-shell {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #d9e2ef;
    border-radius: 24px;
    padding: 1.25rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.stitch-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.stitch-timestamp-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
}

.stitch-timestamp-value {
    font-size: 0.88rem;
    color: #334155;
    font-weight: 600;
}

.stitch-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.stitch-metric-card {
    display: block;
    background: #fff;
    border: 1px solid #d8e1ec;
    border-top-width: 4px;
    border-radius: 6px;
    padding: 1rem 1rem 0.9rem;
    color: var(--stitch-text);
    box-shadow: none;
}

.stitch-metric-card:hover {
    color: var(--stitch-text);
    text-decoration: none;
    border-color: #cbd5e1;
}

.stitch-metric-card.accent-blue { border-top-color: #2563eb; }
.stitch-metric-card.accent-indigo { border-top-color: #1d4ed8; }
.stitch-metric-card.accent-red { border-top-color: #ef4444; }
.stitch-metric-card.accent-slate { border-top-color: #64748b; }

.stitch-metric-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.7rem;
}

.stitch-metric-value {
    font-size: 2rem;
    line-height: 1.05;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.4rem;
}

.stitch-metric-foot {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
}

.stitch-panel-card {
    border-radius: 8px;
}

.stitch-link-action {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1d4ed8;
}

.stitch-link-action:hover {
    color: #1e40af;
    text-decoration: none;
}

.stitch-compact-table thead th {
    font-size: 0.72rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.stitch-compact-table td {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    font-size: 0.92rem;
}

@media (max-width: 767.98px) {
    .content-header h1,
    .content-header .m-0 {
        font-size: 1.5rem;
    }

    .stitch-hero {
        padding: 1.2rem;
    }

    .stitch-dashboard-header {
        flex-direction: column;
    }

    .stitch-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .stitch-metric-grid {
        grid-template-columns: 1fr;
    }
}
