:root {
    --primary: #2757F5;
    --primary-dark: #1c46d4;
    --primary-soft: #e8eeff;
    --accent: #F5DD27;
    --accent-dark: #e0c70f;
    --text: #000000;
    --text-muted: #5b6475;
    --white: #ffffff;
    --bg: #eef2ff;
    --sidebar: #1a2fa8;
    --sidebar-2: #2757F5;
    --danger: #dc3545;
    --radius: 18px;
    --shadow: 0 12px 40px rgba(39, 87, 245, 0.12);
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Kanit', sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100%;
}

body { margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar,
.sidebar-offcanvas {
    width: 270px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: var(--white);
}

.sidebar {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    padding: 0;
}

.sidebar-offcanvas {
    width: min(320px, 86vw);
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px 18px;
    color: #fff;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
    color: var(--white);
}

.brand small { display: block; opacity: .75; font-size: 12px; }
.brand strong { font-size: 18px; }

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--accent);
    color: #000;
    display: grid;
    place-items: center;
    font-size: 20px;
    flex-shrink: 0;
}

.side-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }

.side-nav a {
    color: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-nav a:hover,
.side-nav a.active {
    background: rgba(255,255,255,.16);
    color: #fff;
}

.side-nav a.active { box-shadow: inset 3px 0 0 var(--accent); }

.sidebar-footer { margin-top: auto; padding-top: 18px; }

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    margin-bottom: 12px;
}

.btn-logout {
    background: rgba(0,0,0,.2);
    color: #fff;
    border: 0;
}

.btn-logout:hover { background: #000; color: var(--accent); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 0 rgba(39, 87, 245, .08);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); margin: 0; }
.eyebrow { font-size: 12px; color: var(--text-muted); letter-spacing: .04em; }

.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user-meta span { font-size: 12px; color: var(--text-muted); }

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 0;
}

.content { padding: 20px; }

.panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.panel-head h2 { font-size: 1.15rem; margin: 0; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    box-shadow: var(--shadow);
}

.stat-card span { display: block; color: var(--text-muted); font-size: 13px; }
.stat-card strong { font-size: 1.6rem; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 18px;
}

.stat-card.accent .stat-icon { background: var(--accent); color: #000; }

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
}

.btn-accent,
.btn-accent:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
}

.filter-bar { display: flex; gap: 8px; flex: 1; min-width: 220px; }

.person-cell { display: flex; align-items: center; gap: 10px; color: inherit; }

.avatar {
    object-fit: cover;
    border-radius: 50%;
    background: var(--primary-soft);
}

.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-xl { width: 120px; height: 120px; }

.avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.badge-dev, .badge-you, .badge-user, .badge-accent, .chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
}

.badge-dev { background: var(--accent); color: #000; }
.badge-you { background: var(--primary-soft); color: var(--primary); margin-left: 6px; }
.badge-user { background: var(--primary-soft); color: var(--primary); }
.badge-accent { background: var(--accent); color: #000; }
.chip { background: var(--primary-soft); color: var(--primary); }

.media-empty {
    min-height: 180px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
}

.media-empty-sm { min-height: 120px; }

.asset-photo {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 14px;
    background: #f8fafc;
}

.component-card {
    border: 1px solid #e6ebff;
    border-radius: 16px;
    padding: 16px;
    background: #fbfcff;
}

.component-card-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary);
}

.component-spec { font-size: 1rem; }
.section-title { font-size: 1.05rem; margin: 8px 0 12px; }
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.dept-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eef2ff;
}

.welcome-panel { background: linear-gradient(160deg, #2757F5 0%, #1a2fa8 100%); color: #fff; }
.welcome-panel p { color: rgba(255,255,255,.85); }

.mobile-card {
    border: 1px solid #e6ebff;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
}

.table thead th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    border-bottom-width: 1px;
}

.login-body {
    min-height: 100vh;
    background: #dedede;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-wrap {
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: #fff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(39, 87, 245, 0.12);
    border: 1px solid #e6ebff;
}

.login-panel {
    background: var(--primary);
    color: #fff;
    padding: 40px 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    text-align: start;
    margin: 0;
}
.login-brand h1 { font-size: 1.8rem; margin: 0 0 6px; color: #fff; }
.login-brand p { margin: 0; opacity: .85; }

.login-card { padding: 40px 32px; }
.login-card-head h2 { margin: 10px 0 4px; }
.login-card-head p { color: var(--text-muted); }

.input-icon { position: relative; }
.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}
.input-icon .form-control { padding-left: 42px; }

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .25rem rgba(39, 87, 245, .18);
}

.profile-panel .avatar-xl { margin-inline: auto; }

@media (max-width: 1199px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991.98px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-panel { display: none; }
    .content { padding: 16px; }
}

@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .btn { min-height: 44px; }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .content { padding: 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

img.js-zoomable,
img.asset-photo,
img.avatar {
    cursor: zoom-in;
}

.image-zoom-modal .modal-content {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.image-zoom-modal .modal-body {
    position: relative;
    padding: 0;
    text-align: center;
}

.image-zoom-modal img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
    cursor: default;
}

.image-zoom-modal .modal-backdrop,
.modal-backdrop.show {
    background: rgba(0, 0, 0, 0.8);
}

