/* Yami UI — bộ thiết kế dùng chung cho web người dùng và trang admin.
   Biến màu ở :root (sáng) và @media dark (tối); mọi thành phần chỉ dùng biến. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-hover: #f5f6f8;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #8b93a1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef1f1;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fff8eb;
  --sidebar: #ffffff;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --shadow-sm: 0 1px 2px rgb(16 24 40 / .05);
  --shadow-md: 0 4px 12px -2px rgb(16 24 40 / .08), 0 2px 4px -2px rgb(16 24 40 / .05);
  --shadow-lg: 0 16px 32px -8px rgb(16 24 40 / .18);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --surface: #15181e;
    --surface-2: #1b1f27;
    --surface-hover: #1d222b;
    --border: #262b35;
    --border-strong: #343a46;
    --text: #eef0f4;
    --text-2: #a8afbc;
    --text-3: #727b8a;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #1e1f3d;
    --accent-ink: #0d0f13;
    --danger: #f87171;
    --danger-soft: #2a1617;
    --success: #4ade80;
    --success-soft: #11241a;
    --warning: #fbbf24;
    --warning-soft: #2a2110;
    --sidebar: #111419;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / .5);
    --shadow-lg: 0 16px 32px -8px rgb(0 0 0 / .6);
  }
}

/* MARK: Nền */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 40px; height: 40px; stroke-width: 1.4; }

/* MARK: Bố cục — thanh bên + nội dung */

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 15px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #ec4899)); color: #fff; }
.brand-mark .i { stroke: #fff; width: 18px; height: 18px; }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-3); margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; text-transform: uppercase; }
.who { min-width: 0; flex: 1; line-height: 1.3; }
.who b { display: block; font-weight: 600; font-size: 13px; }
.who span { font-size: 12px; color: var(--text-3); }
.content { min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 36px 64px; }
.page-narrow { max-width: 760px; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 5; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand { padding: 0 6px 0 0; }
  .brand small, .nav-label, .who { display: none; }
  .brand > span:not(.brand-mark) { display: none; } /* màn hẹp: chỉ giữ logo, nhường chỗ cho điều hướng */
  .nav { flex-direction: row; gap: 2px; }
  .nav a { white-space: nowrap; padding: 7px 9px; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .page { padding: 20px 16px 48px; }
}

/* MARK: Đầu trang */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.page-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title .tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--accent); }
.crumbs .i { width: 14px; height: 14px; }

/* MARK: Thẻ */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-body + .card-body { border-top: 1px solid var(--border); }
.card-flush { overflow: hidden; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; }
.section-title h3 { flex: 1; }
.section-title .inline-form { flex-wrap: nowrap; }
.section-title .inline-form .input { flex: 0 1 220px; height: 30px; font-size: 13px; }

/* MARK: Nút */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s; text-decoration: none; }
.btn:hover { background: var(--surface-hover); color: var(--text); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn .i { width: 16px; height: 16px; vertical-align: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { width: 32px; padding: 0; height: 32px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn.danger { color: var(--danger); }

/* MARK: Form */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span, .label { font-size: 13px; font-weight: 550; color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-3); }
.input, .select, .textarea,
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: 14px var(--font); transition: border-color .12s, box-shadow .12s;
}
.textarea, .field textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input::placeholder, .field input::placeholder, .textarea::placeholder { color: var(--text-3); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input, .inline-form .select { width: auto; flex: 1 1 200px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; margin: 4px 16px 4px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-size: 13px; background: var(--surface); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip input { accent-color: var(--accent); margin: 0; }
fieldset { border: none; padding: 0; margin: 0 0 16px; }
legend { font-size: 13px; font-weight: 550; margin-bottom: 8px; padding: 0; }

/* MARK: Bảng & danh sách */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-hover); }
.table .col-actions { text-align: right; white-space: nowrap; }
.file-name { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); font-weight: 500; }
.file-name:hover { color: var(--accent); }
.file-name .truncate { max-width: 420px; }
.ftype { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.ftype .i { width: 18px; height: 18px; vertical-align: 0; }
.ftype.video { background: #fde8ef; color: #be185d; }
.ftype.audio { background: #f3e8ff; color: #7e22ce; }
.ftype.image { background: #e0f2fe; color: #0369a1; }
.ftype.pdf { background: #fee2e2; color: #b91c1c; }
.ftype.text { background: #ecfdf3; color: #15803d; }
.ftype.folder { background: var(--accent-soft); color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .ftype.video { background: #3a1626; color: #f9a8d4; }
  .ftype.audio { background: #2b1840; color: #d8b4fe; }
  .ftype.image { background: #0f2a3a; color: #7dd3fc; }
  .ftype.pdf { background: #3a1616; color: #fca5a5; }
  .ftype.text { background: #11241a; color: #86efac; }
}
@media (max-width: 720px) {
  .table .hide-sm { display: none; }
  .file-name .truncate { max-width: 180px; }
}

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rows > li:last-child { border-bottom: none; }
.rows .meta { color: var(--text-3); font-size: 12.5px; }
.rows .grow { min-width: 0; }
.rows b.truncate { display: block; }

/* Lưới thư mục */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.folder-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; min-width: 0; }
.folder-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-md); color: var(--text); transform: translateY(-1px); }
.folder-card b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card small { color: var(--text-3); font-size: 12px; }

/* MARK: Nhãn */

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* MARK: Thông báo, trạng thái trống */

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid; font-size: 13.5px; margin-bottom: 16px; }
.alert .i { margin-top: 2px; }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty .i-xl { color: var(--border-strong); margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

.secret { border: 1px dashed color-mix(in srgb, var(--warning) 55%, var(--border)); background: var(--warning-soft); border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px; }
.secret p { color: var(--warning); font-weight: 550; font-size: 13px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.secret code, .secret .value { display: flex; align-items: center; justify-content: space-between; gap: 10px; word-break: break-all; background: var(--surface); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); font: 13px var(--mono); cursor: copy; color: var(--text); user-select: all; }

/* MARK: Upload */

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 32px 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { display: none; }
.dropzone .bubble { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); margin-bottom: 6px; }
.dropzone b { font-weight: 600; }
.dropzone b u { color: var(--accent); text-decoration: none; }
.dropzone small { color: var(--text-3); max-width: 560px; }
.upload-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.progress-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.progress-list:empty { display: none; }
.progress-list li { display: grid; grid-template-columns: 1fr 160px; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 13px; }
.progress-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-list li.done span { color: var(--success); }
.progress-list li.failed span { color: var(--danger); white-space: normal; }
progress { width: 100%; height: 6px; border: none; border-radius: 99px; background: var(--border); overflow: hidden; appearance: none; }
progress::-webkit-progress-bar { background: var(--border); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

/* Thanh dung lượng */
.meter { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.meter-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.meter-track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.meter-fill.warn { background: var(--warning); }
.meter-fill.danger { background: var(--danger); }

/* MARK: Xem trước */

.preview { display: grid; place-items: center; padding: 20px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); min-height: 200px; }
.preview img, .preview video { max-width: 100%; max-height: 72vh; border-radius: 10px; box-shadow: var(--shadow-md); background: #000; }
.preview audio { width: min(560px, 100%); }
.preview iframe { width: 100%; height: 78vh; border: none; border-radius: 10px; background: var(--surface); }
.preview pre { width: 100%; margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.6; max-height: 72vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Caption */
.editor { width: 100%; min-height: 460px; font: 13px/1.65 var(--mono); padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); resize: vertical; }
.editor:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.warnings { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warnings li { display: flex; gap: 8px; font-size: 13px; color: var(--warning); background: var(--warning-soft); padding: 7px 10px; border-radius: 7px; }
.warnings li::before { content: "!"; font-weight: 700; }

/* Webhook */
.deliveries { width: 100%; margin-top: 4px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.delivery { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.delivery:last-child { border-bottom: none; }

/* MARK: Thống kê (admin) */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-top .i { color: var(--text-3); }
.stat b { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* MARK: Đăng nhập */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #ec4899 10%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card .brand { padding: 0 0 22px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 22px; }

/* MARK: Toast */

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--shadow-lg); transition: transform .22s ease, opacity .22s; z-index: 20; opacity: 0; pointer-events: none; }
#toast:empty { display: none; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.error { background: var(--danger); color: #fff; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mt { margin-top: 16px; }
.ftype-lg { width: 44px; height: 44px; border-radius: 12px; }
.ftype-lg .i { width: 22px; height: 22px; }
.section-title.flush { margin-top: 0; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.mt0 { margin-top: 0; }
.secret + .btn, .secret-value + .btn { margin-top: 4px; }

/* Trang công khai (link chia sẻ) */
.pub-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pub-bar .brand { padding: 0; }
.auth-inline { display: grid; place-items: center; min-height: 60vh; }

/* Ảnh thu nhỏ trong danh sách */
img.ftype.thumb { object-fit: cover; background: var(--surface-2); padding: 0; }

/* Link công khai */
.rows li.dim { opacity: .6; }
.link-url { display: block; max-width: 520px; margin-bottom: 4px; }
.rows .meta .badge { vertical-align: 1px; }

/* Hộp thoại (di chuyển) */
.dialog { width: min(560px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px)); padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgb(15 18 25 / .45); }
.dialog-crumbs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 20px 0; font-size: 13px; color: var(--text-3); }
.dialog-crumbs a { color: var(--text-2); }
.dialog-list { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; min-height: 160px; flex: 1; }
.dialog-list li { border-bottom: 1px solid var(--border); }
.dialog-list li.muted { padding: 12px 20px; border: none; }
.dialog-list button.row-btn { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 20px; cursor: pointer; }
.dialog-list button.row-btn:hover { background: var(--surface-hover); }
.dialog-list button.row-btn:disabled { opacity: .45; cursor: not-allowed; }
.dialog-foot { border-top: 1px solid var(--border); border-bottom: none; }

/* Ô chọn co theo nội dung trong form ngang */
.inline-form .select-auto { flex: 0 0 auto; width: auto; }
