/* ============================================================
 * Viết đoạn văn — /viet-doan-van/
 * ============================================================ */
.vdv, .vdv-write { max-width: 1240px; margin: 0 auto; padding: 16px 22px 48px; color: #0f172a; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }

/* ---------- Header ---------- */
.vdv-top { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 16px; }
.vdv-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; font-weight: 600; margin-bottom: 4px; }
.vdv-crumb a { color: #94a3b8; text-decoration: none; }
.vdv-crumb a:hover { color: #2563eb; }
.vdv-h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.025em; margin: 0; }
.vdv-sub { color: #64748b; font-size: 13px; margin: 3px 0 0; max-width: 560px; }
.vdv-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 11px; padding: 9px 14px; color: #94a3b8; max-width: 420px; width: 100%; justify-self: center; transition: border-color 120ms, box-shadow 120ms; }
.vdv-search:focus-within { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.vdv-search input { border: none; outline: none; background: transparent; font: inherit; font-size: 13.5px; color: #0f172a; width: 100%; }
.vdv-btn { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1px solid #e2e8f0; padding: 9px 14px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 700; color: #0f172a; cursor: pointer; transition: all 120ms; }
.vdv-btn:hover { background: #f8fafc; }
.vdv-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; }

.vdv-guide { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 13px 16px; font-size: 12.5px; color: #1e40af; line-height: 1.6; margin-bottom: 16px; }
.vdv-guide[hidden] { display: none; }

/* ---------- Stat cards ---------- */
.vdv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.vdv-stat { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px 16px; }
.vdv-stat-ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0; }
.vdv-stat-l { font-size: 12px; color: #64748b; font-weight: 600; }
.vdv-stat-n { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }

/* ---------- Filter bar ---------- */
.vdv-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.vdv-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 11px; }
.vdv-tab { display: inline-flex; align-items: center; gap: 5px; padding: 8px 13px; border: none; background: transparent; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 700; color: #64748b; cursor: pointer; transition: all 120ms; }
.vdv-tab:hover { color: #0f172a; }
.vdv-tab-on { background: #fff; color: #2563eb; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.vdv-tab-n { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; opacity: 0.7; }
.vdv-bar-r { display: flex; gap: 8px; }
.vdv-sel { background: #fff; border: 1px solid #e2e8f0; padding: 8px 12px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600; color: #0f172a; cursor: pointer; }

/* ---------- Table ---------- */
.vdv-table { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 6px 18px 10px; }
.vdv-thead, .vdv-row { display: grid; grid-template-columns: 1.6fr 2.4fr 0.7fr 0.7fr 1fr 0.9fr; gap: 12px; align-items: center; }
.vdv-thead { padding: 12px 6px; border-bottom: 1px solid #f1f5f9; font-size: 10.5px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.vdv-rows { display: flex; flex-direction: column; }
.vdv-row { padding: 12px 6px; border-bottom: 1px solid #f1f5f9; transition: background 100ms; }
.vdv-row:last-child { border-bottom: none; }
.vdv-row:hover { background: #fafbfc; }
.vdv-row[hidden] { display: none !important; }

.vdv-c-topic { display: flex; align-items: center; gap: 11px; min-width: 0; }
.vdv-row-ic { width: 38px; height: 38px; border-radius: 11px; background: #f8fafc; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.vdv-topic-text { min-width: 0; }
.vdv-topic-name { display: block; font-size: 13.5px; font-weight: 800; color: #0f172a; }
.vdv-topic-fi { display: block; font-size: 11.5px; color: #94a3b8; font-style: italic; margin-top: 1px; }
.vdv-c-desc { font-size: 12.5px; color: #64748b; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vdv-lv { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; font-weight: 800; padding: 2px 9px; border-radius: 6px; }
.vdv-lv-a1 { background: #dbeafe; color: #1e40af; }
.vdv-lv-a2 { background: #d1fae5; color: #065f46; }
.vdv-lv-b1 { background: #ede9fe; color: #6d28d9; }
.vdv-lv-b2 { background: #fee2e2; color: #991b1b; }
.vdv-c-words { font-size: 12.5px; color: #64748b; font-weight: 700; }

.vdv-c-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: #94a3b8; }
.vdv-st-dot { width: 9px; height: 9px; border-radius: 999px; border: 2px solid #cbd5e1; flex-shrink: 0; }
.vdv-c-status.is-done { color: #059669; }
.vdv-c-status.is-done .vdv-st-dot { background: #059669; border-color: #059669; }
.vdv-c-status.is-progress { color: #ea580c; }
.vdv-c-status.is-progress .vdv-st-dot { background: #f59e0b; border-color: #f59e0b; }

.vdv-c-act { display: flex; }
.vdv-do { display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: #2563eb; text-decoration: none; transition: all 120ms; }
.vdv-do:hover { background: #2563eb; border-color: #2563eb; color: #fff; text-decoration: none; }
.vdv-do.is-progress { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.vdv-do.is-progress:hover { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.vdv-do.is-done { background: #f0fdf4; border-color: #bbf7d0; color: #059669; }
.vdv-do.is-done:hover { background: #059669; border-color: #059669; color: #fff; }

.vdv-empty { text-align: center; padding: 34px 16px; color: #94a3b8; }
.vdv-empty p { font-weight: 700; margin: 6px 0 0; }

/* ============================================================
 * WRITING VIEW
 * ============================================================ */
.vw-top { margin-bottom: 16px; }
.vw-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; font-weight: 600; margin-bottom: 10px; }
.vw-crumb a { color: #94a3b8; text-decoration: none; }
.vw-crumb a:hover { color: #2563eb; }
.vw-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.vw-headl { display: flex; gap: 14px; align-items: flex-start; }
.vw-icon { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, #eff6ff, #dbeafe); display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; }
.vw-titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vw-title { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.02em; margin: 0; }
.vw-fi { font-style: italic; color: #94a3b8; font-size: 0.95rem; font-weight: 600; }
.vw-desc { color: #64748b; font-size: 13px; margin: 5px 0 0; max-width: 620px; }
.vw-exit { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #e2e8f0; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #475569; text-decoration: none; white-space: nowrap; transition: all 120ms; }
.vw-exit:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; text-decoration: none; }

.vw-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.vw-main { display: flex; flex-direction: column; gap: 14px; }
.vw-block { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px 18px; }
.vw-block-h { font-size: 13px; font-weight: 800; color: #0f172a; margin-bottom: 11px; display: flex; align-items: center; gap: 8px; }
.vw-hint { font-size: 10.5px; font-weight: 600; color: #94a3b8; background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }

.vw-vocab { display: flex; flex-wrap: wrap; gap: 7px; }
.vw-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 11px; border: 1px solid #e2e8f0; border-radius: 9px; background: #f8fafc; font: inherit; cursor: pointer; transition: all 120ms; text-align: left; }
.vw-chip:hover { border-color: #93c5fd; background: #eff6ff; }
.vw-chip-fi { font-size: 13px; font-weight: 800; color: #1d4ed8; }
.vw-chip-vi { font-size: 10.5px; color: #94a3b8; }

.vw-frames { display: flex; flex-direction: column; gap: 7px; }
.vw-frame { display: flex; flex-direction: column; gap: 1px; padding: 10px 13px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; font: inherit; cursor: pointer; text-align: left; transition: all 120ms; }
.vw-frame:hover { border-color: #93c5fd; background: #f8fbff; }
.vw-frame-fi { font-size: 13.5px; font-weight: 700; color: #0f172a; }
.vw-frame-vi { font-size: 11.5px; color: #94a3b8; }

.vw-textarea { width: 100%; box-sizing: border-box; border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; font: inherit; font-size: 14.5px; line-height: 1.7; color: #0f172a; resize: vertical; min-height: 200px; outline: none; transition: border-color 120ms, box-shadow 120ms; }
.vw-textarea:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.vw-toolbar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.vw-count { font-size: 13px; font-weight: 600; color: #64748b; }
.vw-count b { color: #2563eb; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.vw-saved { font-size: 12px; color: #059669; font-weight: 600; }
.vw-tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.vw-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; border: 1px solid #e2e8f0; background: #fff; color: #475569; transition: all 120ms; }
.vw-btn:hover { background: #f8fafc; }
.vw-btn-ghost { background: #f1f5f9; border-color: transparent; }
.vw-btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.vw-btn-primary:hover { background: #1d4ed8; }
.vw-btn-primary.is-done { background: #059669; border-color: #059669; }

.vw-sample[hidden] { display: none; }
.vw-sample-fi { font-size: 14px; line-height: 1.7; color: #0f172a; font-weight: 500; margin: 0 0 10px; }
.vw-sample-vi { font-size: 12.5px; line-height: 1.6; color: #64748b; font-style: italic; margin: 0; }
.vw-sample-note { margin-top: 12px; padding: 10px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; font-size: 12px; color: #92400e; }

/* writing sidebar */
.vw-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.admin-bar .vw-side { top: 46px; }
.vw-side-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px; }
.vw-side-h { font-size: 12.5px; font-weight: 800; color: #0f172a; margin-bottom: 12px; }
.vw-ring { position: relative; width: 96px; height: 96px; margin: 0 auto; }
.vw-ring svg { width: 100%; height: 100%; }
.vw-ring-fg { transition: stroke-dasharray 500ms; }
.vw-ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 19px; font-weight: 800; color: #2563eb; }
.vw-ring-note { text-align: center; font-size: 11.5px; color: #94a3b8; font-weight: 600; margin-top: 8px; }
.vw-struct { margin: 0; padding-left: 18px; font-size: 12px; color: #475569; line-height: 1.7; }
.vw-struct b { color: #0f172a; }
.vw-tips { margin: 0; padding-left: 18px; font-size: 12px; color: #475569; line-height: 1.7; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
	.vw-layout { grid-template-columns: 1fr; }
	.vw-side { position: static; }
}
@media (max-width: 860px) {
	.vdv-stats { grid-template-columns: 1fr 1fr; }
	.vdv-top { grid-template-columns: 1fr; gap: 10px; }
	.vdv-search { max-width: none; }
	.vdv-thead { display: none; }
	.vdv-row { grid-template-columns: 1fr auto; grid-template-areas: "topic act" "desc act" "meta act"; gap: 4px 12px; }
	.vdv-c-topic { grid-area: topic; }
	.vdv-c-desc { grid-area: desc; -webkit-line-clamp: 1; }
	.vdv-c-level { grid-area: meta; display: inline-flex; gap: 8px; }
	.vdv-c-words, .vdv-c-status { display: none; }
	.vdv-c-act { grid-area: act; }
}
@media (max-width: 520px) {
	.vdv-stats { grid-template-columns: 1fr; }
	.vw-headrow { flex-direction: column; }
}
