@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #0f766e;
    --primary-hover: #115e59;
    --primary-light: #ccfbf1;
    --accent: #14b8a6;
    --accent-glow: rgba(20, 184, 166, 0.25);
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --success: #10b981;
    --success-light: #d1fae5;
    --dark: #0b1329;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, 0.12);
    --radius: 20px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; transition: all 0.2s ease; }
img { max-width: 100%; display: block; }

/* Shell Layout */
.app-shell { min-height: 100vh; display: flex; }

/* Modern Sidebar */
.sidebar {
    width: 270px;
    background: linear-gradient(180deg, #0f172a 0%, #090d16 100%);
    color: #fff;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: block;
    object-fit: contain;
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.3);
    transition: transform 0.2s ease;
}

.brand-logo:hover { transform: scale(1.05); }

.brand strong {
    display: block;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand span {
    display: block;
    font-size: 11px;
    color: #14b8a6;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar nav { display: grid; gap: 6px; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    transform: translateX(3px);
}

.sidebar nav a.active {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(20, 184, 166, 0.8));
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.35);
}

.sidebar-user {
    margin-top: auto;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 16px;
}

.sidebar-user small { display: block; color: #94a3b8; font-size: 11px; }
.sidebar-user strong { display: block; font-size: 13.5px; color: #f8fafc; font-weight: 700; }

/* Main Content Area */
.main {
    flex: 1;
    margin-left: 270px;
    padding: 28px 36px;
    max-width: 100%;
}

.auth-main {
    margin-left: 0;
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at 50% 20%, #e6fffa 0%, #f8fafc 70%);
}

/* Topbar */
.topbar {
    height: 72px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    margin-bottom: 28px;
}

.topbar-info strong { display: block; font-size: 16px; font-weight: 800; color: var(--text); }
.topbar-info span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }

.menu-btn {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
    transition: all 0.2s ease;
}

.menu-btn:hover { background: #f1f5f9; }

/* Containers & Title */
.container { max-width: 1240px; margin: 0 auto; }

.page-title {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    margin: 0 0 24px;
}

.page-title h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.8px;
    color: #0f172a;
}

.page-title p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }

/* Dashboard Welcome Banner */
.welcome-card {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #14b8a6 100%);
    border-radius: var(--radius);
    padding: 30px 36px;
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: rgba(255, 255, 255, 0.12);
    filter: blur(40px);
    border-radius: 50%;
    pointer-events: none;
}

.welcome-card h2 { margin: 0 0 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.welcome-card p { margin: 0; color: rgba(255, 255, 255, 0.9); font-size: 15px; max-width: 620px; }

/* Cards & Grid */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card h2 { margin: 0 0 16px; font-size: 19px; font-weight: 700; color: #0f172a; }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* Stat Widgets */
.stat {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

.stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 20px;
    background: var(--primary-light);
    color: var(--primary);
}

.stat small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong { display: block; font-size: 28px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 999px;
}

.trend-up { background: var(--success-light); color: #047857; }
.trend-amber { background: var(--warning-light); color: #b45309; }

/* Forms & Inputs */
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 8px;
    color: #334155;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 14px;
    padding: 12px 16px;
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

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

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* Buttons */
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: #e2e8f0;
    color: #0f172a;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
}

.btn-light {
    background: #ffffff;
    border: 1px solid var(--line);
    color: #334155;
}

.btn-light:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-small { padding: 8px 14px; border-radius: 10px; font-size: 13px; }

/* Alerts */
.alert {
    border-radius: 16px;
    padding: 14px 18px;
    margin: 0 0 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; }

/* Data Tables */
.table-tools {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr auto;
    gap: 12px;
    margin-bottom: 18px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 900px;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th a { color: var(--primary); }

tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: #f1f5f9; }

.table-img {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-active { background: #dcfce7; color: #15803d; }
.badge-active::before { background: #16a34a; }

.badge-pending { background: #fef3c7; color: #b45309; }
.badge-pending::before { background: #d97706; }

.badge-archived { background: #f1f5f9; color: #475569; }
.badge-archived::before { background: #64748b; }

.muted { color: var(--muted); }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 14px;
    background: #fff;
    font-weight: 600;
    font-size: 13.5px;
    transition: all 0.2s ease;
}

.pagination a:hover { background: #f8fafc; border-color: #cbd5e1; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Auth Card */
.auth-card {
    width: min(450px, 92vw);
    padding: 36px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    margin-bottom: 18px;
}

.auth-logo img {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(15, 118, 110, 0.25);
}

.demo-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
    color: #334155;
    font-size: 13.5px;
}

.demo-box code {
    background: #e2e8f0;
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 700;
    color: #0f172a;
}

.file-preview { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.file-preview img {
    width: 130px;
    height: 90px;
    border-radius: 14px;
    border: 1px solid var(--line);
    object-fit: cover;
}

.report-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.no-print { display: flex; gap: 12px; flex-wrap: wrap; }
.map-link { font-size: 13px; color: var(--primary); font-weight: 700; text-decoration: underline; }

/* Responsiveness */
@media(max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 20px 16px; }
    .menu-btn { display: inline-grid; place-items: center; }
    .topbar { height: auto; padding: 14px 18px; }
    .page-title { flex-direction: column; align-items: flex-start; }
    .welcome-card { flex-direction: column; align-items: flex-start; padding: 24px; }
    .grid-4, .grid-3, .grid-2, .form-row, .table-tools { grid-template-columns: 1fr; }
    .actions .btn { width: 100%; }
    .actions.table-actions .btn { width: auto; }
}

@media print {
    .sidebar, .topbar, .no-print, .alert { display: none !important; }
    .main { margin: 0; padding: 0; }
    .card { box-shadow: none; border: 0; }
    .table-wrap { border: 0; overflow: visible; }
    table { min-width: 0; font-size: 12px; }
    body { background: #fff; }
}
