/**
 * File: assets/app.css
 * Project: Bilingual School Management SaaS
 * Purpose: Mobile-first responsive design system for the SaaS landing page, dashboards, forms, cards, tables, modals and app layout.
 */

/* =========================================================
   1. CSS VARIABLES
========================================================= */

:root {
    --primary: #6d4aff;
    --primary-rgb: 109, 74, 255;
    --primary-dark: #5137d5;
    --primary-soft: #f0ecff;

    --secondary: #10c9b7;
    --secondary-rgb: 16, 201, 183;
    --secondary-dark: #0c9d90;
    --secondary-soft: #e6fffb;

    --accent: #ff9f1c;
    --accent-rgb: 255, 159, 28;
    --accent-soft: #fff4df;

    --danger: #e11d48;
    --danger-rgb: 225, 29, 72;
    --danger-soft: #fff1f4;

    --success: #079669;
    --success-rgb: 7, 150, 105;
    --success-soft: #e9fbf4;

    --warning: #d97706;
    --warning-rgb: 217, 119, 6;
    --warning-soft: #fff7e6;

    --info: #2563eb;
    --info-rgb: 37, 99, 235;
    --info-soft: #eff6ff;

    --bg: #f6f5ff;
    --bg-2: #eef8ff;
    --surface: #ffffff;
    --surface-2: #fafaff;
    --surface-3: #f4f4fb;

    --text: #20243f;
    --text-2: #3f4668;
    --muted: #707790;
    --muted-2: #9aa1b7;

    --line: #e5e7f2;
    --line-2: #d7d9e9;

    --sidebar-bg: #ffffff;
    --sidebar-text: #495071;
    --sidebar-active-bg: linear-gradient(135deg, var(--primary), var(--secondary));
    --sidebar-active-text: #ffffff;

    --topbar-bg: rgba(255, 255, 255, 0.82);
    --card-bg: rgba(255, 255, 255, 0.92);

    --shadow-sm: 0 6px 20px rgba(36, 29, 82, 0.07);
    --shadow: 0 18px 50px rgba(36, 29, 82, 0.12);
    --shadow-lg: 0 26px 80px rgba(36, 29, 82, 0.18);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 999px;

    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

    --sidebar-width: 282px;
    --topbar-height: 68px;
    --bottom-nav-height: 74px;

    --container: 1240px;
    --transition: 180ms ease;
}

[data-theme="dark"] {
    --bg: #10182a;
    --bg-2: #0c1324;
    --surface: #172033;
    --surface-2: #1d2940;
    --surface-3: #22304b;

    --text: #f7f8ff;
    --text-2: #d8def2;
    --muted: #aab3cc;
    --muted-2: #828ca7;

    --line: #2b3854;
    --line-2: #374660;

    --sidebar-bg: #111a2d;
    --sidebar-text: #c7d0e8;
    --topbar-bg: rgba(17, 26, 45, 0.86);
    --card-bg: rgba(23, 32, 51, 0.94);

    --primary-soft: rgba(var(--primary-rgb), 0.16);
    --secondary-soft: rgba(var(--secondary-rgb), 0.15);
    --accent-soft: rgba(var(--accent-rgb), 0.15);
    --success-soft: rgba(var(--success-rgb), 0.15);
    --warning-soft: rgba(var(--warning-rgb), 0.16);
    --danger-soft: rgba(var(--danger-rgb), 0.16);
    --info-soft: rgba(var(--info-rgb), 0.16);

    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
    --shadow-lg: 0 26px 80px rgba(0, 0, 0, 0.36);
}

/* =========================================================
   2. RESET + BASE
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(var(--primary-rgb), 0.16), transparent 34rem),
        radial-gradient(circle at top right, rgba(var(--secondary-rgb), 0.16), transparent 36rem),
        linear-gradient(135deg, var(--bg), var(--bg-2));
}

body.no-scroll {
    overflow: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

p {
    margin-top: 0;
}

::selection {
    color: #ffffff;
    background: var(--primary);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

/* =========================================================
   3. TYPOGRAPHY
========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text);
    line-height: 1.12;
    margin: 0 0 12px;
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(30px, 8vw, 58px);
}

h2 {
    font-size: clamp(25px, 5vw, 42px);
}

h3 {
    font-size: clamp(21px, 4vw, 30px);
}

h4 {
    font-size: 19px;
}

h5 {
    font-size: 17px;
}

h6 {
    font-size: 15px;
}

.text-muted {
    color: var(--muted);
}

.text-small {
    font-size: 13px;
}

.text-tiny {
    font-size: 12px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.fw-700 {
    font-weight: 700;
}

.fw-800 {
    font-weight: 800;
}

.fw-900 {
    font-weight: 900;
}

/* =========================================================
   4. UTILITIES
========================================================= */

.hidden {
    display: none !important;
}

.mobile-hidden {
    display: none !important;
}

.desktop-hidden {
    display: initial !important;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 8px !important;
}

.mt-2 {
    margin-top: 14px !important;
}

.mt-3 {
    margin-top: 22px !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 8px !important;
}

.mb-2 {
    margin-bottom: 14px !important;
}

.mb-3 {
    margin-bottom: 22px !important;
}

.gap-1 {
    gap: 8px !important;
}

.gap-2 {
    gap: 14px !important;
}

.gap-3 {
    gap: 22px !important;
}

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2,
.grid-3,
.grid-4 {
    grid-template-columns: 1fr;
}

.container {
    width: min(var(--container), calc(100% - 28px));
    margin-inline: auto;
}

/* =========================================================
   5. BUTTONS
========================================================= */

.btn,
button.btn,
a.btn {
    min-height: 46px;
    border: 0;
    border-radius: 15px;
    padding: 12px 16px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 14px 28px rgba(var(--primary-rgb), 0.24);
}

.btn-secondary {
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-outline {
    color: var(--text);
    background: transparent;
    border: 1px solid var(--line);
}

.btn-light {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    color: #ffffff;
    background: var(--danger);
}

.btn-success {
    color: #ffffff;
    background: var(--success);
}

.btn-warning {
    color: #ffffff;
    background: var(--warning);
}

.btn-sm {
    min-height: 36px;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.btn-lg {
    min-height: 54px;
    padding: 15px 20px;
    border-radius: 18px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 14px;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.56;
    pointer-events: none;
}

/* =========================================================
   6. FORMS
========================================================= */

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.form-group {
    display: block;
}

.form-label,
label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 900;
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
input[type="tel"],
select,
textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.13);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--muted-2);
}

.form-help {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.form-error {
    margin-top: 7px;
    color: var(--danger);
    font-size: 12px;
    font-weight: 800;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .input-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 42px;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.checkbox-row,
.radio-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-row input,
.radio-row input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.color-row {
    display: grid;
    grid-template-columns: 1fr 72px;
    gap: 10px;
    align-items: center;
}

.color-row input[type="color"] {
    height: 48px;
    padding: 4px;
}

/* =========================================================
   7. CARDS + PANELS
========================================================= */

.card,
.panel,
.soft-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
}

[data-theme="dark"] .card,
[data-theme="dark"] .panel,
[data-theme="dark"] .soft-card {
    border-color: var(--line);
}

.card {
    padding: 18px;
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.card-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: -50px auto auto -50px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.11);
}

.stat-content {
    position: relative;
    z-index: 1;
}

.stat-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 12px 28px rgba(var(--primary-rgb), 0.22);
    flex: 0 0 48px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stat-value {
    margin: 10px 0 4px;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -0.04em;
}

.stat-meta {
    color: var(--muted);
    font-size: 12px;
}

.stat-card.success .stat-icon,
.bg-success-gradient {
    background: linear-gradient(135deg, #12b981, #10c9b7);
}

.stat-card.warning .stat-icon,
.bg-warning-gradient {
    background: linear-gradient(135deg, #ff9f1c, #ff6b35);
}

.stat-card.danger .stat-icon,
.bg-danger-gradient {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
}

.stat-card.info .stat-icon,
.bg-info-gradient {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
}

/* =========================================================
   8. BADGES + ALERTS
========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.badge.success {
    color: var(--success);
    background: var(--success-soft);
}

.badge.warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge.danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.badge.info {
    color: var(--info);
    background: var(--info-soft);
}

.badge.muted {
    color: var(--muted);
    background: var(--surface-3);
}

.alert {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--line);
    color: var(--text-2);
    background: var(--surface);
}

.alert.success {
    color: var(--success);
    background: var(--success-soft);
    border-color: rgba(var(--success-rgb), 0.22);
}

.alert.warning {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: rgba(var(--warning-rgb), 0.24);
}

.alert.danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(var(--danger-rgb), 0.22);
}

.alert.info {
    color: var(--info);
    background: var(--info-soft);
    border-color: rgba(var(--info-rgb), 0.22);
}

/* =========================================================
   9. LANDING PAGE
========================================================= */

.landing-shell {
    min-height: 100vh;
}

.landing-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.76);
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(18px);
}

[data-theme="dark"] .landing-nav {
    background: rgba(16, 24, 42, 0.78);
    border-color: var(--line);
}

.landing-nav-inner {
    width: min(var(--container), calc(100% - 28px));
    min-height: 70px;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 950;
    color: var(--text);
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-weight: 950;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 12px 28px rgba(var(--primary-rgb), 0.25);
}

.brand-text {
    display: grid;
    gap: 2px;
}

.brand-name {
    font-size: 18px;
}

.brand-tagline {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.landing-actions {
    display: none;
    align-items: center;
    gap: 10px;
}

.landing-hero {
    padding: 42px 0 24px;
}

.landing-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: center;
}

.landing-kicker {
    width: fit-content;
    margin-bottom: 16px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 13px;
    font-weight: 900;
}

.landing-title {
    margin-bottom: 16px;
}

.landing-subtitle {
    max-width: 640px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.7;
}

.landing-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.landing-preview {
    position: relative;
    padding: 16px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.18), rgba(var(--secondary-rgb), 0.15));
    box-shadow: var(--shadow-lg);
}

.preview-window {
    overflow: hidden;
    border-radius: 26px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.7);
}

.preview-top {
    min-height: 54px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--line);
}

.preview-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--line-2);
}

.preview-dot:nth-child(1) {
    background: var(--danger);
}

.preview-dot:nth-child(2) {
    background: var(--warning);
}

.preview-dot:nth-child(3) {
    background: var(--success);
}

.preview-body {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.preview-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.preview-stat {
    padding: 16px;
    border-radius: 18px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.preview-stat strong {
    display: block;
    margin-bottom: 6px;
    font-size: 24px;
}

.preview-bars {
    display: grid;
    gap: 10px;
}

.preview-bar {
    height: 13px;
    border-radius: var(--radius-full);
    background: var(--surface-3);
    overflow: hidden;
}

.preview-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.feature-section {
    padding: 34px 0;
}

.section-heading {
    margin-bottom: 22px;
}

.feature-grid,
.pricing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.feature-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.pricing-card {
    padding: 22px;
    border-radius: var(--radius-xl);
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
}

.price {
    display: flex;
    align-items: end;
    gap: 8px;
    margin: 14px 0;
}

.price strong {
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.price span {
    color: var(--muted);
}

/* =========================================================
   10. APP LAYOUT
========================================================= */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(var(--sidebar-width), calc(100vw - 54px));
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-open .app-sidebar {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-header {
    min-height: var(--topbar-height);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.sidebar-school {
    min-width: 0;
}

.sidebar-school strong {
    display: block;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar-school span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.nav-section-label {
    margin: 16px 12px 8px;
    color: var(--muted-2);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-link {
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    font-weight: 850;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-link:hover {
    background: var(--surface-3);
}

.nav-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
    box-shadow: 0 14px 28px rgba(var(--primary-rgb), 0.22);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex: 0 0 20px;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--line);
}

.app-main {
    min-width: 0;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: var(--topbar-height);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--topbar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(18px);
}

[data-theme="dark"] .app-topbar {
    border-bottom-color: var(--line);
}

.topbar-title {
    min-width: 0;
    flex: 1;
}

.topbar-title strong {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 15px;
}

.topbar-title span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-search {
    display: none;
    width: min(360px, 32vw);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--line);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-weight: 950;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    overflow: hidden;
    flex: 0 0 36px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-chip-text {
    display: none;
    line-height: 1.1;
}

.user-chip-text strong {
    display: block;
    max-width: 130px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}

.user-chip-text span {
    color: var(--muted);
    font-size: 11px;
}

.app-content {
    width: min(var(--container), calc(100% - 28px));
    margin-inline: auto;
    padding: 18px 0 22px;
}

.content-loading {
    position: relative;
    opacity: 0.58;
    pointer-events: none;
}

.content-loading::after {
    content: "";
    position: fixed;
    left: 50%;
    top: 86px;
    width: 34px;
    height: 34px;
    border: 4px solid rgba(var(--primary-rgb), 0.22);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    z-index: 100;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.page-head {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(26px, 8vw, 40px);
}

.page-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.page-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* =========================================================
   11. MOBILE BOTTOM NAV
========================================================= */

.bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 60;
    min-height: var(--bottom-nav-height);
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

[data-theme="dark"] .bottom-nav {
    background: rgba(17, 26, 45, 0.9);
    border-color: var(--line);
}

.bottom-nav-link {
    min-width: 0;
    min-height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.bottom-nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.bottom-nav-link span {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* =========================================================
   12. TABLES - MOBILE FIRST
========================================================= */

.table-card {
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-sm);
}

.table-toolbar {
    padding: 14px;
    display: grid;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--surface-2);
}

td {
    color: var(--text-2);
}

tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.04);
}

.mobile-card-list {
    display: grid;
    gap: 12px;
}

.mobile-record-card {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.mobile-record-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mobile-record-title {
    font-weight: 950;
}

.mobile-record-meta {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.mobile-record-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* =========================================================
   13. DASHBOARD COMPONENTS
========================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.quick-action {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    flex: 0 0 44px;
}

.quick-action strong {
    display: block;
    margin-bottom: 3px;
}

.quick-action span {
    color: var(--muted);
    font-size: 12px;
}

.progress {
    width: 100%;
    height: 12px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--surface-3);
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.attendance-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.attendance-item {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.attendance-item-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.mini-calendar {
    display: grid;
    gap: 8px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar-cell {
    min-height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.calendar-cell.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

/* =========================================================
   14. SETUP WIZARD
========================================================= */

.wizard {
    display: grid;
    gap: 16px;
}

.wizard-steps {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.wizard-step {
    min-width: 180px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}

.wizard-step.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
}

.wizard-step-number {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 950;
}

.wizard-step strong {
    display: block;
    font-size: 13px;
}

.wizard-step span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    opacity: 0.82;
}

.wizard-panel {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

/* =========================================================
   15. MODALS + DRAWERS
========================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(6px);
}

.modal-backdrop.active {
    display: block;
}

.modal {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 130;
    max-height: calc(100vh - 20px);
    display: none;
    overflow: hidden;
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
}

.modal.active {
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 950;
}

.modal-body {
    padding: 18px;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* =========================================================
   16. TOASTS
========================================================= */

.toast-wrap {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--bottom-nav-height) + 24px);
    z-index: 180;
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.toast {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    pointer-events: auto;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.toast.success {
    border-color: rgba(var(--success-rgb), 0.24);
    background: var(--success-soft);
}

.toast.warning {
    border-color: rgba(var(--warning-rgb), 0.24);
    background: var(--warning-soft);
}

.toast.danger {
    border-color: rgba(var(--danger-rgb), 0.24);
    background: var(--danger-soft);
}

.toast.info {
    border-color: rgba(var(--info-rgb), 0.24);
    background: var(--info-soft);
}

/* =========================================================
   17. AUTH PAGES
========================================================= */

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.auth-card {
    width: min(100%, 460px);
    padding: 22px;
    border-radius: var(--radius-xl);
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.auth-logo {
    width: 62px;
    height: 62px;
    margin-bottom: 16px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-weight: 950;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.auth-title {
    margin-bottom: 8px;
}

.auth-subtitle {
    margin-bottom: 22px;
    color: var(--muted);
}

/* =========================================================
   18. RECEIPTS + REPORT PREVIEW
========================================================= */

.print-sheet {
    width: 100%;
    max-width: 840px;
    margin-inline: auto;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    color: #1f2937;
    box-shadow: var(--shadow);
}

.print-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.print-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    font-weight: 950;
}

.print-title {
    margin: 0;
    color: #111827;
}

.print-table {
    width: 100%;
    min-width: 0;
    margin-top: 16px;
}

.print-table th,
.print-table td {
    color: #1f2937;
    border-color: #e5e7eb;
}

/* =========================================================
   19. EMPTY STATES
========================================================= */

.empty-state {
    padding: 36px 18px;
    text-align: center;
}

.empty-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
}

.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 420px;
    margin-inline: auto;
    color: var(--muted);
}

/* =========================================================
   20. RESPONSIVE BREAKPOINTS
========================================================= */

@media (min-width: 540px) {
    .landing-cta,
    .form-actions,
    .page-actions,
    .modal-footer {
        flex-direction: row;
        align-items: center;
    }

    .preview-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid.two,
    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toast-wrap {
        left: auto;
        right: 18px;
        width: min(420px, calc(100vw - 36px));
    }
}

@media (min-width: 760px) {
    .mobile-hidden {
        display: initial !important;
    }

    .desktop-hidden {
        display: none !important;
    }

    .landing-actions {
        display: flex;
    }

    .landing-hero {
        padding: 70px 0 46px;
    }

    .landing-hero-grid {
        grid-template-columns: minmax(0, 1fr) minmax(330px, 0.92fr);
    }

    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid.three,
    .grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .card {
        padding: 22px;
    }

    .card-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .table-toolbar {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .page-head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .page-actions {
        flex-direction: row;
        justify-content: flex-end;
    }

    .modal {
        top: 50%;
        bottom: auto;
        left: 50%;
        right: auto;
        width: min(680px, calc(100vw - 32px));
        max-height: calc(100vh - 64px);
        transform: translate(-50%, -50%);
    }

    .modal.sm {
        width: min(460px, calc(100vw - 32px));
    }

    .modal.lg {
        width: min(980px, calc(100vw - 32px));
    }

    .print-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

@media (min-width: 980px) {
    .app-shell {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }

    .app-sidebar {
        position: sticky;
        top: 0;
        transform: none;
        box-shadow: none;
    }

    .sidebar-backdrop {
        display: none;
    }

    .app-main {
        padding-bottom: 0;
    }

    .bottom-nav {
        display: none;
    }

    .app-topbar {
        padding-inline: 22px;
    }

    .topbar-search {
        display: block;
    }

    .user-chip-text {
        display: block;
    }

    .app-content {
        padding: 24px 0 34px;
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .action-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .feature-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .form-grid.four,
    .grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1240px) {
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* =========================================================
   21. PRINT
========================================================= */

@media print {
    body {
        background: #ffffff !important;
    }

    .app-sidebar,
    .app-topbar,
    .bottom-nav,
    .sidebar-backdrop,
    .page-actions,
    .btn,
    .no-print {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .app-content {
        width: 100%;
        padding: 0;
    }

    .card,
    .panel,
    .print-sheet {
        box-shadow: none !important;
        border: 0 !important;
        border-radius: 0 !important;
    }

    .print-sheet {
        max-width: none;
        padding: 0;
    }
}