/* ==========================================================================
   VINASA Data Hub — Giao diện SaaS
   Nguyên tắc: nền phẳng + đổ bóng rất nhẹ + khoảng thở rộng.
   Không dùng viền màu ở cạnh để nhấn mạnh (không border-left/top màu).
   ========================================================================== */

:root {
    --brand:        #2563eb;
    --brand-dark:   #1d4ed8;
    --brand-soft:   #eff6ff;

    --ink:          #0f172a;
    --ink-2:        #334155;
    --muted:        #64748b;
    --muted-2:      #94a3b8;

    --bg:           #f6f8fb;
    --surface:      #ffffff;
    --line:         #eef2f7;

    --ok:           #059669;
    --ok-soft:      #ecfdf5;
    --warn:         #d97706;
    --warn-soft:    #fffbeb;
    --danger:       #dc2626;
    --danger-soft:  #fef2f2;
    --info-soft:    #f1f5f9;

    --sidebar:      #0f172a;
    --sidebar-ink:  #94a3b8;
    --sidebar-active:#1e293b;

    --r-sm: 8px;
    --r:    12px;
    --r-lg: 16px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow:    0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .07);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ============================== BỐ CỤC ============================== */
.hub-shell { display: flex; min-height: 100vh; }

.hub-sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.hub-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 20px 18px;
}
.hub-brand-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--brand);
    display: grid; place-items: center;
    font-size: 16px; color: #fff;
    flex-shrink: 0;
}
.hub-brand-text { min-width: 0; }
.hub-brand-text strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.hub-brand-text span { display: block; font-size: 11px; color: var(--sidebar-ink); }

.hub-nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
.hub-nav-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
    color: #64748b; font-weight: 700; padding: 16px 10px 7px;
}
.hub-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: #cbd5e1; font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s;
}
.hub-nav a i { width: 17px; text-align: center; font-size: 14px; color: #64748b; transition: color .15s; }
.hub-nav a:hover { background: var(--sidebar-active); color: #fff; }
.hub-nav a:hover i { color: #cbd5e1; }
.hub-nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.hub-nav a.active i { color: #60a5fa; }
.hub-nav a .count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: #1e293b; color: #94a3b8; padding: 1px 7px; border-radius: 20px;
}
.hub-nav a.active .count { background: #334155; color: #e2e8f0; }

.hub-sidebar-foot { padding: 14px 16px; color: #475569; font-size: 11px; }

.hub-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.hub-topbar {
    background: var(--surface);
    padding: 0 28px;
    height: 62px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 20;
    box-shadow: var(--shadow-xs);
}
.hub-topbar h1 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.hub-topbar .sub { color: var(--muted); font-size: 12.5px; }
.hub-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.hub-user { display: flex; align-items: center; gap: 9px; }
.hub-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.hub-user-name { font-size: 13px; font-weight: 600; }
.hub-user-role { font-size: 11px; color: var(--muted); }

.hub-content { padding: 26px 28px 60px; flex: 1; }
.hub-content > .page-head { margin-bottom: 20px; }
.page-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ============================== THẺ / CARD ============================== */
.card {
    background: var(--surface);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 18px; }
.card-head {
    padding: 16px 20px;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card-head .desc { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-sep { height: 1px; background: var(--line); }

/* ============================== SỐ LIỆU ============================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat {
    background: var(--surface);
    border-radius: var(--r);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center; font-size: 16px; flex-shrink: 0;
    background: var(--brand-soft); color: var(--brand);
}
.stat-icon.green  { background: var(--ok-soft);     color: var(--ok); }
.stat-icon.amber  { background: var(--warn-soft);   color: var(--warn); }
.stat-icon.red    { background: var(--danger-soft); color: var(--danger); }
.stat-icon.slate  { background: var(--info-soft);   color: var(--ink-2); }
.stat-val { font-size: 23px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-foot { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }

/* ============================== BẢNG ============================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
    text-align: left; padding: 11px 20px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 700;
    background: #fbfcfe;
    white-space: nowrap;
}
table.tbl td { padding: 13px 20px; vertical-align: middle; }
table.tbl tbody tr { box-shadow: inset 0 -1px 0 var(--line); }
table.tbl tbody tr:last-child { box-shadow: none; }
table.tbl tbody tr:hover { background: #fbfcfe; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .nowrap { white-space: nowrap; }

.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-2); }

.empty {
    padding: 54px 20px; text-align: center; color: var(--muted);
}
.empty i { font-size: 30px; color: #cbd5e1; display: block; margin-bottom: 12px; }
.empty strong { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }

/* ============================== NHÃN TRẠNG THÁI ============================== */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--info-soft); color: var(--ink-2);
}
.badge i { font-size: 9px; }
.badge.green  { background: var(--ok-soft);     color: var(--ok); }
.badge.amber  { background: var(--warn-soft);   color: var(--warn); }
.badge.red    { background: var(--danger-soft); color: var(--danger); }
.badge.blue   { background: var(--brand-soft);  color: var(--brand); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--muted-2); }
.dot.green { background: var(--ok); }
.dot.red { background: var(--danger); }

/* ============================== NÚT ============================== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 15px; border-radius: var(--r-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: 0; background: var(--info-soft); color: var(--ink-2);
    transition: background .15s, color .15s, box-shadow .15s;
    text-decoration: none; line-height: 1.4;
}
.btn:hover { background: #e2e8f0; color: var(--ink); }
.btn i { font-size: 12px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; color: #b91c1c; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--info-soft); color: var(--ink-2); }

/* ============================== FORM ============================== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, textarea.input {
    width: 100%; padding: 9px 12px;
    border-radius: var(--r-sm);
    border: 1px solid #e2e8f0;
    background: #fff; font-size: 13.5px; font-family: inherit; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* ============================== THÔNG BÁO ============================== */
.alert {
    padding: 13px 16px; border-radius: var(--r-sm);
    font-size: 13.5px; margin-bottom: 18px;
    display: flex; gap: 11px; align-items: flex-start;
}
.alert i { margin-top: 2px; }
.alert.ok    { background: var(--ok-soft);     color: #065f46; }
.alert.warn  { background: var(--warn-soft);   color: #92400e; }
.alert.err   { background: var(--danger-soft); color: #991b1b; }
.alert.info  { background: var(--brand-soft);  color: #1e40af; }
.alert strong { display: block; margin-bottom: 2px; }

/* ============================== CHI TIẾT ============================== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2px 24px; }
.detail-item { padding: 9px 0; }
.detail-item dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.detail-item dd { margin: 0; font-size: 13.5px; color: var(--ink); word-break: break-word; }

.split { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.qa-item { padding: 16px 20px; box-shadow: inset 0 -1px 0 var(--line); }
.qa-item:last-child { box-shadow: none; }
.qa-q { font-weight: 600; color: var(--ink); margin-bottom: 7px; font-size: 13.5px; }
.qa-a { color: var(--ink-2); font-size: 13.5px; white-space: pre-line; }
.qa-a.empty-answer { color: var(--muted-2); font-style: italic; }
.qa-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 9px; font-size: 11.5px; color: var(--muted); }
.qa-files { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.file-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--info-soft); color: var(--ink-2);
    padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
}
.file-chip:hover { background: #e2e8f0; }

/* ============================== ĐĂNG NHẬP / CÀI ĐẶT ============================== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 420px; }
.auth-card { background: var(--surface); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow-lg); }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-logo .hub-brand-icon { width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }
.auth-logo strong { font-size: 16px; display: block; }
.auth-logo span { font-size: 12px; color: var(--muted); }
.auth-foot { text-align: center; color: var(--muted-2); font-size: 12px; margin-top: 18px; }

/* ============================== PHÂN TRANG & TIỆN ÍCH ============================== */
.pager { display: flex; gap: 6px; align-items: center; padding: 14px 20px; }
.pager a, .pager span {
    min-width: 32px; height: 32px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
    background: var(--surface); color: var(--ink-2);
}
.pager a:hover { background: var(--info-soft); }
.pager .current { background: var(--brand); color: #fff; }
.pager .info { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 12.5px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 13px; }
.toolbar .search .input { padding-left: 34px; }

.copy-box {
    display: flex; align-items: center; gap: 10px;
    background: #f8fafc; border-radius: var(--r-sm); padding: 11px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
    word-break: break-all;
}
.copy-box code { flex: 1; color: var(--ink-2); }

.mini-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

.tag-src { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.tag-src i { font-size: 10px; }

@media (max-width: 860px) {
    .hub-sidebar { width: 66px; }
    .hub-brand-text, .hub-nav a span:not(.count), .hub-nav-label, .hub-sidebar-foot { display: none; }
    .hub-nav a { justify-content: center; }
    .hub-content, .hub-topbar { padding-left: 16px; padding-right: 16px; }
}
