/* =========================================================
   Masterbrand Client Portal — UI giống portal SHTT (menu trắng / xanh)
   ========================================================= */

:root {
  --p-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --p-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --p-radius: 8px;
  --p-sidebar-w: 260px;
}

/* —— Theme: Azure (mặc định — sidebar trắng như ảnh) —— */
body.theme-azure {
  --p-bg: #f5f7fb;
  --p-sidebar-bg: #ffffff;
  --p-sidebar-text: #4b5563;
  --p-sidebar-active-bg: #ebf2ff;
  --p-sidebar-active: #1d4ed8;
  --p-sidebar-border: #e5e7eb;
  --p-accent: #1d4ed8;
  --p-accent-soft: #ebf2ff;
  --p-card: #ffffff;
  --p-text: #1f2937;
  --p-muted: #6b7280;
  --p-line: #e5e7eb;
  --p-topbar: #ffffff;
  --p-success: #15803d;
  --p-warning: #b45309;
  --p-danger: #b91c1c;
  --p-menu-hover: #f3f6fb;
}

/* —— Theme: Slate Minimal (tông Instagram — trắng / xám nhạt / xanh #0095f6) —— */
body.theme-slate {
  --p-bg: #fafafa;
  --p-sidebar-bg: #ffffff;
  --p-sidebar-text: #262626;
  --p-sidebar-active-bg: #efefef;
  --p-sidebar-active: #262626;
  --p-sidebar-border: #dbdbdb;
  --p-accent: #0095f6;
  --p-accent-soft: #e8f4fe;
  --p-card: #ffffff;
  --p-text: #262626;
  --p-muted: #8e8e8e;
  --p-line: #dbdbdb;
  --p-topbar: #ffffff;
  --p-success: #00a400;
  --p-warning: #c67c00;
  --p-danger: #ed4956;
  --p-menu-hover: #fafafa;
}
/* Instagram: mục đang chọn dùng chữ đậm đen thay vì đổi màu */
body.theme-slate .client-menu a.active,
body.theme-slate .client-top-menu a.active,
body.theme-slate .client-rail-menu a.active {
  font-weight: 700;
}
body.theme-slate .p-table th {
  color: #fff;
  letter-spacing: 0.02em;
}
body.theme-slate .p-btn:not(.p-btn-ghost),
body.theme-slate .reg-drop-btn {
  color: #fff !important;
}
body.theme-slate .p-btn-ghost {
  color: #262626 !important;
  border-color: #dbdbdb;
}
body.theme-slate .p-btn-ghost:hover {
  color: #0095f6 !important;
  border-color: #0095f6;
}
body.theme-slate .p-badge-info { background: #e8f4fe; color: #0095f6; }
body.theme-slate .p-badge-warn { background: #fdf2e3; color: #c67c00; }
body.theme-slate .p-badge-ok { background: #e6f6e6; color: #00a400; }
body.theme-slate .p-badge-danger { background: #fdeaec; color: #ed4956; }
body.theme-slate .p-badge-muted { background: #efefef; color: #8e8e8e; }
body.theme-slate .p-avatar {
  background: #efefef;
  color: #262626;
  border-radius: 50%;
}

/* —— Theme: Ice —— */
body.theme-ice {
  --p-bg: #f8fafc;
  --p-sidebar-bg: #ffffff;
  --p-sidebar-text: #4b5563;
  --p-sidebar-active-bg: #eff6ff;
  --p-sidebar-active: #2563eb;
  --p-sidebar-border: #e2e8f0;
  --p-accent: #2563eb;
  --p-accent-soft: #eff6ff;
  --p-card: #ffffff;
  --p-text: #0f172a;
  --p-muted: #64748b;
  --p-line: #e2e8f0;
  --p-topbar: #ffffff;
  --p-success: #16a34a;
  --p-warning: #ca8a04;
  --p-danger: #dc2626;
  --p-menu-hover: #f8fafc;
}

.client-sidebar {
  border-right: 1px solid var(--p-sidebar-border);
  box-shadow: none;
}
.client-brand,
.client-side-foot {
  border-color: var(--p-sidebar-border);
}
.nav-toggle {
  border-color: var(--p-line);
  color: var(--p-text);
}

/* Layout — sidebar fixed, chỉ vùng nội dung cuộn */
.client-body {
  margin: 0;
  font-family: var(--p-font-ui);
  font-size: 14px;
  color: var(--p-text);
  background: var(--p-bg);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.client-shell {
  display: block;
  height: 100vh;
  overflow: hidden;
  position: relative;
}
.client-sidebar {
  background: var(--p-sidebar-bg);
  color: var(--p-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  width: var(--p-sidebar-w);
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}
.client-sidebar-head {
  display: flex;
  align-items: center;
  padding-right: 0.5rem;
}
.client-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1rem 1rem 1.1rem;
  border-bottom: 1px solid var(--p-sidebar-border);
  color: inherit !important;
  text-decoration: none !important;
  flex: 1;
}
.client-brand-mark {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--p-accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--p-font-ui);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--p-accent);
  background: var(--p-accent-soft);
  flex-shrink: 0;
}
.client-brand strong {
  display: block;
  color: var(--p-text);
  font-family: var(--p-font-ui);
  font-size: 0.95rem;
  font-weight: 700;
}
.client-brand span {
  display: block;
  font-size: 0.72rem;
  color: var(--p-muted);
  margin-top: 0.12rem;
  font-family: var(--p-font-ui);
  font-weight: 500;
}
.client-menu {
  list-style: none;
  margin: 0.65rem 0;
  padding: 0 0.7rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.client-menu a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.85rem;
  color: var(--p-sidebar-text);
  text-decoration: none !important;
  font-family: var(--p-font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  border-radius: 8px;
  border: 0;
  border-left: 0 !important;
  transition: background 0.15s, color 0.15s;
}
.client-menu a:hover {
  background: var(--p-menu-hover, #f3f6fb);
  color: var(--p-text);
}
.client-menu a.active {
  background: var(--p-sidebar-active-bg);
  color: var(--p-sidebar-active);
  font-weight: 600;
}
.client-menu .menu-ico {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.9;
}
.client-menu a.active .menu-ico {
  opacity: 1;
  color: var(--p-sidebar-active);
}
.client-menu .menu-txt {
  flex: 1;
  min-width: 0;
}
.client-side-foot {
  padding: 0.85rem 1rem 1.15rem;
  border-top: 1px solid var(--p-sidebar-border);
}
.client-side-foot .lang-switch a {
  color: var(--p-sidebar-text);
  border-color: transparent;
  font-size: 0.8rem;
}
.client-side-foot .lang-switch a.active,
.client-side-foot .lang-switch a:hover {
  color: var(--p-accent);
  border-color: var(--p-accent);
}
.client-logout {
  display: block;
  margin-top: 0.75rem;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--p-line);
  border-radius: 8px;
  color: var(--p-text) !important;
  text-decoration: none !important;
  font-family: var(--p-font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
}
.client-logout:hover {
  border-color: var(--p-accent);
  color: var(--p-accent) !important;
  background: var(--p-accent-soft);
}

.client-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--p-sidebar-w);
  width: calc(100% - var(--p-sidebar-w));
  max-width: calc(100% - var(--p-sidebar-w));
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.client-topbar {
  background: var(--p-topbar);
  border-bottom: 1px solid var(--p-line);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  flex-shrink: 0;
  z-index: 30;
}
.client-topbar-title {
  font-family: var(--p-font-ui);
  font-size: 0.95rem;
  color: var(--p-muted);
  margin: 0;
  flex: 1;
  min-width: 0;
}
.client-topbar-title strong {
  color: var(--p-text);
  font-weight: 600;
}
.client-content {
  padding: 1rem 0.85rem 2rem;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Cards / panels */
.p-card {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 1.35rem 1.5rem;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.p-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}
.p-page-head h1 {
  margin: 0;
  font-family: var(--p-font-ui);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--p-text);
  letter-spacing: -0.01em;
}
.p-page-head p {
  margin: 0.35rem 0 0;
  color: var(--p-muted);
  font-size: 0.95rem;
}
.p-section-title {
  text-align: center;
  font-family: var(--p-font-ui);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--p-accent);
  margin: 0 0 1.5rem;
  text-transform: uppercase;
}

/* Buttons */
.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.05rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--p-font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  line-height: 1.2;
  background: var(--p-accent);
  color: #fff !important;
}
.p-btn:hover { filter: brightness(1.06); }
.p-btn-ghost {
  background: #fff;
  color: var(--p-text) !important;
  border-color: var(--p-line);
}
.p-btn-ghost:hover { border-color: var(--p-accent); color: var(--p-accent) !important; }
.p-btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.p-btn-block { width: 100%; }

/* Stats */
.p-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.p-stat {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 1rem 1.15rem;
  border-top: 3px solid var(--p-accent);
}
.p-stat .label {
  font-family: var(--p-font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--p-muted);
  font-weight: 600;
}
.p-stat .value {
  font-family: var(--p-font-ui);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--p-text);
  margin-top: 0.2rem;
}

/* Tables */
.p-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: var(--p-font-ui);
}
.p-table th,
.p-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--p-line);
  text-align: left;
  vertical-align: middle;
}
.p-table th {
  font-family: var(--p-font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--p-accent);
  white-space: nowrap;
}
.p-table thead th:first-child { border-radius: 6px 0 0 0; }
.p-table thead th:last-child { border-radius: 0 6px 0 0; }
.p-table tr:hover td { background: #f8fafc; }

/* Bảng phí dịch vụ */
.fee-schedule {
  border: 1px solid var(--p-line);
}
.fee-schedule th,
.fee-schedule td {
  border: 1px solid var(--p-line);
  text-align: center;
  vertical-align: middle;
}
.fee-schedule .fee-col-name,
.fee-schedule td.fee-name {
  text-align: left;
  min-width: 14rem;
}
.fee-schedule .fee-col-stt {
  width: 3rem;
}
.fee-schedule .fee-qty-input {
  width: 4.5rem;
  margin: 0 auto;
  text-align: center;
  padding: 0.35rem 0.4rem;
}
.fee-schedule .fee-total-row td {
  font-weight: 700;
  background: #f8fafc;
}
.fee-schedule .fee-grand-label {
  text-align: center;
}
.fee-schedule tr:hover td {
  background: transparent;
}
.fee-schedule .fee-total-row:hover td {
  background: #f8fafc;
}
.fee-currency-note {
  margin-bottom: 0;
}

.p-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--p-accent-soft);
  color: var(--p-accent);
  display: grid;
  place-items: center;
  font-family: var(--p-font-ui);
  font-size: 0.7rem;
  font-weight: 700;
}
.p-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-family: var(--p-font-ui);
  font-size: 0.78rem;
  font-weight: 600;
}
.p-badge-info { background: #ebf2ff; color: #1d4ed8; }
.p-badge-warn { background: #fef3c7; color: #b45309; }
.p-badge-ok { background: #dcfce7; color: #15803d; }
.p-badge-danger { background: #fee2e2; color: #b91c1c; }
.p-badge-muted { background: #f3f4f6; color: #6b7280; }

/* Service grid */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.svc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 130px;
  padding: 1.25rem 1rem;
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  text-decoration: none !important;
  color: var(--p-text) !important;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.svc-card:hover {
  border-color: var(--p-accent);
  box-shadow: 0 8px 24px rgba(26,75,140,0.1);
  transform: translateY(-2px);
}
.svc-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--p-accent-soft);
  color: var(--p-accent);
  display: grid;
  place-items: center;
  font-family: var(--p-font-ui);
  font-weight: 700;
  font-size: 0.85rem;
}
.svc-card strong {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}
.svc-system {
  display: block;
  margin-top: -0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--p-accent);
  letter-spacing: 0.02em;
}
.svc-grid-intl {
  grid-template-columns: repeat(3, 1fr);
}
.svc-block .p-section-title {
  text-align: center;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}
.reg-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--p-text);
}
.svc-hint {
  text-align: center;
  color: var(--p-muted);
  font-size: 0.9rem;
  margin-top: 1.25rem;
}

/* Chọn loại thủ tục */
.procedure-card {
  max-width: 820px;
  margin: 0 auto;
}
.procedure-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.procedure-head .reg-back {
  margin-top: 0.35rem;
}
.procedure-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--p-muted);
  margin-bottom: 0.35rem;
}
.procedure-svc-ico {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--p-accent-soft);
  color: var(--p-accent);
  font-size: 0.7rem;
  font-weight: 700;
}
.procedure-title {
  text-align: left;
  margin: 0;
  font-size: 1.25rem;
}
.procedure-hint {
  text-align: left;
  margin: 0.5rem 0 1.15rem;
}
.procedure-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.procedure-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  background: #fff;
  text-decoration: none !important;
  color: var(--p-text) !important;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.procedure-item:hover {
  border-color: var(--p-accent);
  background: var(--p-accent-soft);
  box-shadow: 0 4px 14px rgba(26, 75, 140, 0.08);
}
.procedure-check {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.12rem;
  border: 2px solid var(--p-accent);
  border-radius: 3px;
  background: #fff;
  position: relative;
  box-sizing: border-box;
}
.procedure-item:hover .procedure-check,
.procedure-item:focus-visible .procedure-check {
  background: var(--p-accent);
}
.procedure-item:hover .procedure-check::after,
.procedure-item:focus-visible .procedure-check::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.procedure-label {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Forms */
.p-form-group { margin-bottom: 1rem; }
.p-form-group label {
  display: block;
  font-family: var(--p-font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--p-text);
}
.p-form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--p-line);
  border-radius: 6px;
  font-family: var(--p-font);
  font-size: 1rem;
  background: #fff;
  color: var(--p-text);
  box-sizing: border-box;
}
.p-form-control:focus {
  outline: none;
  border-color: var(--p-accent);
  box-shadow: 0 0 0 3px var(--p-accent-soft);
}
.p-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.p-alert {
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  border-left: 3px solid;
}
.p-alert-success { background: #ecfdf5; border-color: var(--p-success); color: #14532d; }
.p-alert-error { background: #fef2f2; border-color: var(--p-danger); color: #7f1d1d; }
.p-alert-info { background: #eff6ff; border-color: var(--p-accent); color: #1e3a8a; }
.p-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--p-muted);
}
.guide-list { list-style: none; margin: 0; padding: 0; }
.guide-list a {
  display: block;
  padding: 1rem 0;
  border-bottom: 1px solid var(--p-line);
  color: var(--p-text);
  text-decoration: none;
  font-family: var(--p-font-ui);
  font-weight: 600;
}
.guide-list a:hover { color: var(--p-accent); }
.guide-list small {
  display: block;
  font-weight: 400;
  color: var(--p-muted);
  margin-top: 0.25rem;
}

/* Mobile */
.client-topbar .nav-toggle {
  display: none !important;
  width: 40px;
  height: 40px;
  border: 1px solid var(--p-line);
  border-radius: 6px;
  background: #fff;
  color: var(--p-text);
  font-size: 1.3rem;
  cursor: pointer;
}
.client-nav-close {
  display: none !important;
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--p-line);
  background: transparent;
  color: var(--p-text);
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
}
.client-backdrop {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  z-index: 90;
  border: 0;
}

@media (max-width: 960px) {
  .client-shell { display: block; }
  .client-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 100;
    box-shadow: 8px 0 30px rgba(0,0,0,0.2);
  }
  .client-main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
  }
  body.nav-open .client-sidebar { transform: translateX(0); }
  body.nav-open .client-backdrop { display: block !important; }
  body.nav-open { overflow: hidden; }
  .client-topbar .nav-toggle { display: inline-flex !important; align-items: center; justify-content: center; }
  .client-nav-close { display: inline-flex !important; align-items: center; justify-content: center; }
  .client-content { padding: 0.75rem 0.55rem 1.5rem; }
  .svc-grid { grid-template-columns: 1fr 1fr; }
  .svc-grid-intl { grid-template-columns: 1fr 1fr; }
  .p-stats { grid-template-columns: 1fr; }
  .p-form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .svc-grid { grid-template-columns: 1fr; }
  .svc-grid-intl { grid-template-columns: 1fr; }
  .p-page-head .p-btn { width: 100%; }
}

@media (min-width: 961px) {
  .client-topbar .nav-toggle,
  .client-nav-close,
  .client-backdrop {
    display: none !important;
  }
  .client-sidebar {
    transform: none !important;
    position: fixed !important;
  }
  body.layout-topnav .nav-toggle {
    display: none !important;
  }
}

/* =========================================================
   Layout: Top Nav — menu ngang (Western / dễ quét mắt)
   ========================================================= */
body.layout-topnav .client-shell-top {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
body.layout-topnav .client-topnav {
  background: var(--p-sidebar-bg);
  position: relative;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--p-sidebar-border);
}
body.layout-topnav .client-main {
  margin-left: 0;
  width: 100%;
  max-width: 100%;
  flex: 1;
  min-height: 0;
  height: auto;
}
body.layout-topnav .client-topnav-bar {
  width: min(1180px, 94%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  flex-wrap: wrap;
}
body.layout-topnav .client-brand-inline {
  padding: 0;
  border: 0;
  margin: 0;
  flex-shrink: 0;
}
body.layout-topnav .client-top-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}
body.layout-topnav .client-topnav {
  background: var(--p-sidebar-bg);
  position: relative;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: none;
  border-bottom: 1px solid var(--p-sidebar-border);
}
body.layout-topnav .client-top-menu a {
  color: var(--p-sidebar-text);
  text-decoration: none;
  font-family: var(--p-font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
body.layout-topnav .client-top-menu a:hover {
  color: var(--p-text);
  background: var(--p-menu-hover, #f3f6fb);
}
body.theme-ice.layout-topnav .client-top-menu a:hover {
  color: var(--p-accent);
  background: var(--p-accent-soft);
}
body.layout-topnav .client-top-menu a.active {
  background: var(--p-sidebar-active-bg);
  color: var(--p-sidebar-active);
  font-weight: 600;
}
body.layout-topnav .client-top-menu .menu-ico {
  display: inline-flex;
  color: inherit;
}
body.layout-topnav .client-topnav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-left: auto;
}
body.layout-topnav .client-logout-inline {
  margin: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}
body.layout-topnav .client-topbar-simple {
  background: transparent;
  border: 0;
  padding: 1rem 0 0;
  position: static;
}
body.layout-topnav .client-content-wide {
  width: min(1180px, 94%);
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
}
body.layout-topnav .client-topbar-sep {
  margin: 0 0.35rem;
  opacity: 0.45;
}
body.theme-ice.layout-topnav .client-topnav {
  border-bottom: 1px solid var(--p-line);
  background: #fff;
}

@media (max-width: 960px) {
  body.layout-topnav .client-top-menu,
  body.layout-topnav .client-topnav-right {
    display: none;
    width: 100%;
  }
  body.layout-topnav.nav-open .client-top-menu,
  body.layout-topnav.nav-open .client-topnav-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  body.layout-topnav .nav-toggle {
    display: inline-flex !important;
    margin-left: auto;
    border-color: var(--p-line);
    color: var(--p-text);
  }
  body.theme-ice.layout-topnav .nav-toggle {
    border-color: var(--p-line);
    color: var(--p-text);
  }
  body.layout-topnav.nav-open .client-backdrop {
    display: block !important;
  }
}

/* =========================================================
   Layout: Icon Rail — cột icon hẹp (modern global)
   ========================================================= */
body.layout-rail .client-shell-rail {
  display: block;
}
body.layout-rail .client-rail {
  background: var(--p-sidebar-bg);
  color: var(--p-sidebar-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.4rem;
  position: fixed;
  left: 0;
  top: 0;
  width: 72px;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  border-right: 1px solid var(--p-sidebar-border);
}
body.layout-rail .client-main {
  margin-left: 72px;
  width: calc(100% - 72px);
  max-width: calc(100% - 72px);
}
body.layout-rail .client-rail-brand {
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--p-accent);
  color: var(--p-accent);
  background: var(--p-accent-soft);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--p-font-ui);
  font-weight: 700;
  font-size: 0.75rem;
  text-decoration: none;
  margin-bottom: 1rem;
}
body.theme-ice.layout-rail .client-rail-brand {
  border-color: var(--p-accent);
  color: var(--p-accent);
}
body.layout-rail .client-rail-menu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  width: 100%;
}
body.layout-rail .client-rail-menu a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.55rem 0.25rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--p-sidebar-text);
  font-family: var(--p-font-ui);
}
body.layout-rail .client-rail-menu a:hover {
  background: var(--p-menu-hover, #f3f6fb);
  color: var(--p-text);
}
body.theme-ice.layout-rail .client-rail-menu a:hover {
  background: var(--p-accent-soft);
  color: var(--p-accent);
}
body.layout-rail .client-rail-menu a.active {
  background: var(--p-sidebar-active-bg);
  color: var(--p-sidebar-active);
}
body.layout-rail .rail-ico {
  font-size: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  display: grid;
  place-items: center;
  color: inherit;
}
body.layout-rail .rail-ico svg {
  width: 18px;
  height: 18px;
}
body.theme-ice.layout-rail .rail-ico {
  background: transparent;
  color: inherit;
}
body.layout-rail .rail-txt {
  font-size: 0.62rem;
  text-align: center;
  line-height: 1.15;
  max-width: 64px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
body.layout-rail .client-rail-foot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}
body.layout-rail .client-rail-foot a {
  text-align: center;
  font-family: var(--p-font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--p-sidebar-text);
  text-decoration: none;
  padding: 0.45rem 0;
  border-radius: 6px;
}
body.layout-rail .client-rail-foot a:hover {
  background: var(--p-menu-hover, #f3f6fb);
  color: var(--p-accent);
}
body.layout-rail .client-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
body.layout-rail .client-topbar-sep {
  margin: 0 0.35rem;
  opacity: 0.45;
}

@media (max-width: 960px) {
  body.layout-rail .client-shell-rail {
    display: block;
  }
  body.layout-rail .client-main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
  body.layout-rail .client-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(220px, 80vw);
    align-items: stretch;
    padding: 1rem;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  body.layout-rail.nav-open .client-rail {
    transform: translateX(0);
  }
  body.layout-rail .client-rail-menu a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
  }
  body.layout-rail .rail-txt {
    max-width: none;
    font-size: 0.9rem;
    -webkit-line-clamp: 1;
  }
  body.layout-rail .client-rail-foot {
    flex-direction: row;
  }
  body.layout-rail .client-rail-foot a {
    flex: 1;
  }
}

.records-loader, .records-end {
  text-align: center;
  padding: 1rem;
  color: var(--p-muted);
  font-size: 0.875rem;
}
.records-table-shell {
  margin: 0;
  max-width: 100%;
}
.records-page-head {
  align-items: center;
  margin-bottom: 0.9rem;
}
.records-page-head h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--p-text);
}
.records-page-head .records-count {
  font-weight: 700;
  color: var(--p-accent);
}
.records-page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.records-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: #fff;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  font-size: 0.875rem;
}
.records-filter-field {
  flex: 1 1 150px;
  min-width: 0;
}
.records-filter-search {
  flex: 2 1 200px;
}
.records-filter-field label {
  display: block;
  font-family: var(--p-font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--p-muted);
}
.records-toolbar .p-form-control {
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
}
.records-filter-actions {
  flex: 0 0 auto;
}
.records-table-shell .p-table-wrap {
  background: #fff;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  box-shadow: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.records-table {
  width: 100%;
  min-width: 820px;
  background: transparent;
  border: 0;
  border-collapse: collapse;
  table-layout: auto;
}
.records-table col.col-stt { width: 44px; }
.records-table col.col-sample { width: 1%; }
.records-table col.col-name { width: 12%; }
.records-table col.col-app-no { width: 12%; }
.records-table col.col-filed { width: 100px; }
.records-table col.col-group { width: 22%; min-width: 120px; }
.records-table col.col-applicant { width: 14%; }
.records-table col.col-country { width: 56px; }
.records-table th,
.records-table td {
  font-family: var(--p-font-ui) !important;
  font-size: 0.875rem !important;
  font-weight: 500;
  vertical-align: middle;
  text-align: center !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.records-table th {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700 !important;
  font-size: 0.7rem !important;
  white-space: nowrap;
  padding: 0.5rem 0.3rem !important;
}
.records-table td {
  padding: 0.4rem 0.3rem !important;
}
.records-table tbody tr {
  background: #fff;
}
.records-table .cell-bold {
  font-weight: 700 !important;
}
.records-table .cell-group {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  min-width: 0;
}
.records-table .cell-sample {
  text-align: center;
  width: 1%;
  white-space: nowrap;
  padding: 0.35rem 0.25rem !important;
}
.records-table .p-avatar.records-logo,
.records-table .records-logo {
  width: clamp(64px, 9vw, 108px);
  height: clamp(64px, 9vw, 108px);
  max-width: 108px;
  max-height: 108px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--p-line);
  border-radius: 8px;
  margin: 0 auto;
  font-size: clamp(0.75rem, 1.5vw, 1.1rem);
  display: grid;
  place-items: center;
}
.records-logo-link,
.records-name-link {
  color: inherit !important;
  text-decoration: none !important;
  display: inline-block;
  max-width: 100%;
}
.records-name-link:hover {
  color: var(--p-accent) !important;
  text-decoration: underline !important;
}
.records-table td .app-code {
  all: unset;
  font: inherit !important;
  color: inherit !important;
  background: none !important;
  padding: 0 !important;
  letter-spacing: normal !important;
}
.client-content .records-page-actions .p-btn {
  font-size: 0.875rem;
}

@media (max-width: 960px) {
  .client-topbar {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.65rem;
  }
  .client-topbar-title {
    flex: 1 1 auto;
    min-width: 0;
  }
  .client-topbar-actions {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
  }
  .client-topbar-actions .p-btn {
    white-space: nowrap;
  }
  .records-page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .records-page-actions {
    width: 100%;
  }
  .records-page-actions .p-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .records-page-head h1 {
    font-size: 1.4rem;
  }
  .records-table {
    min-width: 760px;
  }
  .records-table .p-avatar.records-logo,
  .records-table .records-logo {
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
  }
}

@media (max-width: 600px) {
  .client-content {
    padding: 0.55rem 0.4rem 1.25rem;
  }
  .client-topbar {
    padding: 0.65rem 0.55rem;
  }
  .records-toolbar {
    padding: 0.65rem 0.55rem;
  }
  .records-table {
    min-width: 700px;
  }
  .records-table th {
    font-size: 0.65rem !important;
    padding: 0.4rem 0.2rem !important;
  }
  .records-table td {
    padding: 0.3rem 0.2rem !important;
    font-size: 0.8rem !important;
  }
  .records-table .p-avatar.records-logo,
  .records-table .records-logo {
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
  }
  .client-topbar-actions .p-btn-sm {
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
  }
}

.suggest-wrap { position: relative; }
.suggest-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% - 0.35rem);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--p-border, #d7dee8);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 35, 70, 0.12);
  max-height: 240px;
  overflow: auto;
}
.suggest-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.suggest-list button:hover { background: rgba(26, 75, 140, 0.08); }
.suggest-list small {
  display: block;
  color: var(--p-muted, #6b778a);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

/* IP registration form (new.php) */
.reg-form {
  max-width: 860px;
  width: 100%;
  margin: 0 auto 3rem;
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.75rem 2.5rem;
  border: 1px solid var(--p-line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: visible;
  box-sizing: border-box;
}
.reg-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: start;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e8edf3;
}
.reg-back {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eef2f7;
  color: #1a4b8c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
}
.reg-back:hover { background: #e2e8f0; }
.reg-head-text {
  text-align: center;
}
.reg-eyebrow {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}
.reg-head h1 {
  margin: 0;
  font-family: var(--p-font-ui);
  font-size: 1.55rem;
  font-weight: 700;
  color: #1a4b8c;
  letter-spacing: -0.01em;
}
.reg-section {
  margin-bottom: 1.75rem;
}
.reg-section h2 {
  margin: 0 0 1rem;
  font-family: var(--p-font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.reg-block {
  position: relative;
  margin-bottom: 0.85rem;
  padding: 0.15rem 0;
}
.reg-field { margin-bottom: 0.75rem; }
.reg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.reg-row > .reg-field {
  min-width: 0;
}
.reg-row-goods {
  align-items: start;
}
.reg-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  font-family: var(--p-font);
  font-size: 0.95rem;
  color: #0f172a;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
}
select.reg-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}
.reg-input::placeholder { color: #94a3b8; }
.reg-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.reg-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  background: transparent;
  color: #2563eb;
  font-family: var(--p-font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
  margin-top: 0.15rem;
}
.reg-add:hover { color: #1d4ed8; }
.reg-add-ico {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
}
.reg-remove {
  position: absolute;
  top: 0.2rem;
  right: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  z-index: 1;
}
.reg-remove:hover { background: #fee2e2; color: #b91c1c; }
.reg-uploads {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .reg-uploads { grid-template-columns: 1fr; }
}
.reg-upload-label {
  font-family: var(--p-font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.65rem;
}
.reg-upload-note {
  margin: -0.35rem 0 1rem;
  color: #64748b;
  font-size: 0.88rem;
}
.reg-file-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  width: 100%;
  text-align: left;
}
.reg-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  margin-top: 0.35rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #0f172a;
}
.reg-file-list button {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
.reg-file-list button:hover { color: #b91c1c; }
.reg-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 170px;
  padding: 1.25rem 1rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.reg-dropzone:hover,
.reg-dropzone.is-drag {
  border-color: #3b82f6;
  background: #eff6ff;
}
.reg-drop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.35rem;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-family: var(--p-font-ui);
  font-size: 0.9rem;
  font-weight: 600;
}
.reg-drop-hint {
  font-size: 0.85rem;
  color: #64748b;
}
.reg-drop-file {
  font-size: 0.82rem;
  color: #1e40af;
  font-weight: 600;
  word-break: break-all;
  max-width: 100%;
}
.reg-extras {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.reg-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-family: var(--p-font-ui);
  font-size: 0.95rem;
  color: #0f172a;
  cursor: pointer;
  line-height: 1.45;
}
.reg-check input {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #1a4b8c;
  flex-shrink: 0;
}
.reg-extra-other {
  margin: -0.15rem 0 0.15rem 1.7rem;
}
.reg-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}
.reg-goods-name {
  min-height: 88px;
  overflow: hidden;
  resize: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.reg-field-hint {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--p-muted);
  line-height: 1.4;
}
.reg-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.reg-actions .p-btn {
  min-width: 140px;
  padding: 0.75rem 1.5rem;
}
.reg-preview-dialog {
  border: 0;
  padding: 0;
  max-width: min(720px, 94vw);
  width: 100%;
  border-radius: 12px;
  background: transparent;
  color: inherit;
}
.reg-preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}
.reg-preview-dialog-inner {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--p-line);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.reg-preview-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--p-line);
  flex-shrink: 0;
}
.reg-preview-dialog-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--p-accent);
}
.reg-preview-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: #f3f4f6;
  color: #334155;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.reg-preview-close:hover {
  background: #e5e7eb;
}
.reg-preview-dialog .reg-preview-body {
  padding: 1rem 1.15rem 0.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
}
.reg-preview-dialog-foot {
  padding: 0.85rem 1.15rem 1.1rem;
  border-top: 1px solid var(--p-line);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}
.reg-preview-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.reg-preview-meta span {
  display: block;
  font-size: 0.78rem;
  color: var(--p-muted);
  margin-bottom: 0.15rem;
}
.reg-preview-block {
  margin-bottom: 0.95rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--p-line);
}
.reg-preview-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.reg-preview-block h4 {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
}
.reg-preview-block p,
.reg-preview-block div {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.reg-preview-block ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}
.reg-preview-pre {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  background: #f8fafc;
  border: 1px solid var(--p-line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}
@media (max-width: 720px) {
  .reg-form { padding: 1.1rem 1rem 1.5rem; }
  .reg-row,
  .reg-uploads { grid-template-columns: 1fr; }
  .reg-head { grid-template-columns: 40px 1fr; }
  .reg-head h1 { font-size: 1.25rem; }
  .reg-preview-meta { grid-template-columns: 1fr; }
  .reg-actions .p-btn { min-width: 0; flex: 1 1 auto; }
}

body.public-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--p-bg, #f4f7fb);
}
body.public-page .public-main { flex: 1; }
body.public-page .public-header .nav-actions > a:not(.btn) {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  margin-right: 0.75rem;
}
body.public-page .public-header .nav-actions > a.active {
  color: var(--p-accent, #1a4b8c);
}

/* —— Admin content đồng bộ phong cách portal khách —— */
body.admin-body.theme-azure {
  --p-bg: #f5f7fb;
  --p-accent: #1d4ed8;
  --p-accent-soft: #ebf2ff;
  --p-card: #ffffff;
  --p-text: #1f2937;
  --p-muted: #6b7280;
  --p-line: #e5e7eb;
  --p-success: #15803d;
  --p-warning: #b45309;
  --p-danger: #b91c1c;
  --p-radius: 8px;
  --p-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
body.admin-body.theme-azure .admin-content {
  background: var(--p-bg);
}
body.admin-body .records-table-shell .p-table {
  background: #fff;
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  overflow: hidden;
}
body.admin-body .records-table .table-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
body.admin-body .records-table .table-actions form {
  display: inline;
  margin: 0;
}
body.admin-body .p-page-head h1 {
  color: #0f172a;
}
body.admin-body .admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--p-line);
}

/* Slate Minimal: màu chữ kiểu Instagram trên nền trắng / xám */
body.theme-slate .p-page-head h1,
body.theme-slate .p-section-title,
body.theme-slate .p-stat .value,
body.theme-slate .svc-card,
body.theme-slate .guide-list a,
body.theme-slate .fee-item,
body.theme-slate .reg-head h1,
body.theme-slate .reg-section h2,
body.theme-slate .reg-input,
body.theme-slate .reg-upload-label,
body.theme-slate .reg-file-list li,
body.theme-slate .reg-check {
  color: #262626 !important;
}
body.theme-slate .p-page-head p,
body.theme-slate .p-stat .label,
body.theme-slate .svc-hint,
body.theme-slate .reg-eyebrow,
body.theme-slate .reg-upload-note,
body.theme-slate .reg-drop-hint,
body.theme-slate .records-filter-field label {
  color: #737373 !important;
}
body.theme-slate .reg-input::placeholder {
  color: #a8a8a8;
}
body.theme-slate .reg-back,
body.theme-slate .reg-add,
body.theme-slate .reg-drop-file,
body.theme-slate .dossier-files a,
body.theme-slate .dp-files a {
  color: #0095f6 !important;
}
body.theme-slate .reg-back,
body.theme-slate .reg-remove,
body.theme-slate .reg-file-list li {
  background: #efefef;
}
body.theme-slate .reg-input,
body.theme-slate .reg-dropzone {
  border-color: #dbdbdb;
}
body.theme-slate .reg-input:focus,
body.theme-slate .reg-dropzone:hover,
body.theme-slate .reg-dropzone.is-drag {
  border-color: #0095f6;
  box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.12);
}

/* ==========================================================================
   Trang công khai (chưa đăng nhập) — dùng lại đúng khung portal của khách
   ========================================================================== */

/* Khu hành động trên topbar — dùng chung cho cả 3 layout */
.client-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-left: auto;
}
.client-topbar-actions .lang-switch {
  display: inline-flex;
}
/* Lang trên nền sáng (topbar trắng) — không dùng chữ trắng của style.css */
.client-topbar-actions .lang-switch a,
.client-topnav-right .lang-switch a,
body.public-body .client-topbar-actions .lang-switch a,
body.client-body .client-topbar .lang-switch a,
body.client-body .client-topnav-right .lang-switch a {
  color: var(--p-text) !important;
  border: 1px solid var(--p-line) !important;
  background: #fff !important;
}
.client-topbar-actions .lang-switch a.active,
.client-topbar-actions .lang-switch a:hover,
.client-topnav-right .lang-switch a.active,
.client-topnav-right .lang-switch a:hover,
body.client-body .client-topbar .lang-switch a.active,
body.client-body .client-topbar .lang-switch a:hover,
body.client-body .client-topnav-right .lang-switch a.active,
body.client-body .client-topnav-right .lang-switch a:hover {
  color: var(--p-accent) !important;
  border-color: var(--p-accent) !important;
  background: var(--p-accent-soft) !important;
}
.client-logout-top {
  white-space: nowrap;
}
body.layout-topnav .client-topnav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.client-topbar-sep {
  margin: 0 0.35rem;
  opacity: 0.45;
}
.client-side-foot .client-logout + .client-side-cta {
  margin-top: 0.5rem;
}
.client-side-foot[hidden] {
  display: none !important;
}

/* Hero */
.p-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-top: 3px solid var(--p-accent);
  border-radius: var(--p-radius);
  padding: 2rem 2.15rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.p-hero-text {
  min-width: 0;
}
.p-hero-eyebrow {
  display: block;
  font-family: var(--p-font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-accent);
}
.p-hero h1 {
  margin: 0.5rem 0 0.6rem;
  font-family: var(--p-font-ui);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--p-text);
  line-height: 1.15;
}
.p-hero p {
  margin: 0;
  max-width: 62ch;
  color: var(--p-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.p-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.35rem;
}
.p-hero-mark {
  flex-shrink: 0;
  width: 108px;
  height: 108px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--p-accent-soft);
  border: 1.5px solid var(--p-accent);
  color: var(--p-accent);
  font-family: var(--p-font-ui);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Điểm mạnh / features */
.p-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.p-feature {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 1.35rem 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.p-feature-num {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--p-accent-soft);
  color: var(--p-accent);
  font-family: var(--p-font-ui);
  font-size: 0.8rem;
  font-weight: 700;
}
.p-feature strong {
  display: block;
  margin: 0.8rem 0 0.4rem;
  font-family: var(--p-font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: var(--p-text);
}
.p-feature p {
  margin: 0;
  color: var(--p-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Giới thiệu + thông tin liên hệ */
.p-about {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 2rem;
  align-items: start;
}
.p-about h2 {
  margin: 0 0 0.6rem;
  font-family: var(--p-font-ui);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--p-text);
}
.p-about p {
  margin: 0;
  color: var(--p-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.p-info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.p-info-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--p-line);
}
.p-info-list li:last-child {
  border-bottom: 0;
}
.p-info-list .label {
  font-family: var(--p-font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--p-muted);
}
.p-info-list .value,
.p-info-list .value a {
  font-family: var(--p-font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--p-text);
  text-decoration: none;
}
.p-info-list .value a:hover {
  color: var(--p-accent);
}

/* Đăng nhập / đăng ký */
.p-auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.p-auth-aside h2 {
  margin: 0 0 0.6rem;
  font-family: var(--p-font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--p-text);
}
.p-auth-aside p {
  margin: 0 0 1rem;
  color: var(--p-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.p-auth-alt {
  margin: 1.35rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--p-muted);
}
.p-auth-alt a {
  color: var(--p-accent);
  font-weight: 600;
  text-decoration: none;
}
.p-form-hint {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--p-muted);
}
.p-form-group .req {
  color: var(--p-danger);
}

/* Chân trang trong vùng nội dung */
.p-portal-foot {
  margin-top: 2rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--p-line);
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 0.75rem 2rem;
  font-size: 0.85rem;
  color: var(--p-muted);
}
.p-portal-foot strong {
  display: block;
  color: var(--p-text);
  font-family: var(--p-font-ui);
  font-weight: 700;
}
.p-portal-foot span {
  display: block;
}
.p-portal-foot a {
  color: inherit;
  text-decoration: none;
}
.p-portal-foot a:hover {
  color: var(--p-accent);
}
.p-portal-foot-bottom {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--p-line);
  font-size: 0.8rem;
}
.p-portal-foot-bottom a {
  opacity: 0.6;
}

@media (max-width: 1000px) {
  .p-auth-grid {
    grid-template-columns: 1fr;
  }
  .p-about,
  .p-portal-foot {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 860px) {
  .p-feature-grid {
    grid-template-columns: 1fr;
  }
  .p-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1.35rem;
  }
  .p-hero h1 {
    font-size: 1.65rem;
  }
  .p-hero-mark {
    width: 72px;
    height: 72px;
    font-size: 1.25rem;
    border-radius: 14px;
  }
}
@media (max-width: 600px) {
  .client-topbar-actions .lang-switch {
    display: none;
  }
}

/* Slate Minimal (tông Instagram) cho trang công khai */
body.theme-slate .p-hero h1,
body.theme-slate .p-feature strong,
body.theme-slate .p-about h2,
body.theme-slate .p-auth-aside h2,
body.theme-slate .p-info-list .value,
body.theme-slate .p-info-list .value a,
body.theme-slate .p-portal-foot strong {
  color: #262626 !important;
}
body.theme-slate .p-hero p,
body.theme-slate .p-feature p,
body.theme-slate .p-about p,
body.theme-slate .p-auth-aside p,
body.theme-slate .p-auth-alt,
body.theme-slate .p-info-list .label,
body.theme-slate .p-portal-foot {
  color: #737373 !important;
}
body.theme-slate .p-auth-alt a,
body.theme-slate .p-info-list .value a:hover,
body.theme-slate .p-portal-foot a:hover {
  color: #0095f6 !important;
}

/* Bi?u m?u / POA */
.forms-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.forms-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-decoration: none !important;
  color: inherit !important;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.forms-hub-card:hover {
  border-color: var(--p-accent);
  box-shadow: 0 8px 24px rgba(26,75,140,0.1);
  transform: translateY(-2px);
}
.forms-hub-ico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--p-accent-soft);
  color: var(--p-accent);
  font-weight: 700;
  font-size: 0.8rem;
}
.forms-hub-card span { color: var(--p-muted); font-size: 0.9rem; }
.forms-list { list-style: none; margin: 0; padding: 0; }
.forms-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--p-line);
}
.forms-list-item:last-child { border-bottom: 0; }
.forms-list-builtin { background: #f8fafc; margin: -0.25rem -0.5rem 0; padding: 1rem 0.5rem; border-radius: 8px; border-bottom: 1px solid var(--p-line); }
.forms-list-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.forms-list-meta { color: var(--p-muted); font-size: 0.85rem; }
.forms-list-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; flex-shrink: 0; }
.forms-list-empty { padding: 1rem 0; color: var(--p-muted); }
.poa-form-card { max-width: 820px; margin: 0 auto; }
.poa-form-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.poa-form-head h1 {
  margin: 0;
  font-size: 1.35rem;
  text-align: center;
  flex: 1;
  font-family: var(--p-font-ui);
}
.poa-row { margin-bottom: 1rem; }
.poa-label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.poa-radios { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.poa-radio, .poa-check, .poa-check-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.poa-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.poa-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--p-line);
}
.poa-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.poa-sub { margin: 0.75rem 0 0.5rem; font-weight: 600; font-size: 0.9rem; }
.poa-checks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}
.poa-checks-objects {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.poa-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.poa-preview-toolbar { align-items: flex-start; }
.poa-preview-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.poa-preview-sheet {
  background: #fff;
  border: 1px solid var(--p-line);
  border-radius: 8px;
  padding: 2rem 2.25rem 3rem;
  max-width: 860px;
  margin: 0 auto 5rem;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}
body:has(.poa-preview-sheet) .chat-fab,
body.page-poa-preview .chat-fab {
  display: none !important;
}
body:has(.poa-preview-sheet) .client-content,
body.page-poa-preview .client-content {
  padding-bottom: 4rem !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.poa-doc {
  font-family: "Times New Roman", Times, serif;
  font-size: 15px;
  line-height: 1.55;
  color: #111;
}
.poa-doc p { margin: 0.45rem 0; }
.poa-doc em { font-style: italic; }
.poa-doc-title {
  text-align: center;
  font-size: 1.2rem;
  margin: 0 0 1.35rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  font-weight: 700;
}
.poa-doc-title span {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 1.05rem;
}
.poa-left { text-align: left; }
.poa-center-block {
  text-align: center;
  margin: 1.1rem 0 1.25rem;
}
.poa-party-name {
  font-weight: 700;
  text-transform: uppercase;
  margin: 0.35rem 0 !important;
}
.poa-party-line { margin: 0.2rem 0 !important; }
.poa-proc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0.65rem 0 1rem;
}
.poa-proc-item { text-align: left; }
.poa-obj-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.35rem;
  margin: 0.35rem 0 1rem;
}
.poa-sign-center {
  text-align: center;
  margin-top: 1.75rem;
  padding-bottom: 1rem;
}
.poa-sign-center p { margin: 0.25rem 0; }
.poa-date { margin-top: 0.65rem !important; }
.poa-applicant-label { margin-top: 1.35rem !important; }
.poa-job-title-line { margin-top: 0.35rem !important; margin-bottom: 0.25rem !important; }
.poa-sign-gap {
  height: 5.5rem;
  min-height: 5.5rem;
}
.poa-sign-name { margin-top: 0 !important; letter-spacing: 0.02em; }
@media (max-width: 720px) {
  .forms-hub-grid { grid-template-columns: 1fr; }
  .forms-list-item { flex-direction: column; align-items: flex-start; }
  .poa-row-split, .poa-checks-objects, .poa-proc-grid { grid-template-columns: 1fr; }
}
@media print {
  /* Bỏ ràng buộc viewport — cho phép nội dung tràn sang trang 2+ */
  html, body.client-body, body.page-poa-preview {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }
  .client-shell,
  .client-main,
  .client-content {
    display: block !important;
    position: static !important;
    height: auto !important;
    max-height: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
  }
  .no-print,
  .client-sidebar,
  .client-topbar,
  .nav-backdrop,
  .p-page-head,
  .client-rail,
  .chat-fab,
  .lang-switch {
    display: none !important;
  }
  .poa-preview-sheet {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
    background: #fff !important;
    overflow: visible !important;
  }
  .poa-doc {
    font-size: 12pt;
    overflow: visible !important;
  }
  .poa-sign-gap {
    height: 4.2cm;
    min-height: 4.2cm;
  }
  .poa-sign-center {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  @page {
    size: A4;
    margin: 16mm;
  }
}
