/* =====================================================================
   Dashboard quản trị sự kiện
   ===================================================================== */
:root {
    --line: #e5e7eb;
    --muted: #6b7280;
    --brand: #b3122a;
    --brand-2: #7f0d1e;
    --ok: #16a34a;
    --warn: #ca8a04;
    --bg: #f5f6f8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: #111827;
    font: 15px/1.55 'Be Vietnam Pro', 'Segoe UI', Roboto, system-ui, sans-serif;
}

a { color: var(--brand); }

/* ---------- Thanh trên ---------- */
.nav {
    background: linear-gradient(120deg, var(--brand-2), var(--brand));
    color: #fff;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}

.nav-in { display: flex; align-items: center; gap: 6px; max-width: 1280px; margin: 0 auto; flex-wrap: wrap; }
.nav .logo { font-weight: 900; letter-spacing: .06em; padding: 14px 14px 14px 0; font-size: 17px; }
.nav a { color: #ffe9c9; text-decoration: none; padding: 14px 13px; font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nav a.on { color: #fff; border-bottom-color: #ffd45e; }
.nav .right { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 13px; }

.page { max-width: 1280px; margin: 0 auto; padding: 22px 18px 60px; }

h1.title { font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* ---------- Thẻ ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); }
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat b { display: block; font-size: 28px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- Form ---------- */
label.f { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: #374151; }
label.f small { font-weight: 400; color: var(--muted); }

input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font: inherit;
    background: #fff;
    color: inherit;
}

input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(179, 18, 42, .12); }
textarea { min-height: 92px; resize: vertical; }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; }
.row.tight > * { flex: 0 0 auto; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.check input { width: 18px; height: 18px; }

/* ---------- Nút ---------- */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { filter: brightness(1.08); }
.btn.sm { padding: 6px 11px; font-size: 13px; font-weight: 600; }
.btn.gray { background: #4b5563; }
.btn.green { background: var(--ok); }
.btn.amber { background: var(--warn); }
.btn.light { background: #eef0f3; color: #374151; }
.btn.danger { background: #dc2626; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tb th, table.tb td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.tb th { background: #fafafa; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
table.tb tr:hover td { background: #fcfcfd; }
table.tb td.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.green { background: #dcfce7; color: #166534; }
.tag.gray { background: #f3f4f6; color: #4b5563; }
.tag.amber { background: #fef3c7; color: #92400e; }
.tag.red { background: #fee2e2; color: #991b1b; }
.tag.blue { background: #dbeafe; color: #1e40af; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.flash.err { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- Đăng nhập ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(150deg, #7f0d1e, #35060f 70%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-card h1 { margin: 0 0 4px; font-size: 21px; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login-card .btn { width: 100%; margin-top: 18px; padding: 12px; }

/* ---------- Bảng giải thưởng ---------- */
.prize-row { display: grid; grid-template-columns: 34px 1.6fr 1fr 96px 96px 96px 60px 108px 40px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.prize-row.head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.prize-row input[type=text], .prize-row input[type=number] { padding: 8px 10px; font-size: 14px; }
.prize-row .pct { font-weight: 800; color: var(--brand); text-align: center; font-variant-numeric: tabular-nums; }
.prize-row .thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: #f3f4f6; }

@media (max-width: 980px) {
    .prize-row { grid-template-columns: 1fr 1fr; }
    .prize-row.head { display: none; }
    .prize-row > * { min-width: 0; }
}

/* ---------- Popup thêm / sửa giải thưởng ---------- */
.modal-bg {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 16px;
    overflow: auto;
    background: rgba(17, 24, 39, .55);
}

.modal-bg.show { display: flex; }

.modal-box {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 16px;
    padding: 22px 24px 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    animation: modalpop .18s ease;
}

@keyframes modalpop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-box h3 {
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    font-size: 17px;
    letter-spacing: .02em;
}

.link-box { display: flex; gap: 8px; align-items: center; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 10px 12px; font-size: 13px; overflow: hidden; }
.link-box code { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
