/* ============================================================
   TVMC ADMIN — Premium Design System v3.0
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---- Design Tokens ---- */
:root {
    --primary:        #0891b2;   /* cyan-600  */
    --primary-dark:   #0e7490;   /* cyan-700  */
    --primary-light:  #06b6d4;   /* cyan-500  */
    --primary-soft:   #ecfeff;   /* cyan-50   */
    --primary-mid:    #cffafe;   /* cyan-100  */

    --accent:         #f59e0b;   /* amber     */
    --success:        #16a34a;   /* green-600 */
    --success-soft:   #f0fdf4;
    --danger:         #dc2626;   /* red-600   */
    --danger-soft:    #fef2f2;
    --info:           #2563eb;   /* blue-600  */
    --warning:        #d97706;

    --bg:             #f1f5f9;   /* slate-100 */
    --surface:        #ffffff;
    --surface-muted:  #f8fafc;   /* slate-50  */
    --surface-2:      #f1f5f9;

    --sidebar-bg:     #0f172a;   /* slate-900 */
    --sidebar-mid:    #1e293b;   /* slate-800 */
    --sidebar-border: rgba(255,255,255,0.07);
    --sidebar-text:   #94a3b8;   /* slate-400 */
    --sidebar-active: #0891b2;

    --text:           #0f172a;   /* slate-900 */
    --text-2:         #334155;   /* slate-700 */
    --text-3:         #64748b;   /* slate-500 */
    --muted:          #94a3b8;   /* slate-400 */
    --border:         #e2e8f0;   /* slate-200 */
    --border-2:       #cbd5e1;   /* slate-300 */

    --radius-sm:  6px;
    --radius:     10px;
    --radius-md:  14px;
    --radius-lg:  18px;
    --radius-xl:  24px;

    --shadow-xs:  0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
    --shadow-sm:  0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
    --shadow-md:  0 10px 28px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);
    --shadow-lg:  0 24px 48px rgba(15,23,42,0.16), 0 8px 16px rgba(15,23,42,0.08);
    --shadow-primary: 0 8px 24px rgba(8,145,178,0.25);

    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
    --sidebar-w: 260px;
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
a { text-decoration: none; }

/* ============================================================
   LOGIN SCREEN — Split Layout Premium
   ============================================================ */
@keyframes loginBgFloat {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes floatOrb {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-28px) scale(1.05); }
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}
@keyframes pulse-ring {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(8,145,178,0.4); }
    70%  { transform: scale(1);    box-shadow: 0 0 0 10px rgba(8,145,178,0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(8,145,178,0); }
}

#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

/* ---- Hero / Left ---- */
.login-hero {
    flex: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 60px 48px;
    background: linear-gradient(135deg, #0c4a6e 0%, #0891b2 45%, #059669 80%, #16a34a 100%);
    background-size: 300% 300%;
    animation: loginBgFloat 14s ease infinite;
}
.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 56px),
        repeating-linear-gradient(0deg,  rgba(255,255,255,0.05) 0 1px, transparent 1px 56px);
    pointer-events: none;
}
.login-hero::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    bottom: -100px; right: -80px;
    animation: floatOrb 7s ease-in-out infinite;
    pointer-events: none;
}
.login-hero-orb2 {
    position: absolute;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.09) 0%, transparent 70%);
    top: -60px; left: -60px;
    animation: floatOrb 9s ease-in-out infinite reverse;
    pointer-events: none;
}
.login-hero-orb3 {
    position: absolute;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
    top: 40%; right: 8%;
    animation: floatOrb 5s ease-in-out infinite;
    pointer-events: none;
}
.login-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: fadeSlideUp 0.8s ease both;
}
.login-logo-ring {
    width: 96px; height: 96px;
    border-radius: 24px;
    background: rgba(255,255,255,0.16);
    border: 2px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    color: #fff;
    margin: 0 auto 28px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 999px;
    padding: 5px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.9);
    margin-bottom: 18px;
}
.login-hero-title {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin: 0 0 12px;
    text-shadow: 0 2px 16px rgba(0,0,0,0.18);
}
.login-hero-sub {
    color: rgba(255,255,255,0.75);
    font-size: 0.97rem;
    line-height: 1.65;
    max-width: 320px;
    margin: 0 auto 44px;
}
.login-hero-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.login-stat {
    text-align: center;
    background: rgba(255,255,255,0.13);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 16px;
    padding: 14px 22px;
    backdrop-filter: blur(6px);
    min-width: 88px;
    transition: background var(--transition);
}
.login-stat:hover { background: rgba(255,255,255,0.2); }
.login-stat-num {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    display: block;
    line-height: 1;
    margin-bottom: 4px;
}
.login-stat-lbl {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---- Form / Right ---- */
.login-form-panel {
    width: 460px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    padding: 56px 48px;
    position: relative;
    overflow-y: auto;
}
.login-form-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #059669, var(--primary));
    background-size: 200% auto;
    animation: shimmer 3s linear infinite;
}
.login-box {
    width: 100%;
    max-width: 360px;
    animation: fadeSlideUp 0.6s ease 0.1s both;
}
.login-form-header { margin-bottom: 32px; }
.login-mark {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--success));
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 16px;
    box-shadow: var(--shadow-primary);
    animation: pulse-ring 2.5s cubic-bezier(0.455,0.03,0.515,0.955) infinite;
}
.login-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
    display: block;
}
.login-box h2 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.2;
}
.login-box > p,
.login-form-header > p {
    color: var(--text-3);
    font-size: 0.92rem;
}
.login-field-group {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition);
}
.login-field-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}
.login-field-group-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.login-field-group-title i { color: var(--primary); font-size: 0.65rem; }
.login-field-group > * + * { margin-top: 14px; }
.login-label {
    display: block;
    color: var(--text-2);
    font-weight: 600;
    margin: 0 0 6px;
    font-size: 0.86rem;
}
.login-primary {
    width: 100%;
    padding: 13px 18px;
    font-size: 0.97rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-primary);
    transition: all var(--transition);
    margin-top: 4px;
}
.login-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #0369a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(8,145,178,0.35);
}
.login-primary:active { transform: translateY(0); }
.login-update-btn {
    width: 100%;
    margin-top: 10px;
    padding: 11px 18px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-2);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
}
.login-update-btn:hover {
    border-color: var(--primary-mid);
    color: var(--primary-dark);
    background: var(--primary-soft);
}
.login-update-btn:disabled {
    cursor: wait;
    opacity: 0.75;
}
.login-form-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.6;
}
.login-form-footer strong { color: var(--primary); }

/* ============================================================
   SHARED INPUTS (login + forms)
   ============================================================ */
.login-box input,
.form-control,
.edit-input,
.score-input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.login-box input {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.password-field { position: relative; width: 100%; }
.login-box input:focus,
.form-control:focus,
.edit-input:focus,
.score-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.13);
    outline: none;
}

select.form-control,
select.edit-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
    box-shadow: none;
    cursor: pointer;
}

select.form-control {
    padding-right: 36px !important;
}

select.edit-input {
    height: 43px;
    min-height: 43px;
    padding: 9px 42px 9px 11px;
    line-height: 1.45;
}

select.form-control::-ms-expand,
select.edit-input::-ms-expand {
    display: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.14); }
.btn:active:not(:disabled) { transform: translateY(0); filter: brightness(0.97); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; box-shadow: none; transform: none; }

/* ============================================================
   ADMIN WRAPPER LAYOUT
   ============================================================ */
#admin-wrapper {
    display: none;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 200;
    border-right: 1px solid rgba(255,255,255,0.04);
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    overflow: hidden;
    transition: width var(--transition);
}

.sidebar-header {
    padding: 20px 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(8,145,178,0.35);
}
.sidebar-header-text { min-width: 0; }
.sidebar-header-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.sidebar-header-sub {
    font-size: 0.7rem;
    color: var(--sidebar-text);
    font-weight: 500;
    display: block;
    margin-top: 1px;
}

.sidebar-section-label {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #475569;
    padding: 16px 18px 6px;
}

.sidebar-menu {
    list-style: none;
    padding: 8px 10px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-menu li { margin-bottom: 2px; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}
.sidebar-menu a:hover {
    background: rgba(255,255,255,0.07);
    color: #e2e8f0;
}
.sidebar-menu li.active a {
    background: rgba(8,145,178,0.2);
    color: #67e8f9;
    font-weight: 700;
    border: 1px solid rgba(8,145,178,0.25);
}
.sidebar-menu li.active a::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    border-radius: 0 4px 4px 0;
    background: var(--primary-light);
}
.sidebar-menu i {
    width: 18px;
    text-align: center;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.72rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-version-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(34,197,94,0.6);
}

@media (min-width: 721px) {
    body.sidebar-collapsed { --sidebar-w: 76px; }
    body.sidebar-collapsed .sidebar-header {
        justify-content: center;
        padding-left: 10px;
        padding-right: 10px;
    }
    body.sidebar-collapsed .sidebar-header-text,
    body.sidebar-collapsed .sidebar-section-label,
    body.sidebar-collapsed .sidebar-menu-text,
    body.sidebar-collapsed .sidebar-footer span {
        display: none;
    }
    body.sidebar-collapsed .sidebar-menu {
        padding-left: 8px;
        padding-right: 8px;
    }
    body.sidebar-collapsed .sidebar-menu a {
        justify-content: center;
        padding-left: 10px;
        padding-right: 10px;
    }
    body.sidebar-collapsed .sidebar-menu i {
        width: 20px;
    }
    body.sidebar-collapsed .sidebar-footer {
        justify-content: center;
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ============================================================
   MAIN PANEL
   ============================================================ */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: var(--primary-mid);
}
.topbar-breadcrumb {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}
.topbar-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-sep {
    color: var(--border-2);
    font-size: 1.1rem;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface-muted);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 13px;
    font-size: 0.875rem;
    transition: border-color var(--transition);
}
.user-info:hover { border-color: var(--border-2); }
.user-avatar {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--success));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.topbar-icon-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.88rem;
}
.topbar-icon-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: #fca5a5; }

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area {
    padding: 22px 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ============================================================
   FILTER / WORKFLOW PANELS
   ============================================================ */
.filter-panel,
.workflow-panel {
    background: var(--surface) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-xs) !important;
    padding: 16px 20px !important;
}
.filter-panel {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 12px !important;
}
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px !important;
}
.filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.form-control {
    min-height: 38px;
    padding: 8px 11px !important;
    font-size: 0.875rem !important;
    border-radius: var(--radius) !important;
    border: 1.5px solid var(--border) !important;
}
#total-count {
    background: #fff7ed;
    color: #c2410c !important;
    border: 1.5px solid #fed7aa;
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-container {
    background: var(--surface) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-xs) !important;
    padding: 0 !important;
    overflow: hidden;
    overflow-x: auto;
}
.table-container::-webkit-scrollbar { height: 6px; }
.table-container::-webkit-scrollbar-track { background: var(--surface-muted); }
.table-container::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    min-width: 820px;
}
thead tr {
    background: var(--surface-muted);
    border-bottom: 2px solid var(--border);
}
th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
th:first-child { padding-left: 20px; }
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
    color: var(--text-2);
}
td:first-child { padding-left: 20px; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Row number ---- */
.row-num {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 6px;
    padding: 3px 8px;
    display: inline-block;
}

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    display: inline-block;
    letter-spacing: 0.02em;
}
.bg-warning  { background: #64748b; }
.bg-success  { background: #16a34a; }
.bg-danger   { background: #dc2626; }
.bg-info     { background: #2563eb; }
.bg-pending  { background: #64748b; }
.bg-supplement { background: #fff; color: #d97706; border: 1px solid #f59e0b; }
.bg-xettuyen { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.bg-gray     { background: var(--text-3); }

.status-badge {
    white-space: normal;
    line-height: 1.3;
    max-width: 200px;
    display: inline-flex;
    justify-content: center;
    text-align: center;
    border-radius: 8px;
    padding: 5px 10px;
}

.source-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.source-online { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.source-school { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Action button */
.action-cell {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.action-btn {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: 1.5px solid var(--primary-mid);
    padding: 6px 13px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.action-btn.print-btn {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}
.action-btn.print-btn:hover {
    background: #ea580c;
    color: white;
    border-color: #ea580c;
}

/* ============================================================
   WORKFLOW PANEL (Xét tuyển)
   ============================================================ */
.workflow-panel {
    border-top: 3px solid var(--accent) !important;
}
.workflow-panel h3 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
.workflow-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-3);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.workflow-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px dashed var(--border);
    padding-top: 14px;
    flex-wrap: wrap;
}
.workflow-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 4px;
}
.workflow-result-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.workflow-result-count {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 10px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 16px;
    animation: fadeSlideUp 0.2s ease both;
}
.modal-content {
    background: var(--surface);
    width: 95%;
    max-width: 1400px;
    border-radius: var(--radius-lg);
    height: 95vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}
.modal-fullscreen {
    width: 98% !important;
    max-width: 100% !important;
    height: 98% !important;
    max-height: 100vh !important;
    border-radius: var(--radius-md) !important;
}
.modal-controls {
    position: absolute;
    top: 16px;
    right: 18px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 10;
}
.control-btn {
    background: var(--surface-muted);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-3);
    transition: all var(--transition);
    font-size: 0.8rem;
}
.control-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.control-btn.close:hover { color: var(--danger); border-color: #fca5a5; background: var(--danger-soft); }

.modal-header-bar {
    padding: 18px 24px 16px;
    border-bottom: 2px solid var(--primary);
    background: linear-gradient(135deg, var(--primary-soft), #fff);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-header-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.modal-header-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
}

/* Detail groups inside modal */
.detail-group {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}
.detail-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.detail-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.detail-label {
    font-weight: 700;
    color: var(--text-3);
    font-size: 0.8rem;
    display: inline-block;
    min-width: 120px;
}
.detail-value {
    font-weight: 600;
    color: var(--text);
    font-size: 0.88rem;
}
.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 7px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.82rem;
    margin: 4px 4px 0 0;
    font-weight: 700;
    border: 1px solid var(--primary-mid);
    transition: all var(--transition);
}
.link-btn:hover { background: var(--primary); color: white; }

.detail-action-bar {
    margin-top: auto;
    padding: 16px 16px 2px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.detail-action-bar .btn {
    flex: 0 0 auto;
    min-width: 112px;
}

/* ============================================================
   NHAP HO SO MODAL
   ============================================================ */
.nhap-modal-header {
    padding: 16px 22px 14px;
    border-bottom: 2px solid #10b981;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f0fdf4, #fff);
}
.nhap-modal-title {
    color: #10b981;
    margin: 0;
    font-size: 0.97rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nhap-modal-actions { display: flex; gap: 6px; align-items: center; }
.nhap-icon-btn {
    background: transparent;
    width: 32px; height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.nhap-icon-btn.expand { border: 1px solid #10b981; color: #10b981; }
.nhap-icon-btn.expand:hover { background: #10b981; color: #fff; }
.nhap-icon-btn.close-x { border: 1px solid var(--danger); color: var(--danger); }
.nhap-icon-btn.close-x:hover { background: var(--danger); color: #fff; }

/* Form sections inside modal */
.form-section {
    background: var(--surface-muted);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    margin-bottom: 14px;
}
.form-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.form-section-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: #fff;
    flex-shrink: 0;
}
.form-section-icon.blue   { background: #2563eb; }
.form-section-icon.slate  { background: #475569; }
.form-section-icon.amber  { background: #d97706; }
.form-section-icon.green  { background: #16a34a; }
.form-section-icon.teal   { background: var(--primary); }
.form-section-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Score box */
.score-box {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1.5px solid #bbf7d0;
    padding: 16px;
    border-radius: var(--radius-md);
}
.score-input {
    width: 80px;
    padding: 9px 8px;
    text-align: center;
    font-weight: 800;
    color: var(--text);
    font-size: 1rem;
}
.score-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-3);
    margin-bottom: 6px;
    font-weight: 700;
}

/* Edit inputs */
.edit-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-3);
    font-weight: 700;
    margin-bottom: 5px;
}
.edit-input {
    width: 100%;
    min-height: 43px;
    padding: 9px 11px;
    font-size: 0.9rem;
    background: #fff;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.edit-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
    outline: none;
}
textarea.edit-input { resize: vertical; min-height: 68px; }

/* Supplement box */
.supplement-request-box {
    grid-column: span 2;
    margin-top: 10px;
    padding: 12px;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--radius-md);
}
.supplement-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.supplement-chip {
    border: 1.5px solid #fbbf24;
    background: #fff;
    color: #92400e;
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}
.supplement-chip:hover { background: #fef3c7; border-color: #f59e0b; }

/* Checkbox */
input[type="checkbox"] { accent-color: var(--primary); }
.hs-disabled { opacity: 0.5; pointer-events: none; }
.hs-rule-note {
    min-height: 16px;
    margin: 0 0 8px;
    color: #0369a1;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================================
   DROPDOWN
   ============================================================ */
.nhap-dropdown-wrapper { position: relative; }
.nhap-dropdown-list {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 9999;
    background: #fff;
    max-height: 200px;
    overflow-y: auto;
    border: 1.5px solid var(--primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    list-style: none;
    padding: 4px;
    margin: 4px 0 0;
    overscroll-behavior: contain;
}
.nhap-dropdown-list.show { display: block; }
.nhap-dropdown-list li {
    padding: 8px 11px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
}
.nhap-dropdown-list li:hover { background: var(--primary-soft) !important; color: var(--primary); }
.nhap-dropdown-list li span.kv-badge {
    font-size: 0.68rem;
    background: var(--primary-mid);
    color: var(--primary-dark);
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
}
.nhap-dropdown-list .no-result {
    color: var(--danger);
    text-align: center;
    padding: 10px;
    font-style: italic;
    font-size: 0.82rem;
}
.nhap-copy-btn {
    margin-top: 8px;
    width: 100%;
    padding: 7px;
    font-size: 0.8rem;
    font-weight: 700;
    background: transparent;
    border: 1.5px dashed var(--primary);
    color: var(--primary);
    border-radius: var(--radius) !important;
    cursor: pointer;
    transition: all var(--transition);
}
.nhap-copy-btn:hover { background: var(--primary); color: white; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    :root { --sidebar-w: 220px; }
}

@media (max-width: 860px) {
    .login-hero { display: none; }
    .login-form-panel { width: 100%; min-width: unset; padding: 40px 28px; }
}

@media (max-width: 980px) {
    .topbar { padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
    .topbar-right { flex-wrap: wrap; }
    .content-area { padding: 14px 16px; }
    .workflow-grid { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 720px) {
    #admin-wrapper { flex-direction: column; }
    .sidebar { width: 100%; height: auto; max-height: 58px; overflow: hidden; }
    .sidebar.open { max-height: 400px; }
    .sidebar-menu { display: flex; overflow-x: auto; padding: 8px; }
    .sidebar-menu li { margin: 0; white-space: nowrap; }
    .login-form-panel { padding: 32px 20px; }
    .workflow-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .login-box h2 { font-size: 1.4rem; }
    .workflow-grid { grid-template-columns: 1fr; }
}
