.financial-stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; margin: 24px 0; }
.financial-stats article { display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: 18px; background: #fff; border: 1px solid #d7e4df; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.financial-stats article:first-child { background: #103e39; color: white; }
.financial-stats article:hover { transform: translateY(-3px); border-color: #b8d2c9; box-shadow: 0 14px 30px rgba(20, 76, 66, .11); }
.financial-stats strong { font-size: clamp(22px, 2.4vw, 34px); font-weight: 800; overflow-wrap: anywhere; color: #0f3f37; }
.financial-stats article:first-child strong { color: #fff; }
.financial-stats small { font-size: 11px; letter-spacing: 1px; font-weight: 800; color: #365f58; }
.financial-stats article:first-child small { color: #d7f0e8; }
.financial-stats span, .financial-stats a { font-size: 12px; font-weight: 650; color: #4d6964; }
.financial-stats article:first-child span { color: #d7eee7; }
.chart-panels { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; margin-bottom: 24px; }
.chart-panels .panel { min-width: 0; overflow: visible; }
.chart-content { padding: 0 20px 20px; overflow-x: auto; overflow-y: visible; position: relative; scrollbar-color: rgba(45,145,123,.35) transparent; }
.chart-content details { max-height: 280px; overflow: auto; }
.chart-content summary { cursor: pointer; font-size: 12px; color: #315f57; font-weight: 700; }
.activity-chart { width: 100%; display: block; overflow: visible; position: relative; z-index: 2; }
.chart-panels svg text { fill: #405f59; font-size: 11px; font-weight: 650; }
.chart-panels svg .axis-label { fill: #31544e; font-size: 12px; font-weight: 750; }
.chart-panels svg .donut-total { font-size: 31px; font-weight: 850; fill: #103e39; }
.chart-panels svg .donut-caption { fill: #456862; font-weight: 750; }
.chart-gridline { stroke: #e9efed; fill: none; }
.chart-import { fill: #d94b4b; }
.chart-export { fill: #174ea6; }
.chart-hit-area { fill: transparent; pointer-events: all; }
.chart-bar-group rect { transform-box: fill-box; transform-origin: center bottom; transition: transform .18s ease, filter .18s ease, opacity .18s ease; }
.chart-bar-group:hover .chart-import { fill: #c83f3f; }
.chart-bar-group:hover .chart-export { fill: #0b3d91; }
.chart-bar-group:hover rect { transform: scale(1.08, 1.04); filter: drop-shadow(0 7px 9px rgba(28, 72, 67, .22)); opacity: .98; }
.chart-bar-group:hover .chart-hit-area { transform: none; filter: none; opacity: 1; }
.bar-popover, .donut-popover { opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease; z-index: 20; }
.chart-bar-group:hover .bar-popover, .donut-segment:hover .donut-popover { opacity: 1; }
.bar-popover div, .donut-popover div { display: grid; gap: 6px; min-width: 150px; max-width: 220px; padding: 11px 13px; border: 1px solid rgba(15, 62, 57, .16); border-radius: 14px; background: rgba(255,255,255,.98); color: #173f39; box-shadow: 0 14px 34px rgba(22, 62, 56, .22); font-size: 11px; line-height: 1.28; }
.bar-popover b, .donut-popover b { font-size: 13px; font-weight: 850; }
.bar-popover span { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; color: #315f57; font-weight: 750; }
.bar-popover i { font-style: normal; color: #42645e; }
.bar-popover strong { color: #103e39; font-weight: 900; }
.bar-popover small { color: #647c77; font-weight: 700; text-align: right; }
.donut-popover > div > span { color: #315f57; font-weight: 800; }
.donut-popover small { display: grid; gap: 5px; max-height: 74px; overflow-y: auto; overscroll-behavior: contain; color: #496b65; font-weight: 650; padding-right: 4px; }
.donut-popover small span { display: grid; gap: 1px; min-width: 0; }
.donut-popover small b { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-popover small em { font-style: normal; color: #607a75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-import { color: #c83f3f; font-weight: 800; }
.legend-export { color: #174ea6; font-weight: 800; }
.legend-import i, .legend-export i { width: 13px; height: 13px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: -2px; box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 3px 8px rgba(22,62,56,.16); }
.legend-import i { background: #d94b4b; }
.legend-export i { background: #174ea6; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: #31544e; align-items: center; }
.chart-legend strong { font-size: 12px; color: #456862; }
.expiry-chart { padding: 0 24px 24px; overflow: visible; position: relative; z-index: 2; }
.expiry-chart svg { width: 180px; display: block; margin: auto; overflow: visible; }
.expiry-chart ul { list-style: none; padding: 0; margin: 0; }
.expiry-chart li { display: flex; align-items: center; gap: 11px; padding: 8px 0; font-size: 12px; color: #304f49; font-weight: 700; }
.expiry-chart li b { margin-left: auto; font-weight: 850; color: #103e39; }
.expiry-chart li > span:first-child { font-size: 18px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(22,62,56,.12)); }
.donut-arc { transform-origin: 100px 100px; }
.expiry-chart svg:hover .donut-arc { animation: donutSpinOnce .9s cubic-bezier(.2,.72,.18,1) 1; }
.donut-segment circle { transition: stroke-width .2s ease, filter .2s ease, opacity .2s ease; }
.donut-segment:hover circle, .donut-segment.selected circle { stroke-width: 27px; filter: drop-shadow(0 8px 9px rgba(22, 62, 56, .22)); opacity: .98; }
@keyframes donutSpinOnce { to { transform: rotate(360deg); } }
.chart-normal { stroke: #3b82f6; color: #3b82f6; }
.chart-soon { stroke: #eab749; color: #ae7b10; }
.chart-warning { stroke: #f08a45; color: #be5916; }
.chart-expired { stroke: #d95f69; color: #c14451; }
@media (max-width: 1000px) { .chart-panels { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .financial-stats { grid-template-columns: 1fr; } }
:root {
  --green: #087f70;
  --dark: #163e38;
  --ink: #223735;
  --muted: #71817e;
  --line: #e3ebe8;
  --bg: #f5f8f7;
  --blue: #327bbd;
  --danger: #c14848;
  --radius: 16px;
  font-family: Segoe UI, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
}

button, a, input, select {
  touch-action: manipulation;
}

/* Nút bấm & Micro-interactions */
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 15px;
  border-radius: 9px;
  color: var(--ink);
  font-weight: 600;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
  will-change: transform;
}

/* Zoom in & Lift khi hover (chuẩn bị nhấn) */
button:hover:not(:disabled) {
  background: #edf5f2;
  border-color: #b9d4ca;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 12px rgba(22, 62, 56, 0.1);
}

/* Zoom out & Press khi click */
button:active:not(:disabled) {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 1px 3px rgba(22, 62, 56, 0.12);
  transition-duration: 0.08s;
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

button:focus-visible, a:focus-visible {
  outline: 3px solid #85cabc;
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.primary:hover:not(:disabled) {
  background: #056657;
  color: #fff;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(8, 127, 112, 0.28);
}

.primary:active:not(:disabled) {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 2px 6px rgba(8, 127, 112, 0.2);
}

.danger {
  color: var(--danger);
}

.danger:hover:not(:disabled) {
  border-color: #f0c3c3;
  background: #fdf5f5;
}

.full {
  width: 100%;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--green);
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

h2 {
  font-size: 24px;
  letter-spacing: -.5px;
}

h3 {
  font-size: 16px;
}

small {
  font-size: 12px;
}

.brand {
  display: flex;
  align-items: center;
  font-size: 23px;
  font-weight: 750;
  letter-spacing: -1px;
  white-space: nowrap;
}

.brand > span:last-child {
  font-weight: 400;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--green);
  color: white;
  border-radius: 11px;
  font-size: 28px;
  margin-right: 10px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-mark {
  transform: scale(1.08) rotate(4deg);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-story {
  background: #e4f1eb;
  padding: 50px 65px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 65px;
}

.login-story h1 {
  font-size: clamp(40px, 4.5vw, 72px);
  line-height: 1.12;
  color: var(--dark);
  margin: 20px 0;
}

.login-story p:not(.eyebrow) {
  max-width: 420px;
  line-height: 1.8;
  color: #56736a;
}

.story-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.story-badges span {
  background: #f5fbf7;
  padding: 9px 13px;
  border-radius: 20px;
  font-size: 12px;
  transition: transform 0.2s ease;
}

.story-badges span:hover {
  transform: translateY(-2px);
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 40px;
  background: #fff;
}

.login-panel form {
  width: 100%;
  max-width: 360px;
}

.login-panel h2 {
  font-size: 30px;
  margin: 15px 0 10px;
}

.login-panel label {
  margin-top: 22px;
}

.login-panel small {
  display: block;
  text-align: center;
  margin-top: 25px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d8e4de;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #79bfad;
  transform: scale(1.008);
  box-shadow: 0 0 0 3px rgba(8, 127, 112, 0.18);
}

.checkbox {
  flex-direction: row;
  align-items: center;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin: 16px 0;
  line-height: 1.5;
}

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 254px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 30px 22px;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(8, 127, 112, .35) transparent;
  z-index: 20;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.warehouse {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  margin-top: 35px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  transition: border-color 0.2s ease;
}

.warehouse div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.warehouse:hover {
  border-color: #bcd9cd;
}

.warehouse > span {
  font-size: 25px;
  color: var(--green);
}

.warehouse small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 5px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #91a09a;
  margin: 28px 10px 10px;
}

nav {
  display: grid;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
}

nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 13px;
  color: #60746d;
  min-width: 0;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s ease, color 0.2s ease;
}

nav a span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

nav a.active {
  background: #e6f4ee;
  color: var(--green);
  font-weight: 700;
}

nav a:hover {
  background: #f0f6f2;
  transform: translateX(4px) scale(1.01);
}

nav a:active {
  transform: scale(0.98);
}

nav a span:first-child {
  width: 20px;
  text-align: center;
  font-size: 18px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2a9c7e;
  margin-right: 7px;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.25); }
}

.profile {
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 6px 0 0;
  font-size: 12px;
  background: transparent;
  box-shadow: none;
  min-width: 0;
  overflow: hidden;
}

.profile:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: translateX(2px);
}

.profile > span:last-child {
  margin-left: auto;
  flex: 0 0 auto;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e6efeb;
  color: var(--green);
  font-weight: 700;
  transition: transform 0.2s ease;
}

.profile:hover .avatar {
  transform: scale(1.1);
}

.sidebar-profile-top {
  margin-top: 24px;
  padding: 12px;
  border: 1px solid rgba(214, 229, 224, .75);
  border-radius: 16px;
  background: rgba(255,255,255,.58);
  box-shadow: 0 10px 24px rgba(24, 89, 74, .06);
}

.sidebar-profile-top:hover:not(:disabled) {
  background: rgba(238, 249, 244, .86);
  box-shadow: 0 14px 30px rgba(24, 89, 74, .09);
}

.app-shell {
  margin-left: 254px;
}

header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 36px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  font-size: 12px;
  color: #87958e;
}

.breadcrumb span {
  padding: 0 12px;
  color: #bbc6c0;
}

.breadcrumb b {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions button {
  font-size: 12px;
}

.status {
  font-size: 11px;
  color: var(--green);
}

#menu-button {
  display: none;
}

.icon-button {
  border: 0;
  font-size: 24px;
  padding: 5px 12px;
  background: transparent;
  box-shadow: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.icon-button:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: scale(1.15) rotate(3deg);
  color: var(--green);
}

.icon-button:active:not(:disabled) {
  transform: scale(0.9);
}

main {
  padding: 34px 36px;
  min-height: calc(100vh - 135px);
  max-width: 1700px;
  margin: auto;
}

/* Chuyển trang mượt mà */
#main > * {
  animation: contentFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes contentFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 26px;
}

.page-heading p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero {
  background: #e1f0e9;
  border: 1px solid #cfe4d9;
  border-radius: var(--radius);
  padding: 25px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  transition: box-shadow 0.25s ease;
}

.hero:hover {
  box-shadow: 0 8px 24px rgba(22, 62, 56, 0.06);
}

.hero h2 {
  font-size: 23px;
  margin: 8px 0;
  color: var(--dark);
}

.hero p {
  font-size: 13px;
  color: #648075;
  margin: 0;
  line-height: 1.8;
}

.hero-symbol {
  font-size: 64px;
  color: #62a28b;
  transform: rotate(-12deg);
  padding: 0 20px;
  transition: transform 0.3s ease;
}

.hero:hover .hero-symbol {
  transform: rotate(0deg) scale(1.1);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat {
  padding: 20px;
  background: white;
  border: 1px solid #d7e6e1;
  border-radius: 14px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  will-change: transform;
}

.stat:hover {
  transform: translateY(-3px) scale(1.012);
  border-color: #afcec4;
  box-shadow: 0 12px 26px rgba(22, 62, 56, 0.09);
}

.stat small {
  color: #496862;
  display: block;
  font-weight: 800;
  letter-spacing: .4px;
}

.stat strong {
  font-size: 31px;
  font-weight: 850;
  display: block;
  margin: 13px 0 9px;
  letter-spacing: -1px;
  color: #113f38;
}

.stat em {
  font-size: 11px;
  line-height: 1.45;
  font-style: normal;
  color: #315f57;
  font-weight: 650;
}

.stat.warn strong {
  color: #b47a25;
}

.stat.danger strong {
  color: var(--danger);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 24px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  min-width: 0;
  box-shadow: 0 2px 8px rgba(22, 62, 56, 0.02);
  transition: box-shadow 0.25s ease;
}

.panel:hover {
  box-shadow: 0 6px 20px rgba(22, 62, 56, 0.05);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
}

.panel-header a {
  color: var(--green);
  font-size: 12px;
  transition: transform 0.15s ease;
  display: inline-block;
}

.panel-header a:hover {
  transform: translateX(3px);
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.toolbar input {
  max-width: 440px;
}

.toolbar select {
  max-width: 180px;
}

.table-wrap {
  overflow: auto;
  position: relative;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  font-size: 10px;
  letter-spacing: .6px;
  color: #809089;
  background: #fbfcfb;
  padding: 13px 20px;
}

td {
  padding: 17px 20px;
  border-top: 1px solid #eef2ef;
  transition: background 0.15s ease;
}

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

td small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
}

td button {
  padding: 6px 9px;
  font-size: 11px;
  margin-right: 4px;
}

.link {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  font-weight: 650;
  color: var(--ink);
  font-size: 12px;
  box-shadow: none;
  transition: transform 0.18s ease, color 0.18s ease;
}

.link:hover:not(:disabled) {
  background: transparent;
  color: var(--green);
  box-shadow: none;
  transform: scale(1.02);
}

.link:active:not(:disabled) {
  transform: scale(0.97);
}

.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 650;
  background: #e7f5ef;
  color: #20846a;
  transition: transform 0.15s ease;
}

.badge:hover {
  transform: scale(1.05);
}

.badge.warning {
  background: #fff4dc;
  color: #b27b24;
}

.badge.expired {
  background: #ffebea;
  color: #be5750;
}

.badge.blue {
  background: #eaf2ff;
  color: #5284be;
}

.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
}

.notice {
  padding: 15px 18px;
  border-radius: 10px;
  background: #fff6e1;
  color: #9b7327;
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 22px;
}

.flow-list {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.flow-item {
  display: grid;
  grid-template-columns: 44px minmax(132px, .75fr) minmax(0, 1.45fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(214, 229, 224, .86);
  border-radius: 16px;
  background: rgba(255,255,255,.62);
  box-shadow: 0 8px 20px rgba(25, 82, 72, .05);
  transition: transform 0.2s ease, background 0.2s ease;
}

.flow-item:hover {
  transform: translateX(4px);
}

.flow-icon {
  background: #e7f5ef;
  color: var(--green);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 19px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.flow-item:hover .flow-icon {
  transform: scale(1.1);
}

.flow-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.flow-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.flow-item small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.flow-desc {
  margin: 0;
  color: #3d4f4b;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.flow-item button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  box-shadow: none;
}

.flow-item button:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.locations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.email-grid {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr);
  gap: 24px;
}

.email-settings {
  padding: 22px;
}

.email-settings .compact {
  grid-template-columns: 1fr;
  max-width: 280px;
}

.email-result {
  margin: 0 22px 18px;
}

.sender-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.sender-section h3 {
  margin-bottom: 14px;
}

.sender-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
}

.sender-card small,
.sender-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.sender-card strong {
  display: block;
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.sender-settings {
  margin-top: 12px;
}

.location {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}

.location:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 10px 24px rgba(22, 62, 56, 0.08);
}

.location h3 {
  color: var(--green);
}

.location p {
  font-size: 13px;
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 36px;
  font-size: 11px;
  color: #8c9c94;
}

footer span {
  margin: 0 8px;
}

footer small {
  font-size: 10px;
}

/* Dialog Modal Zoom In / Out Animation */
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  max-width: 800px;
  width: calc(100% - 32px);
  padding: 26px;
  color: var(--ink);
  max-height: 90vh;
  box-shadow: 0 30px 90px rgba(23, 60, 53, 0.25);
}

dialog[open] {
  animation: dialogZoomIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

dialog::backdrop {
  background: rgba(18, 52, 45, 0.45);
  backdrop-filter: blur(4px);
  animation: backdropFade 0.25s ease forwards;
}

@keyframes dialogZoomIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes backdropFade {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.dialog-header h2 {
  margin: 8px 0 0;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.detail-info {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.8;
}

.detail-info strong {
  display: block;
}

.receipt-total {
  padding: 20px;
  background: #edf7f1;
  border-radius: 10px;
  font-size: 20px;
  margin: 20px 0;
}

.action-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px 24px;
  margin: 18px 0;
  border: 1px solid #d7e8e3;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #edf8f4);
  box-shadow: 0 14px 34px rgba(22, 62, 56, .07);
}

.action-strip h2 {
  margin: 8px 0 5px;
}

.action-strip p {
  margin-bottom: 0;
  color: var(--muted);
}

.action-strip .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 154px;
  min-height: 48px;
  padding: 14px 24px;
  border-radius: 999px;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(8, 127, 112, .18);
}

.action-strip .primary:hover {
  background: #056657;
  border-color: #056657;
  transform: translateY(-2px) scale(1.035);
  box-shadow: 0 14px 30px rgba(8, 127, 112, .24);
}

.kpi-grid .stat {
  text-decoration: none;
}

#allocation-preview:not(:empty) {
  margin-top: 18px;
}

#allocation-preview > .notice,
#allocation-preview > .allocation-preview {
  margin: 0;
}

.allocation-preview {
  grid-column: 1 / -1;
  margin: 6px 0 2px;
  border: 1px solid #dbe8e4;
  border-radius: 14px;
  background: #f8fbfa;
  overflow: hidden;
}

.allocation-preview h3 {
  margin: 0;
  padding: 14px 16px 0;
}

.allocation-preview .table-wrap {
  border: 0;
  margin-top: 8px;
}

.error-soft {
  border-color: #efc8c8;
  background: #fff7f7;
  color: #a43b3b;
}

.location-stock-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0 0 18px;
  list-style: none;
}

.location-stock-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.qr-panel {
  display: grid;
  gap: 18px;
}

.qr-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbfa;
}

.qr-card img {
  width: 190px;
  height: 190px;
  background: #fff;
  border: 1px solid #dde8e4;
  border-radius: 10px;
  padding: 10px;
}

.qr-card h3 {
  font-size: 20px;
  margin: 8px 0 10px;
}

.qr-card p {
  font-size: 13px;
  margin: 7px 0;
}

.qr-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-top: 12px;
}

.medicine-qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding: 0 20px 22px;
}

.medicine-qr-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 10px 28px rgba(22, 62, 56, .06);
}

.medicine-qr-image {
  display: block;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
}

.medicine-qr-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.medicine-qr-copy { min-width: 0; }
.medicine-qr-copy h3 { margin: 5px 0 8px; font-size: 18px; }
.medicine-qr-copy p { margin-bottom: 9px; color: var(--muted); overflow-wrap: anywhere; }
.medicine-qr-status { display: flex; flex-wrap: wrap; gap: 7px; }

.medicine-card-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.medicine-qr-empty {
  display: grid;
  place-items: center;
  min-height: 108px;
  border: 1px dashed #b9ccc6;
  border-radius: 14px;
  color: var(--muted);
  background: #f5faf8;
}

.scan-batch-summary {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f4faf7;
}

.scan-batch-summary img {
  width: 132px;
  height: 132px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
}

.scan-batch-summary h3 { margin: 5px 0 8px; font-size: 20px; }
.scan-batch-summary p { margin-bottom: 7px; }
.scan-batch-summary .badge + .badge { margin-left: 7px; }

/* Toast với Spring Ease */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 20px) scale(0.92);
  background: var(--dark);
  color: white;
  padding: 14px 22px;
  border-radius: 12px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  max-width: 90%;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(23, 60, 53, 0.25);
}

#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* Responsive Media Queries */
.building-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.building-card:hover { border-color: var(--green); background: #edf7f1; }
.building-card strong { font-size: 20px; color: var(--dark); }
.building-card > span { font-size: 13px; color: var(--muted); font-weight: 400; }
.building-card .building-symbol { font-size: 32px; color: var(--green); }
.building-card .building-open { color: var(--green); font-weight: 600; margin-top: 10px; }

@media (min-width: 1500px) {
  main { padding-top: 45px; }
  hero { padding: 35px; }
  .stats { gap: 20px; }
  .stat { padding: 25px; }
}

@media (max-width: 1150px) {
  aside { width: 220px; padding: 25px 17px; }
  .app-shell { margin-left: 220px; }
  header { padding: 0 24px; }
  main { padding: 25px 24px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .columns { grid-template-columns: 1fr; }
  .email-grid { grid-template-columns: 1fr; }
  .status { display: none; }
  .brand { font-size: 21px; }
  .breadcrumb { font-size: 11px; }
  .flow-item { grid-template-columns: 42px minmax(0, 1fr); align-items: start; }
  .flow-desc { grid-column: 2; font-size: 14px; }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { padding: 26px; gap: 30px; }
  .login-story h1 { font-size: 38px; }
  .login-story h1 br { display: none; }
  .login-story > small, .story-badges { display: none; }
  .login-panel { padding: 35px 25px; }
  aside { transform: translateX(-100%); width: 245px; box-shadow: 10px 0 30px rgba(22, 62, 56, 0.2); }
  aside.open { transform: translateX(0); }
  .app-shell { margin-left: 0; }
  header { padding: 0 14px; height: 64px; position: sticky; top: 0; z-index: 10; }
  .breadcrumb { display: none; }
  #menu-button { display: block; }
  main { padding: 24px 16px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .action-strip { align-items: flex-start; flex-direction: column; }
  .action-strip .primary { width: 100%; text-align: center; }
  h1 { font-size: 26px; }
  .page-heading .actions { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 16px; }
  .stat:last-child { grid-column: 1 / -1; }
  .stat strong { font-size: 27px; }
  .hero { padding: 22px; }
  .hero-symbol { display: none; }
  .hero h2 { font-size: 21px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input, .toolbar select { max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .panel-header { padding: 17px; }
  .panel-header h3 { font-size: 14px; }
  footer { padding: 20px 16px; flex-direction: column; font-size: 10px; }
  dialog { padding: 20px; }
  .qr-card { grid-template-columns: 1fr; text-align: center; }
  .qr-card img { margin: auto; }
  .medicine-qr-grid { grid-template-columns: 1fr; padding: 0 14px 18px; }
  .flow-list { padding: 0 14px 16px; }
  .flow-item { grid-template-columns: 40px minmax(0, 1fr); gap: 10px 12px; padding: 12px; }
  .flow-icon { width: 40px; height: 40px; }
  .flow-desc { grid-column: 1 / -1; font-size: 13px; padding-left: 52px; }
  .profile-copy > span { max-width: 128px; }
  .medicine-qr-card { grid-template-columns: 92px minmax(0, 1fr); padding: 13px; }
  .scan-batch-summary { grid-template-columns: 92px minmax(0, 1fr); gap: 13px; }
  .scan-batch-summary img { width: 92px; height: 92px; }
  .header-actions { gap: 7px; }
  .header-actions button { font-size: 11px; padding: 9px 11px; }
  td, th { padding: 14px; }
  detail-info { gap: 12px; }
  .login-story p:not(.eyebrow) { margin-bottom: 0; }
}

/* Soft premium UI refresh: lightweight, mobile-first, no new dependencies. */
:root {
  --bg-main: #f7f8fb;
  --surface: rgba(255,255,255,.82);
  --surface-solid: #ffffff;
  --text-primary: #15171a;
  --text-secondary: #70747c;
  --accent-blue: #6f8cff;
  --accent-purple: #a78bfa;
  --accent-pink: #f5b7c8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --shadow-soft: 0 8px 30px rgba(15,23,42,.08);
  --shadow-hover: 0 14px 36px rgba(15,23,42,.11);
  --green: #0c8f7a;
  --dark: var(--text-primary);
  --ink: #263236;
  --muted: var(--text-secondary);
  --line: rgba(148,163,184,.22);
  --bg: var(--bg-main);
}

body {
  color: var(--text-primary);
  background:
    radial-gradient(circle at 20% 12%, rgba(111,140,255,.16), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(245,183,200,.22), transparent 24rem),
    radial-gradient(circle at 74% 92%, rgba(167,139,250,.14), transparent 30rem),
    linear-gradient(180deg, #fbfcff 0%, var(--bg-main) 54%, #f8fbff 100%);
}

main {
  max-width: 1360px;
  padding: 32px clamp(18px, 3vw, 40px);
}

button,
.primary,
input,
select,
textarea,
.stat,
.panel,
.toolbar,
.hero,
.action-strip {
  border-radius: var(--radius-md);
}

button {
  min-height: 44px;
  padding: 11px 16px;
  border-color: rgba(148,163,184,.25);
  color: var(--text-primary);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

button:hover:not(:disabled),
.primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled),
.primary:active:not(:disabled) {
  transform: scale(.98);
}

aside {
  width: 270px;
  padding: 26px 18px;
  border-radius: 0 28px 28px 0;
}

.app-shell {
  margin-left: 270px;
}

.brand {
  color: #172033;
  letter-spacing: -.6px;
}

.brand-mark {
  border-radius: 16px;
  background: linear-gradient(145deg, #37c99c, #0c8f7a);
}

.sidebar-profile-top {
  border-radius: 22px;
  background: rgba(255,255,255,.74);
}

.nav-label {
  color: #9aa3af;
  margin-top: 24px;
}

nav {
  gap: 8px;
}

nav a {
  min-height: 46px;
  border-radius: 16px;
  color: #65717c;
  font-weight: 650;
}

nav a.active {
  color: #172033;
}

nav a:hover {
  transform: translateX(2px);
}

header {
  height: 76px;
  border-bottom-color: rgba(148,163,184,.18);
}

.page-heading h1 {
  color: var(--text-primary);
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: -1.2px;
}

.page-heading p,
.muted {
  color: var(--text-secondary);
}

.hero {
  padding: clamp(24px, 4vw, 42px);
  border-radius: 32px;
  background:
    radial-gradient(circle at 76% 18%, rgba(111,140,255,.20), transparent 16rem),
    radial-gradient(circle at 90% 78%, rgba(245,183,200,.24), transparent 18rem),
    linear-gradient(135deg, rgba(255,255,255,.86), rgba(244,247,255,.78));
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow-soft);
}

.hero h2 {
  color: var(--text-primary);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.12;
  letter-spacing: -1px;
}

.hero p {
  color: var(--text-secondary);
  max-width: 700px;
}

.hero-symbol {
  color: #fff;
  background: linear-gradient(145deg, rgba(111,140,255,.88), rgba(167,139,250,.78));
}

.action-strip {
  border: 1px solid rgba(255,255,255,.82);
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft);
}

.action-strip .primary,
.primary {
  border-radius: 999px;
  background: linear-gradient(135deg, #2dd4bf, #0c8f7a);
}

.stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat,
.panel,
.financial-stats article,
.toolbar,
.house-card,
.warehouse-section,
.notice {
  border: 1px solid rgba(255,255,255,.82);
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft);
}

.stat {
  min-height: 154px;
  border-radius: 26px;
}

.stat small {
  color: var(--text-secondary);
}

.stat strong {
  color: var(--text-primary);
  letter-spacing: -1.3px;
}

.stat em {
  color: var(--text-secondary);
}

.stat:hover,
.panel:hover,
.financial-stats article:hover,
.house-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.panel {
  border-radius: 28px;
}

.panel-header {
  padding: 22px 24px;
}

.table-wrap {
  border-radius: 0 0 28px 28px;
}

th {
  color: #7b8591;
  background: rgba(248,250,252,.8);
}

td {
  color: #273238;
}

.badge {
  border-radius: 999px;
  padding: 7px 11px;
}

.badge.blue,
.status-in-transit {
  background: #e8f0ff;
  color: #2353c4;
}

.badge.expired,
.status-cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

.flow-item {
  border-radius: 22px;
  background: rgba(255,255,255,.68);
}

.bottom-nav {
  display: none;
}

@media (max-width: 1150px) {
  aside { width: 232px; }
  .app-shell { margin-left: 232px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { padding-bottom: 0; }
  aside {
    width: min(88vw, 310px);
    border-radius: 0 28px 28px 0;
  }
  .app-shell { margin-left: 0; }
  header {
    height: 66px;
    background: rgba(255,255,255,.9);
  }
  main {
    padding: 20px 14px 96px;
  }
  .page-heading {
    gap: 14px;
    margin-bottom: 18px;
  }
  .page-heading h1 {
    font-size: 30px;
  }
  .actions {
    width: 100%;
  }
  .actions button {
    flex: 1 1 140px;
  }
  .hero {
    padding: 24px;
    border-radius: 28px;
  }
  .action-strip {
    padding: 18px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .stat {
    min-height: 132px;
    padding: 17px;
  }
  .stat strong {
    font-size: 29px;
  }
  .columns,
  .chart-panels,
  .financial-stats {
    grid-template-columns: 1fr;
  }
  .panel,
  .table-wrap {
    border-radius: 24px;
  }
  table {
    min-width: 680px;
  }
  .bottom-nav { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .stat,
  .panel,
  .hero,
  button,
  nav a,
  .bottom-nav a,
  .bottom-nav button {
    transition: none !important;
  }
}
nav a.active span:first-child {
  animation: menuIconPulse 1.6s ease-in-out infinite;
}

@keyframes menuIconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}
nav a span:first-child {
  transition: transform 180ms ease;
}

nav a:hover span:first-child,
nav a.active span:first-child {
  transform: translateY(-2px) scale(1.12);
}
 .partner-medicine-list { max-height: 280px; overflow-y: auto; padding: 16px; border: 1px solid #dde5df; border-radius: 16px; }
 .partner-medicine-list .checkbox { margin: 8px 0; min-height: 44px; }
 .partner-detail { min-width: 0; }
 [data-partner-contact][hidden] { display: none !important; }
