/* ============================================
   KM-Online - Knowledge Management Online
   🌿 Fresh Green Healthcare Theme
   สำหรับโรงพยาบาล / สาธารณสุข
   ============================================ */

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

/* ── CSS Variables ── */
:root {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --primary-light: #86efac;
    --secondary: #14b8a6;
    --accent: #f0fdf4;
    --gradient-main: linear-gradient(135deg, #22c55e 0%, #14b8a6 100%);
    --gradient-hero: linear-gradient(160deg, #f0fdf4 0%, #e0f7fa 30%, #f0fdf4 60%, #ecfdf5 100%);
    --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(240,253,244,0.9) 100%);
    --gradient-green: linear-gradient(135deg, #22c55e, #14b8a6);
    --gradient-orange: linear-gradient(135deg, #fb923c, #fbbf24);
    --gradient-pink: linear-gradient(135deg, #f472b6, #e879f9);
    --gradient-blue: linear-gradient(135deg, #38bdf8, #818cf8);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(34, 197, 94, 0.2);
    --glass-shadow: 0 8px 32px rgba(34, 197, 94, 0.1);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --bg-body: #f0fdf4;
    --bg-card: #ffffff;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Kanit', sans-serif;
    min-height: 100vh;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.km-main-content {
    flex: 1 0 auto;
}

/* ── Animated Background ── */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 30%, rgba(34,197,94,0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 60%, rgba(20,184,166,0.06) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(134,239,172,0.05) 0%, transparent 50%);
    animation: bgFloat 25s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(20px, -15px) rotate(0.5deg); }
    66% { transform: translate(-15px, 10px) rotate(-0.5deg); }
}

/* ── Decorative Blobs ── */
body::after {
    content: '';
    position: fixed;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34,197,94,0.07) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* ── Header / Navbar ── */
.km-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(34,197,94,0.12);
    padding: 0 24px;
    box-shadow: 0 1px 12px rgba(34,197,94,0.06);
}

.km-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.km-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.km-logo-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    box-shadow: 0 4px 12px rgba(34,197,94,0.22);
    overflow: hidden;
}

.km-logo-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.km-logo-text {
    font-size: 1.35em;
    font-weight: 600;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.km-logo-sub {
    font-size: 0.72em;
    font-weight: 300;
    color: var(--text-muted);
    display: block;
    margin-top: -3px;
}

.km-admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 50px;
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 0.85em;
    font-family: 'Kanit', sans-serif;
    transition: var(--transition);
    cursor: pointer;
}

.km-admin-btn:hover {
    background: var(--gradient-main);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(34,197,94,0.3);
}

/* ── Hero Section ── */
.km-hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 50px 24px 20px;
}

.km-hero h1 {
    font-size: 2.6em;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInDown 0.8s ease-out;
}

.km-hero p {
    font-size: 1.15em;
    color: var(--text-secondary);
    font-weight: 300;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* ── Year Selector ── */
.km-year-selector {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 10px 24px 40px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.km-year-selector label {
    font-size: 1.05em;
    color: var(--text-secondary);
    font-weight: 400;
}

.km-year-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 2px solid rgba(34,197,94,0.25);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Kanit', sans-serif;
    font-size: 1.1em;
    font-weight: 500;
    padding: 12px 48px 12px 20px;
    cursor: pointer;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2322c55e' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(34,197,94,0.08);
}

.km-year-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(34,197,94,0.15);
}

.km-year-select option {
    background: #fff;
    color: var(--text-primary);
}

/* ── Category Grid ── */
.km-grid-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

.km-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
}

/* ── Category Card ── */
.km-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(34,197,94,0.12);
    box-shadow: 0 4px 20px rgba(34,197,94,0.08);
    cursor: pointer;
    transition: var(--transition);
    animation: cardEntry 0.6s ease-out both;
}

.km-card:nth-child(1) { animation-delay: 0.1s; }
.km-card:nth-child(2) { animation-delay: 0.15s; }
.km-card:nth-child(3) { animation-delay: 0.2s; }
.km-card:nth-child(4) { animation-delay: 0.25s; }
.km-card:nth-child(5) { animation-delay: 0.3s; }
.km-card:nth-child(6) { animation-delay: 0.35s; }
.km-card:nth-child(7) { animation-delay: 0.4s; }
.km-card:nth-child(8) { animation-delay: 0.45s; }
.km-card:nth-child(9) { animation-delay: 0.5s; }
.km-card:nth-child(10) { animation-delay: 0.55s; }
.km-card:nth-child(11) { animation-delay: 0.6s; }
.km-card:nth-child(12) { animation-delay: 0.65s; }

.km-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 20px 50px rgba(34,197,94,0.18),
                0 0 0 1px rgba(34,197,94,0.1);
}

.km-card-img-wrap {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.km-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.km-card:hover .km-card-img {
    transform: scale(1.08);
}

.km-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5, #a7f3d0);
}

.km-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(255,255,255,0.8), transparent);
    pointer-events: none;
}

.km-card-body {
    padding: 20px 22px 24px;
}

.km-card-title {
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.km-card-year {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 300;
}

.km-card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.75em;
    font-weight: 500;
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 2px 10px rgba(34,197,94,0.3);
}

/* ── Modal / Popup ── */
.km-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.km-modal-overlay.active {
    display: flex;
}

.km-modal {
    background: #fff;
    border: 1px solid rgba(34,197,94,0.15);
    border-radius: var(--radius-xl);
    padding: 0;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 80px rgba(0,0,0,0.12),
                0 0 0 1px rgba(34,197,94,0.08);
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.km-modal-header {
    padding: 28px 32px 20px;
    text-align: center;
    position: relative;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.km-modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 32px;
    right: 32px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34,197,94,0.2), transparent);
}

.km-modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.8);
    color: var(--text-muted);
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.km-modal-close:hover {
    background: #fee2e2;
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}

.km-modal-title {
    font-size: 1.4em;
    font-weight: 600;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.km-modal-subtitle {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 300;
    margin-top: 4px;
}

.km-modal-body {
    padding: 24px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.km-modal-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    background: #fafffe;
    border: 1px solid rgba(34,197,94,0.1);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.km-modal-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.km-modal-link.link-knowledge::before { background: linear-gradient(135deg, rgba(34,197,94,0.06), rgba(20,184,166,0.04)); }
.km-modal-link.link-pretest::before { background: linear-gradient(135deg, rgba(56,189,248,0.06), rgba(129,140,248,0.04)); }
.km-modal-link.link-posttest::before { background: linear-gradient(135deg, rgba(251,146,60,0.06), rgba(251,191,36,0.04)); }

.km-modal-link:hover::before { opacity: 1; }

.km-modal-link:hover {
    transform: translateX(6px);
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(34,197,94,0.1);
}

.km-modal-link-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.link-knowledge .km-modal-link-icon { background: linear-gradient(135deg, #22c55e, #14b8a6); }
.link-pretest .km-modal-link-icon { background: linear-gradient(135deg, #38bdf8, #818cf8); }
.link-posttest .km-modal-link-icon { background: linear-gradient(135deg, #fb923c, #fbbf24); }

.km-modal-link-text {
    position: relative;
    z-index: 1;
}

.km-modal-link-title {
    font-size: 1.08em;
    font-weight: 500;
    color: var(--text-primary);
}

.km-modal-link-desc {
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 300;
}

.km-modal-link-arrow {
    margin-left: auto;
    font-size: 1.2em;
    color: var(--text-muted);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.km-modal-link:hover .km-modal-link-arrow {
    color: var(--primary);
    transform: translateX(4px);
}

.km-modal-link.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* ── Empty State ── */
.km-empty {
    text-align: center;
    padding: 80px 24px;
    animation: fadeIn 0.6s ease;
}

.km-empty-icon {
    font-size: 4em;
    margin-bottom: 16px;
    opacity: 0.4;
}

.km-empty-text {
    font-size: 1.2em;
    color: var(--text-muted);
    font-weight: 300;
}

/* ── Footer ── */
.km-footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 18px 24px;
    border-top: 1px solid rgba(34,197,94,0.1);
    background: linear-gradient(90deg, rgba(236,253,245,0.85), rgba(236,253,245,0.55), rgba(224,247,250,0.85));
}

.km-footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.km-footer-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}

.km-footer-title {
    font-size: 1.02em;
    font-weight: 600;
    background: linear-gradient(120deg, #0284c7 0%, #0ea5e9 45%, #14b8a6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.km-footer-sub {
    font-size: 0.8em;
    font-weight: 300;
    color: var(--text-secondary);
}

/* ── Loading Spinner ── */
.km-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 24px;
}

.km-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(34,197,94,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardEntry {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .km-header-inner { height: 60px; }
    .km-logo-text { font-size: 1.1em; }
    .km-logo-sub { display: none; }
    .km-hero { padding: 30px 16px 20px; }
    .km-hero h1 { font-size: 1.8em; }
    .km-hero p { font-size: 0.95em; }
    .km-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
    .km-grid-container { padding: 0 16px 40px; }
    .km-modal { margin: 12px; border-radius: var(--radius-lg); }
    .km-modal-header { padding: 22px 24px 16px; }
    .km-modal-body { padding: 18px 24px 28px; }
    .km-year-selector { flex-direction: column; gap: 8px; }
    .km-footer-title { font-size: 0.9em; }
    .km-footer-sub { font-size: 0.74em; }
}

@media (max-width: 480px) {
    .km-grid { grid-template-columns: 1fr; }
    .km-hero h1 { font-size: 1.5em; }
    .km-card-img-wrap { height: 170px; }
    .km-footer { padding: 14px 12px; }
    .km-footer-inner { flex-direction: column; text-align: center; }
    .km-footer-text-wrap { align-items: center; }
}

/* ============================================
   Admin Styles
   ============================================ */

/* ── Login Page ── */
.km-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--gradient-hero);
}

.km-login-card {
    background: #fff;
    border: 1px solid rgba(34,197,94,0.15);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(34,197,94,0.1),
                0 0 0 1px rgba(34,197,94,0.05);
    animation: fadeInUp 0.6s ease-out;
}

.km-login-card h1 {
    text-align: center;
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.km-login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 32px;
}

.km-form-group {
    margin-bottom: 20px;
}

.km-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 400;
}

.km-input {
    width: 100%;
    padding: 14px 18px;
    background: #f8fffe;
    border: 2px solid rgba(34,197,94,0.15);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Kanit', sans-serif;
    font-size: 1em;
    transition: var(--transition);
}

.km-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(34,197,94,0.12);
    background: #fff;
}

.km-input::placeholder {
    color: var(--text-muted);
}

.km-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Kanit', sans-serif;
    font-size: 1.05em;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: #fff;
}

.km-btn-primary {
    background: var(--gradient-main);
    box-shadow: 0 4px 20px rgba(34,197,94,0.25);
}

.km-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(34,197,94,0.35);
}

.km-btn-success {
    background: var(--gradient-green);
    box-shadow: 0 4px 20px rgba(34,197,94,0.25);
}

.km-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(34,197,94,0.4);
}

.km-btn-danger {
    background: linear-gradient(135deg, #ef4444, #f87171);
    box-shadow: 0 4px 20px rgba(239,68,68,0.2);
}

.km-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239,68,68,0.35);
}

.km-btn-sm {
    padding: 8px 16px;
    font-size: 0.85em;
    border-radius: 8px;
}

.km-btn-block {
    width: 100%;
}

.km-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Admin Dashboard ── */
.km-admin-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}

.km-admin-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(34,197,94,0.12);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 12px rgba(34,197,94,0.06);
}

.km-admin-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.km-admin-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 30px 24px;
    position: relative;
    z-index: 1;
}

.km-admin-title {
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.km-admin-title-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--gradient-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: #fff;
}

/* ── Admin Table ── */
.km-table-wrap {
    background: #fff;
    border: 1px solid rgba(34,197,94,0.1);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 4px 24px rgba(34,197,94,0.06);
    overflow-x: auto;
}

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

.km-table thead th {
    text-align: left;
    padding: 14px 16px;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(34,197,94,0.1);
    white-space: nowrap;
    background: #fafffe;
}

.km-table tbody td {
    padding: 14px 16px;
    font-size: 0.92em;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
    color: var(--text-primary);
}

.km-table tbody tr {
    transition: var(--transition);
}

.km-table tbody tr:hover {
    background: rgba(34,197,94,0.03);
}

.km-table-img {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(34,197,94,0.15);
}

.km-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.78em;
    font-weight: 500;
}

.km-badge-active {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.km-badge-inactive {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ── Admin Modal / Form ── */
.km-admin-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}

.km-admin-modal-overlay.active {
    display: flex;
}

.km-admin-modal {
    background: #fff;
    border: 1px solid rgba(34,197,94,0.12);
    border-radius: var(--radius-xl);
    padding: 0;
    max-width: 600px;
    width: 100%;
    margin: 40px auto;
    box-shadow: 0 25px 80px rgba(0,0,0,0.12);
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.km-admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(34,197,94,0.1);
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.km-admin-modal-header h3 {
    font-size: 1.2em;
    font-weight: 600;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.km-admin-modal-body {
    padding: 28px;
}

.km-admin-modal-footer {
    padding: 18px 28px;
    border-top: 1px solid rgba(34,197,94,0.1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #fafffe;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.km-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.km-toggle input { display: none; }

.km-toggle-slider {
    position: absolute;
    inset: 0;
    background: #e2e8f0;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

.km-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.km-toggle input:checked + .km-toggle-slider {
    background: linear-gradient(135deg, #22c55e, #14b8a6);
}

.km-toggle input:checked + .km-toggle-slider::before {
    transform: translateX(22px);
}

/* ── Image Upload ── */
.km-upload-zone {
    border: 2px dashed rgba(34,197,94,0.3);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    background: #fafffe;
}

.km-upload-zone:hover {
    border-color: var(--primary);
    background: rgba(34,197,94,0.03);
}

.km-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.km-upload-icon {
    font-size: 2.5em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.km-upload-text {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.km-upload-preview {
    max-width: 100%;
    max-height: 180px;
    border-radius: 12px;
    margin-top: 12px;
    display: none;
}

/* ── Utilities ── */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
