    :root {
      --navy: #003375;
      --navy2: #1a4a8a;
      --sea: #1e6db5;
      --foam: #e8f0fb;
      --wave: #c5d9f3;
      --gold: #d48b00;
      --danger: #c0392b;
      --ok: #1a8a5a;
      --txt: #1a2537;
      --mu: #677a95;
      --bg: #f0f4fa;
      --r: 10px;
      --sh: 0 3px 18px rgba(0, 51, 117, .10);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box
    }

    body {
      font-family: 'Be Vietnam Pro', sans-serif;
      background: var(--bg);
      color: var(--txt);
      min-height: 100vh
    }

    /* ── LOGIN ── */
    #appLogin {
      position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
      display: flex; align-items: center; justify-content: center;
      background: linear-gradient(-45deg, #001f3f, #003375, #1e6db5, #00b4d8);
      background-size: 400% 400%;
      animation: loginBgMesh 15s ease infinite;
    }

    @keyframes loginBgMesh { 0% { background-position: 0% 50% } 50% { background-position: 100% 50% } 100% { background-position: 0% 50% } }

    .login-wrapper { padding: 20px; width: 100%; max-width: 400px; }

    .login-glass-card {
      background: rgba(255, 255, 255, 0.93);
      backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 20px;
      padding: 38px 32px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    }

    .login-logo-container { text-align: center; margin-bottom: 30px; }
    .login-logo-container img { width: 80px; height: 80px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1)); }
    .login-badge-cloud {
      display: inline-block; background: linear-gradient(135deg, #00b4d8, #0096c7); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 12px;
      border-radius: 12px; letter-spacing: 0.5px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0, 180, 216, 0.3);
    }
    .login-brand { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: 1px; margin: 0 0 6px 0; }
    .login-subtitle { font-size: 13.5px; color: var(--mu); margin: 0; }
    .login-divider { width: 48px; height: 4px; background: linear-gradient(to right, var(--navy), #00b4d8); border-radius: 2px; margin: 16px auto 0; }

    .login-form { display: flex; flex-direction: column; gap: 20px; }

    .glass-field { position: relative; }
    .glass-field input {
      width: 100%; height: 56px; padding: 22px 16px 6px 16px; background: transparent;
      border: 1.5px solid rgba(200, 210, 225, 0.8); border-radius: 8px; font-size: 15px; font-family: inherit; color: var(--txt);
      outline: none; transition: 0.2s ease all;
    }
    .glass-field input:focus, .glass-field input:not(:placeholder-shown) {
      background: transparent; border-color: var(--sea); box-shadow: 0 0 0 3px rgba(30, 109, 181, 0.1);
    }
    .glass-field label.wave-label {
      position: absolute; left: 16px; top: 18px; color: var(--mu); font-size: 14.5px;
      pointer-events: none; font-weight: 500; display: flex;
    }
    .glass-field label.wave-label .char {
      transition: .25s ease all;
      transition-delay: calc(var(--index) * 0.04s);
    }
    .glass-field input:focus ~ label.wave-label .char, .glass-field input:not(:placeholder-shown) ~ label.wave-label .char {
      transform: translateY(-10px); font-size: 12.5px; color: var(--sea); font-weight: 600;
      background: transparent; /* Hoàn toàn trong suốt để hút 100% màu nền Login Card */
    }
    
    .btn-eye {
      position: absolute; right: 12px; top: 16px; background: none; border: none; padding: 4px; color: var(--mu);
      cursor: pointer; transition: .2s; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    }
    .btn-eye:hover { color: var(--sea); background: rgba(30,109,181,0.06); }

    .login-btn-neon {
      position: relative; overflow: hidden; width: 100%; height: 50px; margin-top: 10px;
      background: linear-gradient(135deg, var(--navy), var(--sea)); color: #fff; border: none; border-radius: 12px;
      font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 6px 16px rgba(30, 109, 181, 0.25);
      display: flex; align-items: center; justify-content: center;
    }
    .login-btn-neon::after {
      content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
      background: linear-gradient(to right, transparent, rgba(255,255,255,0.25), transparent); transform: skewX(-20deg); transition: 0.5s;
    }
    .login-btn-neon:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30, 109, 181, 0.4); }
    .login-btn-neon:hover:not(:disabled)::after { left: 150%; }
    .login-btn-neon:disabled { opacity: 0.7; cursor: not-allowed; transform: none; background: var(--mu); box-shadow: none; pointer-events: none; }

    .login-footer { margin-top: 24px; text-align: center; font-size: 12px; color: #94a3b8; font-weight: 500; }

    /* TOPBAR */
    .topbar {
      background: linear-gradient(135deg, #001f4d 0%, var(--navy) 60%, var(--navy2) 100%);
      color: #fff;
      padding: 0 18px;
      display: flex;
      align-items: center;
      gap: 7px;
      position: sticky;
      top: 0;
      z-index: 100;
      box-shadow: 0 2px 16px rgba(0, 0, 0, .25)
    }

    .tb-brand {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 0;
      flex-shrink: 0
    }

    .tb-ico {
      font-size: 18px;
      background: rgba(255, 255, 255, .15);
      border-radius: 50%;
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1.5px solid rgba(255, 255, 255, .25)
    }

    .tb-name {
      font-size: 12.5px;
      font-weight: 700
    }

    .tb-sub {
      font-size: 10px;
      opacity: .6
    }

    .tb-nav {
      display: flex;
      gap: 2px;
      margin-left: auto;
      flex-wrap: wrap
    }

    .tab-btn {
      background: rgba(255, 255, 255, .1);
      border: none;
      color: rgba(255, 255, 255, .75);
      padding: 6px 12px;
      border-radius: 7px;
      cursor: pointer;
      font-family: inherit;
      font-size: 12px;
      font-weight: 500;
      transition: .2s
    }

    .tab-btn:hover {
      background: rgba(255, 255, 255, .18);
      color: #fff
    }

    .tab-btn.active {
      background: rgba(255, 255, 255, .22);
      color: #fff;
      font-weight: 700;
      box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35)
    }

    .tab-btn.tab-locked {
      opacity: .4;
      position: relative;
    }
    .tab-btn.tab-locked::after {
      content: '🔒';
      font-size: 9px;
      margin-left: 2px;
    }

    .tb-user {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 9px;
      background: rgba(255, 255, 255, .1);
      border-radius: 8px;
      margin-left: 6px
    }

    .tb-user-name {
      font-size: 12px;
      font-weight: 600
    }

    .tb-user-role {
      font-size: 10px;
      opacity: .6
    }

    .tb-logout {
      background: rgba(255, 255, 255, .12);
      border: 1.5px solid rgba(255, 255, 255, .2);
      color: #fff;
      padding: 5px 10px;
      border-radius: 7px;
      font-size: 11.5px;
      font-weight: 500;
      font-family: inherit;
      cursor: pointer;
      white-space: nowrap
    }

    .tb-logout:hover {
      background: rgba(255, 255, 255, .22)
    }

    /* MAIN */
    .main {
      max-width: 1360px;
      margin: 0 auto;
      padding: 18px 13px
    }

    .tab-pane {
      display: none;
      animation: fadeIn .2s
    }

    .tab-pane.active {
      display: block
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(4px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    .sec-hdr {
      display: flex;
      align-items: center;
      gap: 9px;
      margin-bottom: 13px
    }

    .sec-hdr h2 {
      font-size: 17px;
      font-weight: 700;
      color: var(--navy)
    }

    .sec-line {
      flex: 1;
      height: 2px;
      background: linear-gradient(to right, var(--wave), transparent)
    }

    /* FORM */
    .phieu-card {
      background: #fff;
      border-radius: var(--r);
      box-shadow: var(--sh);
      overflow: hidden
    }

    .phieu-hdr-bar {
      background: linear-gradient(135deg, var(--navy), var(--navy2));
      color: #fff;
      padding: 11px 18px;
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    .phieu-hdr-bar h3 {
      font-size: 13.5px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .5px
    }

    .phieu-body {
      padding: 14px 18px
    }

    .meta-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 10px;
      margin-bottom: 12px
    }

    .field {
      display: flex;
      flex-direction: column;
      gap: 4px
    }

    .flbl {
      font-size: 11px;
      font-weight: 600;
      color: var(--mu);
      text-transform: uppercase;
      letter-spacing: .4px
    }

    .flbl span {
      color: var(--danger)
    }

    .finput {
      border: 1.5px solid var(--wave);
      border-radius: 7px;
      padding: 7px 10px;
      font-size: 13px;
      font-family: inherit;
      color: var(--txt);
      background: #fafcff;
      outline: none;
      transition: .2s;
      width: 100%
    }

    .finput:focus {
      border-color: var(--sea);
      box-shadow: 0 0 0 3px rgba(30, 109, 181, .11)
    }

    /* CUSTOM DROPDOWN */
    .csel {
      position: relative
    }

    .cdrop-list {
      position: absolute;
      top: calc(100% + 2px);
      left: 0;
      z-index: 500;
      background: #fff;
      border: 1.5px solid var(--sea);
      border-radius: 8px;
      max-height: 200px;
      overflow-y: auto;
      box-shadow: 0 8px 24px rgba(0, 51, 117, .18);
      display: none;
      white-space: nowrap
    }

    .cdrop-item {
      padding: 8px 12px;
      cursor: pointer;
      font-size: 13px;
      transition: .15s;
      display: flex;
      flex-direction: column;
      gap: 2px;
      border-bottom: 1px solid var(--foam)
    }

    .cdrop-item:last-child {
      border-bottom: none
    }

    .cdrop-item:hover {
      background: var(--foam)
    }

    .cdi-name {
      font-weight: 500;
      color: var(--txt)
    }

    .cdi-sub {
      font-size: 11.5px;
      color: var(--mu)
    }

    .cdrop-empty {
      padding: 10px 12px;
      font-size: 12.5px;
      color: var(--mu);
      font-style: italic
    }

    /* TABLE IN FORM */
    .tbl-wrap {
      overflow: visible;
      border: 1.5px solid var(--wave);
      border-radius: 8px
    }

    .form-tbl {
      width: 100%;
      border-collapse: collapse;
      min-width: 640px
    }

    .form-tbl thead th {
      background: var(--navy);
      color: #fff;
      padding: 7px 7px;
      font-size: 11.5px;
      font-weight: 600;
      white-space: nowrap;
      text-align: center
    }

    .form-tbl thead th:nth-child(2) {
      text-align: left
    }

    .form-tbl tbody tr {
      border-bottom: 1px solid var(--foam);
      transition: .12s
    }

    .form-tbl tbody tr:hover {
      background: #f5f8ff
    }

    .form-tbl tbody td {
      padding: 4px 5px;
      font-size: 12.5px
    }

    .form-tbl tfoot td {
      padding: 7px 9px;
      background: var(--foam);
      font-size: 13px
    }

    .ci {
      border: 1.5px solid var(--wave);
      border-radius: 6px;
      padding: 5px 6px;
      font-size: 13px;
      font-family: inherit;
      width: 100%;
      outline: none;
      transition: .15s;
      background: #fff
    }

    .ci:focus {
      border-color: var(--sea);
      background: #f0f6ff
    }

    .ci-sm {
      min-width: 62px
    }

    .ci-num {
      min-width: 78px;
      text-align: right
    }

    /* TRỢ GIÁ */
    .trg-field {
      display: flex;
      align-items: center;
      gap: 10px;
      background: #ecfbf1;
      border: 1.5px solid #a3dbb8;
      border-radius: 8px;
      padding: 9px 14px;
      margin-top: 9px
    }

    .trg-field label {
      font-size: 12.5px;
      font-weight: 600;
      color: var(--ok);
      white-space: nowrap
    }

    /* BUTTONS */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 7px 15px;
      border: none;
      border-radius: 8px;
      font-family: inherit;
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer;
      transition: .2s
    }

    .btn.sm {
      padding: 6px 11px;
      font-size: 12px
    }

    .btn-primary {
      background: linear-gradient(135deg, var(--sea), var(--navy2));
      color: #fff;
      box-shadow: 0 2px 10px rgba(30, 109, 181, .3)
    }

    .btn-primary:hover:not(:disabled) {
      transform: translateY(-1px)
    }

    .btn-primary:disabled {
      opacity: .6;
      cursor: not-allowed
    }

    .btn-print {
      background: linear-gradient(135deg, #e67e22, var(--danger));
      color: #fff
    }

    .btn-print:hover {
      transform: translateY(-1px)
    }

    .btn-outline {
      background: #fff;
      color: var(--navy);
      border: 1.5px solid var(--wave)
    }

    .btn-outline:hover {
      border-color: var(--sea);
      background: var(--foam)
    }

    .btn-add-row {
      background: var(--foam);
      color: var(--navy);
      border: 1.5px dashed var(--wave);
      width: 100%;
      padding: 6px;
      border-radius: 6px;
      font-family: inherit;
      font-size: 12.5px;
      font-weight: 500;
      cursor: pointer;
      transition: .2s;
      margin-top: 4px
    }

    .btn-add-row:hover {
      border-color: var(--sea);
      background: #dce8f8
    }

    .icon-btn {
      background: none;
      border: none;
      cursor: pointer;
      font-size: 13px;
      padding: 3px 5px;
      border-radius: 5px;
      transition: .15s;
      line-height: 1
    }

    .icon-btn.del:hover {
      background: #fde8e8;
      color: var(--danger)
    }

    .icon-btn.edit:hover {
      background: #e8f0fb;
      color: var(--sea)
    }

    .icon-btn.view:hover {
      background: #e8f8ee;
      color: var(--ok)
    }

    .icon-btn.copy {
      color: var(--ok);
      font-size: 14px
    }

    .icon-btn.copy:hover {
      background: #e8f8ee
    }

    .ok-txt {
      color: var(--ok)
    }

    .danger-txt {
      color: var(--danger)
    }

    /* FILTER / STAT */
    .filter-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      background: #fff;
      border-radius: var(--r);
      padding: 9px 14px;
      box-shadow: var(--sh);
      margin-bottom: 13px
    }

    .filter-bar label {
      font-size: 12px;
      font-weight: 600;
      color: var(--mu);
      white-space: nowrap
    }

    .stat-row {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 9px;
      margin-bottom: 13px
    }

    .stat {
      background: #fff;
      border-radius: var(--r);
      padding: 11px 14px;
      box-shadow: var(--sh);
      border-top: 3px solid var(--sea)
    }

    .stat-v {
      font-size: 16px;
      font-weight: 700;
      color: var(--navy)
    }

    .stat-l {
      font-size: 11.5px;
      color: var(--mu);
      margin-top: 2px
    }

    .tbl-card {
      background: #fff;
      border-radius: var(--r);
      box-shadow: var(--sh);
      overflow: hidden
    }

    .dtbl {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px
    }

    .dtbl td,
    .dtbl th {
      white-space: nowrap
    }

    .dtbl thead th {
      background: linear-gradient(135deg, var(--navy), var(--navy2));
      color: #fff;
      padding: 8px 11px;
      font-size: 12px;
      font-weight: 600;
      text-align: left;
      white-space: nowrap
    }

    .dtbl tbody tr {
      border-bottom: 1px solid var(--foam);
      transition: .12s
    }

    .dtbl tbody tr:hover {
      background: var(--foam)
    }

    .dtbl tbody td {
      padding: 7px 11px
    }

    .dtbl tfoot td {
      padding: 7px 11px;
      background: var(--foam);
      font-size: 13px;
      border-top: 2px solid var(--wave)
    }

    .empty {
      text-align: center;
      color: var(--mu);
      padding: 32px !important;
      font-size: 13px
    }

    .center {
      text-align: center
    }

    .right {
      text-align: right
    }

    .bold {
      font-weight: 700
    }

    .navy {
      color: var(--navy)
    }

    .nowrap {
      white-space: nowrap
    }

    /* PHIẾU BLOCKS */
    .phieu-block {
      border-radius: 8px;
      overflow: hidden;
      box-shadow: var(--sh);
      border: 1.5px solid var(--navy)
    }

    .phieu-block-hdr {
      background: linear-gradient(135deg, var(--navy), var(--navy2));
      color: #fff;
      padding: 8px 13px;
      display: flex;
      align-items: center;
      gap: 5px;
      flex-wrap: wrap;
      font-size: 12.5px
    }

    .phieu-num-badge {
      background: rgba(255, 255, 255, .15);
      padding: 1px 7px;
      border-radius: 10px;
      font-size: 11px;
      font-weight: 700
    }

    .phieu-sp-badge {
      background: rgba(255, 255, 255, .25);
      padding: 2px 9px;
      border-radius: 10px;
      font-size: 12.5px;
      font-weight: 700
    }

    .phieu-date-txt {
      opacity: .85;
      font-size: 12px
    }

    .phieu-kh-txt {
      font-weight: 600
    }

    .phieu-dc-txt {
      opacity: .65;
      font-size: 11.5px
    }

    .kho-badge {
      background: rgba(240, 200, 100, .3);
      border: 1px solid rgba(240, 200, 100, .5);
      padding: 1px 8px;
      border-radius: 10px;
      font-size: 11.5px;
      font-weight: 600
    }

    .phieu-sum-right {
      margin-left: auto;
      font-size: 12px;
      opacity: .9;
      white-space: nowrap
    }

    .phieu-footer-bar {
      background: var(--foam);
      padding: 6px 13px;
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      border-top: 1px solid var(--wave)
    }

    .actions-right {
      margin-left: auto;
      display: flex;
      gap: 4px
    }

    .inner-tbl {
      border-radius: 0
    }

    .inner-tbl thead th {
      border-radius: 0
    }

    .r-even td {
      background: #fff
    }

    .r-odd td {
      background: #f7f9fd
    }

    .grand-total-bar {
      background: var(--navy);
      color: #fff;
      padding: 10px 14px;
      border-radius: 8px;
      margin-top: 5px;
      display: flex;
      justify-content: space-between;
      font-weight: 700;
      font-size: 13px
    }

    /* SUM */
    .sum-mode-bar {
      display: flex;
      gap: 4px;
      margin-bottom: 10px;
      flex-wrap: wrap
    }

    .smbtn {
      padding: 6px 14px;
      border: 1.5px solid var(--wave);
      background: #fff;
      border-radius: 7px;
      font-family: inherit;
      font-size: 12.5px;
      font-weight: 500;
      cursor: pointer;
      color: var(--mu);
      transition: .2s
    }

    .smbtn:hover {
      border-color: var(--sea);
      color: var(--navy)
    }

    .smbtn.active {
      background: var(--navy);
      color: #fff;
      border-color: var(--navy)
    }

    .filter-sum {
      background: #fff;
      border-radius: var(--r);
      padding: 10px 14px;
      box-shadow: var(--sh);
      margin-bottom: 12px
    }

    .filter-sum-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 6px
    }

    .filter-sum-row:last-child {
      margin-bottom: 0;
      border-top: 1px solid var(--foam);
      padding-top: 8px
    }

    .filter-sum label {
      font-size: 11.5px;
      font-weight: 600;
      color: var(--mu);
      white-space: nowrap;
      min-width: 70px
    }

    .filter-sum select,
    .filter-sum input {
      border: 1.5px solid var(--wave);
      border-radius: 7px;
      padding: 6px 9px;
      font-size: 12.5px;
      font-family: inherit;
      color: var(--txt);
      background: #fafcff;
      outline: none
    }

    .sum-cards {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
      gap: 9px;
      margin-bottom: 12px
    }

    .scard {
      background: #fff;
      border-radius: var(--r);
      padding: 12px;
      text-align: center;
      box-shadow: var(--sh)
    }

    .scard.c1 {
      border-top: 3px solid var(--sea)
    }

    .scard.c2 {
      border-top: 3px solid var(--ok)
    }

    .scard.c3 {
      border-top: 3px solid var(--gold)
    }

    .scard.c4 {
      border-top: 3px solid var(--danger)
    }

    .scard .sv {
      font-size: 16px;
      font-weight: 700
    }

    .scard.c1 .sv {
      color: var(--sea)
    }

    .scard.c2 .sv {
      color: var(--ok)
    }

    .scard.c3 .sv {
      color: var(--gold)
    }

    .scard.c4 .sv {
      color: var(--danger)
    }

    .scard .sl {
      font-size: 11px;
      color: var(--mu);
      margin-top: 2px;
      font-weight: 500
    }

    #sum_title {
      font-size: 14px;
      font-weight: 700;
      color: var(--navy);
      margin-bottom: 10px
    }

    /* ĐỊNH MỨC */
    .dm-form {
      background: #fff;
      border-radius: var(--r);
      box-shadow: var(--sh);
      padding: 16px 18px;
      margin-bottom: 14px
    }

    .dm-info {
      background: var(--foam);
      border: 1.5px solid var(--wave);
      border-radius: 7px;
      padding: 8px 13px;
      font-size: 13px;
      margin: 8px 0;
      display: none
    }

    .dm-result {
      background: #ecfbf1;
      border: 1.5px solid #a3dbb8;
      border-radius: 8px;
      padding: 12px 16px;
      margin-top: 10px;
      display: none
    }

    .dm-result-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 10px;
      margin-top: 8px
    }

    .dm-card {
      text-align: center;
      padding: 8px;
      background: #fff;
      border-radius: 7px;
      box-shadow: 0 1px 6px rgba(0, 0, 0, .06)
    }

    .dm-card .dv {
      font-size: 20px;
      font-weight: 700
    }

    .dm-card .dl {
      font-size: 11px;
      color: var(--mu);
      margin-top: 2px
    }

    /* CFG */
    .cfg-tabs {
      display: flex;
      gap: 3px;
      flex-wrap: wrap;
      margin-bottom: 12px;
      background: #fff;
      border-radius: var(--r);
      padding: 8px;
      box-shadow: var(--sh)
    }

    .cfg-tabs button {
      padding: 6px 12px;
      border: 1.5px solid var(--wave);
      background: #fff;
      border-radius: 7px;
      font-family: inherit;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      color: var(--mu);
      transition: .2s
    }

    .cfg-tabs button:hover {
      border-color: var(--sea);
      color: var(--navy)
    }

    .cfg-tabs button.active {
      background: var(--navy);
      color: #fff;
      border-color: var(--navy)
    }

    .add-bar {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-bottom: 11px;
      flex-wrap: wrap
    }

    .inline-edit {
      border: 1px solid transparent;
      border-radius: 5px;
      padding: 4px 7px;
      font-family: inherit;
      font-size: 12.5px;
      background: transparent;
      width: 100%;
      transition: .15s;
      outline: none
    }

    .inline-edit:hover {
      border-color: var(--wave);
      background: #fafcff
    }

    .inline-edit:focus {
      border-color: var(--sea);
      background: #f0f6ff
    }

    .rbadge {
      padding: 2px 8px;
      border-radius: 11px;
      font-size: 11.5px;
      font-weight: 600
    }

    .r-admin {
      background: #e8e0fb;
      color: #3c3489
    }

    .r-ketoan {
      background: #e1f5ee;
      color: #085041
    }

    .r-kho {
      background: #faeeda;
      color: #633806
    }

    .chip {
      padding: 2px 8px;
      border-radius: 11px;
      font-size: 11.5px;
      font-weight: 600
    }

    .chip.ok {
      background: #e1f5ee;
      color: #085041
    }

    .chip.er {
      background: #fcebeb;
      color: #a32d2d
    }

    .chip.log-neu {
      background: var(--foam);
      color: var(--navy2)
    }

    .tog-wrap {
      display: flex;
      align-items: center;
      gap: 5px;
      cursor: pointer
    }

    .tog-wrap input {
      display: none
    }

    .tog {
      width: 30px;
      height: 16px;
      background: var(--wave);
      border-radius: 8px;
      position: relative;
      transition: .2s;
      flex-shrink: 0
    }

    .tog::after {
      content: '';
      position: absolute;
      top: 2px;
      left: 2px;
      width: 12px;
      height: 12px;
      background: #fff;
      border-radius: 50%;
      transition: .2s
    }

    .tog-wrap input:checked+.tog {
      background: var(--ok)
    }

    .tog-wrap input:checked+.tog::after {
      left: 16px
    }

    .toast {
      position: fixed;
      bottom: 18px;
      right: 18px;
      padding: 10px 17px;
      border-radius: 9px;
      font-size: 13px;
      font-weight: 500;
      box-shadow: 0 4px 20px rgba(0, 0, 0, .18);
      transform: translateY(60px);
      opacity: 0;
      transition: .28s;
      z-index: 999;
      pointer-events: none
    }

    .toast.show {
      transform: translateY(0);
      opacity: 1
    }

    .toast.ok {
      background: var(--ok);
      color: #fff
    }

    .toast.warn {
      background: #e67e22;
      color: #fff
    }

    .toast.err {
      background: var(--danger);
      color: #fff
    }

    ::-webkit-scrollbar {
      width: 5px;
      height: 5px
    }

    ::-webkit-scrollbar-thumb {
      background: var(--wave);
      border-radius: 3px
    }

    @media(max-width:720px) {
      .topbar {
        padding: 0 8px;
        flex-wrap: wrap
      }

      .tab-btn {
        padding: 5px 8px;
        font-size: 11px
      }

      .main {
        padding: 10px 6px
      }

      .phieu-body {
        padding: 11px
      }

      .tb-user-role,
      .tb-sub {
        display: none
      }
    }

    /* ── DASHBOARD ── */
    .db-stats {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 10px;
    }
    .db-stat-card {
      background: #fff;
      border-radius: var(--r);
      padding: 16px;
      box-shadow: var(--sh);
      text-align: center;
      border-top: 3px solid var(--sea);
      transition: .2s;
    }
    .db-stat-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 6px 24px rgba(0,51,117,.12);
    }
    .db-stat-icon {
      width: 40px; height: 40px;
      border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      font-size: 18px;
      margin: 0 auto 10px;
    }
    .db-stat-val {
      font-size: 22px;
      font-weight: 800;
      color: var(--navy);
      margin-bottom: 2px;
    }
    .db-stat-label {
      font-size: 11px;
      color: var(--mu);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .3px;
    }
    .db-card {
      background: #fff;
      border-radius: var(--r);
      box-shadow: var(--sh);
      overflow: hidden;
    }
    .db-card-hdr {
      background: linear-gradient(135deg, var(--navy), var(--navy2));
      color: #fff;
      padding: 10px 16px;
      font-size: 13px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .db-card-body {
      padding: 0;
    }
    /* Price table */
    .db-price-tbl {
      width: 100%;
      border-collapse: collapse;
      font-size: 12.5px;
    }
    .db-price-tbl thead th {
      background: var(--foam);
      padding: 8px 10px;
      font-size: 11px;
      font-weight: 700;
      color: var(--navy);
      text-align: left;
      border-bottom: 2px solid var(--wave);
    }
    .db-price-tbl tbody td {
      padding: 7px 10px;
      border-bottom: 1px solid var(--foam);
    }
    .db-price-tbl tbody tr:hover {
      background: #f8fbff;
    }
    .price-up { color: var(--ok); font-weight: 700; }
    .price-down { color: var(--danger); font-weight: 700; }
    .price-same { color: var(--mu); }
    /* Recent list */
    .db-recent-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--foam);
      transition: .15s;
    }
    .db-recent-item:hover {
      background: var(--foam);
    }
    .db-recent-item:last-child {
      border-bottom: none;
    }
    .db-ri-num {
      background: var(--sea);
      color: #fff;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
    }
    .db-ri-info {
      flex: 1;
      min-width: 0;
    }
    .db-ri-info b {
      font-size: 12.5px;
      color: var(--navy);
      display: block;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .db-ri-info small {
      font-size: 11px;
      color: var(--mu);
    }
    .db-ri-amount {
      font-size: 13px;
      font-weight: 700;
      color: var(--navy);
      white-space: nowrap;
    }
    /* Bar chart */
    .db-bar-chart {
      padding: 16px;
    }
    .db-bar-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
    }
    .db-bar-label {
      width: 120px;
      font-size: 12px;
      font-weight: 600;
      color: var(--navy);
      text-align: right;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .db-bar-track {
      flex: 1;
      height: 24px;
      background: var(--foam);
      border-radius: 6px;
      overflow: hidden;
      position: relative;
    }
    .db-bar-fill {
      height: 100%;
      border-radius: 6px;
      background: linear-gradient(135deg, var(--sea), var(--navy2));
      display: flex;
      align-items: center;
      padding-left: 8px;
      font-size: 11px;
      font-weight: 700;
      color: #fff;
      min-width: fit-content;
      transition: width .8s ease-out;
    }
    .db-bar-val {
      font-size: 12px;
      font-weight: 700;
      color: var(--navy);
      width: 80px;
      text-align: right;
    }

    @media (max-width: 768px) {
      .db-stats { grid-template-columns: repeat(2, 1fr); }
      #db_grid { grid-template-columns: 1fr !important; }
    }

    /* Logo image */
    .tb-logo-img {
      width: 40px;
      height: 40px;
      object-fit: contain;
    }
