:root {
    --brand-primary: #1e40af;
    --brand-primary-dark: #1e3a8a;
    --brand-primary-light: #3b82f6;
    --brand-accent: #2563eb;
    --brand-bg: #eff6ff;
    --brand-nav: rgba(30, 58, 138, 0.78);

    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(30, 58, 138, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    --glass-blur: saturate(180%) blur(18px);

    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: rgba(226, 232, 240, 0.7);
    --gray-300: rgba(203, 213, 224, 0.8);
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;

    --danger: #dc2626;
    --danger-bg: rgba(254, 226, 226, 0.85);
    --success: #16a34a;
    --success-bg: rgba(220, 252, 231, 0.85);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-feature-settings: 'ss01', 'ss02';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.35) 0%, transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(168, 85, 247, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 50% 85%, rgba(14, 165, 233, 0.3) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(99, 102, 241, 0.2) 0%, transparent 40%),
        linear-gradient(135deg, #e0f2fe 0%, #dbeafe 50%, #e0e7ff 100%);
    background-attachment: fixed;
    background-size: cover;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(45deg, transparent 0 80px, rgba(255,255,255,0.015) 80px 81px),
        repeating-linear-gradient(-45deg, transparent 0 120px, rgba(255,255,255,0.015) 120px 121px);
    z-index: 0;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; position: relative; z-index: 1; }

/* ---------- Navbar: frosted dark glass ---------- */
.navbar {
    background: var(--brand-nav);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: white;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar a { color: rgba(255,255,255,0.88); text-decoration: none; margin-right: 12px; padding: 4px 2px; transition: color 0.2s, text-shadow 0.2s; font-size: 12.5px; white-space: nowrap; }
.navbar a:hover { color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }
.navbar .nav-link { display: inline-flex; align-items: center; gap: 6px; }
.navbar .nav-link svg { opacity: 0.85; transition: opacity 0.2s, transform 0.2s; }
.navbar .nav-link:hover svg { opacity: 1; transform: scale(1.08); }

/* Navbar dropdown submenu */
.navbar .nav-group {
    position: relative;
    display: inline-block;
    margin-right: 12px;
    flex-shrink: 0;
}
.navbar .nav-group .nav-link { margin-right: 0; }
.navbar .nav-caret { font-size: 10px; margin-left: 2px; opacity: 0.7; transition: transform 0.2s; }
.navbar .nav-group:hover .nav-caret { transform: rotate(180deg); }
.navbar .nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255,255,255,0.8);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
    z-index: 101;
}
.navbar .nav-group:hover .nav-dropdown,
.navbar .nav-group:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.navbar .nav-dropdown a {
    display: block;
    padding: 8px 12px;
    margin: 0;
    color: var(--gray-900);
    font-size: 13.5px;
    border-radius: 6px;
    text-shadow: none;
}
.navbar .nav-dropdown a:hover {
    background: linear-gradient(180deg, rgba(59,130,246,0.15), rgba(59,130,246,0.08));
    color: var(--brand-primary-dark);
    text-shadow: none;
}
.navbar .brand { display: flex; align-items: center; gap: 10px; margin-right: 28px; }
.navbar .brand img { height: 28px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.navbar .brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.3px; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }

/* ---------- Cards: frosted white glass ---------- */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    transition: box-shadow 0.3s, transform 0.2s;
}
.card:hover { box-shadow: 0 12px 40px rgba(30, 58, 138, 0.16), 0 4px 12px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7); }

/* ---------- Buttons: Windows Vista Aero authentic glass ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 18px;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    transition: all 0.1s ease;

    /* Nền chính: gradient nhẹ chỉ phần dưới — phần trên để ::before vẽ glossy */
    background:
        linear-gradient(180deg,
            rgba(80,140,220,0.85) 0%,
            rgba(50,110,200,0.92) 48%,
            rgba(30,80,170,0.95) 52%,
            rgba(20,65,150,1) 100%);

    /* Border 3D: top sáng, sides trung, bottom tối */
    border: 1px solid rgba(10,50,120,0.7);
    border-top-color: rgba(120,170,240,0.8);

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -1px 0 rgba(0,0,0,0.1),
        0 1px 3px rgba(0,0,0,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Glossy reflection — nửa trên bóng sáng, cong nhẹ ở đáy (đặc trưng Vista) */
.btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background:
        linear-gradient(180deg,
            rgba(255,255,255,0.55) 0%,
            rgba(255,255,255,0.35) 40%,
            rgba(255,255,255,0.08) 100%);
    pointer-events: none;
}

/* Hover: sáng hơn + glow bên ngoài */
.btn:hover {
    background:
        linear-gradient(180deg,
            rgba(100,160,240,0.9) 0%,
            rgba(70,130,220,0.95) 48%,
            rgba(45,100,190,0.97) 52%,
            rgba(35,85,175,1) 100%);
    border-top-color: rgba(150,195,255,0.9);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.35),
        inset 0 -1px 0 rgba(0,0,0,0.08),
        0 0 6px rgba(80,150,255,0.5),
        0 1px 3px rgba(0,0,0,0.25);
}

/* Active: gradient đảo + lõm vào */
.btn:active {
    background:
        linear-gradient(180deg,
            rgba(20,60,130,1) 0%,
            rgba(30,75,155,0.97) 48%,
            rgba(45,95,180,0.95) 52%,
            rgba(65,120,200,0.92) 100%);
    border-top-color: rgba(10,50,120,0.8);
    border-bottom-color: rgba(100,155,230,0.6);
    box-shadow:
        inset 0 2px 6px rgba(0,0,0,0.35),
        inset 0 0 4px rgba(0,0,0,0.15);
}
.btn:active::before {
    opacity: 0.3;
}

/* ---- Outline / Frost variant ---- */
.btn-outline {
    background:
        linear-gradient(180deg,
            rgba(255,255,255,0.88) 0%,
            rgba(245,248,255,0.82) 48%,
            rgba(225,235,248,0.78) 52%,
            rgba(210,225,245,0.82) 100%);
    color: #1a3a6a;
    border: 1px solid rgba(160,180,210,0.7);
    border-top-color: rgba(220,230,245,0.9);
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.85),
        inset 0 -1px 0 rgba(0,0,0,0.04),
        0 1px 2px rgba(0,0,0,0.12);
}
.btn-outline::before {
    background:
        linear-gradient(180deg,
            rgba(255,255,255,0.7) 0%,
            rgba(255,255,255,0.35) 40%,
            rgba(255,255,255,0.05) 100%);
}
.btn-outline:hover {
    background:
        linear-gradient(180deg,
            rgba(230,240,255,0.95) 0%,
            rgba(215,230,252,0.9) 48%,
            rgba(195,218,248,0.88) 52%,
            rgba(180,208,245,0.9) 100%);
    border-color: rgba(100,150,220,0.6);
    border-top-color: rgba(200,220,250,0.9);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.9),
        0 0 5px rgba(80,140,230,0.25),
        0 1px 2px rgba(0,0,0,0.1);
}
.btn-outline:active {
    background:
        linear-gradient(180deg,
            rgba(195,210,235,0.9) 0%,
            rgba(210,225,245,0.88) 48%,
            rgba(225,235,250,0.85) 52%,
            rgba(240,245,255,0.88) 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
    border-top-color: rgba(160,180,210,0.7);
}

/* ---- Danger / Red variant ---- */
.btn-danger {
    background:
        linear-gradient(180deg,
            rgba(220,80,80,0.88) 0%,
            rgba(200,50,50,0.93) 48%,
            rgba(170,30,30,0.96) 52%,
            rgba(145,15,15,1) 100%);
    border: 1px solid rgba(100,10,10,0.7);
    border-top-color: rgba(240,120,120,0.8);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -1px 0 rgba(0,0,0,0.1),
        0 1px 3px rgba(0,0,0,0.3);
}
.btn-danger:hover {
    background:
        linear-gradient(180deg,
            rgba(240,100,100,0.9) 0%,
            rgba(220,70,70,0.95) 48%,
            rgba(190,45,45,0.97) 52%,
            rgba(165,25,25,1) 100%);
    border-top-color: rgba(255,150,150,0.9);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.35),
        0 0 6px rgba(220,60,60,0.5),
        0 1px 3px rgba(0,0,0,0.25);
}
.btn-danger:active {
    background:
        linear-gradient(180deg,
            rgba(120,10,10,1) 0%,
            rgba(150,25,25,0.97) 48%,
            rgba(180,40,40,0.95) 52%,
            rgba(210,65,65,0.92) 100%);
    border-top-color: rgba(100,10,10,0.8);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.35);
}

/* ---------- Form inputs: subtle glass ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea,
.card input[type="text"], .card input[type="email"], .card input[type="password"],
.card input[type="number"], .card input[type="date"], .card input[type="datetime-local"],
.card select, .card textarea {
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--gray-900);
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.card input:focus, .card select:focus, .card textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--brand-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
table th, table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
table th {
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.7) 0%, rgba(219, 234, 254, 0.4) 100%);
    font-weight: 600; color: var(--brand-primary-dark);
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
}
table th:first-child { border-top-left-radius: 8px; }
table th:last-child  { border-top-right-radius: 8px; }
table tr:hover td { background: rgba(239, 246, 255, 0.5); }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    border: 1px solid transparent;
}
.alert-error   { background: var(--danger-bg);  color: #991b1b; border-color: rgba(252, 165, 165, 0.6); }
.alert-success { background: var(--success-bg); color: #166534; border-color: rgba(187, 247, 208, 0.6); }

/* ---------- Headings / links ---------- */
h1 { font-size: 24px; color: var(--gray-900); text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
h3 { color: var(--brand-primary-dark); margin-bottom: 8px; font-size: 16px; letter-spacing: 0.2px; }
a { color: var(--brand-accent); transition: color 0.15s; }
a:hover { color: var(--brand-primary); }

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 40px;
    padding: 0;
    background: rgba(30, 58, 138, 0.6);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -2px 12px rgba(30, 58, 138, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}
.site-footer strong { color: #fff; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

body { display: flex; flex-direction: column; min-height: 100vh; }
body > .container { flex: 1; width: 100%; }
.site-footer { margin-top: auto; }

/* ---------- Kanban ---------- */
.kanban-wrap { margin: 0 -20px; padding: 0 20px 20px; overflow-x: auto; }
.kanban-board { display: inline-flex; gap: 14px; padding-bottom: 8px; min-width: 100%; }
.kb-col {
    flex: 0 0 290px;
    max-height: calc(100vh - 260px);
    display: flex; flex-direction: column;
    background: rgba(255,255,255,0.35);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(30,58,138,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.kb-col.drag-over { background: rgba(59,130,246,0.18); border-color: var(--brand-primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.kb-col-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px; font-weight: 600; font-size: 13.5px; color: var(--gray-900);
    border-bottom: 1px solid rgba(15,23,42,0.06);
    border-radius: 12px 12px 0 0;
}
.kb-col-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--kb-color); flex-shrink: 0; }
.kb-col-name { flex: 1; }
.kb-col-count {
    background: rgba(255,255,255,0.8); border: 1px solid rgba(15,23,42,0.1);
    padding: 1px 10px; border-radius: 10px; font-size: 12px; font-weight: 600;
    color: var(--gray-700); min-width: 26px; text-align: center;
}
.kb-col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.kb-card {
    background: rgba(255,255,255,0.9); border: 1px solid var(--gray-200); border-radius: 10px;
    padding: 10px 12px; cursor: grab;
    box-shadow: 0 1px 2px rgba(15,23,42,0.05), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: box-shadow 0.15s, transform 0.15s; font-size: 13px; user-select: none;
}
.kb-card:hover { box-shadow: 0 4px 12px rgba(30,58,138,0.15); transform: translateY(-1px); }
.kb-card.dragging { opacity: 0.35; cursor: grabbing; }
.kb-card a { color: var(--gray-900); text-decoration: none; font-weight: 600; }
.kb-card a:hover { color: var(--brand-primary); }
.kb-card-title { font-size: 14px; margin-bottom: 4px; line-height: 1.35; }
.kb-card-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--gray-500); }
.kb-code { background: var(--brand-bg); color: var(--brand-primary-dark); padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.kb-card-owner { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.kb-toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 10px 18px; background: rgba(15,23,42,0.9); backdrop-filter: blur(10px);
    color: white; border-radius: 8px; font-size: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 1000; pointer-events: none;
}
.kb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.kb-toast.error { background: rgba(220,38,38,0.92); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 8px; bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--gray-200), transparent);
}
.timeline-item { position: relative; padding: 0 0 16px 28px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: 0; top: 6px;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid white;
}
.timeline-content { background: rgba(255,255,255,0.5); border: 1px solid var(--glass-border); padding: 10px 12px; border-radius: 8px; }
.timeline-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.timeline-badge { color: white; padding: 1px 10px; border-radius: 10px; font-size: 11.5px; font-weight: 500; }
.timeline-user { font-weight: 600; color: var(--gray-900); }
.timeline-time { color: var(--gray-500); font-size: 12px; margin-left: auto; }
.timeline-desc { font-size: 13px; color: var(--gray-700); }
.timeline-more { font-size: 12px; display: inline-block; margin-top: 4px; }

/* ---------- Scrollbar (WebKit) ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(30, 58, 138, 0.3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(30, 58, 138, 0.5); background-clip: padding-box; border: 2px solid transparent; }

/* ---------- Selection ---------- */
::selection { background: rgba(59, 130, 246, 0.3); color: var(--gray-900); }

/* ---------- Fallback cho trình duyệt không hỗ trợ backdrop-filter ---------- */
@supports not (backdrop-filter: blur(1px)) {
    .card    { background: rgba(255, 255, 255, 0.92); }
    .navbar  { background: var(--brand-primary-dark); }
    table th { background: #dbeafe; }
}
