/* ===============================
   GOOGLE FONT
================================== */

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

:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --primary: #3B82F6;
    --secondary: #8B5CF6;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --text: #20242B;
    --text-light: #808898;
    --border: #ECEFF5;
    --radius: 24px;
    --radius-sm: 16px;
    --shadow: 0 12px 30px rgba(0, 0, 0, .05);
    --transition: .25s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ===============================
   APP LAYOUT
================================== */

.app {
    display: flex;
    min-height: 100vh;
}

/* ===============================
   SIDEBAR
================================== */

.sidebar {
    width: 270px;
    background: var(--surface);
    border-radius: 28px;
    margin: 20px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 40px;
}

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

.nav a {
    text-decoration: none;
    color: #5d6470;
    padding: 14px 18px;
    border-radius: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.nav a:hover {
    background: #eef3ff;
    color: var(--primary);
}

.nav a.active {
    background: #2c2f42;
    color: white;
}

.nav-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.user form {
    margin-top: 6px;
}

.user .text strong {
    display: block;
    font-size: 14px;
}

.user-link {
    font-size: 13px;
    color: var(--text-light);
    text-decoration: none;
    display: inline-block;
    margin-top: 6px;
}

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

/* ===============================
   CONTENT
================================== */

.content {
    flex: 1;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 34px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search,
.crud-search input[type="search"] {
    width: 320px;
    height: 48px;
    background: white;
    border-radius: 15px;
    border: none;
    padding: 0 18px;
    font-size: 15px;
    outline: none;
}

/* ===============================
   GRID
================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* ===============================
   CARDS
================================== */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .04);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 18px;
}

/* ===============================
   STATS
================================== */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

.stat {
    background: #f6f8fb;
    border-radius: 18px;
    padding: 20px;
}

.stat h3 {
    font-size: 14px;
    color: #8d95a4;
    margin-bottom: 10px;
}

.stat span {
    font-size: 28px;
    font-weight: 700;
}

/* ===============================
   CHART PLACEHOLDER
================================== */

.chart {
    height: 260px;
    border-radius: 20px;
    background: linear-gradient(180deg, #dceeff, #f6fbff);
}

/* ===============================
   TABLE
================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: #8b92a1;
    font-weight: 500;
    padding-bottom: 18px;
    font-size: 14px;
}

td {
    padding: 18px 0;
    border-top: 1px solid #edf0f6;
    font-size: 15px;
}

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

/* ===============================
   BADGES
================================== */

.badge {
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.badge.success {
    background: #dbffe9;
    color: #0c9a56;
}

.badge.warning {
    background: #fff3d9;
    color: #c58b00;
}

.badge.primary {
    background: #e4eeff;
    color: #3475ff;
}

.badge.dark {
    background: #2b2d42;
    color: white;
}

/* ===============================
   BUTTONS
================================== */

.btn,
.button {
    border: none;
    padding: 12px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-primary,
.button {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
.button:hover {
    background: #2d67e8;
}

.btn-light {
    background: #f4f6fb;
    color: var(--text);
}

.btn-light:hover {
    background: #e6ebf5;
}

/* ===============================
   PROGRESS RINGS
================================== */

.progress-container {
    display: flex;
    gap: 30px;
    justify-content: space-between;
}

.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(#4d8dff 70%, #edf2fb 70%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle::before {
    content: "";
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
}

.progress-circle span {
    position: absolute;
    z-index: 1;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.progress-caption {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 12px;
}

/* ===============================
   MINI CARDS
================================== */

.small-card {
    background: #fafbfc;
    border-radius: 18px;
    padding: 18px;
}

.small-card h4 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

/* ===============================
   USER
================================== */

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

/* ===============================
   FORMS
================================== */

form p {
    margin-bottom: 14px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    outline: none;
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.monospace {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.error {
    color: var(--danger);
    margin-bottom: 16px;
}

/* ===============================
   CRUD (neoneapolitan)
================================== */

.crud-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.crud-list-header h2,
.section-title {
    font-size: 18px;
    font-weight: 600;
}

.crud-search {
    display: flex;
    gap: 8px;
}

.crud-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.crud-actions a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    align-self: center;
}

/* ===============================
   CALENDAR
================================== */

.calendar-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.calendar-month.current {
    box-shadow: 0 0 0 2px var(--primary), 0 8px 25px rgba(0, 0, 0, .04);
}

.contribution-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 22px);
    grid-auto-columns: 1fr;
    gap: 4px;
}

.contribution-day {
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
}

.contribution-day.level-0 {
    background: #ebedf0;
    color: #a8b0bf;
}

.contribution-day.level-1 {
    background: #9be9a8;
    color: #1a5e1f;
}

.contribution-day.level-2 {
    background: #40c463;
    color: #ffffff;
}

.contribution-day.level-3 {
    background: #30a14e;
    color: #ffffff;
}

.contribution-day.level-4 {
    background: #216e39;
    color: #ffffff;
}

.contribution-day.today {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.contribution-day.empty {
    background: transparent;
}

.legend {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    width: fit-content;
}

.legend .contribution-day {
    width: 22px;
}

.legend-label {
    font-size: 12px;
    color: var(--text-light);
    margin: 0 4px;
}

.calendar {
    text-align: center;
}

.calendar th {
    text-align: center;
    padding-bottom: 12px;
}

.calendar td {
    border-top: none;
    padding: 14px;
    border-radius: 14px;
    transition: var(--transition);
}

.calendar td:hover {
    background: #f6f8fb;
}

.calendar a {
    font-size: 13px;
}

.day-num {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.calendar .dim {
    color: #c4cad6;
}

.calendar .today {
    background: #e4eeff;
    color: var(--text);
}

/* ===============================
   RECORD CARDS
================================== */

.record-card {
    margin-bottom: 20px;
}

.record-card dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
}

.record-card dt {
    color: var(--text-light);
    font-size: 14px;
}

.record-card dd {
    font-size: 15px;
}

/* ===============================
   DETAIL
================================== */

.crud-detail dl,
.detail-list {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 10px 16px;
}

.crud-detail dt,
.detail-list dt {
    color: var(--text-light);
    font-size: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.crud-detail dd,
.detail-list dd {
    font-size: 15px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* ===============================
   SCROLLBAR
================================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: #d7dce6;
    border-radius: 20px;
}

/* ===============================
   RESPONSIVE
================================== */

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .calendar-months {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        width: 90px;
    }

    .sidebar .text,
    .sidebar .user .text {
        display: none;
    }

    .sidebar .nav a {
        justify-content: center;
    }

    .sidebar .user {
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .search,
    .crud-search input[type="search"] {
        width: 100%;
    }

    .crud-list-header {
        flex-direction: column;
        align-items: stretch;
    }
}
