/* Portal 04 - Shared Administrative Design System (Unslop) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');
:root {
  --bg-page: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-raised: #f1f4f8;
  --bg-subtle: #e8edf4;
  --border-hairline: rgba(17, 24, 39, 0.08);
  --border-strong: rgba(17, 24, 39, 0.14);

  --text-primary: #111827;
  --text-secondary: #4b5565;
  --text-muted: #6b7487;

  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff4ff;
  --accent-border: rgba(29, 78, 216, 0.22);

  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --ok-border: rgba(22, 163, 74, 0.22);
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-border: rgba(180, 83, 9, 0.22);
  --err: #dc2626;
  --err-bg: #fef2f2;
  --err-border: rgba(220, 38, 38, 0.22);

  --font-sans: "IBM Plex Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 8px 24px rgba(17, 24, 39, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.ic {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -3px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  line-height: 1;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  flex-shrink: 0;
}

.p4-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.p4-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.p4-header-title .ic {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.p4-header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p4-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.p4-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
}

.p4-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.p4-nav a.p4-back {
  color: var(--accent);
}

.p4-nav a.p4-back:hover {
  background: var(--accent-soft);
}

main {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

main.p4-narrow { max-width: 680px; }
main.p4-wide { max-width: 1440px; }

.the {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.the-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.the-title .ic { color: var(--text-muted); }

.ghichu {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.ghichu-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--warn);
  font-size: 13px;
  margin-top: 12px;
}

.thanh, .hang {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

select, input[type="text"], input[type="search"], input[type="number"], input[type="file"] {
  font-family: var(--font-sans);
  font-size: 13px;
  height: 36px;
  padding: 0 12px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}

input[type="file"] {
  padding: 6px 10px;
  height: auto;
  background: var(--bg-raised);
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button, a.nut, a.btn-outline {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: color 140ms var(--ease), background-color 140ms var(--ease), border-color 140ms var(--ease), transform 120ms var(--ease);
}

button:hover:not(:disabled), a.btn-outline:hover {
  background: var(--bg-raised);
}

button:active:not(:disabled), a.nut:active, a.btn-outline:active {
  transform: scale(0.98);
}

button:focus-visible, a.nut:focus-visible, a.btn-outline:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.chinh, button.btn-primary, a.nut {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.chinh:hover:not(:disabled), button.btn-primary:hover:not(:disabled), a.nut:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.phu, a.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

button.nguy {
  background: var(--err);
  border-color: var(--err);
  color: #ffffff;
}

button.nguy:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

button.xoa {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--err);
  border-color: var(--err-border);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
}

button.xoa:hover:not(:disabled) {
  background: var(--err-bg);
}

.khung {
  overflow: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  max-height: 70vh;
  box-shadow: var(--shadow-sm);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

th, td {
  border-bottom: 1px solid var(--border-hairline);
  border-right: 1px solid var(--border-hairline);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

th:last-child, td:last-child { border-right: 0; }
tr:last-child td { border-bottom: 0; }

th {
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

tbody tr:hover td {
  background: #f8fafc;
}

td.so {
  color: var(--text-muted);
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  background: var(--bg-page);
}

.canh { color: var(--warn); }
.loi { color: var(--err); }
.ok { color: var(--ok); }
.an { display: none !important; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}

ol, ul { padding-left: 20px; margin: 8px 0; }
li { margin: 4px 0; color: var(--text-secondary); }
a { color: var(--accent); }

@media (max-width: 720px) {
  .p4-header { padding: 0 16px; height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
  main { padding: 16px; }
  .the { padding: 16px; }
}
