:root{
  /* Light / enterprise palette (soft, neutral, readable) */
  --bg:#f4f6f9; --card:#ffffff; --muted:#64748b; --text:#0f172a;
  --line:#e6eaf0; --pri:#2563eb; --pri2:#1d4ed8; --soft:#eef2ff;
  --warn:#f59e0b; --ok:#10b981; --bad:#ef4444;
  --shadow: 0 10px 25px rgba(0,0,0,.06);
  --radius: 16px;
  --radius2: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:15px;line-height:1.5;font-weight:400}
a{color:inherit}

.shell{display:flex;min-height:100vh}

/* SIDEBAR – LIGHT ENTERPRISE */
.side{
  width:200px; /* ~ giảm 1/3 so với 300px */
  background:#f8fafc;
  color:var(--text);
  padding:14px 12px;
  display:flex;
  flex-direction:column;
  gap:12px;
  border-right:1px solid var(--line);
}
.brand{display:flex;flex-direction:column;align-items:center;gap:10px;padding:6px 4px 10px 4px}
.brandLogoWrap{
  width:100%;
  display:flex;
  justify-content:center;
}
.brandLogo{
  width:66%; /* logo ~ 2/3 chiều rộng panel */
  height:auto;
  display:block;
}
.companyName{
  text-align:center;
  font-size:12.5px;
  line-height:1.35;
  font-weight:600;
  color:#0f172a;
}
.companyName div{white-space:nowrap}

.nav{display:flex;flex-direction:column;gap:10px;margin-top:4px}
.navGroup{display:flex;flex-direction:column;gap:8px}
.navGroupTitle{
  font-size:11px;color:var(--muted);
  letter-spacing:.08em;text-transform:uppercase;
  padding:6px 10px 0 10px;
}
.navItem{
  padding:9px 10px;border-radius:12px;
  color:var(--text);text-decoration:none;
  border:1px solid transparent;
  background:transparent;
}
.navItem:hover{
  background:rgba(15,23,42,.04);
  border-color:rgba(15,23,42,.08);
}
.navItem.active{
  background:rgba(37,99,235,.08);
  border-color:rgba(37,99,235,.18);
  color:#1d4ed8;
  font-weight:600;
}

.sideFooter{margin-top:auto;padding-top:12px;border-top:1px solid var(--line)}
.chip{display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border-radius:999px;background:rgba(17,24,39,.04);font-size:12px;font-weight:700}
.mini{font-size:12px;color:var(--muted)}
.muted{color:var(--muted)}

/* MAIN */
.main{flex:1;padding:22px 24px;min-width:0}
.topbar{display:flex;justify-content:space-between;gap:14px;align-items:flex-end;margin-bottom:14px}
.h1{font-size:20px;font-weight:700;letter-spacing:.2px}
.sub{font-size:13px;color:var(--muted);margin-top:2px;font-weight:400}

.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.pad{padding:16px}

.row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}

.field label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.field input,.field select,.field textarea{width:100%;border:1px solid var(--line);border-radius:12px;padding:10px 12px;font-size:14px;line-height:1.45;background:#fff;outline:none;font-weight:400;resize:vertical}
.field input:focus,.field select:focus,.field textarea:focus{
  border-color:rgba(37,99,235,.35);
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}
.field textarea{width:100%;border:1px solid var(--line);border-radius:12px;padding:10px 12px;font-size:14px;line-height:1.45;background:#fff;outline:none;font-weight:400;resize:vertical}

.table{width:100%;border-collapse:separate;border-spacing:0}
.table th,.table td{padding:10px 12px;border-bottom:1px solid var(--line);font-size:13px;vertical-align:middle;font-weight:400}
.table th{font-size:13px;color:#475569;text-align:left;font-weight:600}

.badge{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;font-size:12px;border:1px solid var(--line);background:#fff}
.badge.ok{border-color:rgba(16,185,129,.35);background:rgba(16,185,129,.08);color:#047857}
.badge.warn{border-color:rgba(245,158,11,.35);background:rgba(245,158,11,.10);color:#92400e}
.badge.bad{border-color:rgba(239,68,68,.35);background:rgba(239,68,68,.10);color:#991b1b}

.btnRow{display:flex;gap:10px;flex-wrap:wrap}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:12px;padding:10px 14px;border:1px solid var(--line);text-decoration:none;color:var(--text);background:#fff;cursor:pointer;font-weight:600;font-size:14px}
.btn:hover{box-shadow:0 6px 14px rgba(0,0,0,.06)}
.btnPri{background:var(--pri);border-color:var(--pri);color:#fff}
.btnPri:hover{background:var(--pri2)}
.btnBad{background:var(--bad);border-color:var(--bad);color:#fff}
.btnSoft{background:var(--soft);border-color:rgba(37,99,235,.25);color:#1d4ed8}

.kv{display:grid;grid-template-columns:200px 1fr;gap:8px;margin:0}
.kv dt{color:var(--muted);font-size:12px}
.kv dd{margin:0;font-size:14px}

.msg{padding:10px 12px;border-radius:12px;border:1px solid var(--line);margin:10px 0}
.msgErr{border-color:rgba(239,68,68,.35);background:rgba(239,68,68,.08);color:#991b1b}
.msgOk{border-color:rgba(16,185,129,.35);background:rgba(16,185,129,.08);color:#047857}

.gallery{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px}
.thumb{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.thumb img{width:100%;height:110px;object-fit:cover;display:block}

/* RESPONSIVE */
@media (max-width: 1100px){
  .row{grid-template-columns:repeat(2,minmax(0,1fr))}
  .gallery{grid-template-columns:repeat(3,minmax(0,1fr))}
}


/* ===== UI POLISH (PRO) ===== */
.topbar .btnRow{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.topSearch{display:flex;gap:10px;align-items:center}
.table{border-radius:var(--radius2);overflow:hidden}
.table thead th{background:#f3f6fa;border-bottom:1px solid var(--line)}
.table tbody tr:hover{background:rgba(37,99,235,.03)}
.table td a{color:#1d4ed8}

/* badges: keep single line, avoid tall pills */
.badge{white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;padding:5px 10px;font-size:11px}
.badge.ok{background:rgba(16,185,129,.10);border-color:rgba(16,185,129,.35);color:#047857}
.badge.warn{background:rgba(245,158,11,.10);border-color:rgba(245,158,11,.35);color:#92400e}
.badge.bad{background:rgba(239,68,68,.10);border-color:rgba(239,68,68,.35);color:#b91c1c}

/* inputs */
.input{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:#fff;outline:none;font-size:14px;font-weight:400}
.input:focus{border-color:rgba(37,99,235,.45);box-shadow:0 0 0 4px rgba(37,99,235,.10)}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:12px;padding:10px 14px;border:1px solid var(--line);text-decoration:none;color:var(--text);background:#fff;cursor:pointer;font-weight:600;font-size:14px}
.btn:active{transform:translateY(1px)}
.btnPri{background:var(--pri);border-color:rgba(37,99,235,.0);color:#fff}
.btnPri:hover{background:var(--pri2)}
.btnBad{background:rgba(239,68,68,.10);border-color:rgba(239,68,68,.35);color:#b91c1c}
.btnOk{background:rgba(16,185,129,.10);border-color:rgba(16,185,129,.35);color:#047857}
.btnSm{padding:8px 10px;border-radius:10px;font-size:13px}
.btnGhost{background:transparent}
.btnGhost:hover{background:rgba(17,24,39,.04)}
.btnDis{opacity:.55;cursor:not-allowed;pointer-events:none}

/* action row for table cells */
.actionRow{display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap}
.actionRow form{margin:0}
.actionRow .input{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:#fff;outline:none;font-size:14px;font-weight:400}
.actionRow .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:12px;padding:10px 14px;border:1px solid var(--line);text-decoration:none;color:var(--text);background:#fff;cursor:pointer;font-weight:600;font-size:14px}

/* brand: balance logo + long title */
.brandTitle{font-weight:700;font-size:14px;line-height:1.2}
.brandSub{line-height:1.25}

/* cards */
.card{overflow:hidden}
@media (max-width: 860px){
  .shell{flex-direction:column}
  .side{width:100%;border-right:none;border-bottom:1px solid var(--line)}
  .main{padding:16px}
  .row{grid-template-columns:1fr}
  .grid2{grid-template-columns:1fr}
  .kv{grid-template-columns:1fr}
}



/* ===== UI POLISH: long text safety + better form inputs ===== */
.field input.input-title{font-size:15px;font-weight:600;padding:12px 14px;border-radius:14px}

.field textarea.textarea-sm{
  min-height:96px;
  resize:vertical;
  line-height:1.5;
}

/* Top search input (shared) */
.input-search{
  width:320px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
}

/* Dashboard filter bar */
.filterBar{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:flex-end;
  padding:10px 12px; /* tránh sát lề trái */
}
.filterItem{min-width:120px} /* ~ 2/3 so với trước */
.filterItem label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.filterActions{display:flex;gap:10px;align-items:center;padding-bottom:2px}
@media (max-width: 900px){
  .filterItem{min-width:calc(50% - 6px)}
  .filterActions{width:100%}
  .filterActions .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:12px;padding:10px 14px;border:1px solid var(--line);text-decoration:none;color:var(--text);background:#fff;cursor:pointer;font-weight:600;font-size:14px}
}

/* Table: professional + safe long text
   - Do NOT ellipsis headers
   - Table scrolls horizontally on small screens
   - Title column shows up to 2 lines (clamp), never 'a.' style nonsense
*/
.tableWrap{overflow:auto}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
/* Table uses a safe min-width so title column never collapses */
.tableWrap .table{min-width:1350px;}

/* headers */
.table thead th{
  white-space:nowrap;
  overflow:visible;
  text-overflow:clip;
}

/* cells */
.table tbody td{
  vertical-align:middle;
  overflow:visible;
}

/* width helpers (title is the most important: ~ equals two normal columns) */
.col-id{width:70px}
.col-so-phieu{width:140px}
.col-title{width:240px} /* tiêu đề ~ 1/2 so với trước */
.col-loai{width:120px}
.col-trang-thai{width:180px}
.col-don-vi{width:240px}
.col-nguoi{width:220px}
.col-tac-gia{width:440px} /* tác giả ~ 2x so với trước */
.col-ngay{width:150px}

/* Title cell: 2-line clamp + tooltip support */
.link-title{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  white-space:normal;
  line-height:1.35;
  word-break:break-word;
  overflow-wrap:anywhere;
  color:#1d4ed8;
  font-weight:400; /* không để cột đậm/nhạt - nhấn bằng màu */
  text-decoration:none;
}
.link-title:hover{text-decoration:underline}

/* Detail title can wrap safely */
.detail-title{
  font-weight:800;
  font-size:16px;
  margin-top:4px;
  word-break:break-word;
  overflow-wrap:anywhere;
}

/* Detail title can wrap safely */
.detail-title{
  font-weight:800;
  font-size:16px;
  margin-top:4px;
  word-break:break-word;
  overflow-wrap:anywhere;
}


/* Dashboard bits */
.kpiGrid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:14px;
  margin:14px 0;
}
.kpiCard{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  box-shadow:var(--shadow);
  padding:14px 14px;
}
.kpiLabel{font-size:12px;color:var(--muted)}
.kpiValue{font-size:22px;font-weight:800;margin-top:6px}
.kpiHint{font-size:12px;color:var(--muted);margin-top:6px}
@media (max-width:1100px){
  .kpiGrid{grid-template-columns:repeat(2, minmax(0,1fr))}
}
@media (max-width:640px){
  .kpiGrid{grid-template-columns:1fr}
}


/* Utilities */
.prewrap{white-space:pre-wrap;}

select{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:#fff;outline:none;font-size:14px;font-weight:400}

.field{display:flex;flex-direction:column}

.section{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px}
.sectionTitle{font-size:12px;color:var(--muted);font-weight:700;letter-spacing:.08em;text-transform:uppercase;margin-bottom:12px}


/* BRAND LOGO IMAGE + COMPANY NAME */
.logo{background:#fff;border:1px solid var(--line);color:inherit;font-weight:700}
.logoImg{width:100%;height:100%;object-fit:contain;padding:6px;display:block}
.brandTitle{font-weight:650;font-size:13px;line-height:1.25}
.brandSub{font-size:12px;color:var(--muted);margin-top:2px}
.brandSub2{font-size:11px;color:var(--muted);margin-top:2px;line-height:1.2}

/* ===== Brand header overrides: logo on top, company name below ===== */
.brand{flex-direction:column;align-items:center;text-align:center;gap:10px}
.brandText{display:flex;flex-direction:column;align-items:center}
.logo{width:86px;height:86px;border-radius:18px;background:#fff;border:1px solid var(--line);box-shadow:0 10px 25px rgba(0,0,0,.06);display:flex;align-items:center;justify-content:center}
.logoImg{padding:8px}
.brandTitle{font-size:14px;font-weight:600;line-height:1.25}

@media (max-width: 768px){
  .logo{width:72px;height:72px;border-radius:16px}
  .brandTitle{font-size:13px}
}


/* Alerts */
.alert{border-radius:12px;padding:10px 12px;border:1px solid var(--line);background:#fff;font-weight:600}
.alert.ok{background:rgba(16,185,129,.08);border-color:rgba(16,185,129,.25);color:#047857}
.alert.bad{background:rgba(239,68,68,.08);border-color:rgba(239,68,68,.25);color:#b91c1c}
